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: #define __ARM_FEATURE_CMSE 1
202 // V8M_BASELINE-NOT: __ARM_FEATURE_DSP
203 // V8M_BASELINE-NOT: __ARM_FP 0x{{.*}}
204 // V8M_BASELINE-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
205 
206 // RUN: %clang -target armv8m.main-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_MAINLINE %s
207 // V8M_MAINLINE: #define __ARM_ARCH 8
208 // V8M_MAINLINE: #define __ARM_ARCH_8M_MAIN__ 1
209 // V8M_MAINLINE: #define __ARM_ARCH_EXT_IDIV__ 1
210 // V8M_MAINLINE-NOT: __ARM_ARCH_ISA_ARM
211 // V8M_MAINLINE: #define __ARM_ARCH_ISA_THUMB 2
212 // V8M_MAINLINE: #define __ARM_ARCH_PROFILE 'M'
213 // V8M_MAINLINE-NOT: __ARM_FEATURE_CRC32
214 // V8M_MAINLINE: #define __ARM_FEATURE_CMSE 1
215 // V8M_MAINLINE-NOT: __ARM_FEATURE_DSP
216 // V8M_MAINLINE-NOT: #define __ARM_FP 0x
217 // V8M_MAINLINE: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
218 
219 // 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
220 // 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
221 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH 8
222 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
223 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
224 // V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
225 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
226 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
227 // V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
228 // V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_DSP
229 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_FP 0xe
230 // V8M-MAINLINE-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
231 
232 // 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
233 // V8M_MAINLINE_DSP: #define __ARM_ARCH 8
234 // V8M_MAINLINE_DSP: #define __ARM_ARCH_8M_MAIN__ 1
235 // V8M_MAINLINE_DSP: #define __ARM_ARCH_EXT_IDIV__ 1
236 // V8M_MAINLINE_DSP-NOT: __ARM_ARCH_ISA_ARM
237 // V8M_MAINLINE_DSP: #define __ARM_ARCH_ISA_THUMB 2
238 // V8M_MAINLINE_DSP: #define __ARM_ARCH_PROFILE 'M'
239 // V8M_MAINLINE_DSP-NOT: __ARM_FEATURE_CRC32
240 // V8M_MAINLINE_DSP: #define __ARM_FEATURE_DSP 1
241 // V8M_MAINLINE_DSP-NOT: #define __ARM_FP 0x
242 // V8M_MAINLINE_DSP: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
243 
244 // 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
245 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH 8
246 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
247 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
248 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
249 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
250 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
251 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
252 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_FEATURE_DSP 1
253 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_FP 0xe
254 // V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
255 
256 // RUN: %clang -target arm-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-DEFS %s
257 // CHECK-DEFS:#define __ARM_PCS 1
258 // CHECK-DEFS:#define __ARM_SIZEOF_MINIMAL_ENUM 4
259 // CHECK-DEFS:#define __ARM_SIZEOF_WCHAR_T 4
260 
261 // RUN: %clang -target arm-none-linux-gnu -fno-math-errno -fno-signed-zeros\
262 // RUN:        -fno-trapping-math -fassociative-math -freciprocal-math\
263 // RUN:        -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FASTMATH %s
264 // RUN: %clang -target arm-none-linux-gnu -ffast-math -x c -E -dM %s -o -\
265 // RUN:        | FileCheck -match-full-lines --check-prefix=CHECK-FASTMATH %s
266 // CHECK-FASTMATH: #define __ARM_FP_FAST 1
267 
268 // RUN: %clang -target arm-none-linux-gnu -fshort-wchar -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-SHORTWCHAR %s
269 // CHECK-SHORTWCHAR:#define __ARM_SIZEOF_WCHAR_T 2
270 
271 // RUN: %clang -target arm-none-linux-gnu -fshort-enums -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-SHORTENUMS %s
272 // CHECK-SHORTENUMS:#define __ARM_SIZEOF_MINIMAL_ENUM 1
273 
274 // Test that -mhwdiv has the right effect for a target CPU which has hwdiv enabled by default.
275 // RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
276 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
277 // RUN: %clang -target armv7 -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
278 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
279 // HWDIV:#define __ARM_ARCH_EXT_IDIV__ 1
280 
281 // RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
282 // RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
283 // RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
284 // RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
285 // NOHWDIV-NOT:#define __ARM_ARCH_EXT_IDIV__
286 
287 
288 // Check that -mfpu works properly for Cortex-A7 (enabled by default).
289 // 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
290 // 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
291 // 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
292 // 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
293 // DEFAULTFPU-A7:#define __ARM_FP 0xe
294 // DEFAULTFPU-A7:#define __ARM_NEON__ 1
295 // DEFAULTFPU-A7:#define __ARM_VFPV4__ 1
296 
297 // 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
298 // 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
299 // FPUNONE-A7-NOT:#define __ARM_FP 0x{{.*}}
300 // FPUNONE-A7-NOT:#define __ARM_NEON__ 1
301 // FPUNONE-A7-NOT:#define __ARM_VFPV4__ 1
302 
303 // 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
304 // 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
305 // NONEON-A7:#define __ARM_FP 0xe
306 // NONEON-A7-NOT:#define __ARM_NEON__ 1
307 // NONEON-A7:#define __ARM_VFPV4__ 1
308 
309 // Check that -mfpu works properly for Cortex-A5 (enabled by default).
310 // 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
311 // 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
312 // DEFAULTFPU-A5:#define __ARM_FP 0xe
313 // DEFAULTFPU-A5:#define __ARM_NEON__ 1
314 // DEFAULTFPU-A5:#define __ARM_VFPV4__ 1
315 
316 // 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
317 // 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
318 // FPUNONE-A5-NOT:#define __ARM_FP 0x{{.*}}
319 // FPUNONE-A5-NOT:#define __ARM_NEON__ 1
320 // FPUNONE-A5-NOT:#define __ARM_VFPV4__ 1
321 
322 // 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
323 // 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
324 // NONEON-A5:#define __ARM_FP 0xe
325 // NONEON-A5-NOT:#define __ARM_NEON__ 1
326 // NONEON-A5:#define __ARM_VFPV4__ 1
327 
328 // FIXME: add check for further predefines
329 // Test whether predefines are as expected when targeting ep9312.
330 // RUN: %clang -target armv4t -mcpu=ep9312 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A4T %s
331 // A4T-NOT:#define __ARM_FEATURE_DSP
332 // A4T-NOT:#define __ARM_FP 0x{{.*}}
333 
334 // Test whether predefines are as expected when targeting arm10tdmi.
335 // RUN: %clang -target armv5 -mcpu=arm10tdmi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5T %s
336 // A5T-NOT:#define __ARM_FEATURE_DSP
337 // A5T-NOT:#define __ARM_FP 0x{{.*}}
338 
339 // Test whether predefines are as expected when targeting cortex-a5i (soft FP ABI as default).
340 // RUN: %clang -target armv7 -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5 %s
341 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5 %s
342 // A5:#define __ARM_ARCH 7
343 // A5:#define __ARM_ARCH_7A__ 1
344 // A5-NOT:#define __ARM_ARCH_EXT_IDIV__
345 // A5:#define __ARM_ARCH_PROFILE 'A'
346 // A5-NOT:#define __ARM_DWARF_EH__ 1
347 // A5-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING
348 // A5:#define __ARM_FEATURE_DSP 1
349 // A5-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN
350 // A5-NOT:#define __ARM_FP 0x
351 
352 // Test whether predefines are as expected when targeting cortex-a5 (softfp FP ABI as default).
353 // 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
354 // 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
355 // A5-ALLOW-FP-INSTR:#define __ARM_ARCH 7
356 // A5-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
357 // A5-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
358 // A5-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
359 // A5-ALLOW-FP-INSTR-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING
360 // A5-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
361 // A5-ALLOW-FP-INSTR-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN
362 // A5-ALLOW-FP-INSTR:#define __ARM_FP 0xe
363 
364 // Test whether predefines are as expected when targeting cortex-a7 (soft FP ABI as default).
365 // RUN: %clang -target armv7k -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7 %s
366 // RUN: %clang -target armv7k -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7 %s
367 // A7:#define __ARM_ARCH 7
368 // A7:#define __ARM_ARCH_EXT_IDIV__ 1
369 // A7:#define __ARM_ARCH_PROFILE 'A'
370 // A7-NOT:#define __ARM_DWARF_EH__ 1
371 // A7:#define __ARM_FEATURE_DSP 1
372 // A7-NOT:#define __ARM_FP 0x
373 
374 // Test whether predefines are as expected when targeting cortex-a7 (softfp FP ABI as default).
375 // 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
376 // 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
377 // A7-ALLOW-FP-INSTR:#define __ARM_ARCH 7
378 // A7-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
379 // A7-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
380 // A7-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
381 // A7-ALLOW-FP-INSTR:#define __ARM_FP 0xe
382 
383 // Test whether predefines are as expected when targeting cortex-a7.
384 // RUN: %clang -target x86_64-apple-darwin -arch armv7k -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV7K %s
385 // ARMV7K:#define __ARM_ARCH 7
386 // ARMV7K:#define __ARM_ARCH_EXT_IDIV__ 1
387 // ARMV7K:#define __ARM_ARCH_PROFILE 'A'
388 // ARMV7K:#define __ARM_DWARF_EH__ 1
389 // ARMV7K:#define __ARM_FEATURE_DSP 1
390 // ARMV7K:#define __ARM_FP 0xe
391 // ARMV7K:#define __ARM_PCS_VFP 1
392 
393 
394 // Test whether predefines are as expected when targeting cortex-a8 (soft FP ABI as default).
395 // RUN: %clang -target armv7 -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8 %s
396 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8 %s
397 // A8-NOT:#define __ARM_ARCH_EXT_IDIV__
398 // A8:#define __ARM_FEATURE_DSP 1
399 // A8-NOT:#define __ARM_FP 0x
400 
401 // Test whether predefines are as expected when targeting cortex-a8 (softfp FP ABI as default).
402 // 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
403 // 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
404 // A8-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
405 // A8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
406 // A8-ALLOW-FP-INSTR:#define __ARM_FP 0xc
407 
408 // Test whether predefines are as expected when targeting cortex-a9 (soft FP as default).
409 // RUN: %clang -target armv7 -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
410 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
411 // A9-NOT:#define __ARM_ARCH_EXT_IDIV__
412 // A9:#define __ARM_FEATURE_DSP 1
413 // A9-NOT:#define __ARM_FP 0x
414 
415 // Test whether predefines are as expected when targeting cortex-a9 (softfp FP as default).
416 // 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
417 // 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
418 // A9-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
419 // A9-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
420 // A9-ALLOW-FP-INSTR:#define __ARM_FP 0xe
421 
422 
423 // Check that -mfpu works properly for Cortex-A12 (enabled by default).
424 // 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
425 // 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
426 // DEFAULTFPU-A12:#define __ARM_FP 0xe
427 // DEFAULTFPU-A12:#define __ARM_NEON__ 1
428 // DEFAULTFPU-A12:#define __ARM_VFPV4__ 1
429 
430 // 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
431 // 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
432 // FPUNONE-A12-NOT:#define __ARM_FP 0x{{.*}}
433 // FPUNONE-A12-NOT:#define __ARM_NEON__ 1
434 // FPUNONE-A12-NOT:#define __ARM_VFPV4__ 1
435 
436 // Test whether predefines are as expected when targeting cortex-a12 (soft FP ABI as default).
437 // RUN: %clang -target armv7 -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12 %s
438 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12 %s
439 // A12:#define __ARM_ARCH 7
440 // A12:#define __ARM_ARCH_7A__ 1
441 // A12:#define __ARM_ARCH_EXT_IDIV__ 1
442 // A12:#define __ARM_ARCH_PROFILE 'A'
443 // A12:#define __ARM_FEATURE_DSP 1
444 // A12-NOT:#define __ARM_FP 0x
445 
446 // Test whether predefines are as expected when targeting cortex-a12 (soft FP ABI as default).
447 // 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
448 // 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
449 // A12-ALLOW-FP-INSTR:#define __ARM_ARCH 7
450 // A12-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
451 // A12-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
452 // A12-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
453 // A12-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
454 // A12-ALLOW-FP-INSTR:#define __ARM_FP 0xe
455 
456 // Test whether predefines are as expected when targeting cortex-a15 (soft FP ABI as default).
457 // RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
458 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
459 // A15:#define __ARM_ARCH_EXT_IDIV__ 1
460 // A15:#define __ARM_FEATURE_DSP 1
461 // A15-NOT:#define __ARM_FP 0x
462 
463 // Test whether predefines are as expected when targeting cortex-a15 (softfp ABI as default).
464 // 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
465 // 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
466 // A15-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
467 // A15-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
468 // A15-ALLOW-FP-INSTR:#define __ARM_FP 0xe
469 
470 // Check that -mfpu works properly for Cortex-A17 (enabled by default).
471 // 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
472 // 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
473 // DEFAULTFPU-A17:#define __ARM_FP 0xe
474 // DEFAULTFPU-A17:#define __ARM_NEON__ 1
475 // DEFAULTFPU-A17:#define __ARM_VFPV4__ 1
476 
477 // 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
478 // 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
479 // FPUNONE-A17-NOT:#define __ARM_FP 0x{{.*}}
480 // FPUNONE-A17-NOT:#define __ARM_NEON__ 1
481 // FPUNONE-A17-NOT:#define __ARM_VFPV4__ 1
482 
483 // Test whether predefines are as expected when targeting cortex-a17 (soft FP ABI as default).
484 // RUN: %clang -target armv7 -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17 %s
485 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17 %s
486 // A17:#define __ARM_ARCH 7
487 // A17:#define __ARM_ARCH_7A__ 1
488 // A17:#define __ARM_ARCH_EXT_IDIV__ 1
489 // A17:#define __ARM_ARCH_PROFILE 'A'
490 // A17:#define __ARM_FEATURE_DSP 1
491 // A17-NOT:#define __ARM_FP 0x
492 
493 // Test whether predefines are as expected when targeting cortex-a17 (softfp FP ABI as default).
494 // 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
495 // 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
496 // A17-ALLOW-FP-INSTR:#define __ARM_ARCH 7
497 // A17-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
498 // A17-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
499 // A17-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
500 // A17-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
501 // A17-ALLOW-FP-INSTR:#define __ARM_FP 0xe
502 
503 // Test whether predefines are as expected when targeting swift (soft FP ABI as default).
504 // RUN: %clang -target armv7s -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
505 // RUN: %clang -target armv7s -mthumb -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
506 // SWIFT:#define __ARM_ARCH_EXT_IDIV__ 1
507 // SWIFT:#define __ARM_FEATURE_DSP 1
508 // SWIFT-NOT:#define __ARM_FP 0xxE
509 
510 // Test whether predefines are as expected when targeting swift (softfp FP ABI as default).
511 // RUN: %clang -target armv7s-eabi -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT-ALLOW-FP-INSTR %s
512 // 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
513 // SWIFT-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
514 // SWIFT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
515 // SWIFT-ALLOW-FP-INSTR:#define __ARM_FP 0xe
516 
517 // Test whether predefines are as expected when targeting ARMv8-A Cortex implementations (soft FP ABI as default)
518 // RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
519 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
520 // RUN: %clang -target armv8 -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
521 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
522 // RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
523 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
524 // RUN: %clang -target armv8 -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
525 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
526 // RUN: %clang -target armv8 -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
527 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
528 // RUN: %clang -target armv8 -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
529 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
530 //
531 // RUN: %clang -target armv8 -mcpu=exynos-m3 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
532 // RUN: %clang -target armv8 -mthumb -mcpu=exynos-m3 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
533 // RUN: %clang -target armv8 -mcpu=exynos-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
534 // RUN: %clang -target armv8 -mthumb -mcpu=exynos-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
535 // RUN: %clang -target armv8 -mcpu=exynos-m5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
536 // RUN: %clang -target armv8 -mthumb -mcpu=exynos-m5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
537 // ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
538 // ARMV8:#define __ARM_FEATURE_DSP 1
539 // ARMV8-NOT:#define __ARM_FP 0x
540 
541 // Test whether predefines are as expected when targeting ARMv8-A Cortex implementations (softfp FP ABI as default)
542 // 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
543 // 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
544 // 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
545 // 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
546 // 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
547 // 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
548 // 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
549 // 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
550 // 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
551 // 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
552 // 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
553 // 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
554 //
555 // 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
556 // 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
557 // 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
558 // 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
559 // 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
560 // 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
561 // ARMV8-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
562 // ARMV8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
563 // ARMV8-ALLOW-FP-INSTR:#define __ARM_FP 0xe
564 
565 // Test whether predefines are as expected when targeting cortex-r4.
566 // RUN: %clang -target armv7 -mcpu=cortex-r4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4-ARM %s
567 // R4-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
568 // R4-ARM:#define __ARM_FEATURE_DSP 1
569 // R4-ARM-NOT:#define __ARM_FP 0x{{.*}}
570 
571 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4-THUMB %s
572 // R4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
573 // R4-THUMB:#define __ARM_FEATURE_DSP 1
574 // R4-THUMB-NOT:#define __ARM_FP 0x{{.*}}
575 
576 // Test whether predefines are as expected when targeting cortex-r4f (soft FP ABI as default).
577 // RUN: %clang -target armv7 -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-ARM %s
578 // R4F-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
579 // R4F-ARM:#define __ARM_FEATURE_DSP 1
580 // R4F-ARM-NOT:#define __ARM_FP 0x
581 
582 // Test whether predefines are as expected when targeting cortex-r4f (softfp FP ABI as default).
583 // 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
584 // R4F-ARM-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
585 // R4F-ARM-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
586 // R4F-ARM-ALLOW-FP-INSTR:#define __ARM_FP 0xc
587 
588 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-THUMB %s
589 // R4F-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
590 // R4F-THUMB:#define __ARM_FEATURE_DSP 1
591 // R4F-THUMB-NOT:#define __ARM_FP 0x
592 
593 // 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
594 // R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
595 // R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
596 // R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0xc
597 
598 // Test whether predefines are as expected when targeting cortex-r5 (soft FP ABI as default).
599 // RUN: %clang -target armv7 -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
600 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
601 // R5:#define __ARM_ARCH_EXT_IDIV__ 1
602 // R5:#define __ARM_FEATURE_DSP 1
603 // R5-NOT:#define __ARM_FP 0x
604 
605 // Test whether predefines are as expected when targeting cortex-r5 (softfp FP ABI as default).
606 // 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
607 // 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
608 // R5-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
609 // R5-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
610 // R5-ALLOW-FP-INSTR:#define __ARM_FP 0xc
611 
612 // Test whether predefines are as expected when targeting cortex-r7 and cortex-r8 (soft FP ABI as default).
613 // RUN: %clang -target armv7 -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
614 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
615 // RUN: %clang -target armv7 -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
616 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
617 // R7-R8:#define __ARM_ARCH_EXT_IDIV__ 1
618 // R7-R8:#define __ARM_FEATURE_DSP 1
619 // R7-R8-NOT:#define __ARM_FP 0x
620 
621 // Test whether predefines are as expected when targeting cortex-r7 and cortex-r8 (softfp FP ABI as default).
622 // 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
623 // 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
624 // 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
625 // 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
626 // R7-R8-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
627 // R7-R8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
628 // R7-R8-ALLOW-FP-INSTR:#define __ARM_FP 0xe
629 
630 // Test whether predefines are as expected when targeting cortex-m0.
631 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
632 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0plus -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
633 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m1 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
634 // RUN: %clang -target armv7 -mthumb -mcpu=sc000 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
635 // M0-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
636 // M0-THUMB-NOT:#define __ARM_FEATURE_DSP
637 // M0-THUMB-NOT:#define __ARM_FP 0x{{.*}}
638 
639 // Test whether predefines are as expected when targeting cortex-m3.
640 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m3 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M3-THUMB %s
641 // RUN: %clang -target armv7 -mthumb -mcpu=sc300 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M3-THUMB %s
642 // M3-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
643 // M3-THUMB-NOT:#define __ARM_FEATURE_DSP
644 // M3-THUMB-NOT:#define __ARM_FP 0x{{.*}}
645 
646 // Test whether predefines are as expected when targeting cortex-m4 (soft FP ABI as default).
647 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M4-THUMB %s
648 // M4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
649 // M4-THUMB:#define __ARM_FEATURE_DSP 1
650 // M4-THUMB-NOT:#define __ARM_FP 0x
651 
652 // Test whether predefines are as expected when targeting cortex-m4 (softfp ABI as default).
653 // 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
654 // M4-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
655 // M4-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
656 // M4-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0x6
657 
658 // Test whether predefines are as expected when targeting cortex-m7 (soft FP ABI as default).
659 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M7-THUMB %s
660 // M7-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
661 // M7-THUMB:#define __ARM_FEATURE_DSP 1
662 // M7-THUMB-NOT:#define __ARM_FP 0x
663 // M7-THUMB-NOT:#define __ARM_FPV5__
664 
665 // Test whether predefines are as expected when targeting cortex-m7 (softfp FP ABI as default).
666 // 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
667 // M7-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
668 // M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
669 // M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0xe
670 // M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FPV5__ 1
671 
672 // Check that -mcmse (security extension) option works correctly for v8-M targets
673 // RUN: %clang -target armv8m.base-none-linux-gnu -mcmse -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_CMSE %s
674 // RUN: %clang -target armv8m.main-none-linux-gnu -mcmse -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_CMSE %s
675 // 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
676 // RUN: %clang -target arm -mcpu=cortex-m23 -mcmse -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_CMSE %s
677 // V8M_CMSE-NOT: __ARM_FEATURE_CMSE 1
678 // V8M_CMSE: #define __ARM_FEATURE_CMSE 3
679 
680 // Check that CMSE is not defined on architectures w/o support for security extension
681 // 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
682 // RUN: %clang -target armv8a-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOTV8M_CMSE %s
683 // RUN: %clang -target armv8.1a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOTV8M_CMSE %s
684 // NOTV8M_CMSE-NOT: __ARM_FEATURE_CMSE
685 
686 // Check that -mcmse option gives error on non v8-M targets
687 // 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
688 // NOTV8MCMSE_OPT: error: -mcmse is not supported for cortex-m7
689 
690 // Test whether predefines are as expected when targeting v8m cores
691 // RUN: %clang -target arm -mcpu=cortex-m23 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M23 %s
692 // M23: #define __ARM_ARCH 8
693 // M23: #define __ARM_ARCH_8M_BASE__ 1
694 // M23: #define __ARM_ARCH_EXT_IDIV__ 1
695 // M23-NOT: __ARM_ARCH_ISA_ARM
696 // M23: #define __ARM_ARCH_ISA_THUMB 1
697 // M23: #define __ARM_ARCH_PROFILE 'M'
698 // M23-NOT: __ARM_FEATURE_CRC32
699 // M23-NOT: __ARM_FEATURE_DSP
700 // M23-NOT: __ARM_FP 0x{{.*}}
701 // M23-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
702 
703 // Test whether predefines are as expected when targeting m33 (soft FP ABI as default).
704 // RUN: %clang -target arm -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M33 %s
705 // M33: #define __ARM_ARCH 8
706 // M33: #define __ARM_ARCH_8M_MAIN__ 1
707 // M33: #define __ARM_ARCH_EXT_IDIV__ 1
708 // M33-NOT: __ARM_ARCH_ISA_ARM
709 // M33: #define __ARM_ARCH_ISA_THUMB 2
710 // M33: #define __ARM_ARCH_PROFILE 'M'
711 // M33-NOT: __ARM_FEATURE_CRC32
712 // M33: #define __ARM_FEATURE_DSP 1
713 // M33-NOT: #define __ARM_FP 0x
714 // M33: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
715 
716 // Test whether predefines are as expected when targeting m33 (softfp FP ABI as default).
717 // 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
718 // M33-ALLOW-FP-INSTR: #define __ARM_ARCH 8
719 // M33-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
720 // M33-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
721 // M33-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
722 // M33-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
723 // M33-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
724 // M33-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
725 // M33-ALLOW-FP-INSTR: #define __ARM_FEATURE_DSP 1
726 // M33-ALLOW-FP-INSTR: #define __ARM_FP 0x6
727 // M33-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
728 
729 // Test whether predefines are as expected when targeting krait (soft FP as default).
730 // RUN: %clang -target armv7 -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT %s
731 // RUN: %clang -target armv7 -mthumb -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT %s
732 // KRAIT:#define __ARM_ARCH_EXT_IDIV__ 1
733 // KRAIT:#define __ARM_FEATURE_DSP 1
734 // KRAIT-NOT:#define  __ARM_VFPV4__
735 
736 // Test whether predefines are as expected when targeting krait (softfp FP as default).
737 // RUN: %clang -target armv7-eabi -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT-ALLOW-FP-INSTR %s
738 // 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
739 // KRAIT-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
740 // KRAIT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
741 // KRAIT-ALLOW-FP-INSTR:#define  __ARM_VFPV4__ 1
742 
743 // 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
744 // CHECK-V81M: #define __ARM_ARCH 8
745 // CHECK-V81M: #define __ARM_ARCH_8_1M_MAIN__ 1
746 // CHECK-V81M: #define __ARM_ARCH_ISA_THUMB 2
747 // CHECK-V81M: #define __ARM_ARCH_PROFILE 'M'
748 // CHECK-V81M-NOT: #define __ARM_FEATURE_DSP
749 // CHECK-V81M-NOT: #define __ARM_FEATURE_MVE
750 // CHECK-V81M-NOT: #define __ARM_FEATURE_SIMD32
751 
752 // 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
753 // CHECK-V81M-MVE: #define __ARM_FEATURE_DSP 1
754 // CHECK-V81M-MVE: #define __ARM_FEATURE_MVE 1
755 // CHECK-V81M-MVE: #define __ARM_FEATURE_SIMD32 1
756 
757 // 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
758 // CHECK-V81M-MVEFP: #define __ARM_FEATURE_DSP 1
759 // CHECK-V81M-MVEFP: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
760 // CHECK-V81M-MVEFP: #define __ARM_FEATURE_MVE 3
761 // CHECK-V81M-MVEFP: #define __ARM_FEATURE_SIMD32 1
762 // CHECK-V81M-MVEFP: #define __ARM_FPV5__ 1
763 
764 // nofp discards mve.fp
765 // 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
766 // CHECK-V81M-MVEFP-NOFP-NOT: #define __ARM_FEATURE_MVE
767 
768 // nomve discards mve.fp
769 // 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
770 // CHECK-V81M-MVEFP-NOMVE-NOT: #define __ARM_FEATURE_MVE
771 
772 // mve+fp doesn't imply mve.fp
773 // 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
774 // CHECK-V81M-MVE-FP: #define __ARM_FEATURE_MVE 1
775 
776 // nodsp discards both dsp and mve
777 // 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
778 // CHECK-V81M-MVE-NODSP-NOT: #define __ARM_FEATURE_MVE
779 // CHECK-V81M-MVE-NODSP-NOT: #define __ARM_FEATURE_DSP
780 
781 // RUN: %clang -target armv8.1a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81A %s
782 // CHECK-V81A: #define __ARM_ARCH 8
783 // CHECK-V81A: #define __ARM_ARCH_8_1A__ 1
784 // CHECK-V81A: #define __ARM_ARCH_PROFILE 'A'
785 // CHECK-V81A: #define __ARM_FEATURE_QRDMX 1
786 // CHECK-V81A: #define __ARM_FP 0xe
787 
788 // RUN: %clang -target armv8.2a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V82A %s
789 // CHECK-V82A: #define __ARM_ARCH 8
790 // CHECK-V82A: #define __ARM_ARCH_8_2A__ 1
791 // CHECK-V82A: #define __ARM_ARCH_PROFILE 'A'
792 // CHECK-V82A: #define __ARM_FEATURE_QRDMX 1
793 // CHECK-V82A: #define __ARM_FP 0xe
794 
795 // RUN: %clang -target armv8.3a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V83A %s
796 // CHECK-V83A: #define __ARM_ARCH 8
797 // CHECK-V83A: #define __ARM_ARCH_8_3A__ 1
798 // CHECK-V83A: #define __ARM_ARCH_PROFILE 'A'
799 
800 // RUN: %clang -target armv8.4a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V84A %s
801 // CHECK-V84A: #define __ARM_ARCH 8
802 // CHECK-V84A: #define __ARM_ARCH_8_4A__ 1
803 // CHECK-V84A: #define __ARM_ARCH_PROFILE 'A'
804 
805 // RUN: %clang -target armv8.5a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V85A %s
806 // CHECK-V85A: #define __ARM_ARCH 8
807 // CHECK-V85A: #define __ARM_ARCH_8_5A__ 1
808 // CHECK-V85A: #define __ARM_ARCH_PROFILE 'A'
809 
810 // RUN: %clang -target arm-none-none-eabi -march=armv7-m -mfpu=softvfp -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SOFTVFP %s
811 // CHECK-SOFTVFP-NOT: #define __ARM_FP 0x
812