1 #include "llvm/Support/ARMAttributeParser.h"
2 #include "llvm/Support/ARMBuildAttributes.h"
3 #include "gtest/gtest.h"
4 #include <string>
5
6 using namespace llvm;
7
8 struct AttributeSection {
9 unsigned Tag;
10 unsigned Value;
11
AttributeSectionAttributeSection12 AttributeSection(unsigned tag, unsigned value) : Tag(tag), Value(value) { }
13
writeAttributeSection14 void write(raw_ostream &OS) {
15 OS.flush();
16 // length = length + "aeabi\0" + TagFile + ByteSize + Tag + Value;
17 // length = 17 bytes
18
19 OS << 'A' << (uint8_t)17 << (uint8_t)0 << (uint8_t)0 << (uint8_t)0;
20 OS << "aeabi" << '\0';
21 OS << (uint8_t)1 << (uint8_t)7 << (uint8_t)0 << (uint8_t)0 << (uint8_t)0;
22 OS << (uint8_t)Tag << (uint8_t)Value;
23
24 }
25 };
26
testBuildAttr(unsigned Tag,unsigned Value,unsigned ExpectedTag,unsigned ExpectedValue)27 bool testBuildAttr(unsigned Tag, unsigned Value,
28 unsigned ExpectedTag, unsigned ExpectedValue) {
29 std::string buffer;
30 raw_string_ostream OS(buffer);
31 AttributeSection Section(Tag, Value);
32 Section.write(OS);
33 ArrayRef<uint8_t> Bytes(
34 reinterpret_cast<const uint8_t*>(OS.str().c_str()), OS.str().size());
35
36 ARMAttributeParser Parser;
37 Parser.Parse(Bytes, true);
38
39 return (Parser.hasAttribute(ExpectedTag) &&
40 Parser.getAttributeValue(ExpectedTag) == ExpectedValue);
41 }
42
testTagString(unsigned Tag,const char * name)43 bool testTagString(unsigned Tag, const char *name) {
44 return ARMBuildAttrs::AttrTypeAsString(Tag).str() == name;
45 }
46
TEST(CPUArchBuildAttr,testBuildAttr)47 TEST(CPUArchBuildAttr, testBuildAttr) {
48 EXPECT_TRUE(testTagString(6, "Tag_CPU_arch"));
49
50 EXPECT_TRUE(testBuildAttr(6, 0, ARMBuildAttrs::CPU_arch,
51 ARMBuildAttrs::Pre_v4));
52 EXPECT_TRUE(testBuildAttr(6, 1, ARMBuildAttrs::CPU_arch,
53 ARMBuildAttrs::v4));
54 EXPECT_TRUE(testBuildAttr(6, 2, ARMBuildAttrs::CPU_arch,
55 ARMBuildAttrs::v4T));
56 EXPECT_TRUE(testBuildAttr(6, 3, ARMBuildAttrs::CPU_arch,
57 ARMBuildAttrs::v5T));
58 EXPECT_TRUE(testBuildAttr(6, 4, ARMBuildAttrs::CPU_arch,
59 ARMBuildAttrs::v5TE));
60 EXPECT_TRUE(testBuildAttr(6, 5, ARMBuildAttrs::CPU_arch,
61 ARMBuildAttrs::v5TEJ));
62 EXPECT_TRUE(testBuildAttr(6, 6, ARMBuildAttrs::CPU_arch,
63 ARMBuildAttrs::v6));
64 EXPECT_TRUE(testBuildAttr(6, 7, ARMBuildAttrs::CPU_arch,
65 ARMBuildAttrs::v6KZ));
66 EXPECT_TRUE(testBuildAttr(6, 8, ARMBuildAttrs::CPU_arch,
67 ARMBuildAttrs::v6T2));
68 EXPECT_TRUE(testBuildAttr(6, 9, ARMBuildAttrs::CPU_arch,
69 ARMBuildAttrs::v6K));
70 EXPECT_TRUE(testBuildAttr(6, 10, ARMBuildAttrs::CPU_arch,
71 ARMBuildAttrs::v7));
72 EXPECT_TRUE(testBuildAttr(6, 11, ARMBuildAttrs::CPU_arch,
73 ARMBuildAttrs::v6_M));
74 EXPECT_TRUE(testBuildAttr(6, 12, ARMBuildAttrs::CPU_arch,
75 ARMBuildAttrs::v6S_M));
76 EXPECT_TRUE(testBuildAttr(6, 13, ARMBuildAttrs::CPU_arch,
77 ARMBuildAttrs::v7E_M));
78 }
79
TEST(CPUArchProfileBuildAttr,testBuildAttr)80 TEST(CPUArchProfileBuildAttr, testBuildAttr) {
81 EXPECT_TRUE(testTagString(7, "Tag_CPU_arch_profile"));
82 EXPECT_TRUE(testBuildAttr(7, 'A', ARMBuildAttrs::CPU_arch_profile,
83 ARMBuildAttrs::ApplicationProfile));
84 EXPECT_TRUE(testBuildAttr(7, 'R', ARMBuildAttrs::CPU_arch_profile,
85 ARMBuildAttrs::RealTimeProfile));
86 EXPECT_TRUE(testBuildAttr(7, 'M', ARMBuildAttrs::CPU_arch_profile,
87 ARMBuildAttrs::MicroControllerProfile));
88 EXPECT_TRUE(testBuildAttr(7, 'S', ARMBuildAttrs::CPU_arch_profile,
89 ARMBuildAttrs::SystemProfile));
90 }
91
TEST(ARMISABuildAttr,testBuildAttr)92 TEST(ARMISABuildAttr, testBuildAttr) {
93 EXPECT_TRUE(testTagString(8, "Tag_ARM_ISA_use"));
94 EXPECT_TRUE(testBuildAttr(8, 0, ARMBuildAttrs::ARM_ISA_use,
95 ARMBuildAttrs::Not_Allowed));
96 EXPECT_TRUE(testBuildAttr(8, 1, ARMBuildAttrs::ARM_ISA_use,
97 ARMBuildAttrs::Allowed));
98 }
99
TEST(ThumbISABuildAttr,testBuildAttr)100 TEST(ThumbISABuildAttr, testBuildAttr) {
101 EXPECT_TRUE(testTagString(9, "Tag_THUMB_ISA_use"));
102 EXPECT_TRUE(testBuildAttr(9, 0, ARMBuildAttrs::THUMB_ISA_use,
103 ARMBuildAttrs::Not_Allowed));
104 EXPECT_TRUE(testBuildAttr(9, 1, ARMBuildAttrs::THUMB_ISA_use,
105 ARMBuildAttrs::Allowed));
106 }
107
TEST(FPArchBuildAttr,testBuildAttr)108 TEST(FPArchBuildAttr, testBuildAttr) {
109 EXPECT_TRUE(testTagString(10, "Tag_FP_arch"));
110 EXPECT_TRUE(testBuildAttr(10, 0, ARMBuildAttrs::FP_arch,
111 ARMBuildAttrs::Not_Allowed));
112 EXPECT_TRUE(testBuildAttr(10, 1, ARMBuildAttrs::FP_arch,
113 ARMBuildAttrs::Allowed));
114 EXPECT_TRUE(testBuildAttr(10, 2, ARMBuildAttrs::FP_arch,
115 ARMBuildAttrs::AllowFPv2));
116 EXPECT_TRUE(testBuildAttr(10, 3, ARMBuildAttrs::FP_arch,
117 ARMBuildAttrs::AllowFPv3A));
118 EXPECT_TRUE(testBuildAttr(10, 4, ARMBuildAttrs::FP_arch,
119 ARMBuildAttrs::AllowFPv3B));
120 EXPECT_TRUE(testBuildAttr(10, 5, ARMBuildAttrs::FP_arch,
121 ARMBuildAttrs::AllowFPv4A));
122 EXPECT_TRUE(testBuildAttr(10, 6, ARMBuildAttrs::FP_arch,
123 ARMBuildAttrs::AllowFPv4B));
124 EXPECT_TRUE(testBuildAttr(10, 7, ARMBuildAttrs::FP_arch,
125 ARMBuildAttrs::AllowFPARMv8A));
126 EXPECT_TRUE(testBuildAttr(10, 8, ARMBuildAttrs::FP_arch,
127 ARMBuildAttrs::AllowFPARMv8B));
128 }
129
TEST(WMMXBuildAttr,testBuildAttr)130 TEST(WMMXBuildAttr, testBuildAttr) {
131 EXPECT_TRUE(testTagString(11, "Tag_WMMX_arch"));
132 EXPECT_TRUE(testBuildAttr(11, 0, ARMBuildAttrs::WMMX_arch,
133 ARMBuildAttrs::Not_Allowed));
134 EXPECT_TRUE(testBuildAttr(11, 1, ARMBuildAttrs::WMMX_arch,
135 ARMBuildAttrs::AllowWMMXv1));
136 EXPECT_TRUE(testBuildAttr(11, 2, ARMBuildAttrs::WMMX_arch,
137 ARMBuildAttrs::AllowWMMXv2));
138 }
139
TEST(SIMDBuildAttr,testBuildAttr)140 TEST(SIMDBuildAttr, testBuildAttr) {
141 EXPECT_TRUE(testTagString(12, "Tag_Advanced_SIMD_arch"));
142 EXPECT_TRUE(testBuildAttr(12, 0, ARMBuildAttrs::Advanced_SIMD_arch,
143 ARMBuildAttrs::Not_Allowed));
144 EXPECT_TRUE(testBuildAttr(12, 1, ARMBuildAttrs::Advanced_SIMD_arch,
145 ARMBuildAttrs::AllowNeon));
146 EXPECT_TRUE(testBuildAttr(12, 2, ARMBuildAttrs::Advanced_SIMD_arch,
147 ARMBuildAttrs::AllowNeon2));
148 EXPECT_TRUE(testBuildAttr(12, 3, ARMBuildAttrs::Advanced_SIMD_arch,
149 ARMBuildAttrs::AllowNeonARMv8));
150 EXPECT_TRUE(testBuildAttr(12, 4, ARMBuildAttrs::Advanced_SIMD_arch,
151 ARMBuildAttrs::AllowNeonARMv8_1a));
152 }
153
TEST(FPHPBuildAttr,testBuildAttr)154 TEST(FPHPBuildAttr, testBuildAttr) {
155 EXPECT_TRUE(testTagString(36, "Tag_FP_HP_extension"));
156 EXPECT_TRUE(testBuildAttr(36, 0, ARMBuildAttrs::FP_HP_extension,
157 ARMBuildAttrs::Not_Allowed));
158 EXPECT_TRUE(testBuildAttr(36, 1, ARMBuildAttrs::FP_HP_extension,
159 ARMBuildAttrs::AllowHPFP));
160 }
161
TEST(CPUAlignBuildAttr,testBuildAttr)162 TEST(CPUAlignBuildAttr, testBuildAttr) {
163 EXPECT_TRUE(testTagString(34, "Tag_CPU_unaligned_access"));
164 EXPECT_TRUE(testBuildAttr(34, 0, ARMBuildAttrs::CPU_unaligned_access,
165 ARMBuildAttrs::Not_Allowed));
166 EXPECT_TRUE(testBuildAttr(34, 1, ARMBuildAttrs::CPU_unaligned_access,
167 ARMBuildAttrs::Allowed));
168 }
169
TEST(T2EEBuildAttr,testBuildAttr)170 TEST(T2EEBuildAttr, testBuildAttr) {
171 EXPECT_TRUE(testTagString(66, "Tag_T2EE_use"));
172 EXPECT_TRUE(testBuildAttr(66, 0, ARMBuildAttrs::T2EE_use,
173 ARMBuildAttrs::Not_Allowed));
174 EXPECT_TRUE(testBuildAttr(66, 1, ARMBuildAttrs::T2EE_use,
175 ARMBuildAttrs::Allowed));
176 }
177
TEST(VirtualizationBuildAttr,testBuildAttr)178 TEST(VirtualizationBuildAttr, testBuildAttr) {
179 EXPECT_TRUE(testTagString(68, "Tag_Virtualization_use"));
180 EXPECT_TRUE(testBuildAttr(68, 0, ARMBuildAttrs::Virtualization_use,
181 ARMBuildAttrs::Not_Allowed));
182 EXPECT_TRUE(testBuildAttr(68, 1, ARMBuildAttrs::Virtualization_use,
183 ARMBuildAttrs::AllowTZ));
184 EXPECT_TRUE(testBuildAttr(68, 2, ARMBuildAttrs::Virtualization_use,
185 ARMBuildAttrs::AllowVirtualization));
186 EXPECT_TRUE(testBuildAttr(68, 3, ARMBuildAttrs::Virtualization_use,
187 ARMBuildAttrs::AllowTZVirtualization));
188 }
189
TEST(MPBuildAttr,testBuildAttr)190 TEST(MPBuildAttr, testBuildAttr) {
191 EXPECT_TRUE(testTagString(42, "Tag_MPextension_use"));
192 EXPECT_TRUE(testBuildAttr(42, 0, ARMBuildAttrs::MPextension_use,
193 ARMBuildAttrs::Not_Allowed));
194 EXPECT_TRUE(testBuildAttr(42, 1, ARMBuildAttrs::MPextension_use,
195 ARMBuildAttrs::AllowMP));
196 }
197
TEST(DivBuildAttr,testBuildAttr)198 TEST(DivBuildAttr, testBuildAttr) {
199 EXPECT_TRUE(testTagString(44, "Tag_DIV_use"));
200 EXPECT_TRUE(testBuildAttr(44, 0, ARMBuildAttrs::DIV_use,
201 ARMBuildAttrs::AllowDIVIfExists));
202 EXPECT_TRUE(testBuildAttr(44, 1, ARMBuildAttrs::DIV_use,
203 ARMBuildAttrs::DisallowDIV));
204 EXPECT_TRUE(testBuildAttr(44, 2, ARMBuildAttrs::DIV_use,
205 ARMBuildAttrs::AllowDIVExt));
206 }
207
TEST(PCS_ConfigBuildAttr,testBuildAttr)208 TEST(PCS_ConfigBuildAttr, testBuildAttr) {
209 EXPECT_TRUE(testTagString(13, "Tag_PCS_config"));
210 EXPECT_TRUE(testBuildAttr(13, 0, ARMBuildAttrs::PCS_config, 0));
211 EXPECT_TRUE(testBuildAttr(13, 1, ARMBuildAttrs::PCS_config, 1));
212 EXPECT_TRUE(testBuildAttr(13, 2, ARMBuildAttrs::PCS_config, 2));
213 EXPECT_TRUE(testBuildAttr(13, 3, ARMBuildAttrs::PCS_config, 3));
214 EXPECT_TRUE(testBuildAttr(13, 4, ARMBuildAttrs::PCS_config, 4));
215 EXPECT_TRUE(testBuildAttr(13, 5, ARMBuildAttrs::PCS_config, 5));
216 EXPECT_TRUE(testBuildAttr(13, 6, ARMBuildAttrs::PCS_config, 6));
217 EXPECT_TRUE(testBuildAttr(13, 7, ARMBuildAttrs::PCS_config, 7));
218 }
219
TEST(PCS_R9BuildAttr,testBuildAttr)220 TEST(PCS_R9BuildAttr, testBuildAttr) {
221 EXPECT_TRUE(testTagString(14, "Tag_ABI_PCS_R9_use"));
222 EXPECT_TRUE(testBuildAttr(14, 0, ARMBuildAttrs::ABI_PCS_R9_use,
223 ARMBuildAttrs::R9IsGPR));
224 EXPECT_TRUE(testBuildAttr(14, 1, ARMBuildAttrs::ABI_PCS_R9_use,
225 ARMBuildAttrs::R9IsSB));
226 EXPECT_TRUE(testBuildAttr(14, 2, ARMBuildAttrs::ABI_PCS_R9_use,
227 ARMBuildAttrs::R9IsTLSPointer));
228 EXPECT_TRUE(testBuildAttr(14, 3, ARMBuildAttrs::ABI_PCS_R9_use,
229 ARMBuildAttrs::R9Reserved));
230 }
231
TEST(PCS_RWBuildAttr,testBuildAttr)232 TEST(PCS_RWBuildAttr, testBuildAttr) {
233 EXPECT_TRUE(testTagString(15, "Tag_ABI_PCS_RW_data"));
234 EXPECT_TRUE(testBuildAttr(15, 0, ARMBuildAttrs::ABI_PCS_RW_data,
235 ARMBuildAttrs::Not_Allowed));
236 EXPECT_TRUE(testBuildAttr(15, 1, ARMBuildAttrs::ABI_PCS_RW_data,
237 ARMBuildAttrs::AddressRWPCRel));
238 EXPECT_TRUE(testBuildAttr(15, 2, ARMBuildAttrs::ABI_PCS_RW_data,
239 ARMBuildAttrs::AddressRWSBRel));
240 EXPECT_TRUE(testBuildAttr(15, 3, ARMBuildAttrs::ABI_PCS_RW_data,
241 ARMBuildAttrs::AddressRWNone));
242 }
243
TEST(PCS_ROBuildAttr,testBuildAttr)244 TEST(PCS_ROBuildAttr, testBuildAttr) {
245 EXPECT_TRUE(testTagString(16, "Tag_ABI_PCS_RO_data"));
246 EXPECT_TRUE(testBuildAttr(16, 0, ARMBuildAttrs::ABI_PCS_RO_data,
247 ARMBuildAttrs::Not_Allowed));
248 EXPECT_TRUE(testBuildAttr(16, 1, ARMBuildAttrs::ABI_PCS_RO_data,
249 ARMBuildAttrs::AddressROPCRel));
250 EXPECT_TRUE(testBuildAttr(16, 2, ARMBuildAttrs::ABI_PCS_RO_data,
251 ARMBuildAttrs::AddressRONone));
252 }
253
TEST(PCS_GOTBuildAttr,testBuildAttr)254 TEST(PCS_GOTBuildAttr, testBuildAttr) {
255 EXPECT_TRUE(testTagString(17, "Tag_ABI_PCS_GOT_use"));
256 EXPECT_TRUE(testBuildAttr(17, 0, ARMBuildAttrs::ABI_PCS_GOT_use,
257 ARMBuildAttrs::Not_Allowed));
258 EXPECT_TRUE(testBuildAttr(17, 1, ARMBuildAttrs::ABI_PCS_GOT_use,
259 ARMBuildAttrs::AddressDirect));
260 EXPECT_TRUE(testBuildAttr(17, 2, ARMBuildAttrs::ABI_PCS_GOT_use,
261 ARMBuildAttrs::AddressGOT));
262 }
263
TEST(PCS_WCharBuildAttr,testBuildAttr)264 TEST(PCS_WCharBuildAttr, testBuildAttr) {
265 EXPECT_TRUE(testTagString(18, "Tag_ABI_PCS_wchar_t"));
266 EXPECT_TRUE(testBuildAttr(18, 0, ARMBuildAttrs::ABI_PCS_wchar_t,
267 ARMBuildAttrs::WCharProhibited));
268 EXPECT_TRUE(testBuildAttr(18, 2, ARMBuildAttrs::ABI_PCS_wchar_t,
269 ARMBuildAttrs::WCharWidth2Bytes));
270 EXPECT_TRUE(testBuildAttr(18, 4, ARMBuildAttrs::ABI_PCS_wchar_t,
271 ARMBuildAttrs::WCharWidth4Bytes));
272 }
273
TEST(EnumSizeBuildAttr,testBuildAttr)274 TEST(EnumSizeBuildAttr, testBuildAttr) {
275 EXPECT_TRUE(testTagString(26, "Tag_ABI_enum_size"));
276 EXPECT_TRUE(testBuildAttr(26, 0, ARMBuildAttrs::ABI_enum_size,
277 ARMBuildAttrs::EnumProhibited));
278 EXPECT_TRUE(testBuildAttr(26, 1, ARMBuildAttrs::ABI_enum_size,
279 ARMBuildAttrs::EnumSmallest));
280 EXPECT_TRUE(testBuildAttr(26, 2, ARMBuildAttrs::ABI_enum_size,
281 ARMBuildAttrs::Enum32Bit));
282 EXPECT_TRUE(testBuildAttr(26, 3, ARMBuildAttrs::ABI_enum_size,
283 ARMBuildAttrs::Enum32BitABI));
284 }
285
TEST(AlignNeededBuildAttr,testBuildAttr)286 TEST(AlignNeededBuildAttr, testBuildAttr) {
287 EXPECT_TRUE(testTagString(24, "Tag_ABI_align_needed"));
288 EXPECT_TRUE(testBuildAttr(24, 0, ARMBuildAttrs::ABI_align_needed,
289 ARMBuildAttrs::Not_Allowed));
290 EXPECT_TRUE(testBuildAttr(24, 1, ARMBuildAttrs::ABI_align_needed,
291 ARMBuildAttrs::Align8Byte));
292 EXPECT_TRUE(testBuildAttr(24, 2, ARMBuildAttrs::ABI_align_needed,
293 ARMBuildAttrs::Align4Byte));
294 EXPECT_TRUE(testBuildAttr(24, 3, ARMBuildAttrs::ABI_align_needed,
295 ARMBuildAttrs::AlignReserved));
296 }
297
TEST(AlignPreservedBuildAttr,testBuildAttr)298 TEST(AlignPreservedBuildAttr, testBuildAttr) {
299 EXPECT_TRUE(testTagString(25, "Tag_ABI_align_preserved"));
300 EXPECT_TRUE(testBuildAttr(25, 0, ARMBuildAttrs::ABI_align_preserved,
301 ARMBuildAttrs::AlignNotPreserved));
302 EXPECT_TRUE(testBuildAttr(25, 1, ARMBuildAttrs::ABI_align_preserved,
303 ARMBuildAttrs::AlignPreserve8Byte));
304 EXPECT_TRUE(testBuildAttr(25, 2, ARMBuildAttrs::ABI_align_preserved,
305 ARMBuildAttrs::AlignPreserveAll));
306 EXPECT_TRUE(testBuildAttr(25, 3, ARMBuildAttrs::ABI_align_preserved,
307 ARMBuildAttrs::AlignReserved));
308 }
309
TEST(FPRoundingBuildAttr,testBuildAttr)310 TEST(FPRoundingBuildAttr, testBuildAttr) {
311 EXPECT_TRUE(testTagString(19, "Tag_ABI_FP_rounding"));
312 EXPECT_TRUE(testBuildAttr(19, 0, ARMBuildAttrs::ABI_FP_rounding, 0));
313 EXPECT_TRUE(testBuildAttr(19, 1, ARMBuildAttrs::ABI_FP_rounding, 1));
314 }
315
TEST(FPDenormalBuildAttr,testBuildAttr)316 TEST(FPDenormalBuildAttr, testBuildAttr) {
317 EXPECT_TRUE(testTagString(20, "Tag_ABI_FP_denormal"));
318 EXPECT_TRUE(testBuildAttr(20, 0, ARMBuildAttrs::ABI_FP_denormal,
319 ARMBuildAttrs::PositiveZero));
320 EXPECT_TRUE(testBuildAttr(20, 1, ARMBuildAttrs::ABI_FP_denormal,
321 ARMBuildAttrs::IEEEDenormals));
322 EXPECT_TRUE(testBuildAttr(20, 2, ARMBuildAttrs::ABI_FP_denormal,
323 ARMBuildAttrs::PreserveFPSign));
324 }
325
TEST(FPExceptionsBuildAttr,testBuildAttr)326 TEST(FPExceptionsBuildAttr, testBuildAttr) {
327 EXPECT_TRUE(testTagString(21, "Tag_ABI_FP_exceptions"));
328 EXPECT_TRUE(testBuildAttr(21, 0, ARMBuildAttrs::ABI_FP_exceptions, 0));
329 EXPECT_TRUE(testBuildAttr(21, 1, ARMBuildAttrs::ABI_FP_exceptions, 1));
330 }
331
TEST(FPUserExceptionsBuildAttr,testBuildAttr)332 TEST(FPUserExceptionsBuildAttr, testBuildAttr) {
333 EXPECT_TRUE(testTagString(22, "Tag_ABI_FP_user_exceptions"));
334 EXPECT_TRUE(testBuildAttr(22, 0, ARMBuildAttrs::ABI_FP_user_exceptions, 0));
335 EXPECT_TRUE(testBuildAttr(22, 1, ARMBuildAttrs::ABI_FP_user_exceptions, 1));
336 }
337
TEST(FPNumberModelBuildAttr,testBuildAttr)338 TEST(FPNumberModelBuildAttr, testBuildAttr) {
339 EXPECT_TRUE(testTagString(23, "Tag_ABI_FP_number_model"));
340 EXPECT_TRUE(testBuildAttr(23, 0, ARMBuildAttrs::ABI_FP_number_model,
341 ARMBuildAttrs::Not_Allowed));
342 EXPECT_TRUE(testBuildAttr(23, 1, ARMBuildAttrs::ABI_FP_number_model,
343 ARMBuildAttrs::AllowIEEENormal));
344 EXPECT_TRUE(testBuildAttr(23, 2, ARMBuildAttrs::ABI_FP_number_model,
345 ARMBuildAttrs::AllowRTABI));
346 EXPECT_TRUE(testBuildAttr(23, 3, ARMBuildAttrs::ABI_FP_number_model,
347 ARMBuildAttrs::AllowIEEE754));
348 }
349
TEST(FP16BuildAttr,testBuildAttr)350 TEST(FP16BuildAttr, testBuildAttr) {
351 EXPECT_TRUE(testTagString(38, "Tag_ABI_FP_16bit_format"));
352 EXPECT_TRUE(testBuildAttr(38, 0, ARMBuildAttrs::ABI_FP_16bit_format,
353 ARMBuildAttrs::Not_Allowed));
354 EXPECT_TRUE(testBuildAttr(38, 1, ARMBuildAttrs::ABI_FP_16bit_format,
355 ARMBuildAttrs::FP16FormatIEEE));
356 EXPECT_TRUE(testBuildAttr(38, 2, ARMBuildAttrs::ABI_FP_16bit_format,
357 ARMBuildAttrs::FP16VFP3));
358 }
359
TEST(HardFPBuildAttr,testBuildAttr)360 TEST(HardFPBuildAttr, testBuildAttr) {
361 EXPECT_TRUE(testTagString(27, "Tag_ABI_HardFP_use"));
362 EXPECT_TRUE(testBuildAttr(27, 0, ARMBuildAttrs::ABI_HardFP_use,
363 ARMBuildAttrs::HardFPImplied));
364 EXPECT_TRUE(testBuildAttr(27, 1, ARMBuildAttrs::ABI_HardFP_use,
365 ARMBuildAttrs::HardFPSinglePrecision));
366 EXPECT_TRUE(testBuildAttr(27, 2, ARMBuildAttrs::ABI_HardFP_use, 2));
367 }
368
TEST(VFPArgsBuildAttr,testBuildAttr)369 TEST(VFPArgsBuildAttr, testBuildAttr) {
370 EXPECT_TRUE(testTagString(28, "Tag_ABI_VFP_args"));
371 EXPECT_TRUE(testBuildAttr(28, 0, ARMBuildAttrs::ABI_VFP_args,
372 ARMBuildAttrs::BaseAAPCS));
373 EXPECT_TRUE(testBuildAttr(28, 1, ARMBuildAttrs::ABI_VFP_args,
374 ARMBuildAttrs::HardFPAAPCS));
375 EXPECT_TRUE(testBuildAttr(28, 2, ARMBuildAttrs::ABI_VFP_args, 2));
376 EXPECT_TRUE(testBuildAttr(28, 3, ARMBuildAttrs::ABI_VFP_args, 3));
377 }
378
TEST(WMMXArgsBuildAttr,testBuildAttr)379 TEST(WMMXArgsBuildAttr, testBuildAttr) {
380 EXPECT_TRUE(testTagString(29, "Tag_ABI_WMMX_args"));
381 EXPECT_TRUE(testBuildAttr(29, 0, ARMBuildAttrs::ABI_WMMX_args, 0));
382 EXPECT_TRUE(testBuildAttr(29, 1, ARMBuildAttrs::ABI_WMMX_args, 1));
383 EXPECT_TRUE(testBuildAttr(29, 2, ARMBuildAttrs::ABI_WMMX_args, 2));
384 }
385