1 #include "llvm/Support/ARMAttributeParser.h"
2 #include "llvm/Support/ARMBuildAttributes.h"
3 #include "llvm/Support/ELFAttributes.h"
4 #include "gtest/gtest.h"
9 struct AttributeSection
{
13 AttributeSection(unsigned tag
, unsigned value
) : Tag(tag
), Value(value
) { }
15 void write(raw_ostream
&OS
) {
17 // length = length + "aeabi\0" + TagFile + ByteSize + Tag + Value;
20 OS
<< 'A' << (uint8_t)17 << (uint8_t)0 << (uint8_t)0 << (uint8_t)0;
21 OS
<< "aeabi" << '\0';
22 OS
<< (uint8_t)1 << (uint8_t)7 << (uint8_t)0 << (uint8_t)0 << (uint8_t)0;
23 OS
<< (uint8_t)Tag
<< (uint8_t)Value
;
28 bool testBuildAttr(unsigned Tag
, unsigned Value
,
29 unsigned ExpectedTag
, unsigned ExpectedValue
) {
31 raw_string_ostream
OS(buffer
);
32 AttributeSection
Section(Tag
, Value
);
34 ArrayRef
<uint8_t> Bytes(
35 reinterpret_cast<const uint8_t*>(OS
.str().c_str()), OS
.str().size());
37 ARMAttributeParser Parser
;
38 cantFail(Parser
.parse(Bytes
, llvm::endianness::little
));
40 std::optional
<unsigned> Attr
= Parser
.getAttributeValue(ExpectedTag
);
41 return Attr
&& *Attr
== ExpectedValue
;
44 void testParseError(ArrayRef
<uint8_t> bytes
, const char *msg
) {
45 ARMAttributeParser parser
;
46 Error e
= parser
.parse(bytes
, llvm::endianness::little
);
47 EXPECT_STREQ(toString(std::move(e
)).c_str(), msg
);
50 bool testTagString(unsigned Tag
, const char *name
) {
51 return ELFAttrs::attrTypeAsString(Tag
, ARMBuildAttrs::getARMAttributeTags())
55 TEST(ARMAttributeParser
, UnknownCPU_arch
) {
56 static const uint8_t bytes
[] = {'A', 15, 0, 0, 0, 'a', 'e', 'a', 'b',
57 'i', 0, 1, 7, 0, 0, 0, 6, 23};
58 testParseError(bytes
, "unknown CPU_arch value: 23");
61 TEST(CPUArchBuildAttr
, testBuildAttr
) {
62 EXPECT_TRUE(testTagString(6, "Tag_CPU_arch"));
64 EXPECT_TRUE(testBuildAttr(6, 0, ARMBuildAttrs::CPU_arch
,
65 ARMBuildAttrs::Pre_v4
));
66 EXPECT_TRUE(testBuildAttr(6, 1, ARMBuildAttrs::CPU_arch
,
68 EXPECT_TRUE(testBuildAttr(6, 2, ARMBuildAttrs::CPU_arch
,
70 EXPECT_TRUE(testBuildAttr(6, 3, ARMBuildAttrs::CPU_arch
,
72 EXPECT_TRUE(testBuildAttr(6, 4, ARMBuildAttrs::CPU_arch
,
73 ARMBuildAttrs::v5TE
));
74 EXPECT_TRUE(testBuildAttr(6, 5, ARMBuildAttrs::CPU_arch
,
75 ARMBuildAttrs::v5TEJ
));
76 EXPECT_TRUE(testBuildAttr(6, 6, ARMBuildAttrs::CPU_arch
,
78 EXPECT_TRUE(testBuildAttr(6, 7, ARMBuildAttrs::CPU_arch
,
79 ARMBuildAttrs::v6KZ
));
80 EXPECT_TRUE(testBuildAttr(6, 8, ARMBuildAttrs::CPU_arch
,
81 ARMBuildAttrs::v6T2
));
82 EXPECT_TRUE(testBuildAttr(6, 9, ARMBuildAttrs::CPU_arch
,
84 EXPECT_TRUE(testBuildAttr(6, 10, ARMBuildAttrs::CPU_arch
,
86 EXPECT_TRUE(testBuildAttr(6, 11, ARMBuildAttrs::CPU_arch
,
87 ARMBuildAttrs::v6_M
));
88 EXPECT_TRUE(testBuildAttr(6, 12, ARMBuildAttrs::CPU_arch
,
89 ARMBuildAttrs::v6S_M
));
90 EXPECT_TRUE(testBuildAttr(6, 13, ARMBuildAttrs::CPU_arch
,
91 ARMBuildAttrs::v7E_M
));
92 EXPECT_TRUE(testBuildAttr(6, 14, ARMBuildAttrs::CPU_arch
,
93 ARMBuildAttrs::v8_A
));
94 EXPECT_TRUE(testBuildAttr(6, 15, ARMBuildAttrs::CPU_arch
,
95 ARMBuildAttrs::v8_R
));
96 EXPECT_TRUE(testBuildAttr(6, 16, ARMBuildAttrs::CPU_arch
,
97 ARMBuildAttrs::v8_M_Base
));
98 EXPECT_TRUE(testBuildAttr(6, 17, ARMBuildAttrs::CPU_arch
,
99 ARMBuildAttrs::v8_M_Main
));
100 EXPECT_TRUE(testBuildAttr(6, 21, ARMBuildAttrs::CPU_arch
,
101 ARMBuildAttrs::v8_1_M_Main
));
102 EXPECT_TRUE(testBuildAttr(6, 22, ARMBuildAttrs::CPU_arch
,
103 ARMBuildAttrs::v9_A
));
107 TEST(CPUArchProfileBuildAttr
, testBuildAttr
) {
108 EXPECT_TRUE(testTagString(7, "Tag_CPU_arch_profile"));
109 EXPECT_TRUE(testBuildAttr(7, 'A', ARMBuildAttrs::CPU_arch_profile
,
110 ARMBuildAttrs::ApplicationProfile
));
111 EXPECT_TRUE(testBuildAttr(7, 'R', ARMBuildAttrs::CPU_arch_profile
,
112 ARMBuildAttrs::RealTimeProfile
));
113 EXPECT_TRUE(testBuildAttr(7, 'M', ARMBuildAttrs::CPU_arch_profile
,
114 ARMBuildAttrs::MicroControllerProfile
));
115 EXPECT_TRUE(testBuildAttr(7, 'S', ARMBuildAttrs::CPU_arch_profile
,
116 ARMBuildAttrs::SystemProfile
));
119 TEST(ARMISABuildAttr
, testBuildAttr
) {
120 EXPECT_TRUE(testTagString(8, "Tag_ARM_ISA_use"));
121 EXPECT_TRUE(testBuildAttr(8, 0, ARMBuildAttrs::ARM_ISA_use
,
122 ARMBuildAttrs::Not_Allowed
));
123 EXPECT_TRUE(testBuildAttr(8, 1, ARMBuildAttrs::ARM_ISA_use
,
124 ARMBuildAttrs::Allowed
));
127 TEST(ThumbISABuildAttr
, testBuildAttr
) {
128 EXPECT_TRUE(testTagString(9, "Tag_THUMB_ISA_use"));
129 EXPECT_TRUE(testBuildAttr(9, 0, ARMBuildAttrs::THUMB_ISA_use
,
130 ARMBuildAttrs::Not_Allowed
));
131 EXPECT_TRUE(testBuildAttr(9, 1, ARMBuildAttrs::THUMB_ISA_use
,
132 ARMBuildAttrs::Allowed
));
133 EXPECT_TRUE(testBuildAttr(9, 2, ARMBuildAttrs::THUMB_ISA_use
,
134 ARMBuildAttrs::AllowThumb32
));
135 EXPECT_TRUE(testBuildAttr(9, 3, ARMBuildAttrs::THUMB_ISA_use
,
136 ARMBuildAttrs::AllowThumbDerived
));
139 TEST(FPArchBuildAttr
, testBuildAttr
) {
140 EXPECT_TRUE(testTagString(10, "Tag_FP_arch"));
141 EXPECT_TRUE(testBuildAttr(10, 0, ARMBuildAttrs::FP_arch
,
142 ARMBuildAttrs::Not_Allowed
));
143 EXPECT_TRUE(testBuildAttr(10, 1, ARMBuildAttrs::FP_arch
,
144 ARMBuildAttrs::Allowed
));
145 EXPECT_TRUE(testBuildAttr(10, 2, ARMBuildAttrs::FP_arch
,
146 ARMBuildAttrs::AllowFPv2
));
147 EXPECT_TRUE(testBuildAttr(10, 3, ARMBuildAttrs::FP_arch
,
148 ARMBuildAttrs::AllowFPv3A
));
149 EXPECT_TRUE(testBuildAttr(10, 4, ARMBuildAttrs::FP_arch
,
150 ARMBuildAttrs::AllowFPv3B
));
151 EXPECT_TRUE(testBuildAttr(10, 5, ARMBuildAttrs::FP_arch
,
152 ARMBuildAttrs::AllowFPv4A
));
153 EXPECT_TRUE(testBuildAttr(10, 6, ARMBuildAttrs::FP_arch
,
154 ARMBuildAttrs::AllowFPv4B
));
155 EXPECT_TRUE(testBuildAttr(10, 7, ARMBuildAttrs::FP_arch
,
156 ARMBuildAttrs::AllowFPARMv8A
));
157 EXPECT_TRUE(testBuildAttr(10, 8, ARMBuildAttrs::FP_arch
,
158 ARMBuildAttrs::AllowFPARMv8B
));
161 TEST(WMMXBuildAttr
, testBuildAttr
) {
162 EXPECT_TRUE(testTagString(11, "Tag_WMMX_arch"));
163 EXPECT_TRUE(testBuildAttr(11, 0, ARMBuildAttrs::WMMX_arch
,
164 ARMBuildAttrs::Not_Allowed
));
165 EXPECT_TRUE(testBuildAttr(11, 1, ARMBuildAttrs::WMMX_arch
,
166 ARMBuildAttrs::AllowWMMXv1
));
167 EXPECT_TRUE(testBuildAttr(11, 2, ARMBuildAttrs::WMMX_arch
,
168 ARMBuildAttrs::AllowWMMXv2
));
171 TEST(SIMDBuildAttr
, testBuildAttr
) {
172 EXPECT_TRUE(testTagString(12, "Tag_Advanced_SIMD_arch"));
173 EXPECT_TRUE(testBuildAttr(12, 0, ARMBuildAttrs::Advanced_SIMD_arch
,
174 ARMBuildAttrs::Not_Allowed
));
175 EXPECT_TRUE(testBuildAttr(12, 1, ARMBuildAttrs::Advanced_SIMD_arch
,
176 ARMBuildAttrs::AllowNeon
));
177 EXPECT_TRUE(testBuildAttr(12, 2, ARMBuildAttrs::Advanced_SIMD_arch
,
178 ARMBuildAttrs::AllowNeon2
));
179 EXPECT_TRUE(testBuildAttr(12, 3, ARMBuildAttrs::Advanced_SIMD_arch
,
180 ARMBuildAttrs::AllowNeonARMv8
));
181 EXPECT_TRUE(testBuildAttr(12, 4, ARMBuildAttrs::Advanced_SIMD_arch
,
182 ARMBuildAttrs::AllowNeonARMv8_1a
));
185 TEST(FPHPBuildAttr
, testBuildAttr
) {
186 EXPECT_TRUE(testTagString(36, "Tag_FP_HP_extension"));
187 EXPECT_TRUE(testBuildAttr(36, 0, ARMBuildAttrs::FP_HP_extension
,
188 ARMBuildAttrs::Not_Allowed
));
189 EXPECT_TRUE(testBuildAttr(36, 1, ARMBuildAttrs::FP_HP_extension
,
190 ARMBuildAttrs::AllowHPFP
));
193 TEST(MVEBuildAttr
, testBuildAttr
) {
194 EXPECT_TRUE(testTagString(48, "Tag_MVE_arch"));
195 EXPECT_TRUE(testBuildAttr(48, 0, ARMBuildAttrs::MVE_arch
,
196 ARMBuildAttrs::Not_Allowed
));
197 EXPECT_TRUE(testBuildAttr(48, 1, ARMBuildAttrs::MVE_arch
,
198 ARMBuildAttrs::AllowMVEInteger
));
199 EXPECT_TRUE(testBuildAttr(48, 2, ARMBuildAttrs::MVE_arch
,
200 ARMBuildAttrs::AllowMVEIntegerAndFloat
));
203 TEST(CPUAlignBuildAttr
, testBuildAttr
) {
204 EXPECT_TRUE(testTagString(34, "Tag_CPU_unaligned_access"));
205 EXPECT_TRUE(testBuildAttr(34, 0, ARMBuildAttrs::CPU_unaligned_access
,
206 ARMBuildAttrs::Not_Allowed
));
207 EXPECT_TRUE(testBuildAttr(34, 1, ARMBuildAttrs::CPU_unaligned_access
,
208 ARMBuildAttrs::Allowed
));
211 TEST(T2EEBuildAttr
, testBuildAttr
) {
212 EXPECT_TRUE(testTagString(66, "Tag_T2EE_use"));
213 EXPECT_TRUE(testBuildAttr(66, 0, ARMBuildAttrs::T2EE_use
,
214 ARMBuildAttrs::Not_Allowed
));
215 EXPECT_TRUE(testBuildAttr(66, 1, ARMBuildAttrs::T2EE_use
,
216 ARMBuildAttrs::Allowed
));
219 TEST(VirtualizationBuildAttr
, testBuildAttr
) {
220 EXPECT_TRUE(testTagString(68, "Tag_Virtualization_use"));
221 EXPECT_TRUE(testBuildAttr(68, 0, ARMBuildAttrs::Virtualization_use
,
222 ARMBuildAttrs::Not_Allowed
));
223 EXPECT_TRUE(testBuildAttr(68, 1, ARMBuildAttrs::Virtualization_use
,
224 ARMBuildAttrs::AllowTZ
));
225 EXPECT_TRUE(testBuildAttr(68, 2, ARMBuildAttrs::Virtualization_use
,
226 ARMBuildAttrs::AllowVirtualization
));
227 EXPECT_TRUE(testBuildAttr(68, 3, ARMBuildAttrs::Virtualization_use
,
228 ARMBuildAttrs::AllowTZVirtualization
));
231 TEST(MPBuildAttr
, testBuildAttr
) {
232 EXPECT_TRUE(testTagString(42, "Tag_MPextension_use"));
233 EXPECT_TRUE(testBuildAttr(42, 0, ARMBuildAttrs::MPextension_use
,
234 ARMBuildAttrs::Not_Allowed
));
235 EXPECT_TRUE(testBuildAttr(42, 1, ARMBuildAttrs::MPextension_use
,
236 ARMBuildAttrs::AllowMP
));
239 TEST(DivBuildAttr
, testBuildAttr
) {
240 EXPECT_TRUE(testTagString(44, "Tag_DIV_use"));
241 EXPECT_TRUE(testBuildAttr(44, 0, ARMBuildAttrs::DIV_use
,
242 ARMBuildAttrs::AllowDIVIfExists
));
243 EXPECT_TRUE(testBuildAttr(44, 1, ARMBuildAttrs::DIV_use
,
244 ARMBuildAttrs::DisallowDIV
));
245 EXPECT_TRUE(testBuildAttr(44, 2, ARMBuildAttrs::DIV_use
,
246 ARMBuildAttrs::AllowDIVExt
));
249 TEST(PCS_ConfigBuildAttr
, testBuildAttr
) {
250 EXPECT_TRUE(testTagString(13, "Tag_PCS_config"));
251 EXPECT_TRUE(testBuildAttr(13, 0, ARMBuildAttrs::PCS_config
, 0));
252 EXPECT_TRUE(testBuildAttr(13, 1, ARMBuildAttrs::PCS_config
, 1));
253 EXPECT_TRUE(testBuildAttr(13, 2, ARMBuildAttrs::PCS_config
, 2));
254 EXPECT_TRUE(testBuildAttr(13, 3, ARMBuildAttrs::PCS_config
, 3));
255 EXPECT_TRUE(testBuildAttr(13, 4, ARMBuildAttrs::PCS_config
, 4));
256 EXPECT_TRUE(testBuildAttr(13, 5, ARMBuildAttrs::PCS_config
, 5));
257 EXPECT_TRUE(testBuildAttr(13, 6, ARMBuildAttrs::PCS_config
, 6));
258 EXPECT_TRUE(testBuildAttr(13, 7, ARMBuildAttrs::PCS_config
, 7));
261 TEST(PCS_R9BuildAttr
, testBuildAttr
) {
262 EXPECT_TRUE(testTagString(14, "Tag_ABI_PCS_R9_use"));
263 EXPECT_TRUE(testBuildAttr(14, 0, ARMBuildAttrs::ABI_PCS_R9_use
,
264 ARMBuildAttrs::R9IsGPR
));
265 EXPECT_TRUE(testBuildAttr(14, 1, ARMBuildAttrs::ABI_PCS_R9_use
,
266 ARMBuildAttrs::R9IsSB
));
267 EXPECT_TRUE(testBuildAttr(14, 2, ARMBuildAttrs::ABI_PCS_R9_use
,
268 ARMBuildAttrs::R9IsTLSPointer
));
269 EXPECT_TRUE(testBuildAttr(14, 3, ARMBuildAttrs::ABI_PCS_R9_use
,
270 ARMBuildAttrs::R9Reserved
));
273 TEST(PCS_RWBuildAttr
, testBuildAttr
) {
274 EXPECT_TRUE(testTagString(15, "Tag_ABI_PCS_RW_data"));
275 EXPECT_TRUE(testBuildAttr(15, 0, ARMBuildAttrs::ABI_PCS_RW_data
,
276 ARMBuildAttrs::Not_Allowed
));
277 EXPECT_TRUE(testBuildAttr(15, 1, ARMBuildAttrs::ABI_PCS_RW_data
,
278 ARMBuildAttrs::AddressRWPCRel
));
279 EXPECT_TRUE(testBuildAttr(15, 2, ARMBuildAttrs::ABI_PCS_RW_data
,
280 ARMBuildAttrs::AddressRWSBRel
));
281 EXPECT_TRUE(testBuildAttr(15, 3, ARMBuildAttrs::ABI_PCS_RW_data
,
282 ARMBuildAttrs::AddressRWNone
));
285 TEST(PCS_ROBuildAttr
, testBuildAttr
) {
286 EXPECT_TRUE(testTagString(16, "Tag_ABI_PCS_RO_data"));
287 EXPECT_TRUE(testBuildAttr(16, 0, ARMBuildAttrs::ABI_PCS_RO_data
,
288 ARMBuildAttrs::Not_Allowed
));
289 EXPECT_TRUE(testBuildAttr(16, 1, ARMBuildAttrs::ABI_PCS_RO_data
,
290 ARMBuildAttrs::AddressROPCRel
));
291 EXPECT_TRUE(testBuildAttr(16, 2, ARMBuildAttrs::ABI_PCS_RO_data
,
292 ARMBuildAttrs::AddressRONone
));
295 TEST(PCS_GOTBuildAttr
, testBuildAttr
) {
296 EXPECT_TRUE(testTagString(17, "Tag_ABI_PCS_GOT_use"));
297 EXPECT_TRUE(testBuildAttr(17, 0, ARMBuildAttrs::ABI_PCS_GOT_use
,
298 ARMBuildAttrs::Not_Allowed
));
299 EXPECT_TRUE(testBuildAttr(17, 1, ARMBuildAttrs::ABI_PCS_GOT_use
,
300 ARMBuildAttrs::AddressDirect
));
301 EXPECT_TRUE(testBuildAttr(17, 2, ARMBuildAttrs::ABI_PCS_GOT_use
,
302 ARMBuildAttrs::AddressGOT
));
305 TEST(PCS_WCharBuildAttr
, testBuildAttr
) {
306 EXPECT_TRUE(testTagString(18, "Tag_ABI_PCS_wchar_t"));
307 EXPECT_TRUE(testBuildAttr(18, 0, ARMBuildAttrs::ABI_PCS_wchar_t
,
308 ARMBuildAttrs::WCharProhibited
));
309 EXPECT_TRUE(testBuildAttr(18, 2, ARMBuildAttrs::ABI_PCS_wchar_t
,
310 ARMBuildAttrs::WCharWidth2Bytes
));
311 EXPECT_TRUE(testBuildAttr(18, 4, ARMBuildAttrs::ABI_PCS_wchar_t
,
312 ARMBuildAttrs::WCharWidth4Bytes
));
315 TEST(EnumSizeBuildAttr
, testBuildAttr
) {
316 EXPECT_TRUE(testTagString(26, "Tag_ABI_enum_size"));
317 EXPECT_TRUE(testBuildAttr(26, 0, ARMBuildAttrs::ABI_enum_size
,
318 ARMBuildAttrs::EnumProhibited
));
319 EXPECT_TRUE(testBuildAttr(26, 1, ARMBuildAttrs::ABI_enum_size
,
320 ARMBuildAttrs::EnumSmallest
));
321 EXPECT_TRUE(testBuildAttr(26, 2, ARMBuildAttrs::ABI_enum_size
,
322 ARMBuildAttrs::Enum32Bit
));
323 EXPECT_TRUE(testBuildAttr(26, 3, ARMBuildAttrs::ABI_enum_size
,
324 ARMBuildAttrs::Enum32BitABI
));
327 TEST(AlignNeededBuildAttr
, testBuildAttr
) {
328 EXPECT_TRUE(testTagString(24, "Tag_ABI_align_needed"));
329 EXPECT_TRUE(testBuildAttr(24, 0, ARMBuildAttrs::ABI_align_needed
,
330 ARMBuildAttrs::Not_Allowed
));
331 EXPECT_TRUE(testBuildAttr(24, 1, ARMBuildAttrs::ABI_align_needed
,
332 ARMBuildAttrs::Align8Byte
));
333 EXPECT_TRUE(testBuildAttr(24, 2, ARMBuildAttrs::ABI_align_needed
,
334 ARMBuildAttrs::Align4Byte
));
335 EXPECT_TRUE(testBuildAttr(24, 3, ARMBuildAttrs::ABI_align_needed
,
336 ARMBuildAttrs::AlignReserved
));
339 TEST(AlignPreservedBuildAttr
, testBuildAttr
) {
340 EXPECT_TRUE(testTagString(25, "Tag_ABI_align_preserved"));
341 EXPECT_TRUE(testBuildAttr(25, 0, ARMBuildAttrs::ABI_align_preserved
,
342 ARMBuildAttrs::AlignNotPreserved
));
343 EXPECT_TRUE(testBuildAttr(25, 1, ARMBuildAttrs::ABI_align_preserved
,
344 ARMBuildAttrs::AlignPreserve8Byte
));
345 EXPECT_TRUE(testBuildAttr(25, 2, ARMBuildAttrs::ABI_align_preserved
,
346 ARMBuildAttrs::AlignPreserveAll
));
347 EXPECT_TRUE(testBuildAttr(25, 3, ARMBuildAttrs::ABI_align_preserved
,
348 ARMBuildAttrs::AlignReserved
));
351 TEST(FPRoundingBuildAttr
, testBuildAttr
) {
352 EXPECT_TRUE(testTagString(19, "Tag_ABI_FP_rounding"));
353 EXPECT_TRUE(testBuildAttr(19, 0, ARMBuildAttrs::ABI_FP_rounding
, 0));
354 EXPECT_TRUE(testBuildAttr(19, 1, ARMBuildAttrs::ABI_FP_rounding
, 1));
357 TEST(FPDenormalBuildAttr
, testBuildAttr
) {
358 EXPECT_TRUE(testTagString(20, "Tag_ABI_FP_denormal"));
359 EXPECT_TRUE(testBuildAttr(20, 0, ARMBuildAttrs::ABI_FP_denormal
,
360 ARMBuildAttrs::PositiveZero
));
361 EXPECT_TRUE(testBuildAttr(20, 1, ARMBuildAttrs::ABI_FP_denormal
,
362 ARMBuildAttrs::IEEEDenormals
));
363 EXPECT_TRUE(testBuildAttr(20, 2, ARMBuildAttrs::ABI_FP_denormal
,
364 ARMBuildAttrs::PreserveFPSign
));
367 TEST(FPExceptionsBuildAttr
, testBuildAttr
) {
368 EXPECT_TRUE(testTagString(21, "Tag_ABI_FP_exceptions"));
369 EXPECT_TRUE(testBuildAttr(21, 0, ARMBuildAttrs::ABI_FP_exceptions
, 0));
370 EXPECT_TRUE(testBuildAttr(21, 1, ARMBuildAttrs::ABI_FP_exceptions
, 1));
373 TEST(FPUserExceptionsBuildAttr
, testBuildAttr
) {
374 EXPECT_TRUE(testTagString(22, "Tag_ABI_FP_user_exceptions"));
375 EXPECT_TRUE(testBuildAttr(22, 0, ARMBuildAttrs::ABI_FP_user_exceptions
, 0));
376 EXPECT_TRUE(testBuildAttr(22, 1, ARMBuildAttrs::ABI_FP_user_exceptions
, 1));
379 TEST(FPNumberModelBuildAttr
, testBuildAttr
) {
380 EXPECT_TRUE(testTagString(23, "Tag_ABI_FP_number_model"));
381 EXPECT_TRUE(testBuildAttr(23, 0, ARMBuildAttrs::ABI_FP_number_model
,
382 ARMBuildAttrs::Not_Allowed
));
383 EXPECT_TRUE(testBuildAttr(23, 1, ARMBuildAttrs::ABI_FP_number_model
,
384 ARMBuildAttrs::AllowIEEENormal
));
385 EXPECT_TRUE(testBuildAttr(23, 2, ARMBuildAttrs::ABI_FP_number_model
,
386 ARMBuildAttrs::AllowRTABI
));
387 EXPECT_TRUE(testBuildAttr(23, 3, ARMBuildAttrs::ABI_FP_number_model
,
388 ARMBuildAttrs::AllowIEEE754
));
391 TEST(FP16BuildAttr
, testBuildAttr
) {
392 EXPECT_TRUE(testTagString(38, "Tag_ABI_FP_16bit_format"));
393 EXPECT_TRUE(testBuildAttr(38, 0, ARMBuildAttrs::ABI_FP_16bit_format
,
394 ARMBuildAttrs::Not_Allowed
));
395 EXPECT_TRUE(testBuildAttr(38, 1, ARMBuildAttrs::ABI_FP_16bit_format
,
396 ARMBuildAttrs::FP16FormatIEEE
));
397 EXPECT_TRUE(testBuildAttr(38, 2, ARMBuildAttrs::ABI_FP_16bit_format
,
398 ARMBuildAttrs::FP16VFP3
));
401 TEST(HardFPBuildAttr
, testBuildAttr
) {
402 EXPECT_TRUE(testTagString(27, "Tag_ABI_HardFP_use"));
403 EXPECT_TRUE(testBuildAttr(27, 0, ARMBuildAttrs::ABI_HardFP_use
,
404 ARMBuildAttrs::HardFPImplied
));
405 EXPECT_TRUE(testBuildAttr(27, 1, ARMBuildAttrs::ABI_HardFP_use
,
406 ARMBuildAttrs::HardFPSinglePrecision
));
407 EXPECT_TRUE(testBuildAttr(27, 2, ARMBuildAttrs::ABI_HardFP_use
, 2));
410 TEST(VFPArgsBuildAttr
, testBuildAttr
) {
411 EXPECT_TRUE(testTagString(28, "Tag_ABI_VFP_args"));
412 EXPECT_TRUE(testBuildAttr(28, 0, ARMBuildAttrs::ABI_VFP_args
,
413 ARMBuildAttrs::BaseAAPCS
));
414 EXPECT_TRUE(testBuildAttr(28, 1, ARMBuildAttrs::ABI_VFP_args
,
415 ARMBuildAttrs::HardFPAAPCS
));
416 EXPECT_TRUE(testBuildAttr(28, 2, ARMBuildAttrs::ABI_VFP_args
, 2));
417 EXPECT_TRUE(testBuildAttr(28, 3, ARMBuildAttrs::ABI_VFP_args
, 3));
420 TEST(WMMXArgsBuildAttr
, testBuildAttr
) {
421 EXPECT_TRUE(testTagString(29, "Tag_ABI_WMMX_args"));
422 EXPECT_TRUE(testBuildAttr(29, 0, ARMBuildAttrs::ABI_WMMX_args
, 0));
423 EXPECT_TRUE(testBuildAttr(29, 1, ARMBuildAttrs::ABI_WMMX_args
, 1));
424 EXPECT_TRUE(testBuildAttr(29, 2, ARMBuildAttrs::ABI_WMMX_args
, 2));