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