1 // REQUIRES: x86-registered-target
2 
3 // expected-no-diagnostics
4 
5 // We support -m32 and -m64.  We support all x86 CPU feature flags in gcc's -m
6 // flag space.
7 // RUN: %clang_cl /Zs /WX -m32 -m64 -msse3 -msse4.1 -mavx -mno-avx \
8 // RUN:     --target=i386-pc-win32 -### -- 2>&1 %s | FileCheck -check-prefix=MFLAGS %s
9 // MFLAGS-NOT: argument unused during compilation
10 
11 // RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_IA32 -- %s
12 #if defined(TEST_32_ARCH_IA32)
13 #if _M_IX86_FP || __AVX__ || __AVX2__ || __AVX512F__  || __AVX512BW__
14 #error fail
15 #endif
16 #endif
17 
18 // arch: args are case-sensitive.
19 // RUN: %clang_cl -m32 -arch:ia32 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=ia32 %s
20 // ia32: argument unused during compilation
21 
22 // RUN: %clang_cl -m64 -arch:IA32 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=IA3264 %s
23 // IA3264: argument unused during compilation
24 
25 // RUN: %clang_cl -m32 -arch:SSE --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_SSE -- %s
26 #if defined(TEST_32_ARCH_SSE)
27 #if _M_IX86_FP != 1 || __AVX__ || __AVX2__ || __AVX512F__  || __AVX512BW__
28 #error fail
29 #endif
30 #endif
31 
32 // RUN: %clang_cl -m32 -arch:sse --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=sse %s
33 // sse: argument unused during compilation
34 
35 // RUN: %clang_cl -m32 -arch:SSE2 --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_SSE2 -- %s
36 #if defined(TEST_32_ARCH_SSE2)
37 #if _M_IX86_FP != 2 || __AVX__ || __AVX2__ || __AVX512F__  || __AVX512BW__
38 #error fail
39 #endif
40 #endif
41 
42 // RUN: %clang_cl -m32 -arch:sse2 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=sse %s
43 // sse2: argument unused during compilation
44 
45 // RUN: %clang_cl -m64 -arch:SSE --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=SSE64 %s
46 // SSE64: argument unused during compilation
47 
48 // RUN: %clang_cl -m64 -arch:SSE2 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=SSE264 %s
49 // SSE264: argument unused during compilation
50 
51 // RUN: %clang_cl -m32 -arch:AVX --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_AVX -- %s
52 #if defined(TEST_32_ARCH_AVX)
53 #if _M_IX86_FP != 2 || !__AVX__ || __AVX2__ || __AVX512F__  || __AVX512BW__
54 #error fail
55 #endif
56 #endif
57 
58 // RUN: %clang_cl -m32 -arch:avx --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx %s
59 // avx: argument unused during compilation
60 
61 // RUN: %clang_cl -m32 -arch:AVX2 --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_AVX2 -- %s
62 #if defined(TEST_32_ARCH_AVX2)
63 #if _M_IX86_FP != 2 || !__AVX__ || !__AVX2__ || __AVX512F__  || __AVX512BW__
64 #error fail
65 #endif
66 #endif
67 
68 // RUN: %clang_cl -m32 -arch:avx2 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx2 %s
69 // avx2: argument unused during compilation
70 
71 // RUN: %clang_cl -m32 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_AVX512F -- %s
72 #if defined(TEST_32_ARCH_AVX512F)
73 #if _M_IX86_FP != 2 || !__AVX__ || !__AVX2__ || !__AVX512F__  || __AVX512BW__
74 #error fail
75 #endif
76 #endif
77 
78 // RUN: %clang_cl -m32 -arch:avx512f --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx512f %s
79 // avx512f: argument unused during compilation
80 
81 // RUN: %clang_cl -m32 -arch:AVX512 --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_AVX512 -- %s
82 #if defined(TEST_32_ARCH_AVX512)
83 #if _M_IX86_FP != 2 || !__AVX__ || !__AVX2__ || !__AVX512F__  || !__AVX512BW__
84 #error fail
85 #endif
86 #endif
87 
88 // RUN: %clang_cl -m32 -arch:avx512 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx512 %s
89 // avx512: argument unused during compilation
90 
91 // RUN: %clang_cl -m64 -arch:AVX --target=x86_64-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_64_ARCH_AVX -- %s
92 #if defined(TEST_64_ARCH_AVX)
93 #if _M_IX86_FP || !__AVX__ || __AVX2__ || __AVX512F__  || __AVX512BW__
94 #error fail
95 #endif
96 #endif
97 
98 // RUN: %clang_cl -m64 -arch:avx --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx64 %s
99 // avx64: argument unused during compilation
100 
101 // RUN: %clang_cl -m64 -arch:AVX2 --target=x86_64-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_64_ARCH_AVX2 -- %s
102 #if defined(TEST_64_ARCH_AVX2)
103 #if _M_IX86_FP || !__AVX__ || !__AVX2__ || __AVX512F__  || __AVX512BW__
104 #error fail
105 #endif
106 #endif
107 
108 // RUN: %clang_cl -m64 -arch:avx2 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx264 %s
109 // avx264: argument unused during compilation
110 
111 // RUN: %clang_cl -m64 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_64_ARCH_AVX512F -- %s
112 #if defined(TEST_64_ARCH_AVX512F)
113 #if _M_IX86_FP || !__AVX__ || !__AVX2__ || !__AVX512F__  || __AVX512BW__
114 #error fail
115 #endif
116 #endif
117 
118 // RUN: %clang_cl -m64 -arch:avx512f --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx512f64 %s
119 // avx512f64: argument unused during compilation
120 
121 // RUN: %clang_cl -m64 -arch:AVX512 --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_64_ARCH_AVX512 -- %s
122 #if defined(TEST_64_ARCH_AVX512)
123 #if _M_IX86_FP || !__AVX__ || !__AVX2__ || !__AVX512F__  || !__AVX512BW__
124 #error fail
125 #endif
126 #endif
127 
128 // RUN: %clang_cl -m64 -arch:avx512 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx51264 %s
129 // avx51264: argument unused during compilation
130 
131 // RUN: %clang_cl -m64 -arch:AVX -tune:haswell --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=tune %s
132 // tune: "-target-cpu" "sandybridge"
133 // tune-SAME: "-tune-cpu" "haswell"
134 
f()135 void f() {
136 }
137