Clang Project

clang_source_code/test/Preprocessor/arm-target-features.c
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
11// 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
12// 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
13// CHECK-V8A-ALLOW-FP-INSTR: #define __ARMEL__ 1
14// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_ARCH 8
15// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_ARCH_8A__ 1
16// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FEATURE_CRC32 1
17// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
18// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
19// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP 0xe
20// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_ARGS 1
21// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_FORMAT_IEEE 1
22// CHECK-V8A-ALLOW-FP-INSTR-V8A-NOT: #define __ARM_FEATURE_DOTPROD
23
24// 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
25// 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
26// 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
27// 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
28// 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
29// 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
30// 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
31// 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
32// 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
33// 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
34// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
35// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
36// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FP 0xe
37// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FP16_FORMAT_IEEE 1
38
39// +fp16fml without neon doesn't make sense as the fp16fml instructions all require SIMD.
40// However, as +fp16fml implies +fp16 there is a set of defines that we would expect.
41// 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
42// 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
43// 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
44// 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
45// CHECK-FULLFP16-SCALAR:       #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
46// CHECK-FULLFP16-SCALAR-NOT:   #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
47// CHECK-FULLFP16-SCALAR:       #define __ARM_FP 0xe
48// CHECK-FULLFP16-SCALAR:       #define __ARM_FP16_FORMAT_IEEE 1
49
50// 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
51// 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
52// 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
53// 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
54// 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
55// 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
56// 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
57// 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
58// CHECK-FULLFP16-NOFML-VECTOR-SCALAR-NOT: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
59// CHECK-FULLFP16-NOFML-VECTOR-SCALAR-NOT: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
60// CHECK-FULLFP16-NOFML-VECTOR-SCALAR: #define __ARM_FP 0xe
61// CHECK-FULLFP16-NOFML-VECTOR-SCALAR: #define __ARM_FP16_FORMAT_IEEE 1
62
63// RUN: %clang -target arm -march=armv8-a+fp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SOFT %s
64// RUN: %clang -target arm -march=armv8-a+fp16fml -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SOFT %s
65// 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
66// 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
67// 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
68// 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
69// 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
70// 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
71// CHECK-FULLFP16-SOFT-NOT: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC
72// CHECK-FULLFP16-SOFT-NOT: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
73// CHECK-FULLFP16-SOFT-NOT: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC
74// CHECK-FULLFP16-SOFT-NOT: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
75
76// 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
77// CHECK-DOTPROD: #define __ARM_FEATURE_DOTPROD 1
78
79// RUN: %clang -target armv8r-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8R %s
80// CHECK-V8R: #define __ARMEL__ 1
81// CHECK-V8R: #define __ARM_ARCH 8
82// CHECK-V8R: #define __ARM_ARCH_8R__ 1
83// CHECK-V8R: #define __ARM_FEATURE_CRC32 1
84// CHECK-V8R: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
85// CHECK-V8R: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
86// CHECK-V8R-NOT: #define __ARM_FP 0x
87
88// RUN: %clang -target armv8r-none-linux-gnueabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8R-ALLOW-FP-INSTR %s
89// RUN: %clang -target armv8r-none-linux-gnueabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8R-ALLOW-FP-INSTR %s
90// CHECK-V8R-ALLOW-FP-INSTR: #define __ARMEL__ 1
91// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_ARCH 8
92// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_ARCH_8R__ 1
93// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FEATURE_CRC32 1
94// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
95// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
96// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FP 0xe
97
98// RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7 %s
99// CHECK-V7: #define __ARMEL__ 1
100// CHECK-V7: #define __ARM_ARCH 7
101// CHECK-V7: #define __ARM_ARCH_7A__ 1
102// CHECK-V7-NOT: __ARM_FEATURE_CRC32
103// CHECK-V7-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
104// CHECK-V7-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
105// CHECK-V7-NOT: #define __ARM_FP 0x
106
107// 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
108// 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
109// CHECK-V7-ALLOW-FP-INSTR: #define __ARMEL__ 1
110// CHECK-V7-ALLOW-FP-INSTR: #define __ARM_ARCH 7
111// CHECK-V7-ALLOW-FP-INSTR: #define __ARM_ARCH_7A__ 1
112// CHECK-V7-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
113// CHECK-V7-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
114// CHECK-V7-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
115// CHECK-V7-ALLOW-FP-INSTR: #define __ARM_FP 0xc
116
117// RUN: %clang -target armv7ve-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7VE %s
118// CHECK-V7VE: #define __ARMEL__ 1
119// CHECK-V7VE: #define __ARM_ARCH 7
120// CHECK-V7VE: #define __ARM_ARCH_7VE__ 1
121// CHECK-V7VE: #define __ARM_ARCH_EXT_IDIV__ 1
122// CHECK-V7VE-NOT: #define __ARM_FP 0x
123
124// 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
125// 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
126// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARMEL__ 1
127// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_ARCH 7
128// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_ARCH_7VE__ 1
129// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_ARCH_EXT_IDIV__ 1
130// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_FP 0xc
131
132// 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
133// CHECK-V7S: #define __ARMEL__ 1
134// CHECK-V7S: #define __ARM_ARCH 7
135// CHECK-V7S: #define __ARM_ARCH_7S__ 1
136// CHECK-V7S-NOT: __ARM_FEATURE_CRC32
137// CHECK-V7S-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
138// CHECK-V7S-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
139// CHECK-V7S: #define __ARM_FP 0xe
140
141// RUN: %clang -target armv8a -mfloat-abi=hard -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-BAREHF %s
142// CHECK-V8-BAREHF: #define __ARMEL__ 1
143// CHECK-V8-BAREHF: #define __ARM_ARCH 8
144// CHECK-V8-BAREHF: #define __ARM_ARCH_8A__ 1
145// CHECK-V8-BAREHF: #define __ARM_FEATURE_CRC32 1
146// CHECK-V8-BAREHF: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
147// CHECK-V8-BAREHF: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
148// CHECK-V8-BAREHP: #define __ARM_FP 0xe
149// CHECK-V8-BAREHF: #define __ARM_NEON__ 1
150// CHECK-V8-BAREHF: #define __ARM_PCS_VFP 1
151// CHECK-V8-BAREHF: #define __VFP_FP__ 1
152
153// 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
154// CHECK-V8-BAREHF-FP-NOT: __ARM_NEON__ 1
155// CHECK-V8-BAREHP-FP: #define __ARM_FP 0xe
156// CHECK-V8-BAREHF-FP: #define __VFP_FP__ 1
157
158// 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
159// 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
160// CHECK-V8-BAREHP-NEON-FP: #define __ARM_FP 0xe
161// CHECK-V8-BAREHF-NEON-FP: #define __ARM_NEON__ 1
162// CHECK-V8-BAREHF-NEON-FP: #define __VFP_FP__ 1
163
164// RUN: %clang -target armv8a -mnocrc -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-NOCRC %s
165// CHECK-V8-NOCRC-NOT: __ARM_FEATURE_CRC32 1
166
167// Check that -mhwdiv works properly for armv8/thumbv8 (enabled by default).
168
169// RUN: %clang -target armv8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
170// RUN: %clang -target armv8 -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
171// RUN: %clang -target armv8-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
172// RUN: %clang -target armv8-eabi -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
173// V8:#define __ARM_ARCH_EXT_IDIV__ 1
174
175// RUN: %clang -target armv8 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
176// RUN: %clang -target armv8 -mthumb -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
177// RUN: %clang -target armv8 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
178// RUN: %clang -target armv8 -mthumb -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
179// NOHWDIV-V8-NOT:#define __ARM_ARCH_EXT_IDIV__
180
181// RUN: %clang -target armv8a -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
182// RUN: %clang -target armv8a -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
183// V8A:#define __ARM_ARCH_EXT_IDIV__ 1
184// V8A-NOT:#define __ARM_FP 0x
185
186// RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
187// RUN: %clang -target armv8a-eabi -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
188// RUN: %clang -target armv8a-eabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
189// RUN: %clang -target armv8a-eabihf -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
190// V8A-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
191// V8A-ALLOW-FP-INSTR:#define __ARM_FP 0xe
192
193// RUN: %clang -target armv8m.base-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_BASELINE %s
194// V8M_BASELINE: #define __ARM_ARCH 8
195// V8M_BASELINE: #define __ARM_ARCH_8M_BASE__ 1
196// V8M_BASELINE: #define __ARM_ARCH_EXT_IDIV__ 1
197// V8M_BASELINE-NOT: __ARM_ARCH_ISA_ARM
198// V8M_BASELINE: #define __ARM_ARCH_ISA_THUMB 1
199// V8M_BASELINE: #define __ARM_ARCH_PROFILE 'M'
200// V8M_BASELINE-NOT: __ARM_FEATURE_CRC32
201// V8M_BASELINE-NOT: __ARM_FEATURE_DSP
202// V8M_BASELINE-NOT: __ARM_FP 0x{{.*}}
203// V8M_BASELINE-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
204
205// RUN: %clang -target armv8m.main-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_MAINLINE %s
206// V8M_MAINLINE: #define __ARM_ARCH 8
207// V8M_MAINLINE: #define __ARM_ARCH_8M_MAIN__ 1
208// V8M_MAINLINE: #define __ARM_ARCH_EXT_IDIV__ 1
209// V8M_MAINLINE-NOT: __ARM_ARCH_ISA_ARM
210// V8M_MAINLINE: #define __ARM_ARCH_ISA_THUMB 2
211// V8M_MAINLINE: #define __ARM_ARCH_PROFILE 'M'
212// V8M_MAINLINE-NOT: __ARM_FEATURE_CRC32
213// V8M_MAINLINE-NOT: __ARM_FEATURE_DSP
214// V8M_MAINLINE-NOT: #define __ARM_FP 0x
215// V8M_MAINLINE: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
216
217// 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
218// 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
219// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH 8
220// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
221// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
222// V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
223// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
224// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
225// V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
226// V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_DSP
227// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_FP 0xe
228// V8M-MAINLINE-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
229
230// 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
231// V8M_MAINLINE_DSP: #define __ARM_ARCH 8
232// V8M_MAINLINE_DSP: #define __ARM_ARCH_8M_MAIN__ 1
233// V8M_MAINLINE_DSP: #define __ARM_ARCH_EXT_IDIV__ 1
234// V8M_MAINLINE_DSP-NOT: __ARM_ARCH_ISA_ARM
235// V8M_MAINLINE_DSP: #define __ARM_ARCH_ISA_THUMB 2
236// V8M_MAINLINE_DSP: #define __ARM_ARCH_PROFILE 'M'
237// V8M_MAINLINE_DSP-NOT: __ARM_FEATURE_CRC32
238// V8M_MAINLINE_DSP: #define __ARM_FEATURE_DSP 1
239// V8M_MAINLINE_DSP-NOT: #define __ARM_FP 0x
240// V8M_MAINLINE_DSP: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
241
242// 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
243// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH 8
244// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
245// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
246// V8M-MAINLINE-DSP-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
247// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
248// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
249// V8M-MAINLINE-DSP-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
250// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_FEATURE_DSP 1
251// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_FP 0xe
252// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
253
254// RUN: %clang -target arm-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-DEFS %s
255// CHECK-DEFS:#define __ARM_PCS 1
256// CHECK-DEFS:#define __ARM_SIZEOF_MINIMAL_ENUM 4
257// CHECK-DEFS:#define __ARM_SIZEOF_WCHAR_T 4
258
259// RUN: %clang -target arm-none-linux-gnu -fno-math-errno -fno-signed-zeros\
260// RUN:        -fno-trapping-math -fassociative-math -freciprocal-math\
261// RUN:        -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FASTMATH %s
262// RUN: %clang -target arm-none-linux-gnu -ffast-math -x c -E -dM %s -o -\
263// RUN:        | FileCheck -match-full-lines --check-prefix=CHECK-FASTMATH %s
264// CHECK-FASTMATH: #define __ARM_FP_FAST 1
265
266// RUN: %clang -target arm-none-linux-gnu -fshort-wchar -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-SHORTWCHAR %s
267// CHECK-SHORTWCHAR:#define __ARM_SIZEOF_WCHAR_T 2
268
269// RUN: %clang -target arm-none-linux-gnu -fshort-enums -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-SHORTENUMS %s
270// CHECK-SHORTENUMS:#define __ARM_SIZEOF_MINIMAL_ENUM 1
271
272// Test that -mhwdiv has the right effect for a target CPU which has hwdiv enabled by default.
273// RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
274// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
275// RUN: %clang -target armv7 -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
276// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
277// HWDIV:#define __ARM_ARCH_EXT_IDIV__ 1
278
279// RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
280// RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
281// RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
282// RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
283// NOHWDIV-NOT:#define __ARM_ARCH_EXT_IDIV__
284
285
286// Check that -mfpu works properly for Cortex-A7 (enabled by default).
287// 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
288// 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
289// 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
290// 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
291// DEFAULTFPU-A7:#define __ARM_FP 0xe
292// DEFAULTFPU-A7:#define __ARM_NEON__ 1
293// DEFAULTFPU-A7:#define __ARM_VFPV4__ 1
294
295// 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
296// 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
297// FPUNONE-A7-NOT:#define __ARM_FP 0x{{.*}}
298// FPUNONE-A7-NOT:#define __ARM_NEON__ 1
299// FPUNONE-A7-NOT:#define __ARM_VFPV4__ 1
300
301// 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
302// 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
303// NONEON-A7:#define __ARM_FP 0xe
304// NONEON-A7-NOT:#define __ARM_NEON__ 1
305// NONEON-A7:#define __ARM_VFPV4__ 1
306
307// Check that -mfpu works properly for Cortex-A5 (enabled by default).
308// 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
309// 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
310// DEFAULTFPU-A5:#define __ARM_FP 0xe
311// DEFAULTFPU-A5:#define __ARM_NEON__ 1
312// DEFAULTFPU-A5:#define __ARM_VFPV4__ 1
313
314// 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
315// 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
316// FPUNONE-A5-NOT:#define __ARM_FP 0x{{.*}}
317// FPUNONE-A5-NOT:#define __ARM_NEON__ 1
318// FPUNONE-A5-NOT:#define __ARM_VFPV4__ 1
319
320// 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
321// 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
322// NONEON-A5:#define __ARM_FP 0xe
323// NONEON-A5-NOT:#define __ARM_NEON__ 1
324// NONEON-A5:#define __ARM_VFPV4__ 1
325
326// FIXME: add check for further predefines
327// Test whether predefines are as expected when targeting ep9312.
328// RUN: %clang -target armv4t -mcpu=ep9312 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A4T %s
329// A4T-NOT:#define __ARM_FEATURE_DSP
330// A4T-NOT:#define __ARM_FP 0x{{.*}}
331
332// Test whether predefines are as expected when targeting arm10tdmi.
333// RUN: %clang -target armv5 -mcpu=arm10tdmi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5T %s
334// A5T-NOT:#define __ARM_FEATURE_DSP
335// A5T-NOT:#define __ARM_FP 0x{{.*}}
336
337// Test whether predefines are as expected when targeting cortex-a5i (soft FP ABI as default).
338// RUN: %clang -target armv7 -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5 %s
339// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5 %s
340// A5:#define __ARM_ARCH 7
341// A5:#define __ARM_ARCH_7A__ 1
342// A5-NOT:#define __ARM_ARCH_EXT_IDIV__
343// A5:#define __ARM_ARCH_PROFILE 'A'
344// A5-NOT:#define __ARM_DWARF_EH__ 1
345// A5-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING
346// A5:#define __ARM_FEATURE_DSP 1
347// A5-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN
348// A5-NOT:#define __ARM_FP 0x
349
350// Test whether predefines are as expected when targeting cortex-a5 (softfp FP ABI as default).
351// 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
352// 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
353// A5-ALLOW-FP-INSTR:#define __ARM_ARCH 7
354// A5-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
355// A5-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
356// A5-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
357// A5-ALLOW-FP-INSTR-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING
358// A5-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
359// A5-ALLOW-FP-INSTR-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN
360// A5-ALLOW-FP-INSTR:#define __ARM_FP 0xe
361
362// Test whether predefines are as expected when targeting cortex-a7 (soft FP ABI as default).
363// RUN: %clang -target armv7k -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7 %s
364// RUN: %clang -target armv7k -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7 %s
365// A7:#define __ARM_ARCH 7
366// A7:#define __ARM_ARCH_EXT_IDIV__ 1
367// A7:#define __ARM_ARCH_PROFILE 'A'
368// A7-NOT:#define __ARM_DWARF_EH__ 1
369// A7:#define __ARM_FEATURE_DSP 1
370// A7-NOT:#define __ARM_FP 0x
371
372// Test whether predefines are as expected when targeting cortex-a7 (softfp FP ABI as default).
373// 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
374// 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
375// A7-ALLOW-FP-INSTR:#define __ARM_ARCH 7
376// A7-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
377// A7-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
378// A7-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
379// A7-ALLOW-FP-INSTR:#define __ARM_FP 0xe
380
381// Test whether predefines are as expected when targeting cortex-a7.
382// RUN: %clang -target x86_64-apple-darwin -arch armv7k -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV7K %s
383// ARMV7K:#define __ARM_ARCH 7
384// ARMV7K:#define __ARM_ARCH_EXT_IDIV__ 1
385// ARMV7K:#define __ARM_ARCH_PROFILE 'A'
386// ARMV7K:#define __ARM_DWARF_EH__ 1
387// ARMV7K:#define __ARM_FEATURE_DSP 1
388// ARMV7K:#define __ARM_FP 0xe
389// ARMV7K:#define __ARM_PCS_VFP 1
390
391
392// Test whether predefines are as expected when targeting cortex-a8 (soft FP ABI as default).
393// RUN: %clang -target armv7 -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8 %s
394// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8 %s
395// A8-NOT:#define __ARM_ARCH_EXT_IDIV__
396// A8:#define __ARM_FEATURE_DSP 1
397// A8-NOT:#define __ARM_FP 0x
398
399// Test whether predefines are as expected when targeting cortex-a8 (softfp FP ABI as default).
400// 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
401// 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
402// A8-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
403// A8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
404// A8-ALLOW-FP-INSTR:#define __ARM_FP 0xc
405
406// Test whether predefines are as expected when targeting cortex-a9 (soft FP as default).
407// RUN: %clang -target armv7 -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
408// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
409// A9-NOT:#define __ARM_ARCH_EXT_IDIV__
410// A9:#define __ARM_FEATURE_DSP 1
411// A9-NOT:#define __ARM_FP 0x
412
413// Test whether predefines are as expected when targeting cortex-a9 (softfp FP as default).
414// 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
415// 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
416// A9-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
417// A9-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
418// A9-ALLOW-FP-INSTR:#define __ARM_FP 0xe
419
420
421// Check that -mfpu works properly for Cortex-A12 (enabled by default).
422// 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
423// 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
424// DEFAULTFPU-A12:#define __ARM_FP 0xe
425// DEFAULTFPU-A12:#define __ARM_NEON__ 1
426// DEFAULTFPU-A12:#define __ARM_VFPV4__ 1
427
428// 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
429// 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
430// FPUNONE-A12-NOT:#define __ARM_FP 0x{{.*}}
431// FPUNONE-A12-NOT:#define __ARM_NEON__ 1
432// FPUNONE-A12-NOT:#define __ARM_VFPV4__ 1
433
434// Test whether predefines are as expected when targeting cortex-a12 (soft FP ABI as default).
435// RUN: %clang -target armv7 -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12 %s
436// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12 %s
437// A12:#define __ARM_ARCH 7
438// A12:#define __ARM_ARCH_7A__ 1
439// A12:#define __ARM_ARCH_EXT_IDIV__ 1
440// A12:#define __ARM_ARCH_PROFILE 'A'
441// A12:#define __ARM_FEATURE_DSP 1
442// A12-NOT:#define __ARM_FP 0x
443
444// Test whether predefines are as expected when targeting cortex-a12 (soft FP ABI as default).
445// 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
446// 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
447// A12-ALLOW-FP-INSTR:#define __ARM_ARCH 7
448// A12-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
449// A12-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
450// A12-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
451// A12-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
452// A12-ALLOW-FP-INSTR:#define __ARM_FP 0xe
453
454// Test whether predefines are as expected when targeting cortex-a15 (soft FP ABI as default).
455// RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
456// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
457// A15:#define __ARM_ARCH_EXT_IDIV__ 1
458// A15:#define __ARM_FEATURE_DSP 1
459// A15-NOT:#define __ARM_FP 0x
460
461// Test whether predefines are as expected when targeting cortex-a15 (softfp ABI as default).
462// 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
463// 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
464// A15-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
465// A15-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
466// A15-ALLOW-FP-INSTR:#define __ARM_FP 0xe
467
468// Check that -mfpu works properly for Cortex-A17 (enabled by default).
469// 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
470// 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
471// DEFAULTFPU-A17:#define __ARM_FP 0xe
472// DEFAULTFPU-A17:#define __ARM_NEON__ 1
473// DEFAULTFPU-A17:#define __ARM_VFPV4__ 1
474
475// 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
476// 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
477// FPUNONE-A17-NOT:#define __ARM_FP 0x{{.*}}
478// FPUNONE-A17-NOT:#define __ARM_NEON__ 1
479// FPUNONE-A17-NOT:#define __ARM_VFPV4__ 1
480
481// Test whether predefines are as expected when targeting cortex-a17 (soft FP ABI as default).
482// RUN: %clang -target armv7 -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17 %s
483// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17 %s
484// A17:#define __ARM_ARCH 7
485// A17:#define __ARM_ARCH_7A__ 1
486// A17:#define __ARM_ARCH_EXT_IDIV__ 1
487// A17:#define __ARM_ARCH_PROFILE 'A'
488// A17:#define __ARM_FEATURE_DSP 1
489// A17-NOT:#define __ARM_FP 0x
490
491// Test whether predefines are as expected when targeting cortex-a17 (softfp FP ABI as default).
492// 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
493// 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
494// A17-ALLOW-FP-INSTR:#define __ARM_ARCH 7
495// A17-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
496// A17-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
497// A17-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
498// A17-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
499// A17-ALLOW-FP-INSTR:#define __ARM_FP 0xe
500
501// Test whether predefines are as expected when targeting swift (soft FP ABI as default).
502// RUN: %clang -target armv7s -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
503// RUN: %clang -target armv7s -mthumb -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
504// SWIFT:#define __ARM_ARCH_EXT_IDIV__ 1
505// SWIFT:#define __ARM_FEATURE_DSP 1
506// SWIFT-NOT:#define __ARM_FP 0xxE
507
508// Test whether predefines are as expected when targeting swift (softfp FP ABI as default).
509// RUN: %clang -target armv7s-eabi -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT-ALLOW-FP-INSTR %s
510// 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
511// SWIFT-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
512// SWIFT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
513// SWIFT-ALLOW-FP-INSTR:#define __ARM_FP 0xe
514
515// Test whether predefines are as expected when targeting ARMv8-A Cortex implementations (soft FP ABI as default)
516// RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
517// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
518// RUN: %clang -target armv8 -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
519// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
520// RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
521// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
522// RUN: %clang -target armv8 -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
523// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
524// RUN: %clang -target armv8 -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
525// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
526// RUN: %clang -target armv8 -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
527// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
528//
529// RUN: %clang -target armv8 -mcpu=exynos-m1 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
530// RUN: %clang -target armv8 -mthumb -mcpu=exynos-m1 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
531// RUN: %clang -target armv8 -mcpu=exynos-m2 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
532// RUN: %clang -target armv8 -mthumb -mcpu=exynos-m2 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
533// RUN: %clang -target armv8 -mcpu=exynos-m3 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
534// RUN: %clang -target armv8 -mthumb -mcpu=exynos-m3 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
535// RUN: %clang -target armv8 -mcpu=exynos-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
536// RUN: %clang -target armv8 -mthumb -mcpu=exynos-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
537// RUN: %clang -target armv8 -mcpu=exynos-m5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
538// RUN: %clang -target armv8 -mthumb -mcpu=exynos-m5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
539// ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
540// ARMV8:#define __ARM_FEATURE_DSP 1
541// ARMV8-NOT:#define __ARM_FP 0x
542
543// Test whether predefines are as expected when targeting ARMv8-A Cortex implementations (softfp FP ABI as default)
544// 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
545// 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
546// 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
547// 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
548// 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
549// 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
550// 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
551// 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
552// 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
553// 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
554// 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
555// 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
556//
557// RUN: %clang -target armv8-eabi -mcpu=exynos-m1 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
558// RUN: %clang -target armv8-eabi -mthumb -mcpu=exynos-m1 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
559// RUN: %clang -target armv8-eabi -mcpu=exynos-m2 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
560// RUN: %clang -target armv8-eabi -mthumb -mcpu=exynos-m2 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
561// 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
562// 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
563// 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
564// 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
565// 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
566// 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
567// ARMV8-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
568// ARMV8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
569// ARMV8-ALLOW-FP-INSTR:#define __ARM_FP 0xe
570
571// Test whether predefines are as expected when targeting cortex-r4.
572// RUN: %clang -target armv7 -mcpu=cortex-r4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4-ARM %s
573// R4-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
574// R4-ARM:#define __ARM_FEATURE_DSP 1
575// R4-ARM-NOT:#define __ARM_FP 0x{{.*}}
576
577// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4-THUMB %s
578// R4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
579// R4-THUMB:#define __ARM_FEATURE_DSP 1
580// R4-THUMB-NOT:#define __ARM_FP 0x{{.*}}
581
582// Test whether predefines are as expected when targeting cortex-r4f (soft FP ABI as default).
583// RUN: %clang -target armv7 -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-ARM %s
584// R4F-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
585// R4F-ARM:#define __ARM_FEATURE_DSP 1
586// R4F-ARM-NOT:#define __ARM_FP 0x
587
588// Test whether predefines are as expected when targeting cortex-r4f (softfp FP ABI as default).
589// 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
590// R4F-ARM-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
591// R4F-ARM-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
592// R4F-ARM-ALLOW-FP-INSTR:#define __ARM_FP 0xc
593
594// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-THUMB %s
595// R4F-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
596// R4F-THUMB:#define __ARM_FEATURE_DSP 1
597// R4F-THUMB-NOT:#define __ARM_FP 0x
598
599// 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
600// R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
601// R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
602// R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0xc
603
604// Test whether predefines are as expected when targeting cortex-r5 (soft FP ABI as default).
605// RUN: %clang -target armv7 -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
606// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
607// R5:#define __ARM_ARCH_EXT_IDIV__ 1
608// R5:#define __ARM_FEATURE_DSP 1
609// R5-NOT:#define __ARM_FP 0x
610
611// Test whether predefines are as expected when targeting cortex-r5 (softfp FP ABI as default).
612// 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
613// 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
614// R5-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
615// R5-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
616// R5-ALLOW-FP-INSTR:#define __ARM_FP 0xc
617
618// Test whether predefines are as expected when targeting cortex-r7 and cortex-r8 (soft FP ABI as default).
619// RUN: %clang -target armv7 -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
620// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
621// RUN: %clang -target armv7 -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
622// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
623// R7-R8:#define __ARM_ARCH_EXT_IDIV__ 1
624// R7-R8:#define __ARM_FEATURE_DSP 1
625// R7-R8-NOT:#define __ARM_FP 0x
626
627// Test whether predefines are as expected when targeting cortex-r7 and cortex-r8 (softfp FP ABI as default).
628// 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
629// 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
630// 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
631// 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
632// R7-R8-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
633// R7-R8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
634// R7-R8-ALLOW-FP-INSTR:#define __ARM_FP 0xe
635
636// Test whether predefines are as expected when targeting cortex-m0.
637// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
638// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0plus -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
639// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m1 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
640// RUN: %clang -target armv7 -mthumb -mcpu=sc000 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
641// M0-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
642// M0-THUMB-NOT:#define __ARM_FEATURE_DSP
643// M0-THUMB-NOT:#define __ARM_FP 0x{{.*}}
644
645// Test whether predefines are as expected when targeting cortex-m3.
646// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m3 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M3-THUMB %s
647// RUN: %clang -target armv7 -mthumb -mcpu=sc300 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M3-THUMB %s
648// M3-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
649// M3-THUMB-NOT:#define __ARM_FEATURE_DSP
650// M3-THUMB-NOT:#define __ARM_FP 0x{{.*}}
651
652// Test whether predefines are as expected when targeting cortex-m4 (soft FP ABI as default).
653// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M4-THUMB %s
654// M4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
655// M4-THUMB:#define __ARM_FEATURE_DSP 1
656// M4-THUMB-NOT:#define __ARM_FP 0x
657
658// Test whether predefines are as expected when targeting cortex-m4 (softfp ABI as default).
659// 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
660// M4-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
661// M4-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
662// M4-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0x6
663
664// Test whether predefines are as expected when targeting cortex-m7 (soft FP ABI as default).
665// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M7-THUMB %s
666// M7-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
667// M7-THUMB:#define __ARM_FEATURE_DSP 1
668// M7-THUMB-NOT:#define __ARM_FP 0x
669// M7-THUMB-NOT:#define __ARM_FPV5__
670
671// Test whether predefines are as expected when targeting cortex-m7 (softfp FP ABI as default).
672// 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
673// M7-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
674// M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
675// M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0xe
676// M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FPV5__ 1
677
678// Test whether predefines are as expected when targeting v8m cores
679// RUN: %clang -target arm -mcpu=cortex-m23 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M23 %s
680// M23: #define __ARM_ARCH 8
681// M23: #define __ARM_ARCH_8M_BASE__ 1
682// M23: #define __ARM_ARCH_EXT_IDIV__ 1
683// M23-NOT: __ARM_ARCH_ISA_ARM
684// M23: #define __ARM_ARCH_ISA_THUMB 1
685// M23: #define __ARM_ARCH_PROFILE 'M'
686// M23-NOT: __ARM_FEATURE_CRC32
687// M23-NOT: __ARM_FEATURE_DSP
688// M23-NOT: __ARM_FP 0x{{.*}}
689// M23-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
690
691// Test whether predefines are as expected when targeting m33 (soft FP ABI as default).
692// RUN: %clang -target arm -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M33 %s
693// M33: #define __ARM_ARCH 8
694// M33: #define __ARM_ARCH_8M_MAIN__ 1
695// M33: #define __ARM_ARCH_EXT_IDIV__ 1
696// M33-NOT: __ARM_ARCH_ISA_ARM
697// M33: #define __ARM_ARCH_ISA_THUMB 2
698// M33: #define __ARM_ARCH_PROFILE 'M'
699// M33-NOT: __ARM_FEATURE_CRC32
700// M33: #define __ARM_FEATURE_DSP 1
701// M33-NOT: #define __ARM_FP 0x
702// M33: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
703
704// Test whether predefines are as expected when targeting m33 (softfp FP ABI as default).
705// 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
706// M33-ALLOW-FP-INSTR: #define __ARM_ARCH 8
707// M33-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
708// M33-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
709// M33-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
710// M33-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
711// M33-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
712// M33-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
713// M33-ALLOW-FP-INSTR: #define __ARM_FEATURE_DSP 1
714// M33-ALLOW-FP-INSTR: #define __ARM_FP 0x6
715// M33-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
716
717// Test whether predefines are as expected when targeting krait (soft FP as default).
718// RUN: %clang -target armv7 -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT %s
719// RUN: %clang -target armv7 -mthumb -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT %s
720// KRAIT:#define __ARM_ARCH_EXT_IDIV__ 1
721// KRAIT:#define __ARM_FEATURE_DSP 1
722// KRAIT-NOT:#define  __ARM_VFPV4__
723
724// Test whether predefines are as expected when targeting krait (softfp FP as default).
725// RUN: %clang -target armv7-eabi -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT-ALLOW-FP-INSTR %s
726// 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
727// KRAIT-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
728// KRAIT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
729// KRAIT-ALLOW-FP-INSTR:#define  __ARM_VFPV4__ 1
730
731// RUN: %clang -target armv8.1a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81A %s
732// CHECK-V81A: #define __ARM_ARCH 8
733// CHECK-V81A: #define __ARM_ARCH_8_1A__ 1
734// CHECK-V81A: #define __ARM_ARCH_PROFILE 'A'
735// CHECK-V81A: #define __ARM_FEATURE_QRDMX 1
736// CHECK-V81A: #define __ARM_FP 0xe
737
738// RUN: %clang -target armv8.2a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V82A %s
739// CHECK-V82A: #define __ARM_ARCH 8
740// CHECK-V82A: #define __ARM_ARCH_8_2A__ 1
741// CHECK-V82A: #define __ARM_ARCH_PROFILE 'A'
742// CHECK-V82A: #define __ARM_FEATURE_QRDMX 1
743// CHECK-V82A: #define __ARM_FP 0xe
744
745// RUN: %clang -target armv8.3a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V83A %s
746// CHECK-V83A: #define __ARM_ARCH 8
747// CHECK-V83A: #define __ARM_ARCH_8_3A__ 1
748// CHECK-V83A: #define __ARM_ARCH_PROFILE 'A'
749
750// RUN: %clang -target armv8.4a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V84A %s
751// CHECK-V84A: #define __ARM_ARCH 8
752// CHECK-V84A: #define __ARM_ARCH_8_4A__ 1
753// CHECK-V84A: #define __ARM_ARCH_PROFILE 'A'
754
755// RUN: %clang -target armv8.5a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V85A %s
756// CHECK-V85A: #define __ARM_ARCH 8
757// CHECK-V85A: #define __ARM_ARCH_8_5A__ 1
758// CHECK-V85A: #define __ARM_ARCH_PROFILE 'A'
759