1 //===----------- Triple.cpp - Triple unit tests ---------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/TargetParser/Triple.h"
10 #include "llvm/Support/VersionTuple.h"
11 #include "gtest/gtest.h"
17 TEST(TripleTest
, BasicParsing
) {
21 EXPECT_EQ("", T
.getArchName().str());
22 EXPECT_EQ("", T
.getVendorName().str());
23 EXPECT_EQ("", T
.getOSName().str());
24 EXPECT_EQ("", T
.getEnvironmentName().str());
27 EXPECT_EQ("", T
.getArchName().str());
28 EXPECT_EQ("", T
.getVendorName().str());
29 EXPECT_EQ("", T
.getOSName().str());
30 EXPECT_EQ("", T
.getEnvironmentName().str());
33 EXPECT_EQ("", T
.getArchName().str());
34 EXPECT_EQ("", T
.getVendorName().str());
35 EXPECT_EQ("", T
.getOSName().str());
36 EXPECT_EQ("", T
.getEnvironmentName().str());
39 EXPECT_EQ("", T
.getArchName().str());
40 EXPECT_EQ("", T
.getVendorName().str());
41 EXPECT_EQ("", T
.getOSName().str());
42 EXPECT_EQ("", T
.getEnvironmentName().str());
45 EXPECT_EQ("", T
.getArchName().str());
46 EXPECT_EQ("", T
.getVendorName().str());
47 EXPECT_EQ("", T
.getOSName().str());
48 EXPECT_EQ("-", T
.getEnvironmentName().str());
51 EXPECT_EQ("a", T
.getArchName().str());
52 EXPECT_EQ("", T
.getVendorName().str());
53 EXPECT_EQ("", T
.getOSName().str());
54 EXPECT_EQ("", T
.getEnvironmentName().str());
57 EXPECT_EQ("a", T
.getArchName().str());
58 EXPECT_EQ("b", T
.getVendorName().str());
59 EXPECT_EQ("", T
.getOSName().str());
60 EXPECT_EQ("", T
.getEnvironmentName().str());
63 EXPECT_EQ("a", T
.getArchName().str());
64 EXPECT_EQ("b", T
.getVendorName().str());
65 EXPECT_EQ("c", T
.getOSName().str());
66 EXPECT_EQ("", T
.getEnvironmentName().str());
68 T
= Triple("a-b-c-d");
69 EXPECT_EQ("a", T
.getArchName().str());
70 EXPECT_EQ("b", T
.getVendorName().str());
71 EXPECT_EQ("c", T
.getOSName().str());
72 EXPECT_EQ("d", T
.getEnvironmentName().str());
75 TEST(TripleTest
, ParsedIDs
) {
78 T
= Triple("i386-apple-darwin");
79 EXPECT_EQ(Triple::x86
, T
.getArch());
80 EXPECT_EQ(Triple::Apple
, T
.getVendor());
81 EXPECT_EQ(Triple::Darwin
, T
.getOS());
82 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
84 T
= Triple("i386-pc-elfiamcu");
85 EXPECT_EQ(Triple::x86
, T
.getArch());
86 EXPECT_EQ(Triple::PC
, T
.getVendor());
87 EXPECT_EQ(Triple::ELFIAMCU
, T
.getOS());
88 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
90 T
= Triple("i386-pc-hurd-gnu");
91 EXPECT_EQ(Triple::x86
, T
.getArch());
92 EXPECT_EQ(Triple::PC
, T
.getVendor());
93 EXPECT_EQ(Triple::Hurd
, T
.getOS());
94 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
96 T
= Triple("i686-pc-linux-gnu");
97 EXPECT_EQ(Triple::x86
, T
.getArch());
98 EXPECT_EQ(Triple::PC
, T
.getVendor());
99 EXPECT_EQ(Triple::Linux
, T
.getOS());
100 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
101 EXPECT_FALSE(T
.isTime64ABI());
103 T
= Triple("x86_64-pc-linux-gnu");
104 EXPECT_EQ(Triple::x86_64
, T
.getArch());
105 EXPECT_EQ(Triple::PC
, T
.getVendor());
106 EXPECT_EQ(Triple::Linux
, T
.getOS());
107 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
109 T
= Triple("x86_64-pc-linux-musl");
110 EXPECT_EQ(Triple::x86_64
, T
.getArch());
111 EXPECT_EQ(Triple::PC
, T
.getVendor());
112 EXPECT_EQ(Triple::Linux
, T
.getOS());
113 EXPECT_EQ(Triple::Musl
, T
.getEnvironment());
115 T
= Triple("x86_64-pc-linux-muslx32");
116 EXPECT_EQ(Triple::x86_64
, T
.getArch());
117 EXPECT_EQ(Triple::PC
, T
.getVendor());
118 EXPECT_EQ(Triple::Linux
, T
.getOS());
119 EXPECT_EQ(Triple::MuslX32
, T
.getEnvironment());
121 T
= Triple("x86_64-pc-hurd-gnu");
122 EXPECT_EQ(Triple::x86_64
, T
.getArch());
123 EXPECT_EQ(Triple::PC
, T
.getVendor());
124 EXPECT_EQ(Triple::Hurd
, T
.getOS());
125 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
127 T
= Triple("arm-unknown-linux-android16");
128 EXPECT_EQ(Triple::arm
, T
.getArch());
129 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
130 EXPECT_EQ(Triple::Linux
, T
.getOS());
131 EXPECT_EQ(Triple::Android
, T
.getEnvironment());
133 T
= Triple("aarch64-unknown-linux-android21");
134 EXPECT_EQ(Triple::aarch64
, T
.getArch());
135 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
136 EXPECT_EQ(Triple::Linux
, T
.getOS());
137 EXPECT_EQ(Triple::Android
, T
.getEnvironment());
139 // PS4 has two spellings for the vendor.
140 T
= Triple("x86_64-scei-ps4");
141 EXPECT_EQ(Triple::x86_64
, T
.getArch());
142 EXPECT_EQ(Triple::SCEI
, T
.getVendor());
143 EXPECT_EQ(Triple::PS4
, T
.getOS());
145 T
= Triple("x86_64-sie-ps4");
146 EXPECT_EQ(Triple::x86_64
, T
.getArch());
147 EXPECT_EQ(Triple::SCEI
, T
.getVendor());
148 EXPECT_EQ(Triple::PS4
, T
.getOS());
150 T
= Triple("x86_64-sie-ps5");
151 EXPECT_EQ(Triple::x86_64
, T
.getArch());
152 EXPECT_EQ(Triple::SCEI
, T
.getVendor());
153 EXPECT_EQ(Triple::PS5
, T
.getOS());
155 T
= Triple("powerpc-ibm-aix");
156 EXPECT_EQ(Triple::ppc
, T
.getArch());
157 EXPECT_EQ(Triple::IBM
, T
.getVendor());
158 EXPECT_EQ(Triple::AIX
, T
.getOS());
159 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
161 T
= Triple("powerpc64-ibm-aix");
162 EXPECT_EQ(Triple::ppc64
, T
.getArch());
163 EXPECT_EQ(Triple::IBM
, T
.getVendor());
164 EXPECT_EQ(Triple::AIX
, T
.getOS());
165 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
167 T
= Triple("powerpc-dunno-notsure");
168 EXPECT_EQ(Triple::ppc
, T
.getArch());
169 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
170 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
171 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
173 T
= Triple("powerpcspe-unknown-freebsd");
174 EXPECT_EQ(Triple::ppc
, T
.getArch());
175 EXPECT_EQ(Triple::PPCSubArch_spe
, T
.getSubArch());
176 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
177 EXPECT_EQ(Triple::FreeBSD
, T
.getOS());
178 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
180 T
= Triple("s390x-ibm-zos");
181 EXPECT_EQ(Triple::systemz
, T
.getArch());
182 EXPECT_EQ(Triple::IBM
, T
.getVendor());
183 EXPECT_EQ(Triple::ZOS
, T
.getOS());
184 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
186 T
= Triple("systemz-ibm-zos");
187 EXPECT_EQ(Triple::systemz
, T
.getArch());
188 EXPECT_EQ(Triple::IBM
, T
.getVendor());
189 EXPECT_EQ(Triple::ZOS
, T
.getOS());
190 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
192 T
= Triple("arm-none-none-eabi");
193 EXPECT_EQ(Triple::arm
, T
.getArch());
194 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
195 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
196 EXPECT_EQ(Triple::EABI
, T
.getEnvironment());
197 EXPECT_FALSE(T
.isHardFloatABI());
199 T
= Triple("arm-none-none-eabihf");
200 EXPECT_EQ(Triple::arm
, T
.getArch());
201 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
202 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
203 EXPECT_EQ(Triple::EABIHF
, T
.getEnvironment());
204 EXPECT_TRUE(T
.isHardFloatABI());
206 T
= Triple("arm-none-linux-musleabi");
207 EXPECT_EQ(Triple::arm
, T
.getArch());
208 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
209 EXPECT_EQ(Triple::Linux
, T
.getOS());
210 EXPECT_EQ(Triple::MuslEABI
, T
.getEnvironment());
211 EXPECT_FALSE(T
.isHardFloatABI());
213 T
= Triple("arm-none-linux-musleabihf");
214 EXPECT_EQ(Triple::arm
, T
.getArch());
215 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
216 EXPECT_EQ(Triple::Linux
, T
.getOS());
217 EXPECT_EQ(Triple::MuslEABIHF
, T
.getEnvironment());
218 EXPECT_TRUE(T
.isHardFloatABI());
220 T
= Triple("armv6hl-none-linux-gnueabi");
221 EXPECT_EQ(Triple::arm
, T
.getArch());
222 EXPECT_EQ(Triple::Linux
, T
.getOS());
223 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
224 EXPECT_EQ(Triple::GNUEABI
, T
.getEnvironment());
225 EXPECT_FALSE(T
.isTime64ABI());
226 EXPECT_FALSE(T
.isHardFloatABI());
228 T
= Triple("armv7hl-none-linux-gnueabi");
229 EXPECT_EQ(Triple::arm
, T
.getArch());
230 EXPECT_EQ(Triple::Linux
, T
.getOS());
231 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
232 EXPECT_EQ(Triple::GNUEABI
, T
.getEnvironment());
233 EXPECT_FALSE(T
.isTime64ABI());
234 EXPECT_FALSE(T
.isHardFloatABI());
236 T
= Triple("armv7hl-none-linux-gnueabihf");
237 EXPECT_EQ(Triple::arm
, T
.getArch());
238 EXPECT_EQ(Triple::Linux
, T
.getOS());
239 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
240 EXPECT_EQ(Triple::GNUEABIHF
, T
.getEnvironment());
241 EXPECT_FALSE(T
.isTime64ABI());
242 EXPECT_TRUE(T
.isHardFloatABI());
244 T
= Triple("amdil-unknown-unknown");
245 EXPECT_EQ(Triple::amdil
, T
.getArch());
246 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
247 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
249 T
= Triple("amdil64-unknown-unknown");
250 EXPECT_EQ(Triple::amdil64
, T
.getArch());
251 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
252 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
254 T
= Triple("hsail-unknown-unknown");
255 EXPECT_EQ(Triple::hsail
, T
.getArch());
256 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
257 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
259 T
= Triple("hsail64-unknown-unknown");
260 EXPECT_EQ(Triple::hsail64
, T
.getArch());
261 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
262 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
264 T
= Triple("sparcel-unknown-unknown");
265 EXPECT_EQ(Triple::sparcel
, T
.getArch());
266 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
267 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
269 T
= Triple("spir-unknown-unknown");
270 EXPECT_EQ(Triple::spir
, T
.getArch());
271 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
272 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
274 T
= Triple("spir64-unknown-unknown");
275 EXPECT_EQ(Triple::spir64
, T
.getArch());
276 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
277 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
279 T
= Triple("spirv32-unknown-unknown");
280 EXPECT_EQ(Triple::spirv32
, T
.getArch());
281 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
282 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
283 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
285 T
= Triple("spirv32v1.0-unknown-unknown");
286 EXPECT_EQ(Triple::spirv32
, T
.getArch());
287 EXPECT_EQ(Triple::SPIRVSubArch_v10
, T
.getSubArch());
288 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
289 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
291 T
= Triple("spirv32v1.1-unknown-unknown");
292 EXPECT_EQ(Triple::spirv32
, T
.getArch());
293 EXPECT_EQ(Triple::SPIRVSubArch_v11
, T
.getSubArch());
294 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
295 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
297 T
= Triple("spirv32v1.2-unknown-unknown");
298 EXPECT_EQ(Triple::spirv32
, T
.getArch());
299 EXPECT_EQ(Triple::SPIRVSubArch_v12
, T
.getSubArch());
300 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
301 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
303 T
= Triple("spirv32v1.3-unknown-unknown");
304 EXPECT_EQ(Triple::spirv32
, T
.getArch());
305 EXPECT_EQ(Triple::SPIRVSubArch_v13
, T
.getSubArch());
306 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
307 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
309 T
= Triple("spirv32v1.4-unknown-unknown");
310 EXPECT_EQ(Triple::spirv32
, T
.getArch());
311 EXPECT_EQ(Triple::SPIRVSubArch_v14
, T
.getSubArch());
312 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
313 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
315 T
= Triple("spirv32v1.5-unknown-unknown");
316 EXPECT_EQ(Triple::spirv32
, T
.getArch());
317 EXPECT_EQ(Triple::SPIRVSubArch_v15
, T
.getSubArch());
318 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
319 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
321 T
= Triple("spirv64-unknown-unknown");
322 EXPECT_EQ(Triple::spirv64
, T
.getArch());
323 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
324 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
325 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
327 T
= Triple("spirv64v1.0-unknown-unknown");
328 EXPECT_EQ(Triple::spirv64
, T
.getArch());
329 EXPECT_EQ(Triple::SPIRVSubArch_v10
, T
.getSubArch());
330 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
331 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
333 T
= Triple("spirv64v1.1-unknown-unknown");
334 EXPECT_EQ(Triple::spirv64
, T
.getArch());
335 EXPECT_EQ(Triple::SPIRVSubArch_v11
, T
.getSubArch());
336 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
337 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
339 T
= Triple("spirv64v1.2-unknown-unknown");
340 EXPECT_EQ(Triple::spirv64
, T
.getArch());
341 EXPECT_EQ(Triple::SPIRVSubArch_v12
, T
.getSubArch());
342 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
343 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
345 T
= Triple("spirv64v1.3-unknown-unknown");
346 EXPECT_EQ(Triple::spirv64
, T
.getArch());
347 EXPECT_EQ(Triple::SPIRVSubArch_v13
, T
.getSubArch());
348 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
349 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
351 T
= Triple("spirv64v1.4-unknown-unknown");
352 EXPECT_EQ(Triple::spirv64
, T
.getArch());
353 EXPECT_EQ(Triple::SPIRVSubArch_v14
, T
.getSubArch());
354 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
355 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
357 T
= Triple("spirv64v1.5-unknown-unknown");
358 EXPECT_EQ(Triple::spirv64
, T
.getArch());
359 EXPECT_EQ(Triple::SPIRVSubArch_v15
, T
.getSubArch());
360 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
361 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
363 T
= Triple("spirv-unknown-vulkan-pixel");
364 EXPECT_EQ(Triple::spirv
, T
.getArch());
365 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
366 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
367 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
368 EXPECT_EQ(VersionTuple(1, 2), T
.getVulkanVersion());
369 EXPECT_EQ(Triple::Pixel
, T
.getEnvironment());
371 T
= Triple("spirv-unknown-vulkan-vertex");
372 EXPECT_EQ(Triple::spirv
, T
.getArch());
373 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
374 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
375 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
376 EXPECT_EQ(VersionTuple(1, 2), T
.getVulkanVersion());
377 EXPECT_EQ(Triple::Vertex
, T
.getEnvironment());
379 T
= Triple("spirv-unknown-vulkan-geometry");
380 EXPECT_EQ(Triple::spirv
, T
.getArch());
381 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
382 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
383 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
384 EXPECT_EQ(VersionTuple(1, 2), T
.getVulkanVersion());
385 EXPECT_EQ(Triple::Geometry
, T
.getEnvironment());
387 T
= Triple("spirv-unknown-vulkan-library");
388 EXPECT_EQ(Triple::spirv
, T
.getArch());
389 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
390 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
391 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
392 EXPECT_EQ(VersionTuple(1, 2), T
.getVulkanVersion());
393 EXPECT_EQ(Triple::Library
, T
.getEnvironment());
395 T
= Triple("spirv-unknown-vulkan-raygeneration");
396 EXPECT_EQ(Triple::spirv
, T
.getArch());
397 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
398 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
399 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
400 EXPECT_EQ(VersionTuple(1, 2), T
.getVulkanVersion());
401 EXPECT_EQ(Triple::RayGeneration
, T
.getEnvironment());
403 T
= Triple("spirv-unknown-vulkan-intersection");
404 EXPECT_EQ(Triple::spirv
, T
.getArch());
405 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
406 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
407 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
408 EXPECT_EQ(VersionTuple(1, 2), T
.getVulkanVersion());
409 EXPECT_EQ(Triple::Intersection
, T
.getEnvironment());
411 T
= Triple("spirv-unknown-vulkan-anyhit");
412 EXPECT_EQ(Triple::spirv
, T
.getArch());
413 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
414 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
415 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
416 EXPECT_EQ(VersionTuple(1, 2), T
.getVulkanVersion());
417 EXPECT_EQ(Triple::AnyHit
, T
.getEnvironment());
419 T
= Triple("spirv-unknown-vulkan-closesthit");
420 EXPECT_EQ(Triple::spirv
, T
.getArch());
421 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
422 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
423 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
424 EXPECT_EQ(VersionTuple(1, 2), T
.getVulkanVersion());
425 EXPECT_EQ(Triple::ClosestHit
, T
.getEnvironment());
427 T
= Triple("spirv-unknown-vulkan-miss");
428 EXPECT_EQ(Triple::spirv
, T
.getArch());
429 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
430 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
431 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
432 EXPECT_EQ(VersionTuple(1, 2), T
.getVulkanVersion());
433 EXPECT_EQ(Triple::Miss
, T
.getEnvironment());
435 T
= Triple("spirv-unknown-vulkan-callable");
436 EXPECT_EQ(Triple::spirv
, T
.getArch());
437 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
438 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
439 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
440 EXPECT_EQ(VersionTuple(1, 2), T
.getVulkanVersion());
441 EXPECT_EQ(Triple::Callable
, T
.getEnvironment());
443 T
= Triple("spirv-unknown-vulkan-mesh");
444 EXPECT_EQ(Triple::spirv
, T
.getArch());
445 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
446 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
447 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
448 EXPECT_EQ(VersionTuple(1, 2), T
.getVulkanVersion());
449 EXPECT_EQ(Triple::Mesh
, T
.getEnvironment());
451 T
= Triple("spirv-unknown-vulkan-amplification");
452 EXPECT_EQ(Triple::spirv
, T
.getArch());
453 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
454 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
455 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
456 EXPECT_EQ(VersionTuple(1, 2), T
.getVulkanVersion());
457 EXPECT_EQ(Triple::Amplification
, T
.getEnvironment());
459 T
= Triple("spirv1.5-unknown-vulkan1.2-compute");
460 EXPECT_EQ(Triple::spirv
, T
.getArch());
461 EXPECT_EQ(Triple::SPIRVSubArch_v15
, T
.getSubArch());
462 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
463 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
464 EXPECT_EQ(VersionTuple(1, 2), T
.getVulkanVersion());
465 EXPECT_EQ(Triple::Compute
, T
.getEnvironment());
467 T
= Triple("spirv1.6-unknown-vulkan1.3-compute");
468 EXPECT_EQ(Triple::spirv
, T
.getArch());
469 EXPECT_EQ(Triple::SPIRVSubArch_v16
, T
.getSubArch());
470 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
471 EXPECT_EQ(Triple::Vulkan
, T
.getOS());
472 EXPECT_EQ(VersionTuple(1, 3), T
.getVulkanVersion());
473 EXPECT_EQ(Triple::Compute
, T
.getEnvironment());
475 T
= Triple("dxilv1.0--shadermodel6.0-pixel");
476 EXPECT_EQ(Triple::dxil
, T
.getArch());
477 EXPECT_EQ(Triple::DXILSubArch_v1_0
, T
.getSubArch());
478 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
479 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
480 EXPECT_EQ(VersionTuple(1, 0), T
.getDXILVersion());
481 EXPECT_EQ(Triple::Pixel
, T
.getEnvironment());
483 T
= Triple("dxilv1.1--shadermodel6.1-vertex");
484 EXPECT_EQ(Triple::dxil
, T
.getArch());
485 EXPECT_EQ(Triple::DXILSubArch_v1_1
, T
.getSubArch());
486 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
487 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
488 EXPECT_EQ(VersionTuple(1, 1), T
.getDXILVersion());
489 EXPECT_EQ(Triple::Vertex
, T
.getEnvironment());
491 T
= Triple("dxilv1.2--shadermodel6.2-geometry");
492 EXPECT_EQ(Triple::dxil
, T
.getArch());
493 EXPECT_EQ(Triple::DXILSubArch_v1_2
, T
.getSubArch());
494 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
495 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
496 EXPECT_EQ(VersionTuple(1, 2), T
.getDXILVersion());
497 EXPECT_EQ(Triple::Geometry
, T
.getEnvironment());
499 T
= Triple("dxilv1.3--shadermodel6.3-library");
500 EXPECT_EQ(Triple::dxil
, T
.getArch());
501 EXPECT_EQ(Triple::DXILSubArch_v1_3
, T
.getSubArch());
502 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
503 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
504 EXPECT_EQ(VersionTuple(1, 3), T
.getDXILVersion());
505 EXPECT_EQ(Triple::Library
, T
.getEnvironment());
507 T
= Triple("dxilv1.4--shadermodel6.4-hull");
508 EXPECT_EQ(Triple::dxil
, T
.getArch());
509 EXPECT_EQ(Triple::DXILSubArch_v1_4
, T
.getSubArch());
510 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
511 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
512 EXPECT_EQ(VersionTuple(1, 4), T
.getDXILVersion());
513 EXPECT_EQ(Triple::Hull
, T
.getEnvironment());
515 T
= Triple("dxilv1.5--shadermodel6.5-domain");
516 EXPECT_EQ(Triple::dxil
, T
.getArch());
517 EXPECT_EQ(Triple::DXILSubArch_v1_5
, T
.getSubArch());
518 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
519 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
520 EXPECT_EQ(VersionTuple(1, 5), T
.getDXILVersion());
521 EXPECT_EQ(Triple::Domain
, T
.getEnvironment());
523 T
= Triple("dxilv1.6--shadermodel6.6-compute");
524 EXPECT_EQ(Triple::dxil
, T
.getArch());
525 EXPECT_EQ(Triple::DXILSubArch_v1_6
, T
.getSubArch());
526 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
527 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
528 EXPECT_EQ(VersionTuple(1, 6), T
.getDXILVersion());
529 EXPECT_EQ(Triple::Compute
, T
.getEnvironment());
531 T
= Triple("dxilv1.7-unknown-shadermodel6.7-mesh");
532 EXPECT_EQ(Triple::dxil
, T
.getArch());
533 EXPECT_EQ(Triple::DXILSubArch_v1_7
, T
.getSubArch());
534 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
535 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
536 EXPECT_EQ(VersionTuple(1, 7), T
.getDXILVersion());
537 EXPECT_EQ(Triple::Mesh
, T
.getEnvironment());
539 T
= Triple("dxilv1.8-unknown-shadermodel6.8-amplification");
540 EXPECT_EQ(Triple::dxil
, T
.getArch());
541 EXPECT_EQ(Triple::DXILSubArch_v1_8
, T
.getSubArch());
542 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
543 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
544 EXPECT_EQ(VersionTuple(1, 8), T
.getDXILVersion());
545 EXPECT_EQ(Triple::Amplification
, T
.getEnvironment());
547 T
= Triple("dxilv1.8-unknown-shadermodel6.15-library");
548 EXPECT_EQ(Triple::dxil
, T
.getArch());
549 EXPECT_EQ(Triple::DXILSubArch_v1_8
, T
.getSubArch());
550 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
551 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
552 EXPECT_EQ(VersionTuple(1, 8), T
.getDXILVersion());
554 T
= Triple("x86_64-unknown-fuchsia");
555 EXPECT_EQ(Triple::x86_64
, T
.getArch());
556 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
557 EXPECT_EQ(Triple::Fuchsia
, T
.getOS());
558 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
560 T
= Triple("x86_64-unknown-hermit");
561 EXPECT_EQ(Triple::x86_64
, T
.getArch());
562 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
563 EXPECT_EQ(Triple::HermitCore
, T
.getOS());
564 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
566 T
= Triple("x86_64-unknown-uefi");
567 EXPECT_EQ(Triple::x86_64
, T
.getArch());
568 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
569 EXPECT_EQ(Triple::UEFI
, T
.getOS());
570 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
571 EXPECT_EQ(Triple::COFF
, T
.getObjectFormat());
573 T
= Triple("wasm32-unknown-unknown");
574 EXPECT_EQ(Triple::wasm32
, T
.getArch());
575 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
576 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
577 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
579 T
= Triple("wasm32-unknown-wasi");
580 EXPECT_EQ(Triple::wasm32
, T
.getArch());
581 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
582 EXPECT_EQ(Triple::WASI
, T
.getOS());
583 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
585 T
= Triple("wasm64-unknown-unknown");
586 EXPECT_EQ(Triple::wasm64
, T
.getArch());
587 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
588 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
589 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
591 T
= Triple("wasm64-unknown-wasi");
592 EXPECT_EQ(Triple::wasm64
, T
.getArch());
593 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
594 EXPECT_EQ(Triple::WASI
, T
.getOS());
595 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
597 T
= Triple("avr-unknown-unknown");
598 EXPECT_EQ(Triple::avr
, T
.getArch());
599 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
600 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
601 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
604 EXPECT_EQ(Triple::avr
, T
.getArch());
605 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
606 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
607 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
609 T
= Triple("lanai-unknown-unknown");
610 EXPECT_EQ(Triple::lanai
, T
.getArch());
611 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
612 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
613 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
616 EXPECT_EQ(Triple::lanai
, T
.getArch());
617 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
618 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
619 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
621 T
= Triple("amdgcn-mesa-mesa3d");
622 EXPECT_EQ(Triple::amdgcn
, T
.getArch());
623 EXPECT_EQ(Triple::Mesa
, T
.getVendor());
624 EXPECT_EQ(Triple::Mesa3D
, T
.getOS());
625 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
627 T
= Triple("amdgcn-amd-amdhsa");
628 EXPECT_EQ(Triple::amdgcn
, T
.getArch());
629 EXPECT_EQ(Triple::AMD
, T
.getVendor());
630 EXPECT_EQ(Triple::AMDHSA
, T
.getOS());
631 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
633 T
= Triple("amdgcn-amd-amdpal");
634 EXPECT_EQ(Triple::amdgcn
, T
.getArch());
635 EXPECT_EQ(Triple::AMD
, T
.getVendor());
636 EXPECT_EQ(Triple::AMDPAL
, T
.getOS());
637 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
639 T
= Triple("ve-unknown-linux");
640 EXPECT_EQ(Triple::ve
, T
.getArch());
641 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
642 EXPECT_EQ(Triple::Linux
, T
.getOS());
643 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
645 T
= Triple("csky-unknown-unknown");
646 EXPECT_EQ(Triple::csky
, T
.getArch());
647 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
648 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
649 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
651 T
= Triple("csky-unknown-linux");
652 EXPECT_EQ(Triple::csky
, T
.getArch());
653 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
654 EXPECT_EQ(Triple::Linux
, T
.getOS());
655 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
657 T
= Triple("loongarch32-unknown-unknown");
658 EXPECT_EQ(Triple::loongarch32
, T
.getArch());
659 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
660 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
661 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
663 T
= Triple("loongarch32-unknown-linux-gnu");
664 EXPECT_EQ(Triple::loongarch32
, T
.getArch());
665 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
666 EXPECT_EQ(Triple::Linux
, T
.getOS());
667 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
669 T
= Triple("loongarch32-unknown-linux-gnuf32");
670 EXPECT_EQ(Triple::loongarch32
, T
.getArch());
671 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
672 EXPECT_EQ(Triple::Linux
, T
.getOS());
673 EXPECT_EQ(Triple::GNUF32
, T
.getEnvironment());
675 T
= Triple("loongarch32-unknown-linux-gnuf64");
676 EXPECT_EQ(Triple::loongarch32
, T
.getArch());
677 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
678 EXPECT_EQ(Triple::Linux
, T
.getOS());
679 EXPECT_EQ(Triple::GNUF64
, T
.getEnvironment());
681 T
= Triple("loongarch32-unknown-linux-gnusf");
682 EXPECT_EQ(Triple::loongarch32
, T
.getArch());
683 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
684 EXPECT_EQ(Triple::Linux
, T
.getOS());
685 EXPECT_EQ(Triple::GNUSF
, T
.getEnvironment());
687 T
= Triple("loongarch32-unknown-linux-musl");
688 EXPECT_EQ(Triple::loongarch32
, T
.getArch());
689 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
690 EXPECT_EQ(Triple::Linux
, T
.getOS());
691 EXPECT_EQ(Triple::Musl
, T
.getEnvironment());
693 T
= Triple("loongarch32-unknown-linux-muslf32");
694 EXPECT_EQ(Triple::loongarch32
, T
.getArch());
695 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
696 EXPECT_EQ(Triple::Linux
, T
.getOS());
697 EXPECT_EQ(Triple::MuslF32
, T
.getEnvironment());
699 T
= Triple("loongarch32-unknown-linux-muslsf");
700 EXPECT_EQ(Triple::loongarch32
, T
.getArch());
701 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
702 EXPECT_EQ(Triple::Linux
, T
.getOS());
703 EXPECT_EQ(Triple::MuslSF
, T
.getEnvironment());
705 T
= Triple("loongarch64-unknown-linux");
706 EXPECT_EQ(Triple::loongarch64
, T
.getArch());
707 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
708 EXPECT_EQ(Triple::Linux
, T
.getOS());
709 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
711 T
= Triple("loongarch64-unknown-linux-gnu");
712 EXPECT_EQ(Triple::loongarch64
, T
.getArch());
713 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
714 EXPECT_EQ(Triple::Linux
, T
.getOS());
715 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
717 T
= Triple("loongarch64-unknown-linux-gnuf32");
718 EXPECT_EQ(Triple::loongarch64
, T
.getArch());
719 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
720 EXPECT_EQ(Triple::Linux
, T
.getOS());
721 EXPECT_EQ(Triple::GNUF32
, T
.getEnvironment());
723 T
= Triple("loongarch64-unknown-linux-gnuf64");
724 EXPECT_EQ(Triple::loongarch64
, T
.getArch());
725 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
726 EXPECT_EQ(Triple::Linux
, T
.getOS());
727 EXPECT_EQ(Triple::GNUF64
, T
.getEnvironment());
729 T
= Triple("loongarch64-unknown-linux-gnusf");
730 EXPECT_EQ(Triple::loongarch64
, T
.getArch());
731 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
732 EXPECT_EQ(Triple::Linux
, T
.getOS());
733 EXPECT_EQ(Triple::GNUSF
, T
.getEnvironment());
735 T
= Triple("loongarch64-unknown-linux-musl");
736 EXPECT_EQ(Triple::loongarch64
, T
.getArch());
737 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
738 EXPECT_EQ(Triple::Linux
, T
.getOS());
739 EXPECT_EQ(Triple::Musl
, T
.getEnvironment());
741 T
= Triple("loongarch64-unknown-linux-muslf32");
742 EXPECT_EQ(Triple::loongarch64
, T
.getArch());
743 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
744 EXPECT_EQ(Triple::Linux
, T
.getOS());
745 EXPECT_EQ(Triple::MuslF32
, T
.getEnvironment());
747 T
= Triple("loongarch64-unknown-linux-muslsf");
748 EXPECT_EQ(Triple::loongarch64
, T
.getArch());
749 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
750 EXPECT_EQ(Triple::Linux
, T
.getOS());
751 EXPECT_EQ(Triple::MuslSF
, T
.getEnvironment());
753 T
= Triple("riscv32-unknown-unknown");
754 EXPECT_EQ(Triple::riscv32
, T
.getArch());
755 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
756 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
757 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
759 T
= Triple("riscv64-unknown-linux");
760 EXPECT_EQ(Triple::riscv64
, T
.getArch());
761 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
762 EXPECT_EQ(Triple::Linux
, T
.getOS());
763 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
765 T
= Triple("riscv64-unknown-freebsd");
766 EXPECT_EQ(Triple::riscv64
, T
.getArch());
767 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
768 EXPECT_EQ(Triple::FreeBSD
, T
.getOS());
769 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
771 T
= Triple("riscv64-suse-linux");
772 EXPECT_EQ(Triple::riscv64
, T
.getArch());
773 EXPECT_EQ(Triple::SUSE
, T
.getVendor());
774 EXPECT_EQ(Triple::Linux
, T
.getOS());
775 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
777 T
= Triple("armv7hl-suse-linux-gnueabi");
778 EXPECT_EQ(Triple::arm
, T
.getArch());
779 EXPECT_EQ(Triple::SUSE
, T
.getVendor());
780 EXPECT_EQ(Triple::Linux
, T
.getOS());
781 EXPECT_EQ(Triple::GNUEABI
, T
.getEnvironment());
783 T
= Triple("i586-pc-haiku");
784 EXPECT_EQ(Triple::x86
, T
.getArch());
785 EXPECT_EQ(Triple::PC
, T
.getVendor());
786 EXPECT_EQ(Triple::Haiku
, T
.getOS());
787 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
789 T
= Triple("x86_64-unknown-haiku");
790 EXPECT_EQ(Triple::x86_64
, T
.getArch());
791 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
792 EXPECT_EQ(Triple::Haiku
, T
.getOS());
793 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
795 T
= Triple("mips-mti-linux-gnu");
796 EXPECT_EQ(Triple::mips
, T
.getArch());
797 EXPECT_EQ(Triple::MipsTechnologies
, T
.getVendor());
798 EXPECT_EQ(Triple::Linux
, T
.getOS());
799 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
801 T
= Triple("mipsel-img-linux-gnu");
802 EXPECT_EQ(Triple::mipsel
, T
.getArch());
803 EXPECT_EQ(Triple::ImaginationTechnologies
, T
.getVendor());
804 EXPECT_EQ(Triple::Linux
, T
.getOS());
805 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
807 T
= Triple("mips64-mti-linux-gnu");
808 EXPECT_EQ(Triple::mips64
, T
.getArch());
809 EXPECT_EQ(Triple::MipsTechnologies
, T
.getVendor());
810 EXPECT_EQ(Triple::Linux
, T
.getOS());
811 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
813 T
= Triple("mips64el-img-linux-gnu");
814 EXPECT_EQ(Triple::mips64el
, T
.getArch());
815 EXPECT_EQ(Triple::ImaginationTechnologies
, T
.getVendor());
816 EXPECT_EQ(Triple::Linux
, T
.getOS());
817 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
819 T
= Triple("mips64el-img-linux-gnuabin32");
820 EXPECT_EQ(Triple::mips64el
, T
.getArch());
821 EXPECT_EQ(Triple::ImaginationTechnologies
, T
.getVendor());
822 EXPECT_EQ(Triple::Linux
, T
.getOS());
823 EXPECT_EQ(Triple::GNUABIN32
, T
.getEnvironment());
825 T
= Triple("mips64el-unknown-linux-gnuabi64");
826 EXPECT_EQ(Triple::mips64el
, T
.getArch());
827 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
828 EXPECT_EQ(Triple::Linux
, T
.getOS());
829 EXPECT_EQ(Triple::GNUABI64
, T
.getEnvironment());
830 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
831 T
= Triple("mips64el");
832 EXPECT_EQ(Triple::mips64el
, T
.getArch());
833 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
834 EXPECT_EQ(Triple::GNUABI64
, T
.getEnvironment());
835 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
837 T
= Triple("mips64-unknown-linux-gnuabi64");
838 EXPECT_EQ(Triple::mips64
, T
.getArch());
839 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
840 EXPECT_EQ(Triple::Linux
, T
.getOS());
841 EXPECT_EQ(Triple::GNUABI64
, T
.getEnvironment());
842 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
843 T
= Triple("mips64");
844 EXPECT_EQ(Triple::mips64
, T
.getArch());
845 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
846 EXPECT_EQ(Triple::GNUABI64
, T
.getEnvironment());
847 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
849 T
= Triple("mipsisa64r6el-unknown-linux-gnuabi64");
850 EXPECT_EQ(Triple::mips64el
, T
.getArch());
851 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
852 EXPECT_EQ(Triple::Linux
, T
.getOS());
853 EXPECT_EQ(Triple::GNUABI64
, T
.getEnvironment());
854 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
855 T
= Triple("mips64r6el");
856 EXPECT_EQ(Triple::mips64el
, T
.getArch());
857 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
858 EXPECT_EQ(Triple::GNUABI64
, T
.getEnvironment());
859 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
860 T
= Triple("mipsisa64r6el");
861 EXPECT_EQ(Triple::mips64el
, T
.getArch());
862 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
863 EXPECT_EQ(Triple::GNUABI64
, T
.getEnvironment());
864 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
866 T
= Triple("mipsisa64r6-unknown-linux-gnuabi64");
867 EXPECT_EQ(Triple::mips64
, T
.getArch());
868 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
869 EXPECT_EQ(Triple::Linux
, T
.getOS());
870 EXPECT_EQ(Triple::GNUABI64
, T
.getEnvironment());
871 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
872 T
= Triple("mips64r6");
873 EXPECT_EQ(Triple::mips64
, T
.getArch());
874 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
875 EXPECT_EQ(Triple::GNUABI64
, T
.getEnvironment());
876 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
877 T
= Triple("mipsisa64r6");
878 EXPECT_EQ(Triple::mips64
, T
.getArch());
879 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
880 EXPECT_EQ(Triple::GNUABI64
, T
.getEnvironment());
881 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
883 T
= Triple("mips64el-unknown-linux-gnuabin32");
884 EXPECT_EQ(Triple::mips64el
, T
.getArch());
885 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
886 EXPECT_EQ(Triple::Linux
, T
.getOS());
887 EXPECT_EQ(Triple::GNUABIN32
, T
.getEnvironment());
888 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
889 T
= Triple("mipsn32el");
890 EXPECT_EQ(Triple::mips64el
, T
.getArch());
891 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
892 EXPECT_EQ(Triple::GNUABIN32
, T
.getEnvironment());
893 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
895 T
= Triple("mips64-unknown-linux-gnuabin32");
896 EXPECT_EQ(Triple::mips64
, T
.getArch());
897 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
898 EXPECT_EQ(Triple::Linux
, T
.getOS());
899 EXPECT_EQ(Triple::GNUABIN32
, T
.getEnvironment());
900 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
901 T
= Triple("mipsn32");
902 EXPECT_EQ(Triple::mips64
, T
.getArch());
903 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
904 EXPECT_EQ(Triple::GNUABIN32
, T
.getEnvironment());
905 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
907 T
= Triple("mipsisa64r6el-unknown-linux-gnuabin32");
908 EXPECT_EQ(Triple::mips64el
, T
.getArch());
909 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
910 EXPECT_EQ(Triple::Linux
, T
.getOS());
911 EXPECT_EQ(Triple::GNUABIN32
, T
.getEnvironment());
912 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
913 T
= Triple("mipsn32r6el");
914 EXPECT_EQ(Triple::mips64el
, T
.getArch());
915 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
916 EXPECT_EQ(Triple::GNUABIN32
, T
.getEnvironment());
917 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
919 T
= Triple("mipsisa64r6-unknown-linux-gnuabin32");
920 EXPECT_EQ(Triple::mips64
, T
.getArch());
921 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
922 EXPECT_EQ(Triple::Linux
, T
.getOS());
923 EXPECT_EQ(Triple::GNUABIN32
, T
.getEnvironment());
924 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
925 T
= Triple("mipsn32r6");
926 EXPECT_EQ(Triple::mips64
, T
.getArch());
927 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
928 EXPECT_EQ(Triple::GNUABIN32
, T
.getEnvironment());
929 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
931 T
= Triple("mipsel-unknown-linux-gnu");
932 EXPECT_EQ(Triple::mipsel
, T
.getArch());
933 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
934 EXPECT_EQ(Triple::Linux
, T
.getOS());
935 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
936 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
937 T
= Triple("mipsel");
938 EXPECT_EQ(Triple::mipsel
, T
.getArch());
939 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
940 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
941 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
943 T
= Triple("mips-unknown-linux-gnu");
944 EXPECT_EQ(Triple::mips
, T
.getArch());
945 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
946 EXPECT_EQ(Triple::Linux
, T
.getOS());
947 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
948 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
950 EXPECT_EQ(Triple::mips
, T
.getArch());
951 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
952 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
953 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
955 T
= Triple("mipsisa32r6el-unknown-linux-gnu");
956 EXPECT_EQ(Triple::mipsel
, T
.getArch());
957 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
958 EXPECT_EQ(Triple::Linux
, T
.getOS());
959 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
960 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
961 T
= Triple("mipsr6el");
962 EXPECT_EQ(Triple::mipsel
, T
.getArch());
963 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
964 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
965 T
= Triple("mipsisa32r6el");
966 EXPECT_EQ(Triple::mipsel
, T
.getArch());
967 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
968 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
969 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
971 T
= Triple("mipsisa32r6-unknown-linux-gnu");
972 EXPECT_EQ(Triple::mips
, T
.getArch());
973 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
974 EXPECT_EQ(Triple::Linux
, T
.getOS());
975 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
976 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
977 T
= Triple("mipsr6");
978 EXPECT_EQ(Triple::mips
, T
.getArch());
979 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
980 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
981 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
982 T
= Triple("mipsisa32r6");
983 EXPECT_EQ(Triple::mips
, T
.getArch());
984 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
985 EXPECT_EQ(Triple::GNU
, T
.getEnvironment());
986 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
988 T
= Triple("mips64el-unknown-linux-muslabi64");
989 EXPECT_EQ(Triple::mips64el
, T
.getArch());
990 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
991 EXPECT_EQ(Triple::Linux
, T
.getOS());
992 EXPECT_EQ(Triple::MuslABI64
, T
.getEnvironment());
993 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
995 T
= Triple("mips64-unknown-linux-muslabi64");
996 EXPECT_EQ(Triple::mips64
, T
.getArch());
997 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
998 EXPECT_EQ(Triple::Linux
, T
.getOS());
999 EXPECT_EQ(Triple::MuslABI64
, T
.getEnvironment());
1000 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1002 T
= Triple("mipsisa64r6el-unknown-linux-muslabi64");
1003 EXPECT_EQ(Triple::mips64el
, T
.getArch());
1004 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1005 EXPECT_EQ(Triple::Linux
, T
.getOS());
1006 EXPECT_EQ(Triple::MuslABI64
, T
.getEnvironment());
1007 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
1009 T
= Triple("mipsisa64r6-unknown-linux-muslabi64");
1010 EXPECT_EQ(Triple::mips64
, T
.getArch());
1011 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1012 EXPECT_EQ(Triple::Linux
, T
.getOS());
1013 EXPECT_EQ(Triple::MuslABI64
, T
.getEnvironment());
1014 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
1016 T
= Triple("mips64el-unknown-linux-muslabin32");
1017 EXPECT_EQ(Triple::mips64el
, T
.getArch());
1018 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1019 EXPECT_EQ(Triple::Linux
, T
.getOS());
1020 EXPECT_EQ(Triple::MuslABIN32
, T
.getEnvironment());
1021 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1023 T
= Triple("mips64-unknown-linux-muslabin32");
1024 EXPECT_EQ(Triple::mips64
, T
.getArch());
1025 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1026 EXPECT_EQ(Triple::Linux
, T
.getOS());
1027 EXPECT_EQ(Triple::MuslABIN32
, T
.getEnvironment());
1028 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1030 T
= Triple("mipsisa64r6el-unknown-linux-muslabin32");
1031 EXPECT_EQ(Triple::mips64el
, T
.getArch());
1032 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1033 EXPECT_EQ(Triple::Linux
, T
.getOS());
1034 EXPECT_EQ(Triple::MuslABIN32
, T
.getEnvironment());
1035 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
1037 T
= Triple("mipsisa64r6-unknown-linux-muslabin32");
1038 EXPECT_EQ(Triple::mips64
, T
.getArch());
1039 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1040 EXPECT_EQ(Triple::Linux
, T
.getOS());
1041 EXPECT_EQ(Triple::MuslABIN32
, T
.getEnvironment());
1042 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
1044 T
= Triple("mipsel-unknown-linux-musl");
1045 EXPECT_EQ(Triple::mipsel
, T
.getArch());
1046 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1047 EXPECT_EQ(Triple::Linux
, T
.getOS());
1048 EXPECT_EQ(Triple::Musl
, T
.getEnvironment());
1049 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1051 T
= Triple("mips-unknown-linux-musl");
1052 EXPECT_EQ(Triple::mips
, T
.getArch());
1053 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1054 EXPECT_EQ(Triple::Linux
, T
.getOS());
1055 EXPECT_EQ(Triple::Musl
, T
.getEnvironment());
1056 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1058 T
= Triple("mipsisa32r6el-unknown-linux-musl");
1059 EXPECT_EQ(Triple::mipsel
, T
.getArch());
1060 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1061 EXPECT_EQ(Triple::Linux
, T
.getOS());
1062 EXPECT_EQ(Triple::Musl
, T
.getEnvironment());
1063 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
1065 T
= Triple("mipsisa32r6-unknown-linux-musl");
1066 EXPECT_EQ(Triple::mips
, T
.getArch());
1067 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1068 EXPECT_EQ(Triple::Linux
, T
.getOS());
1069 EXPECT_EQ(Triple::Musl
, T
.getEnvironment());
1070 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getSubArch());
1072 T
= Triple("arm-oe-linux-gnueabi");
1073 EXPECT_EQ(Triple::arm
, T
.getArch());
1074 EXPECT_EQ(Triple::OpenEmbedded
, T
.getVendor());
1075 EXPECT_EQ(Triple::Linux
, T
.getOS());
1076 EXPECT_EQ(Triple::GNUEABI
, T
.getEnvironment());
1078 T
= Triple("aarch64-oe-linux");
1079 EXPECT_EQ(Triple::aarch64
, T
.getArch());
1080 EXPECT_EQ(Triple::OpenEmbedded
, T
.getVendor());
1081 EXPECT_EQ(Triple::Linux
, T
.getOS());
1082 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
1083 EXPECT_TRUE(T
.isArch64Bit());
1085 T
= Triple("arm64_32-apple-ios");
1086 EXPECT_EQ(Triple::aarch64_32
, T
.getArch());
1087 EXPECT_EQ(Triple::IOS
, T
.getOS());
1088 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
1089 EXPECT_TRUE(T
.isArch32Bit());
1091 T
= Triple("dxil-unknown-shadermodel-pixel");
1092 EXPECT_EQ(Triple::dxil
, T
.getArch());
1093 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1094 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1095 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1096 EXPECT_EQ(Triple::Pixel
, T
.getEnvironment());
1097 EXPECT_FALSE(T
.supportsCOMDAT());
1099 T
= Triple("dxil-unknown-shadermodel-vertex");
1100 EXPECT_EQ(Triple::dxil
, T
.getArch());
1101 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1102 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1103 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1104 EXPECT_EQ(Triple::Vertex
, T
.getEnvironment());
1105 EXPECT_FALSE(T
.supportsCOMDAT());
1107 T
= Triple("dxil-unknown-shadermodel-geometry");
1108 EXPECT_EQ(Triple::dxil
, T
.getArch());
1109 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1110 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1111 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1112 EXPECT_EQ(Triple::Geometry
, T
.getEnvironment());
1113 EXPECT_FALSE(T
.supportsCOMDAT());
1115 T
= Triple("dxil-unknown-shadermodel-hull");
1116 EXPECT_EQ(Triple::dxil
, T
.getArch());
1117 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1118 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1119 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1120 EXPECT_EQ(Triple::Hull
, T
.getEnvironment());
1121 EXPECT_FALSE(T
.supportsCOMDAT());
1123 T
= Triple("dxil-unknown-shadermodel-domain");
1124 EXPECT_EQ(Triple::dxil
, T
.getArch());
1125 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1126 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1127 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1128 EXPECT_EQ(Triple::Domain
, T
.getEnvironment());
1129 EXPECT_FALSE(T
.supportsCOMDAT());
1131 T
= Triple("dxil-unknown-shadermodel-compute");
1132 EXPECT_EQ(Triple::dxil
, T
.getArch());
1133 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1134 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1135 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1136 EXPECT_EQ(Triple::Compute
, T
.getEnvironment());
1137 EXPECT_FALSE(T
.supportsCOMDAT());
1139 T
= Triple("dxil-unknown-shadermodel-library");
1140 EXPECT_EQ(Triple::dxil
, T
.getArch());
1141 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1142 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1143 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1144 EXPECT_EQ(Triple::Library
, T
.getEnvironment());
1145 EXPECT_FALSE(T
.supportsCOMDAT());
1147 T
= Triple("dxil-unknown-shadermodel-raygeneration");
1148 EXPECT_EQ(Triple::dxil
, T
.getArch());
1149 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1150 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1151 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1152 EXPECT_EQ(Triple::RayGeneration
, T
.getEnvironment());
1153 EXPECT_FALSE(T
.supportsCOMDAT());
1155 T
= Triple("dxil-unknown-shadermodel-intersection");
1156 EXPECT_EQ(Triple::dxil
, T
.getArch());
1157 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1158 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1159 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1160 EXPECT_EQ(Triple::Intersection
, T
.getEnvironment());
1161 EXPECT_FALSE(T
.supportsCOMDAT());
1163 T
= Triple("dxil-unknown-shadermodel-anyhit");
1164 EXPECT_EQ(Triple::dxil
, T
.getArch());
1165 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1166 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1167 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1168 EXPECT_EQ(Triple::AnyHit
, T
.getEnvironment());
1169 EXPECT_FALSE(T
.supportsCOMDAT());
1171 T
= Triple("dxil-unknown-shadermodel-closesthit");
1172 EXPECT_EQ(Triple::dxil
, T
.getArch());
1173 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1174 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1175 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1176 EXPECT_EQ(Triple::ClosestHit
, T
.getEnvironment());
1177 EXPECT_FALSE(T
.supportsCOMDAT());
1179 T
= Triple("dxil-unknown-shadermodel-miss");
1180 EXPECT_EQ(Triple::dxil
, T
.getArch());
1181 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1182 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1183 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1184 EXPECT_EQ(Triple::Miss
, T
.getEnvironment());
1185 EXPECT_FALSE(T
.supportsCOMDAT());
1187 T
= Triple("dxil-unknown-shadermodel-callable");
1188 EXPECT_EQ(Triple::dxil
, T
.getArch());
1189 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1190 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1191 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1192 EXPECT_EQ(Triple::Callable
, T
.getEnvironment());
1193 EXPECT_FALSE(T
.supportsCOMDAT());
1195 T
= Triple("dxil-unknown-shadermodel-mesh");
1196 EXPECT_EQ(Triple::dxil
, T
.getArch());
1197 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1198 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1199 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1200 EXPECT_EQ(Triple::Mesh
, T
.getEnvironment());
1201 EXPECT_FALSE(T
.supportsCOMDAT());
1203 T
= Triple("dxil-unknown-shadermodel-amplification");
1204 EXPECT_EQ(Triple::dxil
, T
.getArch());
1205 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1206 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1207 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
1208 EXPECT_EQ(Triple::Amplification
, T
.getEnvironment());
1209 EXPECT_FALSE(T
.supportsCOMDAT());
1211 T
= Triple("dxilv1.0-unknown-unknown");
1212 EXPECT_EQ(Triple::dxil
, T
.getArch());
1213 EXPECT_EQ(Triple::DXILSubArch_v1_0
, T
.getSubArch());
1214 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1215 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1217 T
= Triple("dxilv1.1-unknown-unknown");
1218 EXPECT_EQ(Triple::dxil
, T
.getArch());
1219 EXPECT_EQ(Triple::DXILSubArch_v1_1
, T
.getSubArch());
1220 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1221 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1223 T
= Triple("dxilv1.2-unknown-unknown");
1224 EXPECT_EQ(Triple::dxil
, T
.getArch());
1225 EXPECT_EQ(Triple::DXILSubArch_v1_2
, T
.getSubArch());
1226 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1227 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1229 T
= Triple("dxilv1.3-unknown-unknown");
1230 EXPECT_EQ(Triple::dxil
, T
.getArch());
1231 EXPECT_EQ(Triple::DXILSubArch_v1_3
, T
.getSubArch());
1232 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1233 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1235 T
= Triple("dxilv1.4-unknown-unknown");
1236 EXPECT_EQ(Triple::dxil
, T
.getArch());
1237 EXPECT_EQ(Triple::DXILSubArch_v1_4
, T
.getSubArch());
1238 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1239 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1241 T
= Triple("dxilv1.5-unknown-unknown");
1242 EXPECT_EQ(Triple::dxil
, T
.getArch());
1243 EXPECT_EQ(Triple::DXILSubArch_v1_5
, T
.getSubArch());
1244 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1245 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1247 T
= Triple("dxilv1.6-unknown-unknown");
1248 EXPECT_EQ(Triple::dxil
, T
.getArch());
1249 EXPECT_EQ(Triple::DXILSubArch_v1_6
, T
.getSubArch());
1250 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1251 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1253 T
= Triple("dxilv1.7-unknown-unknown");
1254 EXPECT_EQ(Triple::dxil
, T
.getArch());
1255 EXPECT_EQ(Triple::DXILSubArch_v1_7
, T
.getSubArch());
1256 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1257 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1259 T
= Triple("dxilv1.8-unknown-unknown");
1260 EXPECT_EQ(Triple::dxil
, T
.getArch());
1261 EXPECT_EQ(Triple::DXILSubArch_v1_8
, T
.getSubArch());
1262 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1263 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1265 // Check specification of unknown SubArch results in
1266 // unknown architecture.
1267 T
= Triple("dxilv1.999-unknown-unknown");
1268 EXPECT_EQ(Triple::UnknownArch
, T
.getArch());
1269 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1270 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1271 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1273 T
= Triple("dxil-unknown-unknown");
1274 EXPECT_EQ(Triple::dxil
, T
.getArch());
1275 EXPECT_EQ(Triple::NoSubArch
, T
.getSubArch());
1276 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1277 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1279 T
= Triple("xtensa");
1280 EXPECT_EQ(Triple::xtensa
, T
.getArch());
1281 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1282 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1283 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
1285 T
= Triple("xtensa-unknown-unknown");
1286 EXPECT_EQ(Triple::xtensa
, T
.getArch());
1287 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1288 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1289 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
1291 T
= Triple("arm-unknown-linux-ohos");
1292 EXPECT_EQ(Triple::arm
, T
.getArch());
1293 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1294 EXPECT_EQ(Triple::Linux
, T
.getOS());
1295 EXPECT_EQ(Triple::OpenHOS
, T
.getEnvironment());
1297 T
= Triple("arm-unknown-liteos");
1298 EXPECT_EQ(Triple::arm
, T
.getArch());
1299 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1300 EXPECT_EQ(Triple::LiteOS
, T
.getOS());
1301 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
1303 T
= Triple("x86_64-pc-serenity");
1304 EXPECT_EQ(Triple::x86_64
, T
.getArch());
1305 EXPECT_EQ(Triple::PC
, T
.getVendor());
1306 EXPECT_EQ(Triple::Serenity
, T
.getOS());
1307 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
1309 T
= Triple("aarch64-pc-serenity");
1310 EXPECT_EQ(Triple::aarch64
, T
.getArch());
1311 EXPECT_EQ(Triple::PC
, T
.getVendor());
1312 EXPECT_EQ(Triple::Serenity
, T
.getOS());
1313 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
1315 T
= Triple("aarch64-unknown-linux-pauthtest");
1316 EXPECT_EQ(Triple::aarch64
, T
.getArch());
1317 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1318 EXPECT_EQ(Triple::Linux
, T
.getOS());
1319 EXPECT_EQ(Triple::PAuthTest
, T
.getEnvironment());
1321 // Gentoo time64 triples
1322 T
= Triple("i686-pc-linux-gnut64");
1323 EXPECT_EQ(Triple::x86
, T
.getArch());
1324 EXPECT_EQ(Triple::PC
, T
.getVendor());
1325 EXPECT_EQ(Triple::Linux
, T
.getOS());
1326 EXPECT_EQ(Triple::GNUT64
, T
.getEnvironment());
1327 EXPECT_TRUE(T
.isTime64ABI());
1329 T
= Triple("armv5tel-softfloat-linux-gnueabit64");
1330 EXPECT_EQ(Triple::arm
, T
.getArch());
1331 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1332 EXPECT_EQ(Triple::Linux
, T
.getOS());
1333 EXPECT_EQ(Triple::GNUEABIT64
, T
.getEnvironment());
1334 EXPECT_TRUE(T
.isTime64ABI());
1336 T
= Triple("armv7a-unknown-linux-gnueabihft64");
1337 EXPECT_EQ(Triple::arm
, T
.getArch());
1338 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1339 EXPECT_EQ(Triple::Linux
, T
.getOS());
1340 EXPECT_EQ(Triple::GNUEABIHFT64
, T
.getEnvironment());
1341 EXPECT_TRUE(T
.isTime64ABI());
1342 EXPECT_TRUE(T
.isHardFloatABI());
1344 T
= Triple("x86_64-pc-linux-llvm");
1345 EXPECT_EQ(Triple::x86_64
, T
.getArch());
1346 EXPECT_EQ(Triple::PC
, T
.getVendor());
1347 EXPECT_EQ(Triple::Linux
, T
.getOS());
1348 EXPECT_EQ(Triple::LLVM
, T
.getEnvironment());
1350 T
= Triple("spirv64-intel-unknown");
1351 EXPECT_EQ(Triple::spirv64
, T
.getArch());
1352 EXPECT_EQ(Triple::Intel
, T
.getVendor());
1353 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1354 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
1357 EXPECT_EQ(Triple::UnknownArch
, T
.getArch());
1360 static std::string
Join(StringRef A
, StringRef B
, StringRef C
) {
1361 std::string Str
= std::string(A
);
1369 static std::string
Join(StringRef A
, StringRef B
, StringRef C
, StringRef D
) {
1370 std::string Str
= std::string(A
);
1380 TEST(TripleTest
, Normalization
) {
1382 EXPECT_EQ("unknown", Triple::normalize(""));
1383 EXPECT_EQ("unknown-unknown", Triple::normalize("-"));
1384 EXPECT_EQ("unknown-unknown-unknown", Triple::normalize("--"));
1385 EXPECT_EQ("unknown-unknown-unknown-unknown", Triple::normalize("---"));
1386 EXPECT_EQ("unknown-unknown-unknown-unknown-unknown",
1387 Triple::normalize("----"));
1389 EXPECT_EQ("a", Triple::normalize("a"));
1390 EXPECT_EQ("a-b", Triple::normalize("a-b"));
1391 EXPECT_EQ("a-b-c", Triple::normalize("a-b-c"));
1392 EXPECT_EQ("a-b-c-d", Triple::normalize("a-b-c-d"));
1394 EXPECT_EQ("i386-b-c", Triple::normalize("i386-b-c"));
1395 EXPECT_EQ("i386-a-c", Triple::normalize("a-i386-c"));
1396 EXPECT_EQ("i386-a-b", Triple::normalize("a-b-i386"));
1397 EXPECT_EQ("i386-a-b-c", Triple::normalize("a-b-c-i386"));
1399 EXPECT_EQ("a-pc-c", Triple::normalize("a-pc-c"));
1400 EXPECT_EQ("unknown-pc-b-c", Triple::normalize("pc-b-c"));
1401 EXPECT_EQ("a-pc-b", Triple::normalize("a-b-pc"));
1402 EXPECT_EQ("a-pc-b-c", Triple::normalize("a-b-c-pc"));
1404 EXPECT_EQ("a-b-linux", Triple::normalize("a-b-linux"));
1405 EXPECT_EQ("unknown-unknown-linux-b-c", Triple::normalize("linux-b-c"));
1406 EXPECT_EQ("a-unknown-linux-c", Triple::normalize("a-linux-c"));
1408 EXPECT_EQ("i386-pc-a", Triple::normalize("a-pc-i386"));
1409 EXPECT_EQ("i386-pc-unknown", Triple::normalize("-pc-i386"));
1410 EXPECT_EQ("unknown-pc-linux-c", Triple::normalize("linux-pc-c"));
1411 EXPECT_EQ("unknown-pc-linux", Triple::normalize("linux-pc-"));
1413 EXPECT_EQ("i386", Triple::normalize("i386"));
1414 EXPECT_EQ("unknown-pc", Triple::normalize("pc"));
1415 EXPECT_EQ("unknown-unknown-linux", Triple::normalize("linux"));
1417 EXPECT_EQ("x86_64-unknown-linux-gnu", Triple::normalize("x86_64-gnu-linux"));
1419 // Check that normalizing a permutated set of valid components returns a
1420 // triple with the unpermuted components.
1422 // We don't check every possible combination. For the set of architectures A,
1423 // vendors V, operating systems O, and environments E, that would require |A|
1424 // * |V| * |O| * |E| * 4! tests. Instead we check every option for any given
1425 // slot and make sure it gets normalized to the correct position from every
1426 // permutation. This should cover the core logic while being a tractable
1427 // number of tests at (|A| + |V| + |O| + |E|) * 4!.
1428 auto FirstArchType
= Triple::ArchType(Triple::UnknownArch
+ 1);
1429 auto FirstVendorType
= Triple::VendorType(Triple::UnknownVendor
+ 1);
1430 auto FirstOSType
= Triple::OSType(Triple::UnknownOS
+ 1);
1431 auto FirstEnvType
= Triple::EnvironmentType(Triple::UnknownEnvironment
+ 1);
1432 StringRef InitialC
[] = {Triple::getArchTypeName(FirstArchType
),
1433 Triple::getVendorTypeName(FirstVendorType
),
1434 Triple::getOSTypeName(FirstOSType
),
1435 Triple::getEnvironmentTypeName(FirstEnvType
)};
1436 for (int Arch
= FirstArchType
; Arch
<= Triple::LastArchType
; ++Arch
) {
1437 StringRef C
[] = {InitialC
[0], InitialC
[1], InitialC
[2], InitialC
[3]};
1438 C
[0] = Triple::getArchTypeName(Triple::ArchType(Arch
));
1439 std::string E
= Join(C
[0], C
[1], C
[2]);
1440 int I
[] = {0, 1, 2};
1442 EXPECT_EQ(E
, Triple::normalize(Join(C
[I
[0]], C
[I
[1]], C
[I
[2]])));
1443 } while (std::next_permutation(std::begin(I
), std::end(I
)));
1444 std::string F
= Join(C
[0], C
[1], C
[2], C
[3]);
1445 int J
[] = {0, 1, 2, 3};
1447 EXPECT_EQ(F
, Triple::normalize(Join(C
[J
[0]], C
[J
[1]], C
[J
[2]], C
[J
[3]])));
1448 } while (std::next_permutation(std::begin(J
), std::end(J
)));
1450 for (int Vendor
= FirstVendorType
; Vendor
<= Triple::LastVendorType
;
1452 StringRef C
[] = {InitialC
[0], InitialC
[1], InitialC
[2], InitialC
[3]};
1453 C
[1] = Triple::getVendorTypeName(Triple::VendorType(Vendor
));
1454 std::string E
= Join(C
[0], C
[1], C
[2]);
1455 int I
[] = {0, 1, 2};
1457 EXPECT_EQ(E
, Triple::normalize(Join(C
[I
[0]], C
[I
[1]], C
[I
[2]])));
1458 } while (std::next_permutation(std::begin(I
), std::end(I
)));
1459 std::string F
= Join(C
[0], C
[1], C
[2], C
[3]);
1460 int J
[] = {0, 1, 2, 3};
1462 EXPECT_EQ(F
, Triple::normalize(Join(C
[J
[0]], C
[J
[1]], C
[J
[2]], C
[J
[3]])));
1463 } while (std::next_permutation(std::begin(J
), std::end(J
)));
1465 for (int OS
= FirstOSType
; OS
<= Triple::LastOSType
; ++OS
) {
1466 if (OS
== Triple::Win32
)
1468 StringRef C
[] = {InitialC
[0], InitialC
[1], InitialC
[2], InitialC
[3]};
1469 C
[2] = Triple::getOSTypeName(Triple::OSType(OS
));
1470 std::string E
= Join(C
[0], C
[1], C
[2]);
1471 int I
[] = {0, 1, 2};
1473 EXPECT_EQ(E
, Triple::normalize(Join(C
[I
[0]], C
[I
[1]], C
[I
[2]])));
1474 } while (std::next_permutation(std::begin(I
), std::end(I
)));
1475 std::string F
= Join(C
[0], C
[1], C
[2], C
[3]);
1476 int J
[] = {0, 1, 2, 3};
1478 EXPECT_EQ(F
, Triple::normalize(Join(C
[J
[0]], C
[J
[1]], C
[J
[2]], C
[J
[3]])));
1479 } while (std::next_permutation(std::begin(J
), std::end(J
)));
1481 for (int Env
= FirstEnvType
; Env
<= Triple::LastEnvironmentType
; ++Env
) {
1482 StringRef C
[] = {InitialC
[0], InitialC
[1], InitialC
[2], InitialC
[3]};
1483 C
[3] = Triple::getEnvironmentTypeName(Triple::EnvironmentType(Env
));
1484 std::string F
= Join(C
[0], C
[1], C
[2], C
[3]);
1485 int J
[] = {0, 1, 2, 3};
1487 EXPECT_EQ(F
, Triple::normalize(Join(C
[J
[0]], C
[J
[1]], C
[J
[2]], C
[J
[3]])));
1488 } while (std::next_permutation(std::begin(J
), std::end(J
)));
1491 // Various real-world funky triples. The value returned by GCC's config.sub
1492 // is given in the comment.
1493 EXPECT_EQ("i386-unknown-windows-gnu",
1494 Triple::normalize("i386-mingw32")); // i386-pc-mingw32
1495 EXPECT_EQ("x86_64-unknown-linux-gnu",
1496 Triple::normalize("x86_64-linux-gnu")); // x86_64-pc-linux-gnu
1497 EXPECT_EQ("i486-unknown-linux-gnu",
1498 Triple::normalize("i486-linux-gnu")); // i486-pc-linux-gnu
1499 EXPECT_EQ("i386-redhat-linux",
1500 Triple::normalize("i386-redhat-linux")); // i386-redhat-linux-gnu
1501 EXPECT_EQ("i686-unknown-linux",
1502 Triple::normalize("i686-linux")); // i686-pc-linux-gnu
1503 EXPECT_EQ("arm-unknown-none-eabi",
1504 Triple::normalize("arm-none-eabi")); // arm-none-eabi
1505 EXPECT_EQ("ve-unknown-linux",
1506 Triple::normalize("ve-linux")); // ve-linux
1507 EXPECT_EQ("wasm32-unknown-wasi",
1508 Triple::normalize("wasm32-wasi")); // wasm32-unknown-wasi
1509 EXPECT_EQ("wasm64-unknown-wasi",
1510 Triple::normalize("wasm64-wasi")); // wasm64-unknown-wasi
1513 TEST(TripleTest
, MutateName
) {
1515 EXPECT_EQ(Triple::UnknownArch
, T
.getArch());
1516 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
1517 EXPECT_EQ(Triple::UnknownOS
, T
.getOS());
1518 EXPECT_EQ(Triple::UnknownEnvironment
, T
.getEnvironment());
1520 T
.setArchName("i386");
1521 EXPECT_EQ(Triple::x86
, T
.getArch());
1522 EXPECT_EQ("i386--", T
.getTriple());
1524 T
.setVendorName("pc");
1525 EXPECT_EQ(Triple::x86
, T
.getArch());
1526 EXPECT_EQ(Triple::PC
, T
.getVendor());
1527 EXPECT_EQ("i386-pc-", T
.getTriple());
1529 T
.setOSName("linux");
1530 EXPECT_EQ(Triple::x86
, T
.getArch());
1531 EXPECT_EQ(Triple::PC
, T
.getVendor());
1532 EXPECT_EQ(Triple::Linux
, T
.getOS());
1533 EXPECT_EQ("i386-pc-linux", T
.getTriple());
1535 T
.setEnvironmentName("gnu");
1536 EXPECT_EQ(Triple::x86
, T
.getArch());
1537 EXPECT_EQ(Triple::PC
, T
.getVendor());
1538 EXPECT_EQ(Triple::Linux
, T
.getOS());
1539 EXPECT_EQ("i386-pc-linux-gnu", T
.getTriple());
1541 T
.setOSName("freebsd");
1542 EXPECT_EQ(Triple::x86
, T
.getArch());
1543 EXPECT_EQ(Triple::PC
, T
.getVendor());
1544 EXPECT_EQ(Triple::FreeBSD
, T
.getOS());
1545 EXPECT_EQ("i386-pc-freebsd-gnu", T
.getTriple());
1547 T
.setOSAndEnvironmentName("darwin");
1548 EXPECT_EQ(Triple::x86
, T
.getArch());
1549 EXPECT_EQ(Triple::PC
, T
.getVendor());
1550 EXPECT_EQ(Triple::Darwin
, T
.getOS());
1551 EXPECT_EQ("i386-pc-darwin", T
.getTriple());
1554 TEST(TripleTest
, BitWidthChecks
) {
1556 EXPECT_FALSE(T
.isArch16Bit());
1557 EXPECT_FALSE(T
.isArch32Bit());
1558 EXPECT_FALSE(T
.isArch64Bit());
1559 EXPECT_EQ(T
.getArchPointerBitWidth(), 0U);
1561 T
.setArch(Triple::arm
);
1562 EXPECT_FALSE(T
.isArch16Bit());
1563 EXPECT_TRUE(T
.isArch32Bit());
1564 EXPECT_FALSE(T
.isArch64Bit());
1565 EXPECT_EQ(T
.getArchPointerBitWidth(), 32U);
1567 T
.setArch(Triple::hexagon
);
1568 EXPECT_FALSE(T
.isArch16Bit());
1569 EXPECT_TRUE(T
.isArch32Bit());
1570 EXPECT_FALSE(T
.isArch64Bit());
1571 EXPECT_EQ(T
.getArchPointerBitWidth(), 32U);
1573 T
.setArch(Triple::mips
);
1574 EXPECT_FALSE(T
.isArch16Bit());
1575 EXPECT_TRUE(T
.isArch32Bit());
1576 EXPECT_FALSE(T
.isArch64Bit());
1577 EXPECT_EQ(T
.getArchPointerBitWidth(), 32U);
1579 T
.setArch(Triple::mips64
);
1580 EXPECT_FALSE(T
.isArch16Bit());
1581 EXPECT_FALSE(T
.isArch32Bit());
1582 EXPECT_TRUE(T
.isArch64Bit());
1583 EXPECT_EQ(T
.getArchPointerBitWidth(), 64U);
1585 T
.setArch(Triple::msp430
);
1586 EXPECT_TRUE(T
.isArch16Bit());
1587 EXPECT_FALSE(T
.isArch32Bit());
1588 EXPECT_FALSE(T
.isArch64Bit());
1589 EXPECT_EQ(T
.getArchPointerBitWidth(), 16U);
1591 T
.setArch(Triple::ppc
);
1592 EXPECT_FALSE(T
.isArch16Bit());
1593 EXPECT_TRUE(T
.isArch32Bit());
1594 EXPECT_FALSE(T
.isArch64Bit());
1595 EXPECT_EQ(T
.getArchPointerBitWidth(), 32U);
1597 T
.setArch(Triple::ppc64
);
1598 EXPECT_FALSE(T
.isArch16Bit());
1599 EXPECT_FALSE(T
.isArch32Bit());
1600 EXPECT_TRUE(T
.isArch64Bit());
1601 EXPECT_EQ(T
.getArchPointerBitWidth(), 64U);
1603 T
.setArch(Triple::x86
);
1604 EXPECT_FALSE(T
.isArch16Bit());
1605 EXPECT_TRUE(T
.isArch32Bit());
1606 EXPECT_FALSE(T
.isArch64Bit());
1607 EXPECT_EQ(T
.getArchPointerBitWidth(), 32U);
1609 T
.setArch(Triple::x86_64
);
1610 EXPECT_FALSE(T
.isArch16Bit());
1611 EXPECT_FALSE(T
.isArch32Bit());
1612 EXPECT_TRUE(T
.isArch64Bit());
1613 EXPECT_EQ(T
.getArchPointerBitWidth(), 64U);
1615 T
.setArch(Triple::amdil
);
1616 EXPECT_FALSE(T
.isArch16Bit());
1617 EXPECT_TRUE(T
.isArch32Bit());
1618 EXPECT_FALSE(T
.isArch64Bit());
1619 EXPECT_EQ(T
.getArchPointerBitWidth(), 32U);
1621 T
.setArch(Triple::amdil64
);
1622 EXPECT_FALSE(T
.isArch16Bit());
1623 EXPECT_FALSE(T
.isArch32Bit());
1624 EXPECT_TRUE(T
.isArch64Bit());
1625 EXPECT_EQ(T
.getArchPointerBitWidth(), 64U);
1627 T
.setArch(Triple::hsail
);
1628 EXPECT_FALSE(T
.isArch16Bit());
1629 EXPECT_TRUE(T
.isArch32Bit());
1630 EXPECT_FALSE(T
.isArch64Bit());
1631 EXPECT_EQ(T
.getArchPointerBitWidth(), 32U);
1633 T
.setArch(Triple::hsail64
);
1634 EXPECT_FALSE(T
.isArch16Bit());
1635 EXPECT_FALSE(T
.isArch32Bit());
1636 EXPECT_TRUE(T
.isArch64Bit());
1637 EXPECT_EQ(T
.getArchPointerBitWidth(), 64U);
1639 T
.setArch(Triple::spir
);
1640 EXPECT_FALSE(T
.isArch16Bit());
1641 EXPECT_TRUE(T
.isArch32Bit());
1642 EXPECT_FALSE(T
.isArch64Bit());
1643 EXPECT_EQ(T
.getArchPointerBitWidth(), 32U);
1645 T
.setArch(Triple::spir64
);
1646 EXPECT_FALSE(T
.isArch16Bit());
1647 EXPECT_FALSE(T
.isArch32Bit());
1648 EXPECT_TRUE(T
.isArch64Bit());
1649 EXPECT_EQ(T
.getArchPointerBitWidth(), 64U);
1651 T
.setArch(Triple::spirv
);
1652 EXPECT_FALSE(T
.isArch16Bit());
1653 EXPECT_FALSE(T
.isArch32Bit());
1654 EXPECT_TRUE(T
.isArch64Bit());
1655 EXPECT_TRUE(T
.isSPIRV());
1657 T
.setArch(Triple::spirv32
);
1658 EXPECT_FALSE(T
.isArch16Bit());
1659 EXPECT_TRUE(T
.isArch32Bit());
1660 EXPECT_FALSE(T
.isArch64Bit());
1661 EXPECT_TRUE(T
.isSPIRV());
1663 T
.setArch(Triple::spirv64
);
1664 EXPECT_FALSE(T
.isArch16Bit());
1665 EXPECT_FALSE(T
.isArch32Bit());
1666 EXPECT_TRUE(T
.isArch64Bit());
1667 EXPECT_TRUE(T
.isSPIRV());
1669 T
.setArch(Triple::sparc
);
1670 EXPECT_FALSE(T
.isArch16Bit());
1671 EXPECT_TRUE(T
.isArch32Bit());
1672 EXPECT_FALSE(T
.isArch64Bit());
1674 T
.setArch(Triple::sparcel
);
1675 EXPECT_FALSE(T
.isArch16Bit());
1676 EXPECT_TRUE(T
.isArch32Bit());
1677 EXPECT_FALSE(T
.isArch64Bit());
1679 T
.setArch(Triple::sparcv9
);
1680 EXPECT_FALSE(T
.isArch16Bit());
1681 EXPECT_FALSE(T
.isArch32Bit());
1682 EXPECT_TRUE(T
.isArch64Bit());
1684 T
.setArch(Triple::wasm32
);
1685 EXPECT_FALSE(T
.isArch16Bit());
1686 EXPECT_TRUE(T
.isArch32Bit());
1687 EXPECT_FALSE(T
.isArch64Bit());
1689 T
.setArch(Triple::wasm64
);
1690 EXPECT_FALSE(T
.isArch16Bit());
1691 EXPECT_FALSE(T
.isArch32Bit());
1692 EXPECT_TRUE(T
.isArch64Bit());
1694 T
.setArch(Triple::avr
);
1695 EXPECT_TRUE(T
.isArch16Bit());
1696 EXPECT_FALSE(T
.isArch32Bit());
1697 EXPECT_FALSE(T
.isArch64Bit());
1699 T
.setArch(Triple::lanai
);
1700 EXPECT_FALSE(T
.isArch16Bit());
1701 EXPECT_TRUE(T
.isArch32Bit());
1702 EXPECT_FALSE(T
.isArch64Bit());
1704 T
.setArch(Triple::riscv32
);
1705 EXPECT_FALSE(T
.isArch16Bit());
1706 EXPECT_TRUE(T
.isArch32Bit());
1707 EXPECT_FALSE(T
.isArch64Bit());
1708 EXPECT_TRUE(T
.isRISCV());
1710 T
.setArch(Triple::riscv64
);
1711 EXPECT_FALSE(T
.isArch16Bit());
1712 EXPECT_FALSE(T
.isArch32Bit());
1713 EXPECT_TRUE(T
.isArch64Bit());
1714 EXPECT_TRUE(T
.isRISCV());
1716 T
.setArch(Triple::csky
);
1717 EXPECT_FALSE(T
.isArch16Bit());
1718 EXPECT_TRUE(T
.isArch32Bit());
1719 EXPECT_FALSE(T
.isArch64Bit());
1720 EXPECT_TRUE(T
.isCSKY());
1722 T
.setArch(Triple::loongarch32
);
1723 EXPECT_FALSE(T
.isArch16Bit());
1724 EXPECT_TRUE(T
.isArch32Bit());
1725 EXPECT_FALSE(T
.isArch64Bit());
1726 EXPECT_TRUE(T
.isLoongArch());
1727 EXPECT_TRUE(T
.isLoongArch32());
1729 T
.setArch(Triple::loongarch64
);
1730 EXPECT_FALSE(T
.isArch16Bit());
1731 EXPECT_FALSE(T
.isArch32Bit());
1732 EXPECT_TRUE(T
.isArch64Bit());
1733 EXPECT_TRUE(T
.isLoongArch());
1734 EXPECT_TRUE(T
.isLoongArch64());
1736 T
.setArch(Triple::dxil
);
1737 EXPECT_FALSE(T
.isArch16Bit());
1738 EXPECT_TRUE(T
.isArch32Bit());
1739 EXPECT_FALSE(T
.isArch64Bit());
1740 EXPECT_TRUE(T
.isDXIL());
1742 T
.setArch(Triple::xtensa
);
1743 EXPECT_FALSE(T
.isArch16Bit());
1744 EXPECT_TRUE(T
.isArch32Bit());
1745 EXPECT_FALSE(T
.isArch64Bit());
1748 TEST(TripleTest
, BitWidthArchVariants
) {
1750 EXPECT_EQ(Triple::UnknownArch
, T
.get32BitArchVariant().getArch());
1751 EXPECT_EQ(Triple::UnknownArch
, T
.get64BitArchVariant().getArch());
1753 T
.setArch(Triple::UnknownArch
);
1754 EXPECT_EQ(Triple::UnknownArch
, T
.get32BitArchVariant().getArch());
1755 EXPECT_EQ(Triple::UnknownArch
, T
.get64BitArchVariant().getArch());
1757 T
.setArch(Triple::mips
);
1758 EXPECT_EQ(Triple::mips
, T
.get32BitArchVariant().getArch());
1759 EXPECT_EQ(Triple::NoSubArch
, T
.get32BitArchVariant().getSubArch());
1760 EXPECT_EQ(Triple::mips64
, T
.get64BitArchVariant().getArch());
1761 EXPECT_EQ(Triple::NoSubArch
, T
.get64BitArchVariant().getSubArch());
1763 T
.setArch(Triple::mips
, Triple::MipsSubArch_r6
);
1764 EXPECT_EQ(Triple::mips
, T
.get32BitArchVariant().getArch());
1765 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.get32BitArchVariant().getSubArch());
1766 EXPECT_EQ(Triple::mips64
, T
.get64BitArchVariant().getArch());
1767 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.get64BitArchVariant().getSubArch());
1769 T
.setArch(Triple::mipsel
);
1770 EXPECT_EQ(Triple::mipsel
, T
.get32BitArchVariant().getArch());
1771 EXPECT_EQ(Triple::NoSubArch
, T
.get32BitArchVariant().getSubArch());
1772 EXPECT_EQ(Triple::mips64el
, T
.get64BitArchVariant().getArch());
1773 EXPECT_EQ(Triple::NoSubArch
, T
.get64BitArchVariant().getSubArch());
1775 T
.setArch(Triple::mipsel
, Triple::MipsSubArch_r6
);
1776 EXPECT_EQ(Triple::mipsel
, T
.get32BitArchVariant().getArch());
1777 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.get32BitArchVariant().getSubArch());
1778 EXPECT_EQ(Triple::mips64el
, T
.get64BitArchVariant().getArch());
1779 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.get64BitArchVariant().getSubArch());
1781 T
.setArch(Triple::ppc
);
1782 EXPECT_EQ(Triple::ppc
, T
.get32BitArchVariant().getArch());
1783 EXPECT_EQ(Triple::ppc64
, T
.get64BitArchVariant().getArch());
1785 T
.setArch(Triple::nvptx
);
1786 EXPECT_EQ(Triple::nvptx
, T
.get32BitArchVariant().getArch());
1787 EXPECT_EQ(Triple::nvptx64
, T
.get64BitArchVariant().getArch());
1789 T
.setArch(Triple::sparc
);
1790 EXPECT_EQ(Triple::sparc
, T
.get32BitArchVariant().getArch());
1791 EXPECT_EQ(Triple::sparcv9
, T
.get64BitArchVariant().getArch());
1793 T
.setArch(Triple::x86
);
1794 EXPECT_EQ(Triple::x86
, T
.get32BitArchVariant().getArch());
1795 EXPECT_EQ(Triple::x86_64
, T
.get64BitArchVariant().getArch());
1797 T
.setArch(Triple::mips64
);
1798 EXPECT_EQ(Triple::mips
, T
.get32BitArchVariant().getArch());
1799 EXPECT_EQ(Triple::NoSubArch
, T
.get32BitArchVariant().getSubArch());
1800 EXPECT_EQ(Triple::mips64
, T
.get64BitArchVariant().getArch());
1801 EXPECT_EQ(Triple::NoSubArch
, T
.get64BitArchVariant().getSubArch());
1803 T
.setArch(Triple::mips64
, Triple::MipsSubArch_r6
);
1804 EXPECT_EQ(Triple::mips
, T
.get32BitArchVariant().getArch());
1805 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.get32BitArchVariant().getSubArch());
1806 EXPECT_EQ(Triple::mips64
, T
.get64BitArchVariant().getArch());
1807 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.get64BitArchVariant().getSubArch());
1809 T
.setArch(Triple::mips64el
);
1810 EXPECT_EQ(Triple::mipsel
, T
.get32BitArchVariant().getArch());
1811 EXPECT_EQ(Triple::NoSubArch
, T
.get32BitArchVariant().getSubArch());
1812 EXPECT_EQ(Triple::mips64el
, T
.get64BitArchVariant().getArch());
1813 EXPECT_EQ(Triple::NoSubArch
, T
.get64BitArchVariant().getSubArch());
1815 T
.setArch(Triple::mips64el
, Triple::MipsSubArch_r6
);
1816 EXPECT_EQ(Triple::mipsel
, T
.get32BitArchVariant().getArch());
1817 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.get32BitArchVariant().getSubArch());
1818 EXPECT_EQ(Triple::mips64el
, T
.get64BitArchVariant().getArch());
1819 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.get64BitArchVariant().getSubArch());
1821 T
.setArch(Triple::ppc64
);
1822 EXPECT_EQ(Triple::ppc
, T
.get32BitArchVariant().getArch());
1823 EXPECT_EQ(Triple::ppc64
, T
.get64BitArchVariant().getArch());
1825 T
.setArch(Triple::nvptx64
);
1826 EXPECT_EQ(Triple::nvptx
, T
.get32BitArchVariant().getArch());
1827 EXPECT_EQ(Triple::nvptx64
, T
.get64BitArchVariant().getArch());
1829 T
.setArch(Triple::sparcv9
);
1830 EXPECT_EQ(Triple::sparc
, T
.get32BitArchVariant().getArch());
1831 EXPECT_EQ(Triple::sparcv9
, T
.get64BitArchVariant().getArch());
1833 T
.setArch(Triple::x86_64
);
1834 EXPECT_EQ(Triple::x86
, T
.get32BitArchVariant().getArch());
1835 EXPECT_EQ(Triple::x86_64
, T
.get64BitArchVariant().getArch());
1837 T
.setArch(Triple::amdil
);
1838 EXPECT_EQ(Triple::amdil
, T
.get32BitArchVariant().getArch());
1839 EXPECT_EQ(Triple::amdil64
, T
.get64BitArchVariant().getArch());
1841 T
.setArch(Triple::amdil64
);
1842 EXPECT_EQ(Triple::amdil
, T
.get32BitArchVariant().getArch());
1843 EXPECT_EQ(Triple::amdil64
, T
.get64BitArchVariant().getArch());
1845 T
.setArch(Triple::hsail
);
1846 EXPECT_EQ(Triple::hsail
, T
.get32BitArchVariant().getArch());
1847 EXPECT_EQ(Triple::hsail64
, T
.get64BitArchVariant().getArch());
1849 T
.setArch(Triple::hsail64
);
1850 EXPECT_EQ(Triple::hsail
, T
.get32BitArchVariant().getArch());
1851 EXPECT_EQ(Triple::hsail64
, T
.get64BitArchVariant().getArch());
1853 T
.setArch(Triple::spir
);
1854 EXPECT_EQ(Triple::spir
, T
.get32BitArchVariant().getArch());
1855 EXPECT_EQ(Triple::spir64
, T
.get64BitArchVariant().getArch());
1857 T
.setArch(Triple::spir64
);
1858 EXPECT_EQ(Triple::spir
, T
.get32BitArchVariant().getArch());
1859 EXPECT_EQ(Triple::spir64
, T
.get64BitArchVariant().getArch());
1861 T
.setArch(Triple::spirv
);
1862 EXPECT_EQ(Triple::spirv32
, T
.get32BitArchVariant().getArch());
1863 EXPECT_EQ(Triple::spirv64
, T
.get64BitArchVariant().getArch());
1865 T
.setArch(Triple::spirv32
);
1866 EXPECT_EQ(Triple::spirv32
, T
.get32BitArchVariant().getArch());
1867 EXPECT_EQ(Triple::spirv64
, T
.get64BitArchVariant().getArch());
1869 T
.setArch(Triple::spirv64
);
1870 EXPECT_EQ(Triple::spirv32
, T
.get32BitArchVariant().getArch());
1871 EXPECT_EQ(Triple::spirv64
, T
.get64BitArchVariant().getArch());
1873 T
.setArch(Triple::wasm32
);
1874 EXPECT_EQ(Triple::wasm32
, T
.get32BitArchVariant().getArch());
1875 EXPECT_EQ(Triple::wasm64
, T
.get64BitArchVariant().getArch());
1877 T
.setArch(Triple::wasm64
);
1878 EXPECT_EQ(Triple::wasm32
, T
.get32BitArchVariant().getArch());
1879 EXPECT_EQ(Triple::wasm64
, T
.get64BitArchVariant().getArch());
1881 T
.setArch(Triple::riscv32
);
1882 EXPECT_EQ(Triple::riscv32
, T
.get32BitArchVariant().getArch());
1883 EXPECT_EQ(Triple::riscv64
, T
.get64BitArchVariant().getArch());
1885 T
.setArch(Triple::riscv64
);
1886 EXPECT_EQ(Triple::riscv32
, T
.get32BitArchVariant().getArch());
1887 EXPECT_EQ(Triple::riscv64
, T
.get64BitArchVariant().getArch());
1889 T
.setArch(Triple::csky
);
1890 EXPECT_EQ(Triple::csky
, T
.get32BitArchVariant().getArch());
1891 EXPECT_EQ(Triple::UnknownArch
, T
.get64BitArchVariant().getArch());
1893 T
.setArch(Triple::loongarch32
);
1894 EXPECT_EQ(Triple::loongarch32
, T
.get32BitArchVariant().getArch());
1895 EXPECT_EQ(Triple::loongarch64
, T
.get64BitArchVariant().getArch());
1897 T
.setArch(Triple::loongarch64
);
1898 EXPECT_EQ(Triple::loongarch32
, T
.get32BitArchVariant().getArch());
1899 EXPECT_EQ(Triple::loongarch64
, T
.get64BitArchVariant().getArch());
1901 T
.setArch(Triple::thumbeb
);
1902 EXPECT_EQ(Triple::thumbeb
, T
.get32BitArchVariant().getArch());
1903 EXPECT_EQ(Triple::aarch64_be
, T
.get64BitArchVariant().getArch());
1905 T
.setArch(Triple::thumb
);
1906 EXPECT_EQ(Triple::thumb
, T
.get32BitArchVariant().getArch());
1907 EXPECT_EQ(Triple::aarch64
, T
.get64BitArchVariant().getArch());
1909 T
.setArch(Triple::aarch64
);
1910 EXPECT_EQ(Triple::arm
, T
.get32BitArchVariant().getArch());
1911 EXPECT_EQ(Triple::aarch64
, T
.get64BitArchVariant().getArch());
1913 T
.setArch(Triple::aarch64_be
);
1914 EXPECT_EQ(Triple::armeb
, T
.get32BitArchVariant().getArch());
1915 EXPECT_EQ(Triple::aarch64_be
, T
.get64BitArchVariant().getArch());
1917 T
.setArch(Triple::renderscript32
);
1918 EXPECT_EQ(Triple::renderscript32
, T
.get32BitArchVariant().getArch());
1919 EXPECT_EQ(Triple::renderscript64
, T
.get64BitArchVariant().getArch());
1921 T
.setArch(Triple::renderscript64
);
1922 EXPECT_EQ(Triple::renderscript32
, T
.get32BitArchVariant().getArch());
1923 EXPECT_EQ(Triple::renderscript64
, T
.get64BitArchVariant().getArch());
1925 T
.setArch(Triple::armeb
);
1926 EXPECT_EQ(Triple::armeb
, T
.get32BitArchVariant().getArch());
1927 EXPECT_EQ(Triple::aarch64_be
, T
.get64BitArchVariant().getArch());
1929 T
.setArch(Triple::arm
);
1930 EXPECT_EQ(Triple::arm
, T
.get32BitArchVariant().getArch());
1931 EXPECT_EQ(Triple::aarch64
, T
.get64BitArchVariant().getArch());
1933 T
.setArch(Triple::systemz
);
1934 EXPECT_EQ(Triple::UnknownArch
, T
.get32BitArchVariant().getArch());
1935 EXPECT_EQ(Triple::systemz
, T
.get64BitArchVariant().getArch());
1937 T
.setArch(Triple::xcore
);
1938 EXPECT_EQ(Triple::xcore
, T
.get32BitArchVariant().getArch());
1939 EXPECT_EQ(Triple::UnknownArch
, T
.get64BitArchVariant().getArch());
1941 T
.setArch(Triple::dxil
);
1942 EXPECT_EQ(Triple::dxil
, T
.get32BitArchVariant().getArch());
1943 EXPECT_EQ(Triple::UnknownArch
, T
.get64BitArchVariant().getArch());
1945 T
.setArch(Triple::xtensa
);
1946 EXPECT_EQ(Triple::xtensa
, T
.get32BitArchVariant().getArch());
1947 EXPECT_EQ(Triple::UnknownArch
, T
.get64BitArchVariant().getArch());
1950 TEST(TripleTest
, EndianArchVariants
) {
1952 EXPECT_EQ(Triple::UnknownArch
, T
.getBigEndianArchVariant().getArch());
1953 EXPECT_EQ(Triple::UnknownArch
, T
.getLittleEndianArchVariant().getArch());
1955 T
.setArch(Triple::UnknownArch
);
1956 EXPECT_EQ(Triple::UnknownArch
, T
.getBigEndianArchVariant().getArch());
1957 EXPECT_EQ(Triple::UnknownArch
, T
.getLittleEndianArchVariant().getArch());
1959 T
.setArch(Triple::aarch64_be
);
1960 EXPECT_EQ(Triple::aarch64_be
, T
.getBigEndianArchVariant().getArch());
1961 EXPECT_EQ(Triple::aarch64
, T
.getLittleEndianArchVariant().getArch());
1963 T
.setArch(Triple::aarch64
);
1964 EXPECT_EQ(Triple::aarch64_be
, T
.getBigEndianArchVariant().getArch());
1965 EXPECT_EQ(Triple::aarch64
, T
.getLittleEndianArchVariant().getArch());
1967 T
.setArch(Triple::armeb
);
1968 EXPECT_EQ(Triple::armeb
, T
.getBigEndianArchVariant().getArch());
1969 EXPECT_EQ(Triple::UnknownArch
, T
.getLittleEndianArchVariant().getArch());
1971 T
.setArch(Triple::arm
);
1972 EXPECT_EQ(Triple::UnknownArch
, T
.getBigEndianArchVariant().getArch());
1973 EXPECT_EQ(Triple::arm
, T
.getLittleEndianArchVariant().getArch());
1975 EXPECT_TRUE(T
.isLittleEndian());
1976 T
= Triple("thumb");
1977 EXPECT_TRUE(T
.isLittleEndian());
1978 T
= Triple("armeb");
1979 EXPECT_FALSE(T
.isLittleEndian());
1980 T
= Triple("thumbeb");
1981 EXPECT_FALSE(T
.isLittleEndian());
1983 T
.setArch(Triple::bpfeb
);
1984 EXPECT_EQ(Triple::bpfeb
, T
.getBigEndianArchVariant().getArch());
1985 EXPECT_EQ(Triple::bpfel
, T
.getLittleEndianArchVariant().getArch());
1987 T
.setArch(Triple::bpfel
);
1988 EXPECT_EQ(Triple::bpfeb
, T
.getBigEndianArchVariant().getArch());
1989 EXPECT_EQ(Triple::bpfel
, T
.getLittleEndianArchVariant().getArch());
1991 T
.setArch(Triple::mips64
);
1992 EXPECT_EQ(Triple::mips64
, T
.getBigEndianArchVariant().getArch());
1993 EXPECT_EQ(Triple::NoSubArch
, T
.getBigEndianArchVariant().getSubArch());
1994 EXPECT_EQ(Triple::mips64el
, T
.getLittleEndianArchVariant().getArch());
1995 EXPECT_EQ(Triple::NoSubArch
, T
.getLittleEndianArchVariant().getSubArch());
1997 T
.setArch(Triple::mips64
, Triple::MipsSubArch_r6
);
1998 EXPECT_EQ(Triple::mips64
, T
.getBigEndianArchVariant().getArch());
1999 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getBigEndianArchVariant().getSubArch());
2000 EXPECT_EQ(Triple::mips64el
, T
.getLittleEndianArchVariant().getArch());
2001 EXPECT_EQ(Triple::MipsSubArch_r6
,
2002 T
.getLittleEndianArchVariant().getSubArch());
2004 T
.setArch(Triple::mips64el
);
2005 EXPECT_EQ(Triple::mips64
, T
.getBigEndianArchVariant().getArch());
2006 EXPECT_EQ(Triple::NoSubArch
, T
.getBigEndianArchVariant().getSubArch());
2007 EXPECT_EQ(Triple::mips64el
, T
.getLittleEndianArchVariant().getArch());
2008 EXPECT_EQ(Triple::NoSubArch
, T
.getLittleEndianArchVariant().getSubArch());
2010 T
.setArch(Triple::mips64el
, Triple::MipsSubArch_r6
);
2011 EXPECT_EQ(Triple::mips64
, T
.getBigEndianArchVariant().getArch());
2012 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getBigEndianArchVariant().getSubArch());
2013 EXPECT_EQ(Triple::mips64el
, T
.getLittleEndianArchVariant().getArch());
2014 EXPECT_EQ(Triple::MipsSubArch_r6
,
2015 T
.getLittleEndianArchVariant().getSubArch());
2017 T
.setArch(Triple::mips
);
2018 EXPECT_EQ(Triple::mips
, T
.getBigEndianArchVariant().getArch());
2019 EXPECT_EQ(Triple::NoSubArch
, T
.getBigEndianArchVariant().getSubArch());
2020 EXPECT_EQ(Triple::mipsel
, T
.getLittleEndianArchVariant().getArch());
2021 EXPECT_EQ(Triple::NoSubArch
, T
.getLittleEndianArchVariant().getSubArch());
2023 T
.setArch(Triple::mips
, Triple::MipsSubArch_r6
);
2024 EXPECT_EQ(Triple::mips
, T
.getBigEndianArchVariant().getArch());
2025 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getBigEndianArchVariant().getSubArch());
2026 EXPECT_EQ(Triple::mipsel
, T
.getLittleEndianArchVariant().getArch());
2027 EXPECT_EQ(Triple::MipsSubArch_r6
,
2028 T
.getLittleEndianArchVariant().getSubArch());
2030 T
.setArch(Triple::mipsel
);
2031 EXPECT_EQ(Triple::mips
, T
.getBigEndianArchVariant().getArch());
2032 EXPECT_EQ(Triple::NoSubArch
, T
.getBigEndianArchVariant().getSubArch());
2033 EXPECT_EQ(Triple::mipsel
, T
.getLittleEndianArchVariant().getArch());
2034 EXPECT_EQ(Triple::NoSubArch
, T
.getLittleEndianArchVariant().getSubArch());
2036 T
.setArch(Triple::mipsel
, Triple::MipsSubArch_r6
);
2037 EXPECT_EQ(Triple::mips
, T
.getBigEndianArchVariant().getArch());
2038 EXPECT_EQ(Triple::MipsSubArch_r6
, T
.getBigEndianArchVariant().getSubArch());
2039 EXPECT_EQ(Triple::mipsel
, T
.getLittleEndianArchVariant().getArch());
2040 EXPECT_EQ(Triple::MipsSubArch_r6
,
2041 T
.getLittleEndianArchVariant().getSubArch());
2043 T
.setArch(Triple::ppc
);
2044 EXPECT_EQ(Triple::ppc
, T
.getBigEndianArchVariant().getArch());
2045 EXPECT_EQ(Triple::ppcle
, T
.getLittleEndianArchVariant().getArch());
2047 T
.setArch(Triple::ppc64
);
2048 EXPECT_EQ(Triple::ppc64
, T
.getBigEndianArchVariant().getArch());
2049 EXPECT_EQ(Triple::ppc64le
, T
.getLittleEndianArchVariant().getArch());
2051 T
.setArch(Triple::ppc64le
);
2052 EXPECT_EQ(Triple::ppc64
, T
.getBigEndianArchVariant().getArch());
2053 EXPECT_EQ(Triple::ppc64le
, T
.getLittleEndianArchVariant().getArch());
2055 T
.setArch(Triple::sparc
);
2056 EXPECT_EQ(Triple::sparc
, T
.getBigEndianArchVariant().getArch());
2057 EXPECT_EQ(Triple::sparcel
, T
.getLittleEndianArchVariant().getArch());
2059 T
.setArch(Triple::sparcel
);
2060 EXPECT_EQ(Triple::sparc
, T
.getBigEndianArchVariant().getArch());
2061 EXPECT_EQ(Triple::sparcel
, T
.getLittleEndianArchVariant().getArch());
2063 T
.setArch(Triple::thumb
);
2064 EXPECT_EQ(Triple::UnknownArch
, T
.getBigEndianArchVariant().getArch());
2065 EXPECT_EQ(Triple::thumb
, T
.getLittleEndianArchVariant().getArch());
2067 T
.setArch(Triple::thumbeb
);
2068 EXPECT_EQ(Triple::thumbeb
, T
.getBigEndianArchVariant().getArch());
2069 EXPECT_EQ(Triple::UnknownArch
, T
.getLittleEndianArchVariant().getArch());
2071 T
.setArch(Triple::lanai
);
2072 EXPECT_EQ(Triple::lanai
, T
.getBigEndianArchVariant().getArch());
2073 EXPECT_EQ(Triple::UnknownArch
, T
.getLittleEndianArchVariant().getArch());
2075 T
.setArch(Triple::tcele
);
2076 EXPECT_EQ(Triple::tce
, T
.getBigEndianArchVariant().getArch());
2077 EXPECT_EQ(Triple::tcele
, T
.getLittleEndianArchVariant().getArch());
2079 T
.setArch(Triple::tce
);
2080 EXPECT_EQ(Triple::tce
, T
.getBigEndianArchVariant().getArch());
2081 EXPECT_EQ(Triple::tcele
, T
.getLittleEndianArchVariant().getArch());
2083 T
.setArch(Triple::csky
);
2084 EXPECT_EQ(Triple::UnknownArch
, T
.getBigEndianArchVariant().getArch());
2085 EXPECT_EQ(Triple::csky
, T
.getLittleEndianArchVariant().getArch());
2087 T
.setArch(Triple::loongarch32
);
2088 EXPECT_TRUE(T
.isLittleEndian());
2089 EXPECT_EQ(Triple::UnknownArch
, T
.getBigEndianArchVariant().getArch());
2090 EXPECT_EQ(Triple::loongarch32
, T
.getLittleEndianArchVariant().getArch());
2092 T
.setArch(Triple::loongarch64
);
2093 EXPECT_TRUE(T
.isLittleEndian());
2094 EXPECT_EQ(Triple::UnknownArch
, T
.getBigEndianArchVariant().getArch());
2095 EXPECT_EQ(Triple::loongarch64
, T
.getLittleEndianArchVariant().getArch());
2097 T
.setArch(Triple::dxil
);
2098 EXPECT_TRUE(T
.isLittleEndian());
2099 EXPECT_EQ(Triple::UnknownArch
, T
.getBigEndianArchVariant().getArch());
2100 EXPECT_EQ(Triple::dxil
, T
.getLittleEndianArchVariant().getArch());
2103 TEST(TripleTest
, XROS
) {
2105 VersionTuple Version
;
2107 T
= Triple("arm64-apple-xros");
2108 EXPECT_TRUE(T
.isXROS());
2109 EXPECT_TRUE(T
.isOSDarwin());
2110 EXPECT_FALSE(T
.isiOS());
2111 EXPECT_FALSE(T
.isMacOSX());
2112 EXPECT_FALSE(T
.isSimulatorEnvironment());
2113 EXPECT_EQ(T
.getOSName(), "xros");
2114 Version
= T
.getOSVersion();
2115 EXPECT_EQ(VersionTuple(0), Version
);
2117 T
= Triple("arm64-apple-visionos1.2");
2118 EXPECT_TRUE(T
.isXROS());
2119 EXPECT_TRUE(T
.isOSDarwin());
2120 EXPECT_FALSE(T
.isiOS());
2121 EXPECT_FALSE(T
.isMacOSX());
2122 EXPECT_FALSE(T
.isSimulatorEnvironment());
2123 EXPECT_EQ(T
.getOSName(), "visionos1.2");
2124 Version
= T
.getOSVersion();
2125 EXPECT_EQ(VersionTuple(1, 2), Version
);
2127 T
= Triple("arm64-apple-xros1-simulator");
2128 EXPECT_TRUE(T
.isXROS());
2129 EXPECT_TRUE(T
.isOSDarwin());
2130 EXPECT_FALSE(T
.isiOS());
2131 EXPECT_FALSE(T
.isMacOSX());
2132 EXPECT_TRUE(T
.isSimulatorEnvironment());
2133 Version
= T
.getOSVersion();
2134 EXPECT_EQ(VersionTuple(1), Version
);
2135 Version
= T
.getiOSVersion();
2136 EXPECT_EQ(VersionTuple(17), Version
);
2139 TEST(TripleTest
, getOSVersion
) {
2141 VersionTuple Version
;
2143 T
= Triple("i386-apple-darwin9");
2144 EXPECT_TRUE(T
.isMacOSX());
2145 EXPECT_FALSE(T
.isiOS());
2146 EXPECT_FALSE(T
.isArch16Bit());
2147 EXPECT_TRUE(T
.isArch32Bit());
2148 EXPECT_FALSE(T
.isArch64Bit());
2149 T
.getMacOSXVersion(Version
);
2150 EXPECT_EQ(VersionTuple(10, 5), Version
);
2151 Version
= T
.getiOSVersion();
2152 EXPECT_EQ(VersionTuple(5), Version
);
2154 T
= Triple("x86_64-apple-darwin9");
2155 EXPECT_TRUE(T
.isMacOSX());
2156 EXPECT_FALSE(T
.isiOS());
2157 EXPECT_FALSE(T
.isArch16Bit());
2158 EXPECT_FALSE(T
.isArch32Bit());
2159 EXPECT_TRUE(T
.isArch64Bit());
2160 T
.getMacOSXVersion(Version
);
2161 EXPECT_EQ(VersionTuple(10, 5), Version
);
2162 Version
= T
.getiOSVersion();
2163 EXPECT_EQ(VersionTuple(5), Version
);
2165 T
= Triple("x86_64-apple-macosx");
2166 EXPECT_TRUE(T
.isMacOSX());
2167 EXPECT_FALSE(T
.isiOS());
2168 EXPECT_FALSE(T
.isArch16Bit());
2169 EXPECT_FALSE(T
.isArch32Bit());
2170 EXPECT_TRUE(T
.isArch64Bit());
2171 T
.getMacOSXVersion(Version
);
2172 EXPECT_EQ(VersionTuple(10, 4), Version
);
2173 Version
= T
.getiOSVersion();
2174 EXPECT_EQ(VersionTuple(5), Version
);
2176 T
= Triple("x86_64-apple-macosx10.7");
2177 EXPECT_TRUE(T
.isMacOSX());
2178 EXPECT_FALSE(T
.isiOS());
2179 EXPECT_FALSE(T
.isArch16Bit());
2180 EXPECT_FALSE(T
.isArch32Bit());
2181 EXPECT_TRUE(T
.isArch64Bit());
2182 T
.getMacOSXVersion(Version
);
2183 EXPECT_EQ(VersionTuple(10, 7), Version
);
2184 Version
= T
.getiOSVersion();
2185 EXPECT_EQ(VersionTuple(5), Version
);
2187 T
= Triple("x86_64-apple-macos11.0");
2188 EXPECT_TRUE(T
.isMacOSX());
2189 EXPECT_FALSE(T
.isiOS());
2190 EXPECT_FALSE(T
.isArch16Bit());
2191 EXPECT_FALSE(T
.isArch32Bit());
2192 EXPECT_TRUE(T
.isArch64Bit());
2193 T
.getMacOSXVersion(Version
);
2194 EXPECT_EQ(VersionTuple(11, 0), Version
);
2196 T
= Triple("arm64-apple-macosx11.5.8");
2197 EXPECT_TRUE(T
.isMacOSX());
2198 EXPECT_FALSE(T
.isiOS());
2199 EXPECT_FALSE(T
.isArch16Bit());
2200 EXPECT_FALSE(T
.isArch32Bit());
2201 EXPECT_TRUE(T
.isArch64Bit());
2202 T
.getMacOSXVersion(Version
);
2203 EXPECT_EQ(VersionTuple(11, 5, 8), Version
);
2205 // 10.16 forms a valid triple, even though it's not
2206 // a version of a macOS.
2207 T
= Triple("x86_64-apple-macos10.16");
2208 EXPECT_TRUE(T
.isMacOSX());
2209 T
.getMacOSXVersion(Version
);
2210 EXPECT_EQ(VersionTuple(10, 16), Version
);
2212 T
= Triple("x86_64-apple-darwin20");
2213 EXPECT_TRUE(T
.isMacOSX());
2214 T
.getMacOSXVersion(Version
);
2215 EXPECT_EQ(VersionTuple(11), Version
);
2217 // For darwin triples on macOS 11, only compare the major version.
2218 T
= Triple("x86_64-apple-darwin20.2");
2219 EXPECT_TRUE(T
.isMacOSX());
2220 T
.getMacOSXVersion(Version
);
2221 EXPECT_EQ(VersionTuple(11), Version
);
2223 T
= Triple("armv7-apple-ios");
2224 EXPECT_FALSE(T
.isMacOSX());
2225 EXPECT_TRUE(T
.isiOS());
2226 EXPECT_FALSE(T
.isArch16Bit());
2227 EXPECT_TRUE(T
.isArch32Bit());
2228 EXPECT_FALSE(T
.isArch64Bit());
2229 T
.getMacOSXVersion(Version
);
2230 EXPECT_EQ(VersionTuple(10, 4), Version
);
2231 Version
= T
.getiOSVersion();
2232 EXPECT_EQ(VersionTuple(5), Version
);
2234 T
= Triple("armv7-apple-ios7.0");
2235 EXPECT_FALSE(T
.isMacOSX());
2236 EXPECT_TRUE(T
.isiOS());
2237 EXPECT_FALSE(T
.isArch16Bit());
2238 EXPECT_TRUE(T
.isArch32Bit());
2239 EXPECT_FALSE(T
.isArch64Bit());
2240 T
.getMacOSXVersion(Version
);
2241 EXPECT_EQ(VersionTuple(10, 4), Version
);
2242 Version
= T
.getiOSVersion();
2243 EXPECT_EQ(VersionTuple(7, 0), Version
);
2244 EXPECT_FALSE(T
.isSimulatorEnvironment());
2246 T
= Triple("x86_64-apple-ios10.3-simulator");
2247 EXPECT_TRUE(T
.isiOS());
2248 Version
= T
.getiOSVersion();
2249 EXPECT_EQ(VersionTuple(10, 3), Version
);
2250 EXPECT_TRUE(T
.isSimulatorEnvironment());
2251 EXPECT_FALSE(T
.isMacCatalystEnvironment());
2253 T
= Triple("x86_64-apple-ios13.0-macabi");
2254 EXPECT_TRUE(T
.isiOS());
2255 Version
= T
.getiOSVersion();
2256 EXPECT_EQ(VersionTuple(13, 0), Version
);
2257 EXPECT_TRUE(T
.getEnvironment() == Triple::MacABI
);
2258 EXPECT_TRUE(T
.isMacCatalystEnvironment());
2259 EXPECT_FALSE(T
.isSimulatorEnvironment());
2261 T
= Triple("x86_64-apple-driverkit20.1.0");
2262 EXPECT_TRUE(T
.isDriverKit());
2263 EXPECT_TRUE(T
.isOSDarwin());
2264 EXPECT_FALSE(T
.isMacOSX());
2265 EXPECT_FALSE(T
.isiOS());
2266 Version
= T
.getDriverKitVersion();
2267 EXPECT_EQ(VersionTuple(20, 1), Version
);
2269 T
= Triple("x86_64-apple-driverkit20");
2270 Version
= T
.getDriverKitVersion();
2271 EXPECT_EQ(VersionTuple(20, 0), Version
);
2273 // DriverKit version should default to 19.0.
2274 T
= Triple("x86_64-apple-driverkit");
2275 Version
= T
.getDriverKitVersion();
2276 EXPECT_EQ(VersionTuple(19, 0), Version
);
2278 T
= Triple("dxil-unknown-shadermodel6.6-pixel");
2279 EXPECT_EQ(Triple::dxil
, T
.getArch());
2280 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
2281 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
2282 Version
= T
.getOSVersion();
2283 EXPECT_EQ(VersionTuple(6, 6), Version
);
2284 EXPECT_EQ(Triple::Pixel
, T
.getEnvironment());
2286 T
= Triple("dxil-unknown-shadermodel6.0-pixel");
2287 EXPECT_EQ(Triple::dxil
, T
.getArch());
2288 EXPECT_EQ(Triple::UnknownVendor
, T
.getVendor());
2289 EXPECT_EQ(Triple::ShaderModel
, T
.getOS());
2290 Version
= T
.getOSVersion();
2291 EXPECT_EQ(VersionTuple(6, 0), Version
);
2292 EXPECT_EQ(Triple::Pixel
, T
.getEnvironment());
2295 TEST(TripleTest
, getEnvironmentVersion
) {
2297 VersionTuple Version
;
2299 T
= Triple("arm-unknown-linux-android16");
2300 EXPECT_TRUE(T
.isAndroid());
2301 Version
= T
.getEnvironmentVersion();
2302 EXPECT_EQ(VersionTuple(16), Version
);
2303 EXPECT_EQ(Triple::Android
, T
.getEnvironment());
2305 T
= Triple("aarch64-unknown-linux-android21");
2306 EXPECT_TRUE(T
.isAndroid());
2307 Version
= T
.getEnvironmentVersion();
2308 EXPECT_EQ(VersionTuple(21), Version
);
2309 EXPECT_EQ(Triple::Android
, T
.getEnvironment());
2312 TEST(TripleTest
, isMacOSVersionLT
) {
2313 Triple T
= Triple("x86_64-apple-macos11");
2314 EXPECT_TRUE(T
.isMacOSXVersionLT(11, 1, 0));
2315 EXPECT_FALSE(T
.isMacOSXVersionLT(10, 15, 0));
2317 T
= Triple("x86_64-apple-darwin20");
2318 EXPECT_TRUE(T
.isMacOSXVersionLT(11, 1, 0));
2319 EXPECT_FALSE(T
.isMacOSXVersionLT(11, 0, 0));
2320 EXPECT_FALSE(T
.isMacOSXVersionLT(10, 15, 0));
2323 TEST(TripleTest
, CanonicalizeOSVersion
) {
2324 EXPECT_EQ(VersionTuple(10, 15, 4),
2325 Triple::getCanonicalVersionForOS(Triple::MacOSX
,
2326 VersionTuple(10, 15, 4)));
2327 EXPECT_EQ(VersionTuple(11, 0), Triple::getCanonicalVersionForOS(
2328 Triple::MacOSX
, VersionTuple(10, 16)));
2329 EXPECT_EQ(VersionTuple(20),
2330 Triple::getCanonicalVersionForOS(Triple::Darwin
, VersionTuple(20)));
2333 TEST(TripleTest
, FileFormat
) {
2334 EXPECT_EQ(Triple::ELF
, Triple("i686-unknown-linux-gnu").getObjectFormat());
2335 EXPECT_EQ(Triple::ELF
, Triple("i686-unknown-freebsd").getObjectFormat());
2336 EXPECT_EQ(Triple::ELF
, Triple("i686-unknown-netbsd").getObjectFormat());
2337 EXPECT_EQ(Triple::ELF
, Triple("i686--win32-elf").getObjectFormat());
2338 EXPECT_EQ(Triple::ELF
, Triple("i686---elf").getObjectFormat());
2340 EXPECT_EQ(Triple::MachO
, Triple("i686-apple-macosx").getObjectFormat());
2341 EXPECT_EQ(Triple::MachO
, Triple("i686-apple-ios").getObjectFormat());
2342 EXPECT_EQ(Triple::MachO
, Triple("i686---macho").getObjectFormat());
2343 EXPECT_EQ(Triple::MachO
, Triple("powerpc-apple-macosx").getObjectFormat());
2345 EXPECT_EQ(Triple::COFF
, Triple("i686--win32").getObjectFormat());
2347 EXPECT_EQ(Triple::ELF
, Triple("i686-pc-windows-msvc-elf").getObjectFormat());
2348 EXPECT_EQ(Triple::ELF
, Triple("i686-pc-cygwin-elf").getObjectFormat());
2350 EXPECT_EQ(Triple::ELF
, Triple("systemz-ibm-linux").getObjectFormat());
2351 EXPECT_EQ(Triple::ELF
, Triple("systemz-ibm-unknown").getObjectFormat());
2353 EXPECT_EQ(Triple::GOFF
, Triple("s390x-ibm-zos").getObjectFormat());
2354 EXPECT_EQ(Triple::GOFF
, Triple("systemz-ibm-zos").getObjectFormat());
2355 EXPECT_EQ(Triple::GOFF
, Triple("s390x-ibm-zos-goff").getObjectFormat());
2356 EXPECT_EQ(Triple::GOFF
, Triple("s390x-unknown-zos-goff").getObjectFormat());
2357 EXPECT_EQ(Triple::GOFF
, Triple("s390x---goff").getObjectFormat());
2359 EXPECT_EQ(Triple::Wasm
, Triple("wasm32-unknown-unknown").getObjectFormat());
2360 EXPECT_EQ(Triple::Wasm
, Triple("wasm64-unknown-unknown").getObjectFormat());
2361 EXPECT_EQ(Triple::Wasm
, Triple("wasm32-wasi").getObjectFormat());
2362 EXPECT_EQ(Triple::Wasm
, Triple("wasm64-wasi").getObjectFormat());
2363 EXPECT_EQ(Triple::Wasm
, Triple("wasm32-unknown-wasi").getObjectFormat());
2364 EXPECT_EQ(Triple::Wasm
, Triple("wasm64-unknown-wasi").getObjectFormat());
2366 EXPECT_EQ(Triple::Wasm
,
2367 Triple("wasm32-unknown-unknown-wasm").getObjectFormat());
2368 EXPECT_EQ(Triple::Wasm
,
2369 Triple("wasm64-unknown-unknown-wasm").getObjectFormat());
2370 EXPECT_EQ(Triple::Wasm
,
2371 Triple("wasm32-wasi-wasm").getObjectFormat());
2372 EXPECT_EQ(Triple::Wasm
,
2373 Triple("wasm64-wasi-wasm").getObjectFormat());
2374 EXPECT_EQ(Triple::Wasm
,
2375 Triple("wasm32-unknown-wasi-wasm").getObjectFormat());
2376 EXPECT_EQ(Triple::Wasm
,
2377 Triple("wasm64-unknown-wasi-wasm").getObjectFormat());
2379 EXPECT_EQ(Triple::XCOFF
, Triple("powerpc-ibm-aix").getObjectFormat());
2380 EXPECT_EQ(Triple::XCOFF
, Triple("powerpc64-ibm-aix").getObjectFormat());
2381 EXPECT_EQ(Triple::XCOFF
, Triple("powerpc---xcoff").getObjectFormat());
2382 EXPECT_EQ(Triple::XCOFF
, Triple("powerpc64---xcoff").getObjectFormat());
2384 EXPECT_EQ(Triple::ELF
, Triple("csky-unknown-unknown").getObjectFormat());
2385 EXPECT_EQ(Triple::ELF
, Triple("csky-unknown-linux").getObjectFormat());
2387 EXPECT_EQ(Triple::SPIRV
, Triple("spirv-unknown-unknown").getObjectFormat());
2388 EXPECT_EQ(Triple::SPIRV
, Triple("spirv32-unknown-unknown").getObjectFormat());
2389 EXPECT_EQ(Triple::SPIRV
, Triple("spirv64-unknown-unknown").getObjectFormat());
2391 EXPECT_EQ(Triple::ELF
,
2392 Triple("loongarch32-unknown-unknown").getObjectFormat());
2393 EXPECT_EQ(Triple::ELF
, Triple("loongarch64-unknown-linux").getObjectFormat());
2395 Triple
MSVCNormalized(Triple::normalize("i686-pc-windows-msvc-elf"));
2396 EXPECT_EQ(Triple::ELF
, MSVCNormalized
.getObjectFormat());
2398 Triple
GNUWindowsNormalized(Triple::normalize("i686-pc-windows-gnu-elf"));
2399 EXPECT_EQ(Triple::ELF
, GNUWindowsNormalized
.getObjectFormat());
2401 Triple
CygnusNormalised(Triple::normalize("i686-pc-windows-cygnus-elf"));
2402 EXPECT_EQ(Triple::ELF
, CygnusNormalised
.getObjectFormat());
2404 Triple
CygwinNormalized(Triple::normalize("i686-pc-cygwin-elf"));
2405 EXPECT_EQ(Triple::ELF
, CygwinNormalized
.getObjectFormat());
2407 EXPECT_EQ(Triple::DXContainer
,
2408 Triple("dxil-unknown-shadermodel").getObjectFormat());
2410 Triple T
= Triple("");
2411 T
.setObjectFormat(Triple::ELF
);
2412 EXPECT_EQ(Triple::ELF
, T
.getObjectFormat());
2413 EXPECT_EQ("elf", Triple::getObjectFormatTypeName(T
.getObjectFormat()));
2415 T
.setObjectFormat(Triple::MachO
);
2416 EXPECT_EQ(Triple::MachO
, T
.getObjectFormat());
2417 EXPECT_EQ("macho", Triple::getObjectFormatTypeName(T
.getObjectFormat()));
2419 T
.setObjectFormat(Triple::XCOFF
);
2420 EXPECT_EQ(Triple::XCOFF
, T
.getObjectFormat());
2421 EXPECT_EQ("xcoff", Triple::getObjectFormatTypeName(T
.getObjectFormat()));
2423 T
.setObjectFormat(Triple::GOFF
);
2424 EXPECT_EQ(Triple::GOFF
, T
.getObjectFormat());
2425 EXPECT_EQ("goff", Triple::getObjectFormatTypeName(T
.getObjectFormat()));
2427 T
.setObjectFormat(Triple::SPIRV
);
2428 EXPECT_EQ(Triple::SPIRV
, T
.getObjectFormat());
2429 EXPECT_EQ("spirv", Triple::getObjectFormatTypeName(T
.getObjectFormat()));
2431 EXPECT_EQ(Triple::ELF
, Triple("amdgcn-apple-macosx").getObjectFormat());
2432 EXPECT_EQ(Triple::ELF
, Triple("r600-apple-macosx").getObjectFormat());
2433 EXPECT_EQ(Triple::SPIRV
, Triple("spirv-apple-macosx").getObjectFormat());
2434 EXPECT_EQ(Triple::SPIRV
, Triple("spirv32-apple-macosx").getObjectFormat());
2435 EXPECT_EQ(Triple::SPIRV
, Triple("spirv64-apple-macosx").getObjectFormat());
2436 EXPECT_EQ(Triple::DXContainer
, Triple("dxil-apple-macosx").getObjectFormat());
2439 TEST(TripleTest
, NormalizeWindows
) {
2440 EXPECT_EQ("i686-pc-windows-msvc", Triple::normalize("i686-pc-win32"));
2441 EXPECT_EQ("i686-unknown-windows-msvc", Triple::normalize("i686-win32"));
2442 EXPECT_EQ("i686-pc-windows-gnu", Triple::normalize("i686-pc-mingw32"));
2443 EXPECT_EQ("i686-unknown-windows-gnu", Triple::normalize("i686-mingw32"));
2444 EXPECT_EQ("i686-pc-windows-gnu", Triple::normalize("i686-pc-mingw32-w64"));
2445 EXPECT_EQ("i686-unknown-windows-gnu", Triple::normalize("i686-mingw32-w64"));
2446 EXPECT_EQ("i686-pc-windows-cygnus", Triple::normalize("i686-pc-cygwin"));
2447 EXPECT_EQ("i686-unknown-windows-cygnus", Triple::normalize("i686-cygwin"));
2449 EXPECT_EQ("x86_64-pc-windows-msvc", Triple::normalize("x86_64-pc-win32"));
2450 EXPECT_EQ("x86_64-unknown-windows-msvc", Triple::normalize("x86_64-win32"));
2451 EXPECT_EQ("x86_64-pc-windows-gnu", Triple::normalize("x86_64-pc-mingw32"));
2452 EXPECT_EQ("x86_64-unknown-windows-gnu", Triple::normalize("x86_64-mingw32"));
2453 EXPECT_EQ("x86_64-pc-windows-gnu",
2454 Triple::normalize("x86_64-pc-mingw32-w64"));
2455 EXPECT_EQ("x86_64-unknown-windows-gnu",
2456 Triple::normalize("x86_64-mingw32-w64"));
2458 EXPECT_EQ("i686-pc-windows-elf", Triple::normalize("i686-pc-win32-elf"));
2459 EXPECT_EQ("i686-unknown-windows-elf", Triple::normalize("i686-win32-elf"));
2460 EXPECT_EQ("i686-pc-windows-macho", Triple::normalize("i686-pc-win32-macho"));
2461 EXPECT_EQ("i686-unknown-windows-macho",
2462 Triple::normalize("i686-win32-macho"));
2464 EXPECT_EQ("x86_64-pc-windows-elf", Triple::normalize("x86_64-pc-win32-elf"));
2465 EXPECT_EQ("x86_64-unknown-windows-elf",
2466 Triple::normalize("x86_64-win32-elf"));
2467 EXPECT_EQ("x86_64-pc-windows-macho",
2468 Triple::normalize("x86_64-pc-win32-macho"));
2469 EXPECT_EQ("x86_64-unknown-windows-macho",
2470 Triple::normalize("x86_64-win32-macho"));
2472 EXPECT_EQ("i686-pc-windows-cygnus",
2473 Triple::normalize("i686-pc-windows-cygnus"));
2474 EXPECT_EQ("i686-pc-windows-gnu", Triple::normalize("i686-pc-windows-gnu"));
2475 EXPECT_EQ("i686-pc-windows-itanium",
2476 Triple::normalize("i686-pc-windows-itanium"));
2477 EXPECT_EQ("i686-pc-windows-msvc", Triple::normalize("i686-pc-windows-msvc"));
2479 EXPECT_EQ("i686-pc-windows-elf",
2480 Triple::normalize("i686-pc-windows-elf-elf"));
2482 EXPECT_TRUE(Triple("x86_64-pc-win32").isWindowsMSVCEnvironment());
2484 EXPECT_TRUE(Triple(Triple::normalize("mipsel-windows-msvccoff")).isOSBinFormatCOFF());
2485 EXPECT_TRUE(Triple(Triple::normalize("mipsel-windows-msvc")).isOSBinFormatCOFF());
2486 EXPECT_TRUE(Triple(Triple::normalize("mipsel-windows-gnu")).isOSBinFormatCOFF());
2489 TEST(TripleTest
, NormalizeAndroid
) {
2490 EXPECT_EQ("arm-unknown-linux-android16",
2491 Triple::normalize("arm-linux-androideabi16"));
2492 EXPECT_EQ("armv7a-unknown-linux-android",
2493 Triple::normalize("armv7a-linux-androideabi"));
2494 EXPECT_EQ("aarch64-unknown-linux-android21",
2495 Triple::normalize("aarch64-linux-android21"));
2498 TEST(TripleTest
, NormalizeARM
) {
2499 EXPECT_EQ("armv6-unknown-netbsd-eabi",
2500 Triple::normalize("armv6-netbsd-eabi"));
2501 EXPECT_EQ("armv7-unknown-netbsd-eabi",
2502 Triple::normalize("armv7-netbsd-eabi"));
2503 EXPECT_EQ("armv6eb-unknown-netbsd-eabi",
2504 Triple::normalize("armv6eb-netbsd-eabi"));
2505 EXPECT_EQ("armv7eb-unknown-netbsd-eabi",
2506 Triple::normalize("armv7eb-netbsd-eabi"));
2507 EXPECT_EQ("armv6-unknown-netbsd-eabihf",
2508 Triple::normalize("armv6-netbsd-eabihf"));
2509 EXPECT_EQ("armv7-unknown-netbsd-eabihf",
2510 Triple::normalize("armv7-netbsd-eabihf"));
2511 EXPECT_EQ("armv6eb-unknown-netbsd-eabihf",
2512 Triple::normalize("armv6eb-netbsd-eabihf"));
2513 EXPECT_EQ("armv7eb-unknown-netbsd-eabihf",
2514 Triple::normalize("armv7eb-netbsd-eabihf"));
2516 EXPECT_EQ("armv7-suse-linux-gnueabihf",
2517 Triple::normalize("armv7-suse-linux-gnueabi"));
2520 T
= Triple("armv6--netbsd-eabi");
2521 EXPECT_EQ(Triple::arm
, T
.getArch());
2522 T
= Triple("armv6eb--netbsd-eabi");
2523 EXPECT_EQ(Triple::armeb
, T
.getArch());
2524 T
= Triple("armv7-suse-linux-gnueabihf");
2525 EXPECT_EQ(Triple::GNUEABIHF
, T
.getEnvironment());
2528 TEST(TripleTest
, ParseARMArch
) {
2531 Triple T
= Triple("arm");
2532 EXPECT_EQ(Triple::arm
, T
.getArch());
2535 Triple T
= Triple("armeb");
2536 EXPECT_EQ(Triple::armeb
, T
.getArch());
2540 Triple T
= Triple("thumb");
2541 EXPECT_EQ(Triple::thumb
, T
.getArch());
2544 Triple T
= Triple("thumbeb");
2545 EXPECT_EQ(Triple::thumbeb
, T
.getArch());
2549 Triple T
= Triple("arm64");
2550 EXPECT_EQ(Triple::aarch64
, T
.getArch());
2553 Triple T
= Triple("arm64_32");
2554 EXPECT_EQ(Triple::aarch64_32
, T
.getArch());
2557 Triple T
= Triple("aarch64");
2558 EXPECT_EQ(Triple::aarch64
, T
.getArch());
2561 Triple T
= Triple("aarch64_be");
2562 EXPECT_EQ(Triple::aarch64_be
, T
.getArch());
2565 Triple T
= Triple("arm64e");
2566 EXPECT_EQ(Triple::aarch64
, T
.getArch());
2567 EXPECT_EQ(Triple::AArch64SubArch_arm64e
, T
.getSubArch());
2570 Triple T
= Triple("arm64ec");
2571 EXPECT_EQ(Triple::aarch64
, T
.getArch());
2572 EXPECT_EQ(Triple::AArch64SubArch_arm64ec
, T
.getSubArch());
2576 T
.setArch(Triple::aarch64
, Triple::AArch64SubArch_arm64ec
);
2577 EXPECT_EQ("arm64ec", T
.getArchName());
2581 TEST(TripleTest
, isArmT32
) {
2584 Triple T
= Triple("thumbv6m");
2585 EXPECT_FALSE(T
.isArmT32());
2588 Triple T
= Triple("armv8m.base");
2589 EXPECT_FALSE(T
.isArmT32());
2592 Triple T
= Triple("armv7s");
2593 EXPECT_FALSE(T
.isArmT32());
2596 Triple T
= Triple("armv7k");
2597 EXPECT_FALSE(T
.isArmT32());
2600 Triple T
= Triple("armv7ve");
2601 EXPECT_FALSE(T
.isArmT32());
2604 Triple T
= Triple("armv6");
2605 EXPECT_FALSE(T
.isArmT32());
2608 Triple T
= Triple("armv6m");
2609 EXPECT_FALSE(T
.isArmT32());
2612 Triple T
= Triple("armv6k");
2613 EXPECT_FALSE(T
.isArmT32());
2616 Triple T
= Triple("armv6t2");
2617 EXPECT_FALSE(T
.isArmT32());
2620 Triple T
= Triple("armv5");
2621 EXPECT_FALSE(T
.isArmT32());
2624 Triple T
= Triple("armv5te");
2625 EXPECT_FALSE(T
.isArmT32());
2628 Triple T
= Triple("armv4t");
2629 EXPECT_FALSE(T
.isArmT32());
2634 Triple T
= Triple("arm");
2635 EXPECT_TRUE(T
.isArmT32());
2638 Triple T
= Triple("armv7m");
2639 EXPECT_TRUE(T
.isArmT32());
2642 Triple T
= Triple("armv7em");
2643 EXPECT_TRUE(T
.isArmT32());
2646 Triple T
= Triple("armv8m.main");
2647 EXPECT_TRUE(T
.isArmT32());
2650 Triple T
= Triple("armv8.1m.main");
2651 EXPECT_TRUE(T
.isArmT32());
2655 TEST(TripleTest
, isArmMClass
) {
2658 Triple T
= Triple("armv7s");
2659 EXPECT_FALSE(T
.isArmMClass());
2662 Triple T
= Triple("armv7k");
2663 EXPECT_FALSE(T
.isArmMClass());
2666 Triple T
= Triple("armv7ve");
2667 EXPECT_FALSE(T
.isArmMClass());
2670 Triple T
= Triple("armv6");
2671 EXPECT_FALSE(T
.isArmMClass());
2674 Triple T
= Triple("armv6k");
2675 EXPECT_FALSE(T
.isArmMClass());
2678 Triple T
= Triple("armv6t2");
2679 EXPECT_FALSE(T
.isArmMClass());
2682 Triple T
= Triple("armv5");
2683 EXPECT_FALSE(T
.isArmMClass());
2686 Triple T
= Triple("armv5te");
2687 EXPECT_FALSE(T
.isArmMClass());
2690 Triple T
= Triple("armv4t");
2691 EXPECT_FALSE(T
.isArmMClass());
2694 Triple T
= Triple("arm");
2695 EXPECT_FALSE(T
.isArmMClass());
2700 Triple T
= Triple("armv6m");
2701 EXPECT_TRUE(T
.isArmMClass());
2704 Triple T
= Triple("armv7m");
2705 EXPECT_TRUE(T
.isArmMClass());
2708 Triple T
= Triple("armv7em");
2709 EXPECT_TRUE(T
.isArmMClass());
2712 Triple T
= Triple("armv8m.base");
2713 EXPECT_TRUE(T
.isArmMClass());
2716 Triple T
= Triple("armv8m.main");
2717 EXPECT_TRUE(T
.isArmMClass());
2720 Triple T
= Triple("armv8.1m.main");
2721 EXPECT_TRUE(T
.isArmMClass());
2725 TEST(TripleTest
, DXILNormaizeWithVersion
) {
2726 EXPECT_EQ("dxilv1.0-unknown-shadermodel6.0",
2727 Triple::normalize("dxilv1.0--shadermodel6.0"));
2728 EXPECT_EQ("dxilv1.0-unknown-shadermodel6.0",
2729 Triple::normalize("dxil--shadermodel6.0"));
2730 EXPECT_EQ("dxilv1.1-unknown-shadermodel6.1-library",
2731 Triple::normalize("dxil-shadermodel6.1-unknown-library"));
2732 EXPECT_EQ("dxilv1.8-unknown-shadermodel6.x-unknown",
2733 Triple::normalize("dxil-unknown-shadermodel6.x-unknown"));
2734 EXPECT_EQ("dxilv1.8-unknown-shadermodel6.x-unknown",
2735 Triple::normalize("dxil-unknown-shadermodel6.x-unknown"));
2736 EXPECT_EQ("dxil-unknown-unknown-unknown", Triple::normalize("dxil---"));
2737 EXPECT_EQ("dxilv1.0-pc-shadermodel5.0-compute",
2738 Triple::normalize("dxil-shadermodel5.0-pc-compute"));
2740 } // end anonymous namespace