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