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: #define __ARM_FP 0xE
9 // CHECK-V8A: #define __ARM_FP16_ARGS 1
10 // CHECK-V8A: #define __ARM_FP16_FORMAT_IEEE 1
11 
12 // RUN: %clang -target armv8r-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8R %s
13 // CHECK-V8R: #define __ARMEL__ 1
14 // CHECK-V8R: #define __ARM_ARCH 8
15 // CHECK-V8R: #define __ARM_ARCH_8R__ 1
16 // CHECK-V8R: #define __ARM_FEATURE_CRC32 1
17 // CHECK-V8R: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
18 // CHECK-V8R: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
19 // CHECK-V8R: #define __ARM_FP 0xE
20 
21 // RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7 %s
22 // CHECK-V7: #define __ARMEL__ 1
23 // CHECK-V7: #define __ARM_ARCH 7
24 // CHECK-V7: #define __ARM_ARCH_7A__ 1
25 // CHECK-V7-NOT: __ARM_FEATURE_CRC32
26 // CHECK-V7-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
27 // CHECK-V7-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
28 // CHECK-V7: #define __ARM_FP 0xC
29 
30 // RUN: %clang -target armv7ve-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7VE %s
31 // CHECK-V7VE: #define __ARMEL__ 1
32 // CHECK-V7VE: #define __ARM_ARCH 7
33 // CHECK-V7VE: #define __ARM_ARCH_7VE__ 1
34 // CHECK-V7VE: #define __ARM_ARCH_EXT_IDIV__ 1
35 // CHECK-V7VE: #define __ARM_FP 0xC
36 
37 // 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
38 // CHECK-V7S: #define __ARMEL__ 1
39 // CHECK-V7S: #define __ARM_ARCH 7
40 // CHECK-V7S: #define __ARM_ARCH_7S__ 1
41 // CHECK-V7S-NOT: __ARM_FEATURE_CRC32
42 // CHECK-V7S-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
43 // CHECK-V7S-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
44 // CHECK-V7S: #define __ARM_FP 0xE
45 
46 // RUN: %clang -target armv8a -mfloat-abi=hard -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-BAREHF %s
47 // CHECK-V8-BAREHF: #define __ARMEL__ 1
48 // CHECK-V8-BAREHF: #define __ARM_ARCH 8
49 // CHECK-V8-BAREHF: #define __ARM_ARCH_8A__ 1
50 // CHECK-V8-BAREHF: #define __ARM_FEATURE_CRC32 1
51 // CHECK-V8-BAREHF: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
52 // CHECK-V8-BAREHF: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
53 // CHECK-V8-BAREHP: #define __ARM_FP 0xE
54 // CHECK-V8-BAREHF: #define __ARM_NEON__ 1
55 // CHECK-V8-BAREHF: #define __ARM_PCS_VFP 1
56 // CHECK-V8-BAREHF: #define __VFP_FP__ 1
57 
58 // 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
59 // CHECK-V8-BAREHF-FP-NOT: __ARM_NEON__ 1
60 // CHECK-V8-BAREHP-FP: #define __ARM_FP 0xE
61 // CHECK-V8-BAREHF-FP: #define __VFP_FP__ 1
62 
63 // 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
64 // 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
65 // CHECK-V8-BAREHP-NEON-FP: #define __ARM_FP 0xE
66 // CHECK-V8-BAREHF-NEON-FP: #define __ARM_NEON__ 1
67 // CHECK-V8-BAREHF-NEON-FP: #define __VFP_FP__ 1
68 
69 // RUN: %clang -target armv8a -mnocrc -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-NOCRC %s
70 // CHECK-V8-NOCRC-NOT: __ARM_FEATURE_CRC32 1
71 
72 // Check that -mhwdiv works properly for armv8/thumbv8 (enabled by default).
73 
74 // RUN: %clang -target armv8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
75 // RUN: %clang -target armv8 -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
76 // RUN: %clang -target armv8-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
77 // RUN: %clang -target armv8-eabi -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
78 // V8:#define __ARM_ARCH_EXT_IDIV__ 1
79 
80 // RUN: %clang -target armv8 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
81 // RUN: %clang -target armv8 -mthumb -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
82 // RUN: %clang -target armv8 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
83 // RUN: %clang -target armv8 -mthumb -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
84 // NOHWDIV-V8-NOT:#define __ARM_ARCH_EXT_IDIV__
85 
86 // RUN: %clang -target armv8a -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
87 // RUN: %clang -target armv8a -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
88 // RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
89 // RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
90 // V8A:#define __ARM_ARCH_EXT_IDIV__ 1
91 // V8A:#define __ARM_FP 0xE
92 
93 // RUN: %clang -target armv8m.base-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_BASELINE %s
94 // V8M_BASELINE: #define __ARM_ARCH 8
95 // V8M_BASELINE: #define __ARM_ARCH_8M_BASE__ 1
96 // V8M_BASELINE: #define __ARM_ARCH_EXT_IDIV__ 1
97 // V8M_BASELINE-NOT: __ARM_ARCH_ISA_ARM
98 // V8M_BASELINE: #define __ARM_ARCH_ISA_THUMB 1
99 // V8M_BASELINE: #define __ARM_ARCH_PROFILE 'M'
100 // V8M_BASELINE-NOT: __ARM_FEATURE_CRC32
101 // V8M_BASELINE-NOT: __ARM_FEATURE_DSP
102 // V8M_BASELINE-NOT: __ARM_FP 0x{{.*}}
103 // V8M_BASELINE-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
104 
105 // RUN: %clang -target armv8m.main-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_MAINLINE %s
106 // V8M_MAINLINE: #define __ARM_ARCH 8
107 // V8M_MAINLINE: #define __ARM_ARCH_8M_MAIN__ 1
108 // V8M_MAINLINE: #define __ARM_ARCH_EXT_IDIV__ 1
109 // V8M_MAINLINE-NOT: __ARM_ARCH_ISA_ARM
110 // V8M_MAINLINE: #define __ARM_ARCH_ISA_THUMB 2
111 // V8M_MAINLINE: #define __ARM_ARCH_PROFILE 'M'
112 // V8M_MAINLINE-NOT: __ARM_FEATURE_CRC32
113 // V8M_MAINLINE-NOT: __ARM_FEATURE_DSP
114 // V8M_MAINLINE: #define __ARM_FP 0xE
115 // V8M_MAINLINE: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
116 
117 // 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
118 // V8M_MAINLINE_DSP: #define __ARM_ARCH 8
119 // V8M_MAINLINE_DSP: #define __ARM_ARCH_8M_MAIN__ 1
120 // V8M_MAINLINE_DSP: #define __ARM_ARCH_EXT_IDIV__ 1
121 // V8M_MAINLINE_DSP-NOT: __ARM_ARCH_ISA_ARM
122 // V8M_MAINLINE_DSP: #define __ARM_ARCH_ISA_THUMB 2
123 // V8M_MAINLINE_DSP: #define __ARM_ARCH_PROFILE 'M'
124 // V8M_MAINLINE_DSP-NOT: __ARM_FEATURE_CRC32
125 // V8M_MAINLINE_DSP: #define __ARM_FEATURE_DSP 1
126 // V8M_MAINLINE_DSP: #define __ARM_FP 0xE
127 // V8M_MAINLINE_DSP: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
128 
129 // RUN: %clang -target arm-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-DEFS %s
130 // CHECK-DEFS:#define __ARM_PCS 1
131 // CHECK-DEFS:#define __ARM_SIZEOF_MINIMAL_ENUM 4
132 // CHECK-DEFS:#define __ARM_SIZEOF_WCHAR_T 4
133 
134 // RUN: %clang -target arm-none-linux-gnu -fno-math-errno -fno-signed-zeros\
135 // RUN:        -fno-trapping-math -fassociative-math -freciprocal-math\
136 // RUN:        -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FASTMATH %s
137 // RUN: %clang -target arm-none-linux-gnu -ffast-math -x c -E -dM %s -o -\
138 // RUN:        | FileCheck -match-full-lines --check-prefix=CHECK-FASTMATH %s
139 // CHECK-FASTMATH: #define __ARM_FP_FAST 1
140 
141 // RUN: %clang -target arm-none-linux-gnu -fshort-wchar -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-SHORTWCHAR %s
142 // CHECK-SHORTWCHAR:#define __ARM_SIZEOF_WCHAR_T 2
143 
144 // RUN: %clang -target arm-none-linux-gnu -fshort-enums -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-SHORTENUMS %s
145 // CHECK-SHORTENUMS:#define __ARM_SIZEOF_MINIMAL_ENUM 1
146 
147 // Test that -mhwdiv has the right effect for a target CPU which has hwdiv enabled by default.
148 // RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
149 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
150 // RUN: %clang -target armv7 -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
151 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
152 // HWDIV:#define __ARM_ARCH_EXT_IDIV__ 1
153 
154 // RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
155 // RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
156 // RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
157 // RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
158 // NOHWDIV-NOT:#define __ARM_ARCH_EXT_IDIV__
159 
160 
161 // Check that -mfpu works properly for Cortex-A7 (enabled by default).
162 // 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
163 // 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
164 // DEFAULTFPU-A7:#define __ARM_FP 0xE
165 // DEFAULTFPU-A7:#define __ARM_NEON__ 1
166 // DEFAULTFPU-A7:#define __ARM_VFPV4__ 1
167 
168 // 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
169 // 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
170 // FPUNONE-A7-NOT:#define __ARM_FP 0x{{.*}}
171 // FPUNONE-A7-NOT:#define __ARM_NEON__ 1
172 // FPUNONE-A7-NOT:#define __ARM_VFPV4__ 1
173 
174 // 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
175 // 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
176 // NONEON-A7:#define __ARM_FP 0xE
177 // NONEON-A7-NOT:#define __ARM_NEON__ 1
178 // NONEON-A7:#define __ARM_VFPV4__ 1
179 
180 // Check that -mfpu works properly for Cortex-A5 (enabled by default).
181 // 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
182 // 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
183 // DEFAULTFPU-A5:#define __ARM_FP 0xE
184 // DEFAULTFPU-A5:#define __ARM_NEON__ 1
185 // DEFAULTFPU-A5:#define __ARM_VFPV4__ 1
186 
187 // 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
188 // 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
189 // FPUNONE-A5-NOT:#define __ARM_FP 0x{{.*}}
190 // FPUNONE-A5-NOT:#define __ARM_NEON__ 1
191 // FPUNONE-A5-NOT:#define __ARM_VFPV4__ 1
192 
193 // 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
194 // 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
195 // NONEON-A5:#define __ARM_FP 0xE
196 // NONEON-A5-NOT:#define __ARM_NEON__ 1
197 // NONEON-A5:#define __ARM_VFPV4__ 1
198 
199 // FIXME: add check for further predefines
200 // Test whether predefines are as expected when targeting ep9312.
201 // RUN: %clang -target armv4t -mcpu=ep9312 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A4T %s
202 // A4T-NOT:#define __ARM_FEATURE_DSP
203 // A4T-NOT:#define __ARM_FP 0x{{.*}}
204 
205 // Test whether predefines are as expected when targeting arm10tdmi.
206 // RUN: %clang -target armv5 -mcpu=arm10tdmi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5T %s
207 // A5T-NOT:#define __ARM_FEATURE_DSP
208 // A5T-NOT:#define __ARM_FP 0x{{.*}}
209 
210 // Test whether predefines are as expected when targeting cortex-a5.
211 // RUN: %clang -target armv7 -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5 %s
212 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5 %s
213 // A5:#define __ARM_ARCH 7
214 // A5:#define __ARM_ARCH_7A__ 1
215 // A5-NOT:#define __ARM_ARCH_EXT_IDIV__
216 // A5:#define __ARM_ARCH_PROFILE 'A'
217 // A5-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING
218 // A5:#define __ARM_FEATURE_DSP 1
219 // A5-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN
220 // A5:#define __ARM_FP 0xE
221 
222 // Test whether predefines are as expected when targeting cortex-a7.
223 // RUN: %clang -target armv7k -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7 %s
224 // RUN: %clang -target armv7k -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7 %s
225 // A7:#define __ARM_ARCH 7
226 // A7:#define __ARM_ARCH_EXT_IDIV__ 1
227 // A7:#define __ARM_ARCH_PROFILE 'A'
228 // A7:#define __ARM_FEATURE_DSP 1
229 // A7:#define __ARM_FP 0xE
230 
231 // Test whether predefines are as expected when targeting cortex-a7.
232 // RUN: %clang -target x86_64-apple-darwin -arch armv7k -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV7K %s
233 // ARMV7K:#define __ARM_ARCH 7
234 // ARMV7K:#define __ARM_ARCH_EXT_IDIV__ 1
235 // ARMV7K:#define __ARM_ARCH_PROFILE 'A'
236 // ARMV7K:#define __ARM_DWARF_EH__ 1
237 // ARMV7K:#define __ARM_FEATURE_DSP 1
238 // ARMV7K:#define __ARM_FP 0xE
239 // ARMV7K:#define __ARM_PCS_VFP 1
240 
241 
242 // Test whether predefines are as expected when targeting cortex-a8.
243 // RUN: %clang -target armv7 -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8 %s
244 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8 %s
245 // A8-NOT:#define __ARM_ARCH_EXT_IDIV__
246 // A8:#define __ARM_FEATURE_DSP 1
247 // A8:#define __ARM_FP 0xC
248 
249 // Test whether predefines are as expected when targeting cortex-a9.
250 // RUN: %clang -target armv7 -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
251 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
252 // A9-NOT:#define __ARM_ARCH_EXT_IDIV__
253 // A9:#define __ARM_FEATURE_DSP 1
254 // A9:#define __ARM_FP 0xE
255 
256 
257 // Check that -mfpu works properly for Cortex-A12 (enabled by default).
258 // 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
259 // 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
260 // DEFAULTFPU-A12:#define __ARM_FP 0xE
261 // DEFAULTFPU-A12:#define __ARM_NEON__ 1
262 // DEFAULTFPU-A12:#define __ARM_VFPV4__ 1
263 
264 // 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
265 // 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
266 // FPUNONE-A12-NOT:#define __ARM_FP 0x{{.*}}
267 // FPUNONE-A12-NOT:#define __ARM_NEON__ 1
268 // FPUNONE-A12-NOT:#define __ARM_VFPV4__ 1
269 
270 // Test whether predefines are as expected when targeting cortex-a12.
271 // RUN: %clang -target armv7 -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12 %s
272 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12 %s
273 // A12:#define __ARM_ARCH 7
274 // A12:#define __ARM_ARCH_7A__ 1
275 // A12:#define __ARM_ARCH_EXT_IDIV__ 1
276 // A12:#define __ARM_ARCH_PROFILE 'A'
277 // A12:#define __ARM_FEATURE_DSP 1
278 // A12:#define __ARM_FP 0xE
279 
280 // Test whether predefines are as expected when targeting cortex-a15.
281 // RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
282 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
283 // A15:#define __ARM_ARCH_EXT_IDIV__ 1
284 // A15:#define __ARM_FEATURE_DSP 1
285 // A15:#define __ARM_FP 0xE
286 
287 // Check that -mfpu works properly for Cortex-A17 (enabled by default).
288 // 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
289 // 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
290 // DEFAULTFPU-A17:#define __ARM_FP 0xE
291 // DEFAULTFPU-A17:#define __ARM_NEON__ 1
292 // DEFAULTFPU-A17:#define __ARM_VFPV4__ 1
293 
294 // 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
295 // 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
296 // FPUNONE-A17-NOT:#define __ARM_FP 0x{{.*}}
297 // FPUNONE-A17-NOT:#define __ARM_NEON__ 1
298 // FPUNONE-A17-NOT:#define __ARM_VFPV4__ 1
299 
300 // Test whether predefines are as expected when targeting cortex-a17.
301 // RUN: %clang -target armv7 -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17 %s
302 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17 %s
303 // A17:#define __ARM_ARCH 7
304 // A17:#define __ARM_ARCH_7A__ 1
305 // A17:#define __ARM_ARCH_EXT_IDIV__ 1
306 // A17:#define __ARM_ARCH_PROFILE 'A'
307 // A17:#define __ARM_FEATURE_DSP 1
308 // A17:#define __ARM_FP 0xE
309 
310 // Test whether predefines are as expected when targeting swift.
311 // RUN: %clang -target armv7s -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
312 // RUN: %clang -target armv7s -mthumb -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
313 // SWIFT:#define __ARM_ARCH_EXT_IDIV__ 1
314 // SWIFT:#define __ARM_FEATURE_DSP 1
315 // SWIFT:#define __ARM_FP 0xE
316 
317 // Test whether predefines are as expected when targeting ARMv8-A Cortex implementations
318 // RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
319 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
320 // RUN: %clang -target armv8 -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
321 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
322 // RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
323 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
324 // RUN: %clang -target armv8 -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
325 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
326 // RUN: %clang -target armv8 -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
327 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
328 // RUN: %clang -target armv8 -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
329 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
330 // ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
331 // ARMV8:#define __ARM_FEATURE_DSP 1
332 // ARMV8:#define __ARM_FP 0xE
333 
334 // Test whether predefines are as expected when targeting cortex-r4.
335 // RUN: %clang -target armv7 -mcpu=cortex-r4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4-ARM %s
336 // R4-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
337 // R4-ARM:#define __ARM_FEATURE_DSP 1
338 // R4-ARM-NOT:#define __ARM_FP 0x{{.*}}
339 
340 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4-THUMB %s
341 // R4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
342 // R4-THUMB:#define __ARM_FEATURE_DSP 1
343 // R4-THUMB-NOT:#define __ARM_FP 0x{{.*}}
344 
345 // Test whether predefines are as expected when targeting cortex-r4f.
346 // RUN: %clang -target armv7 -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-ARM %s
347 // R4F-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
348 // R4F-ARM:#define __ARM_FEATURE_DSP 1
349 // R4F-ARM:#define __ARM_FP 0xC
350 
351 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-THUMB %s
352 // R4F-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
353 // R4F-THUMB:#define __ARM_FEATURE_DSP 1
354 // R4F-THUMB:#define __ARM_FP 0xC
355 
356 // Test whether predefines are as expected when targeting cortex-r5.
357 // RUN: %clang -target armv7 -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
358 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
359 // R5:#define __ARM_ARCH_EXT_IDIV__ 1
360 // R5:#define __ARM_FEATURE_DSP 1
361 // R5:#define __ARM_FP 0xC
362 
363 // Test whether predefines are as expected when targeting cortex-r7 and cortex-r8.
364 // RUN: %clang -target armv7 -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
365 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
366 // RUN: %clang -target armv7 -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
367 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
368 // R7-R8:#define __ARM_ARCH_EXT_IDIV__ 1
369 // R7-R8:#define __ARM_FEATURE_DSP 1
370 // R7-R8:#define __ARM_FP 0xE
371 
372 // Test whether predefines are as expected when targeting cortex-m0.
373 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
374 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0plus -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
375 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m1 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
376 // RUN: %clang -target armv7 -mthumb -mcpu=sc000 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
377 // M0-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
378 // M0-THUMB-NOT:#define __ARM_FEATURE_DSP
379 // M0-THUMB-NOT:#define __ARM_FP 0x{{.*}}
380 
381 // Test whether predefines are as expected when targeting cortex-m3.
382 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m3 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M3-THUMB %s
383 // RUN: %clang -target armv7 -mthumb -mcpu=sc300 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M3-THUMB %s
384 // M3-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
385 // M3-THUMB-NOT:#define __ARM_FEATURE_DSP
386 // M3-THUMB-NOT:#define __ARM_FP 0x{{.*}}
387 
388 // Test whether predefines are as expected when targeting cortex-m4.
389 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M4-THUMB %s
390 // M4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
391 // M4-THUMB:#define __ARM_FEATURE_DSP 1
392 // M4-THUMB:#define __ARM_FP 0x6
393 
394 // Test whether predefines are as expected when targeting cortex-m7.
395 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M7-THUMB %s
396 // M7-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
397 // M7-THUMB:#define __ARM_FEATURE_DSP 1
398 // M7-THUMB:#define __ARM_FP 0xE
399 // M7-THUMB:#define __ARM_FPV5__ 1
400 
401 // Test whether predefines are as expected when targeting v8m cores
402 // RUN: %clang -target arm -mcpu=cortex-m23 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M23 %s
403 // M23: #define __ARM_ARCH 8
404 // M23: #define __ARM_ARCH_8M_BASE__ 1
405 // M23: #define __ARM_ARCH_EXT_IDIV__ 1
406 // M23-NOT: __ARM_ARCH_ISA_ARM
407 // M23: #define __ARM_ARCH_ISA_THUMB 1
408 // M23: #define __ARM_ARCH_PROFILE 'M'
409 // M23-NOT: __ARM_FEATURE_CRC32
410 // M23-NOT: __ARM_FEATURE_DSP
411 // M23-NOT: __ARM_FP 0x{{.*}}
412 // M23-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
413 
414 // RUN: %clang -target arm -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M33 %s
415 // M33: #define __ARM_ARCH 8
416 // M33: #define __ARM_ARCH_8M_MAIN__ 1
417 // M33: #define __ARM_ARCH_EXT_IDIV__ 1
418 // M33-NOT: __ARM_ARCH_ISA_ARM
419 // M33: #define __ARM_ARCH_ISA_THUMB 2
420 // M33: #define __ARM_ARCH_PROFILE 'M'
421 // M33-NOT: __ARM_FEATURE_CRC32
422 // M33: #define __ARM_FEATURE_DSP 1
423 // M33: #define __ARM_FP 0x6
424 // M33: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
425 
426 // Test whether predefines are as expected when targeting krait.
427 // RUN: %clang -target armv7 -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT %s
428 // RUN: %clang -target armv7 -mthumb -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT %s
429 // KRAIT:#define __ARM_ARCH_EXT_IDIV__ 1
430 // KRAIT:#define __ARM_FEATURE_DSP 1
431 // KRAIT:#define  __ARM_VFPV4__ 1
432 
433 // RUN: %clang -target armv8.1a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81A %s
434 // CHECK-V81A: #define __ARM_ARCH 8
435 // CHECK-V81A: #define __ARM_ARCH_8_1A__ 1
436 // CHECK-V81A: #define __ARM_ARCH_PROFILE 'A'
437 // CHECK-V81A: #define __ARM_FEATURE_QRDMX 1
438 // CHECK-V81A: #define __ARM_FP 0xE
439 
440 // RUN: %clang -target armv8.2a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V82A %s
441 // CHECK-V82A: #define __ARM_ARCH 8
442 // CHECK-V82A: #define __ARM_ARCH_8_2A__ 1
443 // CHECK-V82A: #define __ARM_ARCH_PROFILE 'A'
444 // CHECK-V82A: #define __ARM_FP 0xE
445