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