xref: /llvm-project/clang/test/Preprocessor/arm-target-features.c (revision 6b486f458fe40919577d9249fa754daa913795d1)
1 // RUN: %clang -target armv8a-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8A %s
2 // CHECK-V8A: #define __ARMEL__ 1
3 // CHECK-V8A: #define __ARM_ARCH 8
4 // CHECK-V8A: #define __ARM_ARCH_8A__ 1
5 // CHECK-V8A: #define __ARM_FEATURE_CRC32 1
6 // CHECK-V8A: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
7 // CHECK-V8A: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
8 // CHECK-V8A-NOT: #define __ARM_FP 0x
9 // CHECK-V8A-NOT: #define __ARM_FEATURE_DOTPROD
10 // CHECK-V8A-NOT: #define __ARM_BF16_FORMAT_ALTERNATIVE
11 // CHECK-V8A-NOT: #define __ARM_FEATURE_BF16
12 // CHECK-V8A-NOT: #define __ARM_FEATURE_BF16_VECTOR_ARITHMETIC
13 
14 // RUN: %clang -target armv8a-none-linux-gnueabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8A-ALLOW-FP-INSTR %s
15 // RUN: %clang -target armv8a-none-linux-gnueabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8A-ALLOW-FP-INSTR %s
16 // CHECK-V8A-ALLOW-FP-INSTR: #define __ARMEL__ 1
17 // CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_ARCH 8
18 // CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_ARCH_8A__ 1
19 // CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FEATURE_CRC32 1
20 // CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
21 // CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
22 // CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP 0xe
23 // CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_ARGS 1
24 // CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_FORMAT_IEEE 1
25 // CHECK-V8A-ALLOW-FP-INSTR-V8A-NOT: #define __ARM_FEATURE_DOTPROD
26 
27 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2-a+nofp16fml+fp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
28 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2-a+nofp16+fp16fml -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
29 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2-a+fp16+nofp16fml -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
30 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8-a+fp16fml -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
31 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8-a+fp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
32 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.4-a+nofp16fml+fp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
33 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.4-a+nofp16+fp16fml -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
34 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.4-a+fp16+nofp16fml -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
35 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.4-a+fp16fml -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
36 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.4-a+fp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
37 // CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
38 // CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
39 // CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FP 0xe
40 // CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FP16_FORMAT_IEEE 1
41 
42 // +fp16fml without neon doesn't make sense as the fp16fml instructions all require SIMD.
43 // However, as +fp16fml implies +fp16 there is a set of defines that we would expect.
44 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8-a+fp16fml -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SCALAR %s
45 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8-a+fp16 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SCALAR %s
46 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.4-a+fp16fml -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SCALAR %s
47 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.4-a+fp16 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SCALAR %s
48 // CHECK-FULLFP16-SCALAR:       #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
49 // CHECK-FULLFP16-SCALAR-NOT:   #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
50 // CHECK-FULLFP16-SCALAR:       #define __ARM_FP 0xe
51 // CHECK-FULLFP16-SCALAR:       #define __ARM_FP16_FORMAT_IEEE 1
52 
53 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2-a -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-NOFML-VECTOR-SCALAR %s
54 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2-a+nofp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-NOFML-VECTOR-SCALAR %s
55 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2-a+nofp16fml -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-NOFML-VECTOR-SCALAR %s
56 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2-a+fp16fml+nofp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-NOFML-VECTOR-SCALAR %s
57 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.4-a -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-NOFML-VECTOR-SCALAR %s
58 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.4-a+nofp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-NOFML-VECTOR-SCALAR %s
59 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.4-a+nofp16fml -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-NOFML-VECTOR-SCALAR %s
60 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.4-a+fp16fml+nofp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-NOFML-VECTOR-SCALAR %s
61 // CHECK-FULLFP16-NOFML-VECTOR-SCALAR-NOT: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
62 // CHECK-FULLFP16-NOFML-VECTOR-SCALAR-NOT: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
63 // CHECK-FULLFP16-NOFML-VECTOR-SCALAR: #define __ARM_FP 0xe
64 // CHECK-FULLFP16-NOFML-VECTOR-SCALAR: #define __ARM_FP16_FORMAT_IEEE 1
65 
66 // RUN: %clang -target arm -march=armv8-a+fp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SOFT %s
67 // RUN: %clang -target arm -march=armv8-a+fp16fml -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SOFT %s
68 // RUN: %clang -target arm -march=armv8-a+fp16+fp16fml -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SOFT %s
69 // RUN: %clang -target arm -march=armv8-a+fp16fml+fp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SOFT %s
70 // RUN: %clang -target arm -march=armv8.4-a+fp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SOFT %s
71 // RUN: %clang -target arm -march=armv8.4-a+fp16fml -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SOFT %s
72 // RUN: %clang -target arm -march=armv8.4-a+fp16+fp16fml -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SOFT %s
73 // RUN: %clang -target arm -march=armv8.4-a+fp16fml+fp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SOFT %s
74 // CHECK-FULLFP16-SOFT-NOT: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC
75 // CHECK-FULLFP16-SOFT-NOT: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
76 // CHECK-FULLFP16-SOFT-NOT: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC
77 // CHECK-FULLFP16-SOFT-NOT: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
78 
79 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2a+dotprod -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-DOTPROD %s
80 // CHECK-DOTPROD: #define __ARM_FEATURE_DOTPROD 1
81 
82 // RUN: %clang -target armv8r-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8R %s
83 // CHECK-V8R: #define __ARMEL__ 1
84 // CHECK-V8R: #define __ARM_ARCH 8
85 // CHECK-V8R: #define __ARM_ARCH_8R__ 1
86 // CHECK-V8R: #define __ARM_FEATURE_CRC32 1
87 // CHECK-V8R: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
88 // CHECK-V8R: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
89 // CHECK-V8R-NOT: #define __ARM_FP 0x
90 
91 // RUN: %clang -target armv8r-none-linux-gnueabi -mcpu=cortex-r52 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8R-ALLOW-FP-INSTR %s
92 // RUN: %clang -target armv8r-none-linux-gnueabihf -mcpu=cortex-r52 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8R-ALLOW-FP-INSTR %s
93 // CHECK-V8R-ALLOW-FP-INSTR: #define __ARMEL__ 1
94 // CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_ARCH 8
95 // CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_ARCH_8R__ 1
96 // CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FEATURE_CRC32 1
97 // CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
98 // CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
99 // CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FP 0xe
100 
101 // RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7 %s
102 // CHECK-V7: #define __ARMEL__ 1
103 // CHECK-V7: #define __ARM_ARCH 7
104 // CHECK-V7: #define __ARM_ARCH_7A__ 1
105 // CHECK-V7-NOT: __ARM_FEATURE_CRC32
106 // CHECK-V7-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
107 // CHECK-V7-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
108 // CHECK-V7-NOT: #define __ARM_FP 0x
109 
110 // RUN: %clang -target armv7a-none-linux-gnueabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7-ALLOW-FP-INSTR %s
111 // RUN: %clang -target armv7a-none-linux-gnueabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7-ALLOW-FP-INSTR %s
112 // CHECK-V7-ALLOW-FP-INSTR: #define __ARMEL__ 1
113 // CHECK-V7-ALLOW-FP-INSTR: #define __ARM_ARCH 7
114 // CHECK-V7-ALLOW-FP-INSTR: #define __ARM_ARCH_7A__ 1
115 // CHECK-V7-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
116 // CHECK-V7-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
117 // CHECK-V7-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
118 // CHECK-V7-ALLOW-FP-INSTR: #define __ARM_FP 0xc
119 
120 // RUN: %clang -target armv7ve-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7VE %s
121 // CHECK-V7VE: #define __ARMEL__ 1
122 // CHECK-V7VE: #define __ARM_ARCH 7
123 // CHECK-V7VE: #define __ARM_ARCH_7VE__ 1
124 // CHECK-V7VE: #define __ARM_ARCH_EXT_IDIV__ 1
125 // CHECK-V7VE-NOT: #define __ARM_FP 0x
126 
127 // RUN: %clang -target armv7ve-none-linux-gnueabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7VE-DEFAULT-ABI-SOFT %s
128 // RUN: %clang -target armv7ve-none-linux-gnueabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7VE-DEFAULT-ABI-SOFT %s
129 // CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARMEL__ 1
130 // CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_ARCH 7
131 // CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_ARCH_7VE__ 1
132 // CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_ARCH_EXT_IDIV__ 1
133 // CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_FP 0xc
134 
135 // RUN: %clang -target x86_64-apple-macosx10.10 -arch armv7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-DARWIN-V7 %s
136 // CHECK-DARWIN-V7: #define __ARMEL__ 1
137 // CHECK-DARWIN-V7: #define __ARM_ARCH 7
138 // CHECK-DARWIN-V7: #define __ARM_ARCH_7A__ 1
139 // CHECK-DARWIN-V7-NOT: __ARM_FEATURE_CRC32
140 // CHECK-DARWIN-V7-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
141 // CHECK-DARWIN-V7-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
142 // CHECK-DARWIN-V7: #define __ARM_FP 0xc
143 // CHECK-DARWIN-V7: #define __ARM_NEON 1
144 // CHECK-DARWIN-V7: #define __ARM_NEON_FP 0x4
145 // CHECK-DARWIN-V7: #define __ARM_NEON__ 1
146 
147 // RUN: %clang -target armv7-windows -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-WINDOWS-V7 %s
148 // CHECK-WINDOWS-V7: #define __ARMEL__ 1
149 // CHECK-WINDOWS-V7: #define __ARM_ARCH 7
150 // CHECK-WINDOWS-V7: #define __ARM_ARCH_7A__ 1
151 // CHECK-WINDOWS-V7-NOT: __ARM_FEATURE_CRC32
152 // CHECK-WINDOWS-V7-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
153 // CHECK-WINDOWS-V7-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
154 // CHECK-WINDOWS-V7: #define __ARM_FP 0xe
155 // CHECK-WINDOWS-V7: #define __ARM_NEON 1
156 // CHECK-WINDOWS-V7: #define __ARM_NEON_FP 0x6
157 // CHECK-WINDOWS-V7: #define __ARM_NEON__ 1
158 
159 // RUN: %clang -target x86_64-apple-macosx10.10 -arch armv7s -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7S %s
160 // CHECK-V7S: #define __ARMEL__ 1
161 // CHECK-V7S: #define __ARM_ARCH 7
162 // CHECK-V7S: #define __ARM_ARCH_7S__ 1
163 // CHECK-V7S-NOT: __ARM_FEATURE_CRC32
164 // CHECK-V7S-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
165 // CHECK-V7S-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
166 // CHECK-V7S: #define __ARM_FP 0xe
167 // CHECK-V7S: #define __ARM_NEON 1
168 // CHECK-V7S: #define __ARM_NEON_FP 0x6
169 // CHECK-V7S: #define __ARM_NEON__ 1
170 
171 // RUN: %clang -target arm-arm-none-eabi -march=armv7-m -mfloat-abi=soft -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-VFP-FP %s
172 // RUN: %clang -target arm-arm-none-eabi -march=armv7-m -mfloat-abi=softfp -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-VFP-FP %s
173 // RUN: %clang -target arm-arm-none-eabi -march=armv7-m -mfloat-abi=hard -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-VFP-FP %s
174 // CHECK-VFP-FP: #define __VFP_FP__ 1
175 
176 // RUN: %clang -target armv8a -mfloat-abi=hard -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-BAREHF %s
177 // CHECK-V8-BAREHF: #define __ARMEL__ 1
178 // CHECK-V8-BAREHF: #define __ARM_ARCH 8
179 // CHECK-V8-BAREHF: #define __ARM_ARCH_8A__ 1
180 // CHECK-V8-BAREHF: #define __ARM_FEATURE_CRC32 1
181 // CHECK-V8-BAREHF: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
182 // CHECK-V8-BAREHF: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
183 // CHECK-V8-BAREHP: #define __ARM_FP 0xe
184 // CHECK-V8-BAREHF: #define __ARM_NEON__ 1
185 // CHECK-V8-BAREHF: #define __ARM_PCS_VFP 1
186 // CHECK-V8-BAREHF: #define __VFP_FP__ 1
187 
188 // RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=fp-armv8 -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-BAREHF-FP %s
189 // CHECK-V8-BAREHF-FP-NOT: __ARM_NEON__ 1
190 // CHECK-V8-BAREHP-FP: #define __ARM_FP 0xe
191 // CHECK-V8-BAREHF-FP: #define __VFP_FP__ 1
192 
193 // RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=neon-fp-armv8 -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-BAREHF-NEON-FP %s
194 // RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=crypto-neon-fp-armv8 -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-BAREHF-NEON-FP %s
195 // CHECK-V8-BAREHP-NEON-FP: #define __ARM_FP 0xe
196 // CHECK-V8-BAREHF-NEON-FP: #define __ARM_NEON__ 1
197 // CHECK-V8-BAREHF-NEON-FP: #define __VFP_FP__ 1
198 
199 // RUN: %clang -target armv8a -mnocrc -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-NOCRC %s
200 // CHECK-V8-NOCRC-NOT: __ARM_FEATURE_CRC32 1
201 
202 // Check that -mhwdiv works properly for armv8/thumbv8 (enabled by default).
203 
204 // RUN: %clang -target armv8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
205 // RUN: %clang -target armv8 -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
206 // RUN: %clang -target armv8-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
207 // RUN: %clang -target armv8-eabi -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
208 // V8:#define __ARM_ARCH_EXT_IDIV__ 1
209 
210 // RUN: %clang -target armv8 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
211 // RUN: %clang -target armv8 -mthumb -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
212 // RUN: %clang -target armv8 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
213 // RUN: %clang -target armv8 -mthumb -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
214 // NOHWDIV-V8-NOT:#define __ARM_ARCH_EXT_IDIV__
215 
216 // RUN: %clang -target armv8a -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
217 // RUN: %clang -target armv8a -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
218 // V8A:#define __ARM_ARCH_EXT_IDIV__ 1
219 // V8A-NOT:#define __ARM_FP 0x
220 
221 // RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
222 // RUN: %clang -target armv8a-eabi -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
223 // RUN: %clang -target armv8a-eabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
224 // RUN: %clang -target armv8a-eabihf -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
225 // V8A-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
226 // V8A-ALLOW-FP-INSTR:#define __ARM_FP 0xe
227 
228 // RUN: %clang -target armv8m.base-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_BASELINE %s
229 // V8M_BASELINE: #define __ARM_ARCH 8
230 // V8M_BASELINE: #define __ARM_ARCH_8M_BASE__ 1
231 // V8M_BASELINE: #define __ARM_ARCH_EXT_IDIV__ 1
232 // V8M_BASELINE-NOT: __ARM_ARCH_ISA_ARM
233 // V8M_BASELINE: #define __ARM_ARCH_ISA_THUMB 1
234 // V8M_BASELINE: #define __ARM_ARCH_PROFILE 'M'
235 // V8M_BASELINE-NOT: __ARM_FEATURE_CRC32
236 // V8M_BASELINE: #define __ARM_FEATURE_CMSE 1
237 // V8M_BASELINE-NOT: __ARM_FEATURE_DSP
238 // V8M_BASELINE-NOT: __ARM_FP 0x{{.*}}
239 // V8M_BASELINE-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
240 
241 // RUN: %clang -target armv8m.main-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_MAINLINE %s
242 // V8M_MAINLINE: #define __ARM_ARCH 8
243 // V8M_MAINLINE: #define __ARM_ARCH_8M_MAIN__ 1
244 // V8M_MAINLINE: #define __ARM_ARCH_EXT_IDIV__ 1
245 // V8M_MAINLINE-NOT: __ARM_ARCH_ISA_ARM
246 // V8M_MAINLINE: #define __ARM_ARCH_ISA_THUMB 2
247 // V8M_MAINLINE: #define __ARM_ARCH_PROFILE 'M'
248 // V8M_MAINLINE-NOT: __ARM_FEATURE_CRC32
249 // V8M_MAINLINE: #define __ARM_FEATURE_CMSE 1
250 // V8M_MAINLINE-NOT: __ARM_FEATURE_DSP
251 // V8M_MAINLINE-NOT: #define __ARM_FP 0x
252 // V8M_MAINLINE: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
253 
254 // RUN: %clang -target armv8m.main-none-linux-gnueabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M-MAINLINE-ALLOW-FP-INSTR %s
255 // RUN: %clang -target armv8m.main-none-linux-gnueabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M-MAINLINE-ALLOW-FP-INSTR %s
256 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH 8
257 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
258 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
259 // V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
260 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
261 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
262 // V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
263 // V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_DSP
264 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_FP 0xe
265 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
266 
267 // RUN: %clang -target arm-none-linux-gnu -march=armv8-m.main+dsp -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_MAINLINE_DSP %s
268 // V8M_MAINLINE_DSP: #define __ARM_ARCH 8
269 // V8M_MAINLINE_DSP: #define __ARM_ARCH_8M_MAIN__ 1
270 // V8M_MAINLINE_DSP: #define __ARM_ARCH_EXT_IDIV__ 1
271 // V8M_MAINLINE_DSP-NOT: __ARM_ARCH_ISA_ARM
272 // V8M_MAINLINE_DSP: #define __ARM_ARCH_ISA_THUMB 2
273 // V8M_MAINLINE_DSP: #define __ARM_ARCH_PROFILE 'M'
274 // V8M_MAINLINE_DSP-NOT: __ARM_FEATURE_CRC32
275 // V8M_MAINLINE_DSP: #define __ARM_FEATURE_DSP 1
276 // V8M_MAINLINE_DSP-NOT: #define __ARM_FP 0x
277 // V8M_MAINLINE_DSP: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
278 
279 // RUN: %clang -target arm-none-linux-gnueabi -march=armv8-m.main+dsp -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M-MAINLINE-DSP-ALLOW-FP-INSTR %s
280 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH 8
281 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
282 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
283 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
284 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
285 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
286 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
287 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_FEATURE_DSP 1
288 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_FP 0xe
289 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
290 
291 // RUN: %clang -target arm-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-DEFS %s
292 // CHECK-DEFS:#define __ARM_PCS 1
293 // CHECK-DEFS:#define __ARM_SIZEOF_MINIMAL_ENUM 4
294 // CHECK-DEFS:#define __ARM_SIZEOF_WCHAR_T 4
295 
296 // RUN: %clang -target arm-none-linux-gnu -fno-math-errno -fno-signed-zeros\
297 // RUN:        -fno-trapping-math -fassociative-math -freciprocal-math -fapprox-func\
298 // RUN:        -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FASTMATH %s
299 // RUN: %clang -target arm-none-linux-gnu -ffast-math -x c -E -dM %s -o -\
300 // RUN:        | FileCheck -match-full-lines --check-prefix=CHECK-FASTMATH %s
301 // CHECK-FASTMATH: #define __ARM_FP_FAST 1
302 
303 // RUN: %clang -target arm-none-linux-gnu -fshort-wchar -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-SHORTWCHAR %s
304 // CHECK-SHORTWCHAR:#define __ARM_SIZEOF_WCHAR_T 2
305 
306 // RUN: %clang -target arm-none-linux-gnu -fshort-enums -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-SHORTENUMS %s
307 // CHECK-SHORTENUMS:#define __ARM_SIZEOF_MINIMAL_ENUM 1
308 
309 // Test that -mhwdiv has the right effect for a target CPU which has hwdiv enabled by default.
310 // RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
311 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
312 // RUN: %clang -target armv7 -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
313 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
314 // HWDIV:#define __ARM_ARCH_EXT_IDIV__ 1
315 
316 // RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
317 // RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
318 // RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
319 // RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
320 // NOHWDIV-NOT:#define __ARM_ARCH_EXT_IDIV__
321 
322 
323 // Check that -mfpu works properly for Cortex-A7 (enabled by default).
324 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A7 %s
325 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A7 %s
326 // RUN: %clang -target armv7-none-linux-gnueabihf -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A7 %s
327 // RUN: %clang -target armv7-none-linux-gnueabihf -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A7 %s
328 // DEFAULTFPU-A7:#define __ARM_FP 0xe
329 // DEFAULTFPU-A7:#define __ARM_NEON__ 1
330 // DEFAULTFPU-A7:#define __ARM_VFPV4__ 1
331 
332 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -mfpu=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=FPUNONE-A7 %s
333 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -mfpu=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=FPUNONE-A7 %s
334 // FPUNONE-A7-NOT:#define __ARM_FP 0x{{.*}}
335 // FPUNONE-A7-NOT:#define __ARM_NEON__ 1
336 // FPUNONE-A7-NOT:#define __ARM_VFPV4__ 1
337 
338 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NONEON-A7 %s
339 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NONEON-A7 %s
340 // NONEON-A7:#define __ARM_FP 0xe
341 // NONEON-A7-NOT:#define __ARM_NEON__ 1
342 // NONEON-A7:#define __ARM_VFPV4__ 1
343 
344 // Check that -mfpu works properly for Cortex-A5 (enabled by default).
345 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A5 %s
346 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A5 %s
347 // DEFAULTFPU-A5:#define __ARM_FP 0xe
348 // DEFAULTFPU-A5:#define __ARM_NEON__ 1
349 // DEFAULTFPU-A5:#define __ARM_VFPV4__ 1
350 
351 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a5 -mfpu=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=FPUNONE-A5 %s
352 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a5 -mfpu=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=FPUNONE-A5 %s
353 // FPUNONE-A5-NOT:#define __ARM_FP 0x{{.*}}
354 // FPUNONE-A5-NOT:#define __ARM_NEON__ 1
355 // FPUNONE-A5-NOT:#define __ARM_VFPV4__ 1
356 
357 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a5 -mfpu=vfp4-d16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NONEON-A5 %s
358 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a5 -mfpu=vfp4-d16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NONEON-A5 %s
359 // NONEON-A5:#define __ARM_FP 0xe
360 // NONEON-A5-NOT:#define __ARM_NEON__ 1
361 // NONEON-A5:#define __ARM_VFPV4__ 1
362 
363 // FIXME: add check for further predefines
364 // Test whether predefines are as expected when targeting ep9312.
365 // RUN: %clang -target armv4t -mcpu=ep9312 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A4T %s
366 // A4T-NOT:#define __ARM_FEATURE_DSP
367 // A4T-NOT:#define __ARM_FP 0x{{.*}}
368 
369 // Test whether predefines are as expected when targeting arm10tdmi.
370 // RUN: %clang -target armv5 -mcpu=arm10tdmi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5T %s
371 // A5T-NOT:#define __ARM_FEATURE_DSP
372 // A5T-NOT:#define __ARM_FP 0x{{.*}}
373 
374 // Test whether predefines are as expected when targeting cortex-a5i (soft FP ABI as default).
375 // RUN: %clang -target armv7 -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5 %s
376 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5 %s
377 // A5:#define __ARM_ARCH 7
378 // A5:#define __ARM_ARCH_7A__ 1
379 // A5-NOT:#define __ARM_ARCH_EXT_IDIV__
380 // A5:#define __ARM_ARCH_PROFILE 'A'
381 // A5-NOT:#define __ARM_DWARF_EH__ 1
382 // A5-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING
383 // A5:#define __ARM_FEATURE_DSP 1
384 // A5-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN
385 // A5-NOT:#define __ARM_FP 0x
386 
387 // Test whether predefines are as expected when targeting cortex-a5 (softfp FP ABI as default).
388 // RUN: %clang -target armv7-eabi -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5-ALLOW-FP-INSTR %s
389 // RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5-ALLOW-FP-INSTR %s
390 // A5-ALLOW-FP-INSTR:#define __ARM_ARCH 7
391 // A5-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
392 // A5-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
393 // A5-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
394 // A5-ALLOW-FP-INSTR-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING
395 // A5-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
396 // A5-ALLOW-FP-INSTR-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN
397 // A5-ALLOW-FP-INSTR:#define __ARM_FP 0xe
398 
399 // Test whether predefines are as expected when targeting cortex-a7 (soft FP ABI as default).
400 // RUN: %clang -target armv7k -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7 %s
401 // RUN: %clang -target armv7k -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7 %s
402 // A7:#define __ARM_ARCH 7
403 // A7:#define __ARM_ARCH_EXT_IDIV__ 1
404 // A7:#define __ARM_ARCH_PROFILE 'A'
405 // A7-NOT:#define __ARM_DWARF_EH__ 1
406 // A7:#define __ARM_FEATURE_DSP 1
407 // A7-NOT:#define __ARM_FP 0x
408 
409 // Test whether predefines are as expected when targeting cortex-a7 (softfp FP ABI as default).
410 // RUN: %clang -target armv7k-eabi -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7-ALLOW-FP-INSTR %s
411 // RUN: %clang -target armv7k-eabi -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7-ALLOW-FP-INSTR %s
412 // A7-ALLOW-FP-INSTR:#define __ARM_ARCH 7
413 // A7-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
414 // A7-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
415 // A7-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
416 // A7-ALLOW-FP-INSTR:#define __ARM_FP 0xe
417 
418 // Test whether predefines are as expected when targeting cortex-a7.
419 // RUN: %clang -target x86_64-apple-darwin -arch armv7k -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV7K %s
420 // ARMV7K:#define __ARM_ARCH 7
421 // ARMV7K:#define __ARM_ARCH_EXT_IDIV__ 1
422 // ARMV7K:#define __ARM_ARCH_PROFILE 'A'
423 // ARMV7K:#define __ARM_DWARF_EH__ 1
424 // ARMV7K:#define __ARM_FEATURE_DSP 1
425 // ARMV7K:#define __ARM_FP 0xe
426 // ARMV7K:#define __ARM_PCS_VFP 1
427 
428 
429 // Test whether predefines are as expected when targeting cortex-a8 (soft FP ABI as default).
430 // RUN: %clang -target armv7 -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8 %s
431 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8 %s
432 // A8-NOT:#define __ARM_ARCH_EXT_IDIV__
433 // A8:#define __ARM_FEATURE_DSP 1
434 // A8-NOT:#define __ARM_FP 0x
435 
436 // Test whether predefines are as expected when targeting cortex-a8 (softfp FP ABI as default).
437 // RUN: %clang -target armv7-eabi -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8-ALLOW-FP-INSTR %s
438 // RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8-ALLOW-FP-INSTR %s
439 // A8-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
440 // A8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
441 // A8-ALLOW-FP-INSTR:#define __ARM_FP 0xc
442 
443 // Test whether predefines are as expected when targeting cortex-a9 (soft FP as default).
444 // RUN: %clang -target armv7 -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
445 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
446 // A9-NOT:#define __ARM_ARCH_EXT_IDIV__
447 // A9:#define __ARM_FEATURE_DSP 1
448 // A9-NOT:#define __ARM_FP 0x
449 
450 // Test whether predefines are as expected when targeting cortex-a9 (softfp FP as default).
451 // RUN: %clang -target armv7-eabi -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9-ALLOW-FP-INSTR %s
452 // RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9-ALLOW-FP-INSTR %s
453 // A9-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
454 // A9-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
455 // A9-ALLOW-FP-INSTR:#define __ARM_FP 0xe
456 
457 
458 // Check that -mfpu works properly for Cortex-A12 (enabled by default).
459 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A12 %s
460 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A12 %s
461 // DEFAULTFPU-A12:#define __ARM_FP 0xe
462 // DEFAULTFPU-A12:#define __ARM_NEON__ 1
463 // DEFAULTFPU-A12:#define __ARM_VFPV4__ 1
464 
465 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a12 -mfpu=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=FPUNONE-A12 %s
466 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a12 -mfpu=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=FPUNONE-A12 %s
467 // FPUNONE-A12-NOT:#define __ARM_FP 0x{{.*}}
468 // FPUNONE-A12-NOT:#define __ARM_NEON__ 1
469 // FPUNONE-A12-NOT:#define __ARM_VFPV4__ 1
470 
471 // Test whether predefines are as expected when targeting cortex-a12 (soft FP ABI as default).
472 // RUN: %clang -target armv7 -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12 %s
473 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12 %s
474 // A12:#define __ARM_ARCH 7
475 // A12:#define __ARM_ARCH_7A__ 1
476 // A12:#define __ARM_ARCH_EXT_IDIV__ 1
477 // A12:#define __ARM_ARCH_PROFILE 'A'
478 // A12:#define __ARM_FEATURE_DSP 1
479 // A12-NOT:#define __ARM_FP 0x
480 
481 // Test whether predefines are as expected when targeting cortex-a12 (soft FP ABI as default).
482 // RUN: %clang -target armv7-eabi -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12-ALLOW-FP-INSTR %s
483 // RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12-ALLOW-FP-INSTR %s
484 // A12-ALLOW-FP-INSTR:#define __ARM_ARCH 7
485 // A12-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
486 // A12-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
487 // A12-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
488 // A12-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
489 // A12-ALLOW-FP-INSTR:#define __ARM_FP 0xe
490 
491 // Test whether predefines are as expected when targeting cortex-a15 (soft FP ABI as default).
492 // RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
493 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
494 // A15:#define __ARM_ARCH_EXT_IDIV__ 1
495 // A15:#define __ARM_FEATURE_DSP 1
496 // A15-NOT:#define __ARM_FP 0x
497 
498 // Test whether predefines are as expected when targeting cortex-a15 (softfp ABI as default).
499 // RUN: %clang -target armv7-eabi -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15-ALLOW-FP-INSTR %s
500 // RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15-ALLOW-FP-INSTR %s
501 // A15-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
502 // A15-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
503 // A15-ALLOW-FP-INSTR:#define __ARM_FP 0xe
504 
505 // Check that -mfpu works properly for Cortex-A17 (enabled by default).
506 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A17 %s
507 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A17 %s
508 // DEFAULTFPU-A17:#define __ARM_FP 0xe
509 // DEFAULTFPU-A17:#define __ARM_NEON__ 1
510 // DEFAULTFPU-A17:#define __ARM_VFPV4__ 1
511 
512 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a17 -mfpu=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=FPUNONE-A17 %s
513 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a17 -mfpu=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=FPUNONE-A17 %s
514 // FPUNONE-A17-NOT:#define __ARM_FP 0x{{.*}}
515 // FPUNONE-A17-NOT:#define __ARM_NEON__ 1
516 // FPUNONE-A17-NOT:#define __ARM_VFPV4__ 1
517 
518 // Test whether predefines are as expected when targeting cortex-a17 (soft FP ABI as default).
519 // RUN: %clang -target armv7 -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17 %s
520 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17 %s
521 // A17:#define __ARM_ARCH 7
522 // A17:#define __ARM_ARCH_7A__ 1
523 // A17:#define __ARM_ARCH_EXT_IDIV__ 1
524 // A17:#define __ARM_ARCH_PROFILE 'A'
525 // A17:#define __ARM_FEATURE_DSP 1
526 // A17-NOT:#define __ARM_FP 0x
527 
528 // Test whether predefines are as expected when targeting cortex-a17 (softfp FP ABI as default).
529 // RUN: %clang -target armv7-eabi -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17-ALLOW-FP-INSTR %s
530 // RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17-ALLOW-FP-INSTR %s
531 // A17-ALLOW-FP-INSTR:#define __ARM_ARCH 7
532 // A17-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
533 // A17-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
534 // A17-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
535 // A17-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
536 // A17-ALLOW-FP-INSTR:#define __ARM_FP 0xe
537 
538 // Test whether predefines are as expected when targeting swift (soft FP ABI as default).
539 // RUN: %clang -target armv7s -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
540 // RUN: %clang -target armv7s -mthumb -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
541 // SWIFT:#define __ARM_ARCH_EXT_IDIV__ 1
542 // SWIFT:#define __ARM_FEATURE_DSP 1
543 // SWIFT-NOT:#define __ARM_FP 0xxE
544 
545 // Test whether predefines are as expected when targeting swift (softfp FP ABI as default).
546 // RUN: %clang -target armv7s-eabi -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT-ALLOW-FP-INSTR %s
547 // RUN: %clang -target armv7s-eabi -mthumb -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT-ALLOW-FP-INSTR %s
548 // SWIFT-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
549 // SWIFT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
550 // SWIFT-ALLOW-FP-INSTR:#define __ARM_FP 0xe
551 
552 // Test whether predefines are as expected when targeting ARMv8-A Cortex implementations (soft FP ABI as default)
553 // RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
554 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
555 // RUN: %clang -target armv8 -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
556 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
557 // RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
558 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
559 // RUN: %clang -target armv8 -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
560 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
561 // RUN: %clang -target armv8 -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
562 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
563 // RUN: %clang -target armv8 -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
564 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
565 //
566 // RUN: %clang -target armv8 -mcpu=exynos-m3 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
567 // RUN: %clang -target armv8 -mthumb -mcpu=exynos-m3 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
568 // RUN: %clang -target armv8 -mcpu=exynos-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
569 // RUN: %clang -target armv8 -mthumb -mcpu=exynos-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
570 // RUN: %clang -target armv8 -mcpu=exynos-m5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
571 // RUN: %clang -target armv8 -mthumb -mcpu=exynos-m5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
572 // ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
573 // ARMV8:#define __ARM_FEATURE_DSP 1
574 // ARMV8-NOT:#define __ARM_FP 0x
575 
576 // Test whether predefines are as expected when targeting ARMv8-A Cortex implementations (softfp FP ABI as default)
577 // RUN: %clang -target armv8-eabi -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
578 // RUN: %clang -target armv8-eabi -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
579 // RUN: %clang -target armv8-eabi -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
580 // RUN: %clang -target armv8-eabi -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
581 // RUN: %clang -target armv8-eabi -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
582 // RUN: %clang -target armv8-eabi -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
583 // RUN: %clang -target armv8-eabi -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
584 // RUN: %clang -target armv8-eabi -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
585 // RUN: %clang -target armv8-eabi -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
586 // RUN: %clang -target armv8-eabi -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
587 // RUN: %clang -target armv8-eabi -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
588 // RUN: %clang -target armv8-eabi -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
589 //
590 // RUN: %clang -target armv8-eabi -mcpu=exynos-m3 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
591 // RUN: %clang -target armv8-eabi -mthumb -mcpu=exynos-m3 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
592 // RUN: %clang -target armv8-eabi -mcpu=exynos-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
593 // RUN: %clang -target armv8-eabi -mthumb -mcpu=exynos-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
594 // RUN: %clang -target armv8-eabi -mcpu=exynos-m5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
595 // RUN: %clang -target armv8-eabi -mthumb -mcpu=exynos-m5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
596 // ARMV8-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
597 // ARMV8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
598 // ARMV8-ALLOW-FP-INSTR:#define __ARM_FP 0xe
599 
600 // Test whether predefines are as expected when targeting cortex-r4.
601 // RUN: %clang -target armv7 -mcpu=cortex-r4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4-ARM %s
602 // R4-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
603 // R4-ARM:#define __ARM_FEATURE_DSP 1
604 // R4-ARM-NOT:#define __ARM_FP 0x{{.*}}
605 
606 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4-THUMB %s
607 // R4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
608 // R4-THUMB:#define __ARM_FEATURE_DSP 1
609 // R4-THUMB-NOT:#define __ARM_FP 0x{{.*}}
610 
611 // Test whether predefines are as expected when targeting cortex-r4f (soft FP ABI as default).
612 // RUN: %clang -target armv7 -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-ARM %s
613 // R4F-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
614 // R4F-ARM:#define __ARM_FEATURE_DSP 1
615 // R4F-ARM-NOT:#define __ARM_FP 0x
616 
617 // Test whether predefines are as expected when targeting cortex-r4f (softfp FP ABI as default).
618 // RUN: %clang -target armv7-eabi -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-ARM-ALLOW-FP-INSTR %s
619 // R4F-ARM-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
620 // R4F-ARM-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
621 // R4F-ARM-ALLOW-FP-INSTR:#define __ARM_FP 0xc
622 
623 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-THUMB %s
624 // R4F-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
625 // R4F-THUMB:#define __ARM_FEATURE_DSP 1
626 // R4F-THUMB-NOT:#define __ARM_FP 0x
627 
628 // RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-THUMB-ALLOW-FP-INSTR %s
629 // R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
630 // R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
631 // R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0xc
632 
633 // Test whether predefines are as expected when targeting cortex-r5 (soft FP ABI as default).
634 // RUN: %clang -target armv7 -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
635 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
636 // R5:#define __ARM_ARCH_EXT_IDIV__ 1
637 // R5:#define __ARM_FEATURE_DSP 1
638 // R5-NOT:#define __ARM_FP 0x
639 
640 // Test whether predefines are as expected when targeting cortex-r5 (softfp FP ABI as default).
641 // RUN: %clang -target armv7-eabi -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5-ALLOW-FP-INSTR %s
642 // RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5-ALLOW-FP-INSTR %s
643 // R5-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
644 // R5-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
645 // R5-ALLOW-FP-INSTR:#define __ARM_FP 0xc
646 
647 // Test whether predefines are as expected when targeting cortex-r7 and cortex-r8 (soft FP ABI as default).
648 // RUN: %clang -target armv7 -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
649 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
650 // RUN: %clang -target armv7 -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
651 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
652 // R7-R8:#define __ARM_ARCH_EXT_IDIV__ 1
653 // R7-R8:#define __ARM_FEATURE_DSP 1
654 // R7-R8-NOT:#define __ARM_FP 0x
655 
656 // Test whether predefines are as expected when targeting cortex-r7 and cortex-r8 (softfp FP ABI as default).
657 // RUN: %clang -target armv7-eabi -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8-ALLOW-FP-INSTR %s
658 // RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8-ALLOW-FP-INSTR %s
659 // RUN: %clang -target armv7-eabi -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8-ALLOW-FP-INSTR %s
660 // RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8-ALLOW-FP-INSTR %s
661 // R7-R8-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
662 // R7-R8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
663 // R7-R8-ALLOW-FP-INSTR:#define __ARM_FP 0xe
664 
665 // Test whether predefines are as expected when targeting cortex-m0.
666 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
667 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0plus -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
668 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m1 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
669 // RUN: %clang -target armv7 -mthumb -mcpu=sc000 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
670 // M0-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
671 // M0-THUMB-NOT:#define __ARM_FEATURE_DSP
672 // M0-THUMB-NOT:#define __ARM_FP 0x{{.*}}
673 
674 // Test whether predefines are as expected when targeting cortex-m3.
675 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m3 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M3-THUMB %s
676 // RUN: %clang -target armv7 -mthumb -mcpu=sc300 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M3-THUMB %s
677 // M3-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
678 // M3-THUMB-NOT:#define __ARM_FEATURE_DSP
679 // M3-THUMB-NOT:#define __ARM_FP 0x{{.*}}
680 
681 // Test whether predefines are as expected when targeting cortex-m4 (soft FP ABI as default).
682 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M4-THUMB %s
683 // M4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
684 // M4-THUMB:#define __ARM_FEATURE_DSP 1
685 // M4-THUMB-NOT:#define __ARM_FP 0x
686 
687 // Test whether predefines are as expected when targeting cortex-m4 (softfp ABI as default).
688 // RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M4-THUMB-ALLOW-FP-INSTR %s
689 // M4-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
690 // M4-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
691 // M4-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0x6
692 
693 // Test whether predefines are as expected when targeting cortex-m7 (soft FP ABI as default).
694 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M7-THUMB %s
695 // M7-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
696 // M7-THUMB:#define __ARM_FEATURE_DSP 1
697 // M7-THUMB-NOT:#define __ARM_FP 0x
698 // M7-THUMB-NOT:#define __ARM_FPV5__
699 
700 // Test whether predefines are as expected when targeting cortex-m7 (softfp FP ABI as default).
701 // RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M7-THUMB-ALLOW-FP-INSTR %s
702 // M7-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
703 // M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
704 // M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0xe
705 // M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FPV5__ 1
706 
707 // Check that -mcmse (security extension) option works correctly for v8-M targets
708 // RUN: %clang -target armv8m.base-none-linux-gnu -mcmse -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_CMSE %s
709 // RUN: %clang -target armv8m.main-none-linux-gnu -mcmse -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_CMSE %s
710 // RUN: %clang -target arm-none-linux-gnu -mcpu=cortex-m33 -mcmse -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_CMSE %s
711 // RUN: %clang -target arm -mcpu=cortex-m23 -mcmse -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_CMSE %s
712 // RUN: %clang -target arm-none-linux-gnu -mcpu=cortex-m55 -mcmse -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_CMSE %s
713 // V8M_CMSE-NOT: __ARM_FEATURE_CMSE 1
714 // V8M_CMSE: #define __ARM_FEATURE_CMSE 3
715 
716 // Check that CMSE is not defined on architectures w/o support for security extension
717 // RUN: %clang -target arm-arm-none-gnueabi -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOTV8M_CMSE %s
718 // RUN: %clang -target armv8a-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOTV8M_CMSE %s
719 // RUN: %clang -target armv8.1a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOTV8M_CMSE %s
720 // NOTV8M_CMSE-NOT: __ARM_FEATURE_CMSE
721 
722 // Check that -mcmse option gives error on non v8-M targets
723 // RUN: not %clang -target arm-arm-none-eabi -mthumb -mcmse -mcpu=cortex-m7 -x c -E -dM %s -o - 2>&1 | FileCheck -match-full-lines --check-prefix=NOTV8MCMSE_OPT %s
724 // NOTV8MCMSE_OPT: error: -mcmse is not supported for cortex-m7
725 
726 // Test whether predefines are as expected when targeting v8m cores
727 // RUN: %clang -target arm -mcpu=cortex-m23 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M23 %s
728 // M23: #define __ARM_ARCH 8
729 // M23: #define __ARM_ARCH_8M_BASE__ 1
730 // M23: #define __ARM_ARCH_EXT_IDIV__ 1
731 // M23-NOT: __ARM_ARCH_ISA_ARM
732 // M23: #define __ARM_ARCH_ISA_THUMB 1
733 // M23: #define __ARM_ARCH_PROFILE 'M'
734 // M23-NOT: __ARM_FEATURE_CRC32
735 // M23-NOT: __ARM_FEATURE_DSP
736 // M23-NOT: __ARM_FP 0x{{.*}}
737 // M23-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
738 
739 // Test whether predefines are as expected when targeting m33 (soft FP ABI as default).
740 // RUN: %clang -target arm -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M33 %s
741 // M33: #define __ARM_ARCH 8
742 // M33: #define __ARM_ARCH_8M_MAIN__ 1
743 // M33: #define __ARM_ARCH_EXT_IDIV__ 1
744 // M33-NOT: __ARM_ARCH_ISA_ARM
745 // M33: #define __ARM_ARCH_ISA_THUMB 2
746 // M33: #define __ARM_ARCH_PROFILE 'M'
747 // M33-NOT: __ARM_FEATURE_CRC32
748 // M33: #define __ARM_FEATURE_DSP 1
749 // M33-NOT: #define __ARM_FP 0x
750 // M33: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
751 
752 // Test whether predefines are as expected when targeting m33 (softfp FP ABI as default).
753 // RUN: %clang -target arm-eabi -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M33-ALLOW-FP-INSTR %s
754 // M33-ALLOW-FP-INSTR: #define __ARM_ARCH 8
755 // M33-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
756 // M33-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
757 // M33-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
758 // M33-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
759 // M33-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
760 // M33-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
761 // M33-ALLOW-FP-INSTR: #define __ARM_FEATURE_DSP 1
762 // M33-ALLOW-FP-INSTR: #define __ARM_FP 0x6
763 // M33-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
764 
765 // Test whether predefines are as expected when targeting cortex-m55 (softfp FP ABI as default).
766 // RUN: %clang -target arm-eabi -mcpu=cortex-m55 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M55 %s
767 // M55: #define __ARM_ARCH 8
768 // M55: #define __ARM_ARCH_8_1M_MAIN__ 1
769 // M55: #define __ARM_ARCH_EXT_IDIV__ 1
770 // M55-NOT: __ARM_ARCH_ISA_ARM
771 // M55: #define __ARM_ARCH_ISA_THUMB 2
772 // M55: #define __ARM_ARCH_PROFILE 'M'
773 // M55-NOT: __ARM_FEATURE_CRC32
774 // M55: #define __ARM_FEATURE_DSP 1
775 // M55: #define __ARM_FEATURE_MVE 3
776 // M55: #define __ARM_FP 0xe
777 // M55: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
778 
779 // Test whether predefines are as expected when targeting krait (soft FP as default).
780 // RUN: %clang -target armv7 -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT %s
781 // RUN: %clang -target armv7 -mthumb -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT %s
782 // KRAIT:#define __ARM_ARCH_EXT_IDIV__ 1
783 // KRAIT:#define __ARM_FEATURE_DSP 1
784 // KRAIT-NOT:#define  __ARM_VFPV4__
785 
786 // Test whether predefines are as expected when targeting krait (softfp FP as default).
787 // RUN: %clang -target armv7-eabi -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT-ALLOW-FP-INSTR %s
788 // RUN: %clang -target armv7-eabi -mthumb -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT-ALLOW-FP-INSTR %s
789 // KRAIT-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
790 // KRAIT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
791 // KRAIT-ALLOW-FP-INSTR:#define  __ARM_VFPV4__ 1
792 
793 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M %s
794 // CHECK-V81M: #define __ARM_ARCH 8
795 // CHECK-V81M: #define __ARM_ARCH_8_1M_MAIN__ 1
796 // CHECK-V81M: #define __ARM_ARCH_ISA_THUMB 2
797 // CHECK-V81M: #define __ARM_ARCH_PROFILE 'M'
798 // CHECK-V81M-NOT: #define __ARM_FEATURE_DSP
799 // CHECK-V81M-NOT: #define __ARM_FEATURE_MVE
800 // CHECK-V81M-NOT: #define __ARM_FEATURE_SIMD32
801 
802 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE %s
803 // CHECK-V81M-MVE: #define __ARM_FEATURE_DSP 1
804 // CHECK-V81M-MVE: #define __ARM_FEATURE_MVE 1
805 // CHECK-V81M-MVE: #define __ARM_FEATURE_SIMD32 1
806 
807 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVEFP %s
808 // CHECK-V81M-MVEFP: #define __ARM_FEATURE_DSP 1
809 // CHECK-V81M-MVEFP: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
810 // CHECK-V81M-MVEFP: #define __ARM_FEATURE_MVE 3
811 // CHECK-V81M-MVEFP: #define __ARM_FEATURE_SIMD32 1
812 // CHECK-V81M-MVEFP: #define __ARM_FPV5__ 1
813 
814 // fpu=none/nofp discards mve.fp, but not mve/dsp
815 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp+nofp            -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVEFP-NOFP %s
816 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp      -mfpu=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVEFP-NOFP %s
817 // CHECK-V81M-MVEFP-NOFP: #define __ARM_FEATURE_DSP 1
818 // CHECK-V81M-MVEFP-NOFP: #define __ARM_FEATURE_MVE 1
819 
820 // nomve discards mve.fp
821 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp+nomve -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVEFP-NOMVE %s
822 // CHECK-V81M-MVEFP-NOMVE-NOT: #define __ARM_FEATURE_MVE
823 
824 // mve+fp doesn't imply mve.fp
825 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve+fp -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE-FP %s
826 // CHECK-V81M-MVE-FP: #define __ARM_FEATURE_MVE 1
827 
828 // nodsp discards both dsp and mve ...
829 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve+nodsp -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE-NODSP %s
830 // CHECK-V81M-MVE-NODSP-NOT: #define __ARM_FEATURE_MVE
831 // CHECK-V81M-MVE-NODSP-NOT: #define __ARM_FEATURE_DSP
832 
833 // ... and also mve.fp
834 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp+nodsp -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE-NODSP %s
835 // CHECK-V81M-MVE-NODSP-NOT: #define __ARM_FEATURE_MVE
836 // CHECK-V81M-MVE-NODSP-NOT: #define __ARM_FEATURE_DSP
837 
838 // Test CDE (Custom Datapath Extension) feature test macros
839 
840 // RUN: %clang -target arm-arm-none-eabi -march=armv8m.main -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V8M-NOCDE %s
841 // CHECK-V8M-NOCDE-NOT: #define __ARM_FEATURE_CDE
842 // CHECK-V8M-NOCDE-NOT: #define __ARM_FEATURE_CDE_COPROC
843 // RUN: %clang -target arm-arm-none-eabi -march=armv8m.main+cdecp0+cdecp1+cdecp7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8M-CDE-MASK1 %s
844 // CHECK-V8M-CDE-MASK1: #define __ARM_FEATURE_CDE 1
845 // CHECK-V8M-CDE-MASK1: #define __ARM_FEATURE_CDE_COPROC 0x83
846 // RUN: %clang -target arm-arm-none-eabi -march=armv8m.main+cdecp0+cdecp1+cdecp2+cdecp3+cdecp4+cdecp5+cdecp6+cdecp7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8M-CDE-MASK2 %s
847 // CHECK-V8M-CDE-MASK2: #define __ARM_FEATURE_CDE 1
848 // CHECK-V8M-CDE-MASK2: #define __ARM_FEATURE_CDE_COPROC 0xff
849 
850 // RUN: %clang -target armv8.1a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81A %s
851 // CHECK-V81A: #define __ARM_ARCH 8
852 // CHECK-V81A: #define __ARM_ARCH_8_1A__ 1
853 // CHECK-V81A: #define __ARM_ARCH_PROFILE 'A'
854 // CHECK-V81A: #define __ARM_FEATURE_QRDMX 1
855 // CHECK-V81A: #define __ARM_FP 0xe
856 
857 // RUN: %clang -target armv8.2a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V82A %s
858 // CHECK-V82A: #define __ARM_ARCH 8
859 // CHECK-V82A: #define __ARM_ARCH_8_2A__ 1
860 // CHECK-V82A: #define __ARM_ARCH_PROFILE 'A'
861 // CHECK-V82A: #define __ARM_FEATURE_QRDMX 1
862 // CHECK-V82A: #define __ARM_FP 0xe
863 
864 // RUN: %clang -target armv7-apple-driverkit21.0 -x c %s -dM -E -o - | FileCheck -match-full-lines --check-prefix=CHECK-DRIVERKIT %s
865 // CHECK-DRIVERKIT-NOT: #define __ARM_PCS_VFP 1
866 
867 // RUN: %clang -target armv8.3a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V83A %s
868 // CHECK-V83A: #define __ARM_ARCH 8
869 // CHECK-V83A: #define __ARM_ARCH_8_3A__ 1
870 // CHECK-V83A: #define __ARM_ARCH_PROFILE 'A'
871 
872 // RUN: %clang -target armv8.4a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V84A %s
873 // CHECK-V84A: #define __ARM_ARCH 8
874 // CHECK-V84A: #define __ARM_ARCH_8_4A__ 1
875 // CHECK-V84A: #define __ARM_ARCH_PROFILE 'A'
876 
877 // RUN: %clang -target armv8.5a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V85A %s
878 // CHECK-V85A: #define __ARM_ARCH 8
879 // CHECK-V85A: #define __ARM_ARCH_8_5A__ 1
880 // CHECK-V85A: #define __ARM_ARCH_PROFILE 'A'
881 
882 // RUN: %clang -target armv8.6a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V86A %s
883 // CHECK-V86A: #define __ARM_ARCH 8
884 // CHECK-V86A: #define __ARM_ARCH_8_6A__ 1
885 // CHECK-V86A: #define __ARM_ARCH_PROFILE 'A'
886 
887 // RUN: %clang -target armv8.7a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V87A %s
888 // CHECK-V87A: #define __ARM_ARCH 8
889 // CHECK-V87A: #define __ARM_ARCH_8_7A__ 1
890 // CHECK-V87A: #define __ARM_ARCH_PROFILE 'A'
891 
892 // RUN: %clang -target armv8.8a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V88A %s
893 // CHECK-V88A: #define __ARM_ARCH 8
894 // CHECK-V88A: #define __ARM_ARCH_8_8A__ 1
895 // CHECK-V88A: #define __ARM_ARCH_PROFILE 'A'
896 
897 // RUN: %clang -target armv8.9a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V89A %s
898 // CHECK-V89A: #define __ARM_ARCH 8
899 // CHECK-V89A: #define __ARM_ARCH_8_9A__ 1
900 // CHECK-V89A: #define __ARM_ARCH_PROFILE 'A'
901 
902 // RUN: %clang -target armv9a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V9A %s
903 // CHECK-V9A: #define __ARM_ARCH 9
904 // CHECK-V9A: #define __ARM_ARCH_9A__ 1
905 // CHECK-V9A: #define __ARM_ARCH_PROFILE 'A'
906 
907 // RUN: %clang -target armv9.1a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V91A %s
908 // CHECK-V91A: #define __ARM_ARCH 9
909 // CHECK-V91A: #define __ARM_ARCH_9_1A__ 1
910 // CHECK-V91A: #define __ARM_ARCH_PROFILE 'A'
911 
912 // RUN: %clang -target armv9.2a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V92A %s
913 // CHECK-V92A: #define __ARM_ARCH 9
914 // CHECK-V92A: #define __ARM_ARCH_9_2A__ 1
915 // CHECK-V92A: #define __ARM_ARCH_PROFILE 'A'
916 
917 // RUN: %clang -target armv9.3a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V93A %s
918 // CHECK-V93A: #define __ARM_ARCH 9
919 // CHECK-V93A: #define __ARM_ARCH_9_3A__ 1
920 // CHECK-V93A: #define __ARM_ARCH_PROFILE 'A'
921 
922 // RUN: %clang -target armv9.4a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V94A %s
923 // CHECK-V94A: #define __ARM_ARCH 9
924 // CHECK-V94A: #define __ARM_ARCH_9_4A__ 1
925 // CHECK-V94A: #define __ARM_ARCH_PROFILE 'A'
926 
927 // RUN: %clang -target armv9.5a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V95A %s
928 // CHECK-V95A: #define __ARM_ARCH 9
929 // CHECK-V95A: #define __ARM_ARCH_9_5A__ 1
930 // CHECK-V95A: #define __ARM_ARCH_PROFILE 'A'
931 
932 // RUN: %clang -target armv9.6a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V96A %s
933 // CHECK-V96A: #define __ARM_ARCH 9
934 // CHECK-V96A: #define __ARM_ARCH_9_6A__ 1
935 // CHECK-V96A: #define __ARM_ARCH_PROFILE 'A'
936 
937 // RUN: %clang -target arm-none-none-eabi -march=armv7-m -mfpu=softvfp -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SOFTVFP %s
938 // CHECK-SOFTVFP-NOT: #define __ARM_FP 0x
939 
940 // Test Armv8.1-M PACBTI
941 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-NOBTI,CHECK-NOPAC %s
942 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -mbranch-protection=bti -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-BTI,CHECK-NOPAC %s
943 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -mbranch-protection=pac-ret -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-PAC,CHECK-NOBTI %s
944 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -mbranch-protection=pac-ret+b-key -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-PAC,CHECK-NOBTI %s
945 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -mbranch-protection=pac-ret+leaf -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-PAC-LEAF,CHECK-NOBTI %s
946 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -mbranch-protection=pac-ret+b-key+leaf -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-PAC-LEAF,CHECK-NOBTI %s
947 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -mbranch-protection=bti+pac-ret -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-PAC,CHECK-BTI %s
948 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -mbranch-protection=bti+pac-ret+b-key -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-PAC,CHECK-BTI %s
949 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -mbranch-protection=bti+pac-ret+leaf -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-PAC-LEAF,CHECK-BTI %s
950 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -mbranch-protection=bti+pac-ret+b-key+leaf -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-PAC-LEAF,CHECK-BTI %s
951 // CHECK-NOBTI-NOT: #define __ARM_FEATURE_BTI_DEFAULT
952 // CHECK-NOPAC-NOT: #define __ARM_FEATURE_PAC_DEFAULT
953 // CHECK-BTI: #define __ARM_FEATURE_BTI_DEFAULT 1
954 // CHECK-PAC: #define __ARM_FEATURE_PAC_DEFAULT 1
955 // CHECK-PAC-LEAF: #define __ARM_FEATURE_PAC_DEFAULT 5
956 
957 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-NOBTI-EXT,CHECK-NOPAC-EXT %s
958 // RUN: %clang -target arm-arm-none-eabi -march=armv7-m+pacbti -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-PACBTI-EXT %s
959 // CHECK-NOBTI-EXT-NOT: #define __ARM_FEATURE_BTI 1
960 // CHECK-NOPAC-EXT-NOT: #define __ARM_FEATURE_PAUTH 1
961 // CHECK-PACBTI-EXT: #define __ARM_FEATURE_BTI 1
962 // CHECK-PACBTI-EXT: #define __ARM_FEATURE_PAUTH 1
963 
964 // ================== Check BFloat16 Extensions.
965 // RUN: %clang -target arm-arm-none-eabi -march=armv8.6-a+bf16 -x c -E -dM %s -o - 2>&1 | FileCheck -check-prefix=CHECK-BFLOAT %s
966 // CHECK-BFLOAT: #define __ARM_BF16_FORMAT_ALTERNATIVE 1
967 // CHECK-BFLOAT: #define __ARM_FEATURE_BF16 1
968 // CHECK-BFLOAT: #define __ARM_FEATURE_BF16_VECTOR_ARITHMETIC 1
969 
970 // Check crypto feature test macros
971 // RUN: %clang -target arm-arm-none-eabi -march=armv8-a+crypto -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-CRYPTO %s
972 // CHECK-CRYPTO: #define __ARM_ARCH_PROFILE 'A'
973 // CHECK-CRYPTO: #define __ARM_FEATURE_AES 1
974 // CHECK-CRYPTO: #define __ARM_FEATURE_CRYPTO 1
975 // CHECK-CRYPTO: #define __ARM_FEATURE_SHA2 1
976 // RUN: %clang -target arm-arm-none-eabi -march=armv8-a+nocrypto -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-NOCRYPTO %s
977 // CHECK-NOCRYPTO: #define __ARM_ARCH_PROFILE 'A'
978 // CHECK-NOCRYPTO-NOT: #define __ARM_FEATURE_AES 1
979 // CHECK-NOCRYPTO-NOT: #define __ARM_FEATURE_CRYPTO 1
980 // CHECK-NOCRYPTO-NOT: #define __ARM_FEATURE_SHA2 1
981 // RUN: %clang -target arm-arm-none-eabi -march=armv8-a+aes+nosha2 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-AES %s
982 // CHECK-AES: #define __ARM_ARCH_PROFILE 'A'
983 // CHECK-AES: #define __ARM_FEATURE_AES 1
984 // CHECK-AES-NOT: #define __ARM_FEATURE_CRYPTO 1
985 // CHECK-AES-NOT: #define __ARM_FEATURE_SHA2 1
986 // RUN: %clang -target arm-arm-none-eabi -march=armv8-a+noaes+sha2 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-SHA2 %s
987 // CHECK-SHA2: #define __ARM_ARCH_PROFILE 'A'
988 // CHECK-SHA2-NOT: #define __ARM_FEATURE_AES 1
989 // CHECK-SHA2-NOT: #define __ARM_FEATURE_CRYPTO 1
990 // CHECK-SHA2: #define __ARM_FEATURE_SHA2 1
991 
992 // ================== Check default macros for Armv8.1-A and later
993 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-BEFORE-V83   %s
994 // RUN: %clang -target arm-arm-none-eabi -march=armv8.2-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-BEFORE-V83   %s
995 // RUN: %clang -target arm-arm-none-eabi -march=armv8.3-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER %s
996 // RUN: %clang -target arm-arm-none-eabi -march=armv8.4-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER %s
997 // RUN: %clang -target arm-arm-none-eabi -march=armv8.5-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER %s
998 // RUN: %clang -target arm-arm-none-eabi -march=armv8.6-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER %s
999 // RUN: %clang -target arm-arm-none-eabi -march=armv8.7-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER %s
1000 // RUN: %clang -target arm-arm-none-eabi -march=armv8.8-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER %s
1001 // RUN: %clang -target arm-arm-none-eabi -march=armv9-a   -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER %s
1002 // RUN: %clang -target arm-arm-none-eabi -march=armv9.1-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER %s
1003 // RUN: %clang -target arm-arm-none-eabi -march=armv9.2-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER %s
1004 // RUN: %clang -target arm-arm-none-eabi -march=armv9.3-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER %s
1005 // CHECK-V83-OR-LATER: __ARM_FEATURE_COMPLEX 1
1006 // CHECK-V81-OR-LATER: __ARM_FEATURE_QRDMX 1
1007 // CHECK-BEFORE-V83-NOT: __ARM_FEATURE_COMPLEX 1
1008 
1009 // Check if MVE floating-point feature is disabled (-mve.fp) during explicit fpv5-d16 or fpv5-sp-d16
1010 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp -mfpu=fpv5-d16 -x c -E -dM %s -o - | FileCheck -check-prefix=CHECK-MVE1 %s
1011 // CHECK-MVE1: #define __ARM_FEATURE_MVE 1
1012 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp -mfpu=fpv5-sp-d16 -x c -E -dM %s -o - | FileCheck -check-prefix=CHECK-MVE1_2 %s
1013 // CHECK-MVE1_2: #define __ARM_FEATURE_MVE 1
1014 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp -x c -E -dM %s -o - | FileCheck -check-prefix=CHECK-MVE3 %s
1015 // CHECK-MVE3: #define __ARM_FEATURE_MVE 3
1016