blob: b8116b241e7afd6254d23a016c481d8fdce66a7f [file] [log] [blame]
James Y Knight3508b222016-04-01 21:33:20 +00001// 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
Keith Walker167961f2018-02-19 12:40:26 +00008// CHECK-V8A-NOT: #define __ARM_FP 0x
9
10// 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
11// 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
12// CHECK-V8A-ALLOW-FP-INSTR: #define __ARMEL__ 1
13// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_ARCH 8
14// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_ARCH_8A__ 1
15// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FEATURE_CRC32 1
16// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
17// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
18// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP 0xe
19// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_ARGS 1
20// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_FORMAT_IEEE 1
Joey Gouly1e8637b2013-09-18 10:07:09 +000021
Sjoerd Meijera7463df2018-03-13 22:11:06 +000022// RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2a+fp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
23// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
24// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
25// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FP 0xe
26// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FP16_FORMAT_IEEE 1
27
28// RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2a+fp16 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SCALAR %s
29// CHECK-FULLFP16-SCALAR: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
30// CHECK-FULLFP16-SCALAR-NOT: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
31// CHECK-FULLFP16-SCALAR: #define __ARM_FP 0xe
32// CHECK-FULLFP16-SCALAR: #define __ARM_FP16_FORMAT_IEEE 1
33
Javed Absar00b74442016-10-07 12:08:41 +000034// RUN: %clang -target armv8r-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8R %s
35// CHECK-V8R: #define __ARMEL__ 1
36// CHECK-V8R: #define __ARM_ARCH 8
37// CHECK-V8R: #define __ARM_ARCH_8R__ 1
38// CHECK-V8R: #define __ARM_FEATURE_CRC32 1
39// CHECK-V8R: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
40// CHECK-V8R: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
Keith Walker167961f2018-02-19 12:40:26 +000041// CHECK-V8R-NOT: #define __ARM_FP 0x
42
43// 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
44// 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
45// CHECK-V8R-ALLOW-FP-INSTR: #define __ARMEL__ 1
46// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_ARCH 8
47// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_ARCH_8R__ 1
48// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FEATURE_CRC32 1
49// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
50// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
51// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FP 0xe
Javed Absar00b74442016-10-07 12:08:41 +000052
James Y Knight3508b222016-04-01 21:33:20 +000053// RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7 %s
54// CHECK-V7: #define __ARMEL__ 1
55// CHECK-V7: #define __ARM_ARCH 7
56// CHECK-V7: #define __ARM_ARCH_7A__ 1
Nico Riecke6a158252014-02-16 07:29:41 +000057// CHECK-V7-NOT: __ARM_FEATURE_CRC32
Pablo Barrio1c1b2512016-03-15 19:03:09 +000058// CHECK-V7-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
James Molloy0ffb0932014-09-15 11:25:38 +000059// CHECK-V7-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
Keith Walker167961f2018-02-19 12:40:26 +000060// CHECK-V7-NOT: #define __ARM_FP 0x
61
62// 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
63// 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
64// CHECK-V7-ALLOW-FP-INSTR: #define __ARMEL__ 1
65// CHECK-V7-ALLOW-FP-INSTR: #define __ARM_ARCH 7
66// CHECK-V7-ALLOW-FP-INSTR: #define __ARM_ARCH_7A__ 1
67// CHECK-V7-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
68// CHECK-V7-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
69// CHECK-V7-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
70// CHECK-V7-ALLOW-FP-INSTR: #define __ARM_FP 0xc
Silviu Barangae5690462013-10-21 10:59:33 +000071
George Burgess IVfc970562017-02-09 23:30:10 +000072// RUN: %clang -target armv7ve-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7VE %s
73// CHECK-V7VE: #define __ARMEL__ 1
74// CHECK-V7VE: #define __ARM_ARCH 7
75// CHECK-V7VE: #define __ARM_ARCH_7VE__ 1
76// CHECK-V7VE: #define __ARM_ARCH_EXT_IDIV__ 1
Keith Walker167961f2018-02-19 12:40:26 +000077// CHECK-V7VE-NOT: #define __ARM_FP 0x
78
79// 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
80// 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
81// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARMEL__ 1
82// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_ARCH 7
83// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_ARCH_7VE__ 1
84// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_ARCH_EXT_IDIV__ 1
85// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_FP 0xc
George Burgess IVfc970562017-02-09 23:30:10 +000086
James Y Knight3508b222016-04-01 21:33:20 +000087// 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
88// CHECK-V7S: #define __ARMEL__ 1
89// CHECK-V7S: #define __ARM_ARCH 7
90// CHECK-V7S: #define __ARM_ARCH_7S__ 1
Tim Northover525c73c2015-07-21 21:47:33 +000091// CHECK-V7S-NOT: __ARM_FEATURE_CRC32
92// CHECK-V7S-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
93// CHECK-V7S-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
Benjamin Kramer3a13ed62017-12-28 16:58:54 +000094// CHECK-V7S: #define __ARM_FP 0xe
Tim Northover525c73c2015-07-21 21:47:33 +000095
James Y Knight3508b222016-04-01 21:33:20 +000096// RUN: %clang -target armv8a -mfloat-abi=hard -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-BAREHF %s
97// CHECK-V8-BAREHF: #define __ARMEL__ 1
98// CHECK-V8-BAREHF: #define __ARM_ARCH 8
99// CHECK-V8-BAREHF: #define __ARM_ARCH_8A__ 1
100// CHECK-V8-BAREHF: #define __ARM_FEATURE_CRC32 1
101// CHECK-V8-BAREHF: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
102// CHECK-V8-BAREHF: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
Benjamin Kramer3a13ed62017-12-28 16:58:54 +0000103// CHECK-V8-BAREHP: #define __ARM_FP 0xe
James Y Knight3508b222016-04-01 21:33:20 +0000104// CHECK-V8-BAREHF: #define __ARM_NEON__ 1
105// CHECK-V8-BAREHF: #define __ARM_PCS_VFP 1
106// CHECK-V8-BAREHF: #define __VFP_FP__ 1
Bernard Ogdenda13af32013-10-24 18:32:51 +0000107
James Y Knight3508b222016-04-01 21:33:20 +0000108// 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
Bernard Ogdenda13af32013-10-24 18:32:51 +0000109// CHECK-V8-BAREHF-FP-NOT: __ARM_NEON__ 1
Benjamin Kramer3a13ed62017-12-28 16:58:54 +0000110// CHECK-V8-BAREHP-FP: #define __ARM_FP 0xe
James Y Knight3508b222016-04-01 21:33:20 +0000111// CHECK-V8-BAREHF-FP: #define __VFP_FP__ 1
Bernard Ogdenda13af32013-10-24 18:32:51 +0000112
James Y Knight3508b222016-04-01 21:33:20 +0000113// 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
114// 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
Benjamin Kramer3a13ed62017-12-28 16:58:54 +0000115// CHECK-V8-BAREHP-NEON-FP: #define __ARM_FP 0xe
James Y Knight3508b222016-04-01 21:33:20 +0000116// CHECK-V8-BAREHF-NEON-FP: #define __ARM_NEON__ 1
117// CHECK-V8-BAREHF-NEON-FP: #define __VFP_FP__ 1
Bernard Ogdenda13af32013-10-24 18:32:51 +0000118
James Y Knight3508b222016-04-01 21:33:20 +0000119// RUN: %clang -target armv8a -mnocrc -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-NOCRC %s
Bernard Ogden18b57012013-10-29 09:47:51 +0000120// CHECK-V8-NOCRC-NOT: __ARM_FEATURE_CRC32 1
121
Silviu Barangae5690462013-10-21 10:59:33 +0000122// Check that -mhwdiv works properly for armv8/thumbv8 (enabled by default).
123
James Y Knight3508b222016-04-01 21:33:20 +0000124// RUN: %clang -target armv8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
125// RUN: %clang -target armv8 -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
126// RUN: %clang -target armv8-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
127// RUN: %clang -target armv8-eabi -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8 %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000128// V8:#define __ARM_ARCH_EXT_IDIV__ 1
Silviu Barangae5690462013-10-21 10:59:33 +0000129
James Y Knight3508b222016-04-01 21:33:20 +0000130// RUN: %clang -target armv8 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
131// RUN: %clang -target armv8 -mthumb -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
132// RUN: %clang -target armv8 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
133// RUN: %clang -target armv8 -mthumb -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV-V8 %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000134// NOHWDIV-V8-NOT:#define __ARM_ARCH_EXT_IDIV__
Silviu Barangae5690462013-10-21 10:59:33 +0000135
James Y Knight3508b222016-04-01 21:33:20 +0000136// RUN: %clang -target armv8a -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
137// RUN: %clang -target armv8a -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000138// V8A:#define __ARM_ARCH_EXT_IDIV__ 1
Keith Walker167961f2018-02-19 12:40:26 +0000139// V8A-NOT:#define __ARM_FP 0x
140
141// RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
142// RUN: %clang -target armv8a-eabi -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
143// RUN: %clang -target armv8a-eabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
144// RUN: %clang -target armv8a-eabihf -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
145// V8A-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
146// V8A-ALLOW-FP-INSTR:#define __ARM_FP 0xe
Silviu Barangae5690462013-10-21 10:59:33 +0000147
James Y Knight3508b222016-04-01 21:33:20 +0000148// RUN: %clang -target armv8m.base-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_BASELINE %s
149// V8M_BASELINE: #define __ARM_ARCH 8
150// V8M_BASELINE: #define __ARM_ARCH_8M_BASE__ 1
151// V8M_BASELINE: #define __ARM_ARCH_EXT_IDIV__ 1
Bradley Smithf4affc12016-03-03 13:52:22 +0000152// V8M_BASELINE-NOT: __ARM_ARCH_ISA_ARM
James Y Knight3508b222016-04-01 21:33:20 +0000153// V8M_BASELINE: #define __ARM_ARCH_ISA_THUMB 1
154// V8M_BASELINE: #define __ARM_ARCH_PROFILE 'M'
Bradley Smithf4affc12016-03-03 13:52:22 +0000155// V8M_BASELINE-NOT: __ARM_FEATURE_CRC32
156// V8M_BASELINE-NOT: __ARM_FEATURE_DSP
157// V8M_BASELINE-NOT: __ARM_FP 0x{{.*}}
158// V8M_BASELINE-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
159
James Y Knight3508b222016-04-01 21:33:20 +0000160// RUN: %clang -target armv8m.main-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_MAINLINE %s
161// V8M_MAINLINE: #define __ARM_ARCH 8
162// V8M_MAINLINE: #define __ARM_ARCH_8M_MAIN__ 1
163// V8M_MAINLINE: #define __ARM_ARCH_EXT_IDIV__ 1
Bradley Smithf4affc12016-03-03 13:52:22 +0000164// V8M_MAINLINE-NOT: __ARM_ARCH_ISA_ARM
James Y Knight3508b222016-04-01 21:33:20 +0000165// V8M_MAINLINE: #define __ARM_ARCH_ISA_THUMB 2
166// V8M_MAINLINE: #define __ARM_ARCH_PROFILE 'M'
Bradley Smithf4affc12016-03-03 13:52:22 +0000167// V8M_MAINLINE-NOT: __ARM_FEATURE_CRC32
168// V8M_MAINLINE-NOT: __ARM_FEATURE_DSP
Keith Walker167961f2018-02-19 12:40:26 +0000169// V8M_MAINLINE-NOT: #define __ARM_FP 0x
James Y Knight3508b222016-04-01 21:33:20 +0000170// V8M_MAINLINE: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
Bradley Smithf4affc12016-03-03 13:52:22 +0000171
Keith Walker167961f2018-02-19 12:40:26 +0000172// 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
173// 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
174// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH 8
175// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
176// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
177// V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
178// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
179// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
180// V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
181// V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_DSP
182// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_FP 0xe
183// V8M-MAINLINE-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
184
James Y Knight3508b222016-04-01 21:33:20 +0000185// 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
186// V8M_MAINLINE_DSP: #define __ARM_ARCH 8
187// V8M_MAINLINE_DSP: #define __ARM_ARCH_8M_MAIN__ 1
188// V8M_MAINLINE_DSP: #define __ARM_ARCH_EXT_IDIV__ 1
Bradley Smithf4affc12016-03-03 13:52:22 +0000189// V8M_MAINLINE_DSP-NOT: __ARM_ARCH_ISA_ARM
James Y Knight3508b222016-04-01 21:33:20 +0000190// V8M_MAINLINE_DSP: #define __ARM_ARCH_ISA_THUMB 2
191// V8M_MAINLINE_DSP: #define __ARM_ARCH_PROFILE 'M'
Bradley Smithf4affc12016-03-03 13:52:22 +0000192// V8M_MAINLINE_DSP-NOT: __ARM_FEATURE_CRC32
James Y Knight3508b222016-04-01 21:33:20 +0000193// V8M_MAINLINE_DSP: #define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000194// V8M_MAINLINE_DSP-NOT: #define __ARM_FP 0x
James Y Knight3508b222016-04-01 21:33:20 +0000195// V8M_MAINLINE_DSP: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
Bradley Smithf4affc12016-03-03 13:52:22 +0000196
Keith Walker167961f2018-02-19 12:40:26 +0000197// 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
198// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH 8
199// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
200// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
201// V8M-MAINLINE-DSP-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
202// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
203// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
204// V8M-MAINLINE-DSP-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
205// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_FEATURE_DSP 1
206// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_FP 0xe
207// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
208
James Y Knight3508b222016-04-01 21:33:20 +0000209// RUN: %clang -target arm-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-DEFS %s
Alexandros Lamprineasf5a8e6c2015-10-02 14:56:37 +0000210// CHECK-DEFS:#define __ARM_PCS 1
Bradley Smith0f28f0c2014-01-20 10:52:00 +0000211// CHECK-DEFS:#define __ARM_SIZEOF_MINIMAL_ENUM 4
212// CHECK-DEFS:#define __ARM_SIZEOF_WCHAR_T 4
213
Alexandros Lamprineasf5a8e6c2015-10-02 14:56:37 +0000214// RUN: %clang -target arm-none-linux-gnu -fno-math-errno -fno-signed-zeros\
215// RUN: -fno-trapping-math -fassociative-math -freciprocal-math\
James Y Knight3508b222016-04-01 21:33:20 +0000216// RUN: -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FASTMATH %s
Alexandros Lamprineasf5a8e6c2015-10-02 14:56:37 +0000217// RUN: %clang -target arm-none-linux-gnu -ffast-math -x c -E -dM %s -o -\
James Y Knight3508b222016-04-01 21:33:20 +0000218// RUN: | FileCheck -match-full-lines --check-prefix=CHECK-FASTMATH %s
219// CHECK-FASTMATH: #define __ARM_FP_FAST 1
Alexandros Lamprineasf5a8e6c2015-10-02 14:56:37 +0000220
James Y Knight3508b222016-04-01 21:33:20 +0000221// RUN: %clang -target arm-none-linux-gnu -fshort-wchar -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-SHORTWCHAR %s
Bradley Smith0f28f0c2014-01-20 10:52:00 +0000222// CHECK-SHORTWCHAR:#define __ARM_SIZEOF_WCHAR_T 2
223
James Y Knight3508b222016-04-01 21:33:20 +0000224// RUN: %clang -target arm-none-linux-gnu -fshort-enums -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-SHORTENUMS %s
Bradley Smith0f28f0c2014-01-20 10:52:00 +0000225// CHECK-SHORTENUMS:#define __ARM_SIZEOF_MINIMAL_ENUM 1
Silviu Barangae5690462013-10-21 10:59:33 +0000226
227// Test that -mhwdiv has the right effect for a target CPU which has hwdiv enabled by default.
James Y Knight3508b222016-04-01 21:33:20 +0000228// RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
229// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
230// RUN: %clang -target armv7 -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
231// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=HWDIV %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000232// HWDIV:#define __ARM_ARCH_EXT_IDIV__ 1
Silviu Barangae5690462013-10-21 10:59:33 +0000233
James Y Knight3508b222016-04-01 21:33:20 +0000234// RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
235// RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
236// RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
237// RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOHWDIV %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000238// NOHWDIV-NOT:#define __ARM_ARCH_EXT_IDIV__
Silviu Barangae5690462013-10-21 10:59:33 +0000239
Artyom Skrobov53b000a82013-11-21 14:04:38 +0000240
241// Check that -mfpu works properly for Cortex-A7 (enabled by default).
James Y Knight3508b222016-04-01 21:33:20 +0000242// 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
243// 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
Keith Walker167961f2018-02-19 12:40:26 +0000244// 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
245// 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
Benjamin Kramer3a13ed62017-12-28 16:58:54 +0000246// DEFAULTFPU-A7:#define __ARM_FP 0xe
Artyom Skrobov53b000a82013-11-21 14:04:38 +0000247// DEFAULTFPU-A7:#define __ARM_NEON__ 1
248// DEFAULTFPU-A7:#define __ARM_VFPV4__ 1
249
James Y Knight3508b222016-04-01 21:33:20 +0000250// 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
251// 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
Richard Barton7dacc242015-10-21 10:03:55 +0000252// FPUNONE-A7-NOT:#define __ARM_FP 0x{{.*}}
Artyom Skrobov53b000a82013-11-21 14:04:38 +0000253// FPUNONE-A7-NOT:#define __ARM_NEON__ 1
254// FPUNONE-A7-NOT:#define __ARM_VFPV4__ 1
255
James Y Knight3508b222016-04-01 21:33:20 +0000256// 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
257// 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
Benjamin Kramer3a13ed62017-12-28 16:58:54 +0000258// NONEON-A7:#define __ARM_FP 0xe
Artyom Skrobov53b000a82013-11-21 14:04:38 +0000259// NONEON-A7-NOT:#define __ARM_NEON__ 1
260// NONEON-A7:#define __ARM_VFPV4__ 1
261
Amara Emersona1daec72013-11-25 13:18:59 +0000262// Check that -mfpu works properly for Cortex-A5 (enabled by default).
James Y Knight3508b222016-04-01 21:33:20 +0000263// 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
264// 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
Benjamin Kramer3a13ed62017-12-28 16:58:54 +0000265// DEFAULTFPU-A5:#define __ARM_FP 0xe
Amara Emersona1daec72013-11-25 13:18:59 +0000266// DEFAULTFPU-A5:#define __ARM_NEON__ 1
267// DEFAULTFPU-A5:#define __ARM_VFPV4__ 1
268
James Y Knight3508b222016-04-01 21:33:20 +0000269// 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
270// 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
Richard Barton7dacc242015-10-21 10:03:55 +0000271// FPUNONE-A5-NOT:#define __ARM_FP 0x{{.*}}
Amara Emersona1daec72013-11-25 13:18:59 +0000272// FPUNONE-A5-NOT:#define __ARM_NEON__ 1
273// FPUNONE-A5-NOT:#define __ARM_VFPV4__ 1
274
James Y Knight3508b222016-04-01 21:33:20 +0000275// 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
276// 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
Benjamin Kramer3a13ed62017-12-28 16:58:54 +0000277// NONEON-A5:#define __ARM_FP 0xe
Amara Emersona1daec72013-11-25 13:18:59 +0000278// NONEON-A5-NOT:#define __ARM_NEON__ 1
279// NONEON-A5:#define __ARM_VFPV4__ 1
280
Silviu Barangae5690462013-10-21 10:59:33 +0000281// FIXME: add check for further predefines
Sergey Dmitrouk745f5302014-11-25 08:57:36 +0000282// Test whether predefines are as expected when targeting ep9312.
James Y Knight3508b222016-04-01 21:33:20 +0000283// RUN: %clang -target armv4t -mcpu=ep9312 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A4T %s
Sergey Dmitrouk745f5302014-11-25 08:57:36 +0000284// A4T-NOT:#define __ARM_FEATURE_DSP
Richard Barton7dacc242015-10-21 10:03:55 +0000285// A4T-NOT:#define __ARM_FP 0x{{.*}}
Sergey Dmitrouk745f5302014-11-25 08:57:36 +0000286
287// Test whether predefines are as expected when targeting arm10tdmi.
James Y Knight3508b222016-04-01 21:33:20 +0000288// RUN: %clang -target armv5 -mcpu=arm10tdmi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5T %s
Sergey Dmitrouk745f5302014-11-25 08:57:36 +0000289// A5T-NOT:#define __ARM_FEATURE_DSP
Richard Barton7dacc242015-10-21 10:03:55 +0000290// A5T-NOT:#define __ARM_FP 0x{{.*}}
Sergey Dmitrouk745f5302014-11-25 08:57:36 +0000291
Keith Walker167961f2018-02-19 12:40:26 +0000292// Test whether predefines are as expected when targeting cortex-a5i (soft FP ABI as default).
James Y Knight3508b222016-04-01 21:33:20 +0000293// RUN: %clang -target armv7 -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5 %s
294// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5 %s
Amara Emersona1daec72013-11-25 13:18:59 +0000295// A5:#define __ARM_ARCH 7
296// A5:#define __ARM_ARCH_7A__ 1
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000297// A5-NOT:#define __ARM_ARCH_EXT_IDIV__
Saleem Abdulrasool52a5d412014-06-15 18:48:41 +0000298// A5:#define __ARM_ARCH_PROFILE 'A'
Martell Malonec950c652017-11-29 07:25:12 +0000299// A5-NOT:#define __ARM_DWARF_EH__ 1
James Molloy0ffb0932014-09-15 11:25:38 +0000300// A5-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING
James Y Knight3508b222016-04-01 21:33:20 +0000301// A5:#define __ARM_FEATURE_DSP 1
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000302// A5-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN
Keith Walker167961f2018-02-19 12:40:26 +0000303// A5-NOT:#define __ARM_FP 0x
Amara Emersona1daec72013-11-25 13:18:59 +0000304
Keith Walker167961f2018-02-19 12:40:26 +0000305// Test whether predefines are as expected when targeting cortex-a5 (softfp FP ABI as default).
306// 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
307// 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
308// A5-ALLOW-FP-INSTR:#define __ARM_ARCH 7
309// A5-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
310// A5-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
311// A5-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
312// A5-ALLOW-FP-INSTR-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING
313// A5-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
314// A5-ALLOW-FP-INSTR-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN
315// A5-ALLOW-FP-INSTR:#define __ARM_FP 0xe
316
317// Test whether predefines are as expected when targeting cortex-a7 (soft FP ABI as default).
James Y Knight3508b222016-04-01 21:33:20 +0000318// RUN: %clang -target armv7k -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7 %s
319// RUN: %clang -target armv7k -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7 %s
Artyom Skrobov53b000a82013-11-21 14:04:38 +0000320// A7:#define __ARM_ARCH 7
Artyom Skrobov53b000a82013-11-21 14:04:38 +0000321// A7:#define __ARM_ARCH_EXT_IDIV__ 1
Saleem Abdulrasool52a5d412014-06-15 18:48:41 +0000322// A7:#define __ARM_ARCH_PROFILE 'A'
Martell Malonec950c652017-11-29 07:25:12 +0000323// A7-NOT:#define __ARM_DWARF_EH__ 1
James Y Knight3508b222016-04-01 21:33:20 +0000324// A7:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000325// A7-NOT:#define __ARM_FP 0x
326
327// Test whether predefines are as expected when targeting cortex-a7 (softfp FP ABI as default).
328// 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
329// 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
330// A7-ALLOW-FP-INSTR:#define __ARM_ARCH 7
331// A7-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
332// A7-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
333// A7-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
334// A7-ALLOW-FP-INSTR:#define __ARM_FP 0xe
Artyom Skrobov53b000a82013-11-21 14:04:38 +0000335
Tim Northover32617992016-04-28 14:01:49 +0000336// Test whether predefines are as expected when targeting cortex-a7.
337// RUN: %clang -target x86_64-apple-darwin -arch armv7k -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV7K %s
338// ARMV7K:#define __ARM_ARCH 7
339// ARMV7K:#define __ARM_ARCH_EXT_IDIV__ 1
340// ARMV7K:#define __ARM_ARCH_PROFILE 'A'
Chris Bieneman46977b62016-04-29 17:53:00 +0000341// ARMV7K:#define __ARM_DWARF_EH__ 1
Tim Northover32617992016-04-28 14:01:49 +0000342// ARMV7K:#define __ARM_FEATURE_DSP 1
Benjamin Kramer3a13ed62017-12-28 16:58:54 +0000343// ARMV7K:#define __ARM_FP 0xe
Tim Northover32617992016-04-28 14:01:49 +0000344// ARMV7K:#define __ARM_PCS_VFP 1
345
346
Keith Walker167961f2018-02-19 12:40:26 +0000347// Test whether predefines are as expected when targeting cortex-a8 (soft FP ABI as default).
James Y Knight3508b222016-04-01 21:33:20 +0000348// RUN: %clang -target armv7 -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8 %s
349// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8 %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000350// A8-NOT:#define __ARM_ARCH_EXT_IDIV__
James Y Knight3508b222016-04-01 21:33:20 +0000351// A8:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000352// A8-NOT:#define __ARM_FP 0x
Silviu Barangae5690462013-10-21 10:59:33 +0000353
Keith Walker167961f2018-02-19 12:40:26 +0000354// Test whether predefines are as expected when targeting cortex-a8 (softfp FP ABI as default).
355// 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
356// 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
357// A8-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
358// A8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
359// A8-ALLOW-FP-INSTR:#define __ARM_FP 0xc
360
361// Test whether predefines are as expected when targeting cortex-a9 (soft FP as default).
James Y Knight3508b222016-04-01 21:33:20 +0000362// RUN: %clang -target armv7 -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
363// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000364// A9-NOT:#define __ARM_ARCH_EXT_IDIV__
James Y Knight3508b222016-04-01 21:33:20 +0000365// A9:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000366// A9-NOT:#define __ARM_FP 0x
367
368// Test whether predefines are as expected when targeting cortex-a9 (softfp FP as default).
369// 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
370// 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
371// A9-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
372// A9-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
373// A9-ALLOW-FP-INSTR:#define __ARM_FP 0xe
Silviu Barangae5690462013-10-21 10:59:33 +0000374
Richard Barton3b82ed32013-11-22 11:53:28 +0000375
376// Check that -mfpu works properly for Cortex-A12 (enabled by default).
James Y Knight3508b222016-04-01 21:33:20 +0000377// 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
378// 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
Benjamin Kramer3a13ed62017-12-28 16:58:54 +0000379// DEFAULTFPU-A12:#define __ARM_FP 0xe
Richard Barton3b82ed32013-11-22 11:53:28 +0000380// DEFAULTFPU-A12:#define __ARM_NEON__ 1
381// DEFAULTFPU-A12:#define __ARM_VFPV4__ 1
382
James Y Knight3508b222016-04-01 21:33:20 +0000383// 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
384// 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
Richard Barton7dacc242015-10-21 10:03:55 +0000385// FPUNONE-A12-NOT:#define __ARM_FP 0x{{.*}}
Richard Barton3b82ed32013-11-22 11:53:28 +0000386// FPUNONE-A12-NOT:#define __ARM_NEON__ 1
387// FPUNONE-A12-NOT:#define __ARM_VFPV4__ 1
388
Keith Walker167961f2018-02-19 12:40:26 +0000389// Test whether predefines are as expected when targeting cortex-a12 (soft FP ABI as default).
James Y Knight3508b222016-04-01 21:33:20 +0000390// RUN: %clang -target armv7 -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12 %s
391// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12 %s
Richard Barton3b82ed32013-11-22 11:53:28 +0000392// A12:#define __ARM_ARCH 7
393// A12:#define __ARM_ARCH_7A__ 1
394// A12:#define __ARM_ARCH_EXT_IDIV__ 1
Saleem Abdulrasool52a5d412014-06-15 18:48:41 +0000395// A12:#define __ARM_ARCH_PROFILE 'A'
James Y Knight3508b222016-04-01 21:33:20 +0000396// A12:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000397// A12-NOT:#define __ARM_FP 0x
Richard Barton3b82ed32013-11-22 11:53:28 +0000398
Keith Walker167961f2018-02-19 12:40:26 +0000399// Test whether predefines are as expected when targeting cortex-a12 (soft FP ABI as default).
400// 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
401// 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
402// A12-ALLOW-FP-INSTR:#define __ARM_ARCH 7
403// A12-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
404// A12-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
405// A12-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
406// A12-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
407// A12-ALLOW-FP-INSTR:#define __ARM_FP 0xe
408
409// Test whether predefines are as expected when targeting cortex-a15 (soft FP ABI as default).
James Y Knight3508b222016-04-01 21:33:20 +0000410// RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
411// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000412// A15:#define __ARM_ARCH_EXT_IDIV__ 1
James Y Knight3508b222016-04-01 21:33:20 +0000413// A15:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000414// A15-NOT:#define __ARM_FP 0x
415
416// Test whether predefines are as expected when targeting cortex-a15 (softfp ABI as default).
417// 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
418// 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
419// A15-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
420// A15-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
421// A15-ALLOW-FP-INSTR:#define __ARM_FP 0xe
Silviu Barangae5690462013-10-21 10:59:33 +0000422
Renato Golin5886bc32014-10-13 10:22:48 +0000423// Check that -mfpu works properly for Cortex-A17 (enabled by default).
James Y Knight3508b222016-04-01 21:33:20 +0000424// 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
425// 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
Benjamin Kramer3a13ed62017-12-28 16:58:54 +0000426// DEFAULTFPU-A17:#define __ARM_FP 0xe
Renato Golin5886bc32014-10-13 10:22:48 +0000427// DEFAULTFPU-A17:#define __ARM_NEON__ 1
428// DEFAULTFPU-A17:#define __ARM_VFPV4__ 1
429
James Y Knight3508b222016-04-01 21:33:20 +0000430// 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
431// 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
Richard Barton7dacc242015-10-21 10:03:55 +0000432// FPUNONE-A17-NOT:#define __ARM_FP 0x{{.*}}
Renato Golin5886bc32014-10-13 10:22:48 +0000433// FPUNONE-A17-NOT:#define __ARM_NEON__ 1
434// FPUNONE-A17-NOT:#define __ARM_VFPV4__ 1
435
Keith Walker167961f2018-02-19 12:40:26 +0000436// Test whether predefines are as expected when targeting cortex-a17 (soft FP ABI as default).
James Y Knight3508b222016-04-01 21:33:20 +0000437// RUN: %clang -target armv7 -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17 %s
438// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17 %s
Renato Golin5886bc32014-10-13 10:22:48 +0000439// A17:#define __ARM_ARCH 7
440// A17:#define __ARM_ARCH_7A__ 1
441// A17:#define __ARM_ARCH_EXT_IDIV__ 1
442// A17:#define __ARM_ARCH_PROFILE 'A'
James Y Knight3508b222016-04-01 21:33:20 +0000443// A17:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000444// A17-NOT:#define __ARM_FP 0x
Renato Golin5886bc32014-10-13 10:22:48 +0000445
Keith Walker167961f2018-02-19 12:40:26 +0000446// Test whether predefines are as expected when targeting cortex-a17 (softfp FP ABI as default).
447// 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
448// 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
449// A17-ALLOW-FP-INSTR:#define __ARM_ARCH 7
450// A17-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
451// A17-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
452// A17-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
453// A17-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
454// A17-ALLOW-FP-INSTR:#define __ARM_FP 0xe
455
456// Test whether predefines are as expected when targeting swift (soft FP ABI as default).
James Y Knight3508b222016-04-01 21:33:20 +0000457// RUN: %clang -target armv7s -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
458// RUN: %clang -target armv7s -mthumb -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000459// SWIFT:#define __ARM_ARCH_EXT_IDIV__ 1
James Y Knight3508b222016-04-01 21:33:20 +0000460// SWIFT:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000461// SWIFT-NOT:#define __ARM_FP 0xxE
Silviu Barangae5690462013-10-21 10:59:33 +0000462
Keith Walker167961f2018-02-19 12:40:26 +0000463// Test whether predefines are as expected when targeting swift (softfp FP ABI as default).
464// RUN: %clang -target armv7s-eabi -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT-ALLOW-FP-INSTR %s
465// 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
466// SWIFT-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
467// SWIFT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
468// SWIFT-ALLOW-FP-INSTR:#define __ARM_FP 0xe
469
470// Test whether predefines are as expected when targeting ARMv8-A Cortex implementations (soft FP ABI as default)
James Y Knight3508b222016-04-01 21:33:20 +0000471// RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
472// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
Sjoerd Meijerb3b81472016-06-03 08:47:56 +0000473// RUN: %clang -target armv8 -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
474// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
James Y Knight3508b222016-04-01 21:33:20 +0000475// RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
476// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
Sjoerd Meijerb3b81472016-06-03 08:47:56 +0000477// RUN: %clang -target armv8 -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
478// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
479// RUN: %clang -target armv8 -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
480// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
Sjoerd Meijer90df4a72016-06-02 10:48:37 +0000481// RUN: %clang -target armv8 -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
482// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000483// ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
James Y Knight3508b222016-04-01 21:33:20 +0000484// ARMV8:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000485// ARMV8-NOT:#define __ARM_FP 0x
486
487// Test whether predefines are as expected when targeting ARMv8-A Cortex implementations (softfp FP ABI as default)
488// 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
489// 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
490// 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
491// 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
492// 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
493// 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
494// 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
495// 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
496// 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
497// 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
498// 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
499// 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
500// ARMV8-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
501// ARMV8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
502// ARMV8-ALLOW-FP-INSTR:#define __ARM_FP 0xe
Silviu Barangae5690462013-10-21 10:59:33 +0000503
Javed Absar879d18b82015-04-09 14:12:10 +0000504// Test whether predefines are as expected when targeting cortex-r4.
James Y Knight3508b222016-04-01 21:33:20 +0000505// RUN: %clang -target armv7 -mcpu=cortex-r4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4-ARM %s
Javed Absar879d18b82015-04-09 14:12:10 +0000506// R4-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
James Y Knight3508b222016-04-01 21:33:20 +0000507// R4-ARM:#define __ARM_FEATURE_DSP 1
Richard Barton7dacc242015-10-21 10:03:55 +0000508// R4-ARM-NOT:#define __ARM_FP 0x{{.*}}
Javed Absar879d18b82015-04-09 14:12:10 +0000509
James Y Knight3508b222016-04-01 21:33:20 +0000510// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4-THUMB %s
Javed Absar879d18b82015-04-09 14:12:10 +0000511// R4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
James Y Knight3508b222016-04-01 21:33:20 +0000512// R4-THUMB:#define __ARM_FEATURE_DSP 1
Richard Barton7dacc242015-10-21 10:03:55 +0000513// R4-THUMB-NOT:#define __ARM_FP 0x{{.*}}
Javed Absar879d18b82015-04-09 14:12:10 +0000514
Keith Walker167961f2018-02-19 12:40:26 +0000515// Test whether predefines are as expected when targeting cortex-r4f (soft FP ABI as default).
James Y Knight3508b222016-04-01 21:33:20 +0000516// RUN: %clang -target armv7 -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-ARM %s
Javed Absar879d18b82015-04-09 14:12:10 +0000517// R4F-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
James Y Knight3508b222016-04-01 21:33:20 +0000518// R4F-ARM:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000519// R4F-ARM-NOT:#define __ARM_FP 0x
520
521// Test whether predefines are as expected when targeting cortex-r4f (softfp FP ABI as default).
522// 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
523// R4F-ARM-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
524// R4F-ARM-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
525// R4F-ARM-ALLOW-FP-INSTR:#define __ARM_FP 0xc
Javed Absar879d18b82015-04-09 14:12:10 +0000526
James Y Knight3508b222016-04-01 21:33:20 +0000527// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-THUMB %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000528// R4F-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
James Y Knight3508b222016-04-01 21:33:20 +0000529// R4F-THUMB:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000530// R4F-THUMB-NOT:#define __ARM_FP 0x
Javed Absar879d18b82015-04-09 14:12:10 +0000531
Keith Walker167961f2018-02-19 12:40:26 +0000532// 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
533// R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
534// R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
535// R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0xc
536
537// Test whether predefines are as expected when targeting cortex-r5 (soft FP ABI as default).
James Y Knight3508b222016-04-01 21:33:20 +0000538// RUN: %clang -target armv7 -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
539// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000540// R5:#define __ARM_ARCH_EXT_IDIV__ 1
James Y Knight3508b222016-04-01 21:33:20 +0000541// R5:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000542// R5-NOT:#define __ARM_FP 0x
Silviu Barangae5690462013-10-21 10:59:33 +0000543
Keith Walker167961f2018-02-19 12:40:26 +0000544// Test whether predefines are as expected when targeting cortex-r5 (softfp FP ABI as default).
545// 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
546// 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
547// R5-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
548// R5-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
549// R5-ALLOW-FP-INSTR:#define __ARM_FP 0xc
550
551// Test whether predefines are as expected when targeting cortex-r7 and cortex-r8 (soft FP ABI as default).
James Y Knight3508b222016-04-01 21:33:20 +0000552// RUN: %clang -target armv7 -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
553// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
554// RUN: %clang -target armv7 -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
555// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000556// R7-R8:#define __ARM_ARCH_EXT_IDIV__ 1
James Y Knight3508b222016-04-01 21:33:20 +0000557// R7-R8:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000558// R7-R8-NOT:#define __ARM_FP 0x
559
560// Test whether predefines are as expected when targeting cortex-r7 and cortex-r8 (softfp FP ABI as default).
561// 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
562// 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
563// 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
564// 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
565// R7-R8-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
566// R7-R8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
567// R7-R8-ALLOW-FP-INSTR:#define __ARM_FP 0xe
Bradley Smithd86d6702015-02-18 10:34:48 +0000568
Silviu Barangae5690462013-10-21 10:59:33 +0000569// Test whether predefines are as expected when targeting cortex-m0.
James Y Knight3508b222016-04-01 21:33:20 +0000570// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
571// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0plus -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
572// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m1 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
573// RUN: %clang -target armv7 -mthumb -mcpu=sc000 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
Silviu Barangae5690462013-10-21 10:59:33 +0000574// M0-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
Sergey Dmitrouk745f5302014-11-25 08:57:36 +0000575// M0-THUMB-NOT:#define __ARM_FEATURE_DSP
Richard Barton7dacc242015-10-21 10:03:55 +0000576// M0-THUMB-NOT:#define __ARM_FP 0x{{.*}}
Silviu Barangae5690462013-10-21 10:59:33 +0000577
578// Test whether predefines are as expected when targeting cortex-m3.
James Y Knight3508b222016-04-01 21:33:20 +0000579// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m3 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M3-THUMB %s
580// RUN: %clang -target armv7 -mthumb -mcpu=sc300 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M3-THUMB %s
Silviu Barangae5690462013-10-21 10:59:33 +0000581// M3-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
Sergey Dmitrouk745f5302014-11-25 08:57:36 +0000582// M3-THUMB-NOT:#define __ARM_FEATURE_DSP
Richard Barton7dacc242015-10-21 10:03:55 +0000583// M3-THUMB-NOT:#define __ARM_FP 0x{{.*}}
Silviu Barangae5690462013-10-21 10:59:33 +0000584
Keith Walker167961f2018-02-19 12:40:26 +0000585// Test whether predefines are as expected when targeting cortex-m4 (soft FP ABI as default).
James Y Knight3508b222016-04-01 21:33:20 +0000586// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M4-THUMB %s
Silviu Barangae5690462013-10-21 10:59:33 +0000587// M4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
James Y Knight3508b222016-04-01 21:33:20 +0000588// M4-THUMB:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000589// M4-THUMB-NOT:#define __ARM_FP 0x
Ana Pazosdd6068d2013-12-06 22:43:17 +0000590
Keith Walker167961f2018-02-19 12:40:26 +0000591// Test whether predefines are as expected when targeting cortex-m4 (softfp ABI as default).
592// 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
593// M4-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
594// M4-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
595// M4-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0x6
596
597// Test whether predefines are as expected when targeting cortex-m7 (soft FP ABI as default).
James Y Knight3508b222016-04-01 21:33:20 +0000598// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M7-THUMB %s
Oliver Stannardbfd3ea32014-10-01 09:03:02 +0000599// M7-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
James Y Knight3508b222016-04-01 21:33:20 +0000600// M7-THUMB:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000601// M7-THUMB-NOT:#define __ARM_FP 0x
602// M7-THUMB-NOT:#define __ARM_FPV5__
603
604// Test whether predefines are as expected when targeting cortex-m7 (softfp FP ABI as default).
605// 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
606// M7-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
607// M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
608// M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0xe
609// M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FPV5__ 1
Oliver Stannardbfd3ea32014-10-01 09:03:02 +0000610
Sanne Wouda0479e692017-02-20 10:37:01 +0000611// Test whether predefines are as expected when targeting v8m cores
612// RUN: %clang -target arm -mcpu=cortex-m23 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M23 %s
613// M23: #define __ARM_ARCH 8
614// M23: #define __ARM_ARCH_8M_BASE__ 1
615// M23: #define __ARM_ARCH_EXT_IDIV__ 1
616// M23-NOT: __ARM_ARCH_ISA_ARM
617// M23: #define __ARM_ARCH_ISA_THUMB 1
618// M23: #define __ARM_ARCH_PROFILE 'M'
619// M23-NOT: __ARM_FEATURE_CRC32
620// M23-NOT: __ARM_FEATURE_DSP
621// M23-NOT: __ARM_FP 0x{{.*}}
622// M23-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
623
Keith Walker167961f2018-02-19 12:40:26 +0000624// Test whether predefines are as expected when targeting m33 (soft FP ABI as default).
Sanne Wouda0479e692017-02-20 10:37:01 +0000625// RUN: %clang -target arm -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M33 %s
626// M33: #define __ARM_ARCH 8
627// M33: #define __ARM_ARCH_8M_MAIN__ 1
628// M33: #define __ARM_ARCH_EXT_IDIV__ 1
629// M33-NOT: __ARM_ARCH_ISA_ARM
630// M33: #define __ARM_ARCH_ISA_THUMB 2
631// M33: #define __ARM_ARCH_PROFILE 'M'
632// M33-NOT: __ARM_FEATURE_CRC32
633// M33: #define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000634// M33-NOT: #define __ARM_FP 0x
Sanne Wouda0479e692017-02-20 10:37:01 +0000635// M33: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
636
Keith Walker167961f2018-02-19 12:40:26 +0000637// Test whether predefines are as expected when targeting m33 (softfp FP ABI as default).
638// 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
639// M33-ALLOW-FP-INSTR: #define __ARM_ARCH 8
640// M33-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
641// M33-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
642// M33-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
643// M33-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
644// M33-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
645// M33-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
646// M33-ALLOW-FP-INSTR: #define __ARM_FEATURE_DSP 1
647// M33-ALLOW-FP-INSTR: #define __ARM_FP 0x6
648// M33-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
649
650// Test whether predefines are as expected when targeting krait (soft FP as default).
James Y Knight3508b222016-04-01 21:33:20 +0000651// RUN: %clang -target armv7 -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT %s
652// RUN: %clang -target armv7 -mthumb -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT %s
Artyom Skrobov59f43bb2016-03-23 13:32:33 +0000653// KRAIT:#define __ARM_ARCH_EXT_IDIV__ 1
James Y Knight3508b222016-04-01 21:33:20 +0000654// KRAIT:#define __ARM_FEATURE_DSP 1
Keith Walker167961f2018-02-19 12:40:26 +0000655// KRAIT-NOT:#define __ARM_VFPV4__
656
657// Test whether predefines are as expected when targeting krait (softfp FP as default).
658// RUN: %clang -target armv7-eabi -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT-ALLOW-FP-INSTR %s
659// 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
660// KRAIT-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
661// KRAIT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
662// KRAIT-ALLOW-FP-INSTR:#define __ARM_VFPV4__ 1
Vladimir Sukharevc6dab752015-05-14 08:25:18 +0000663
James Y Knight3508b222016-04-01 21:33:20 +0000664// RUN: %clang -target armv8.1a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81A %s
665// CHECK-V81A: #define __ARM_ARCH 8
666// CHECK-V81A: #define __ARM_ARCH_8_1A__ 1
Vladimir Sukharevc6dab752015-05-14 08:25:18 +0000667// CHECK-V81A: #define __ARM_ARCH_PROFILE 'A'
James Y Knight3508b222016-04-01 21:33:20 +0000668// CHECK-V81A: #define __ARM_FEATURE_QRDMX 1
Benjamin Kramer3a13ed62017-12-28 16:58:54 +0000669// CHECK-V81A: #define __ARM_FP 0xe
Oliver Stannard3086c042016-02-11 16:05:52 +0000670
James Y Knight3508b222016-04-01 21:33:20 +0000671// RUN: %clang -target armv8.2a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V82A %s
672// CHECK-V82A: #define __ARM_ARCH 8
673// CHECK-V82A: #define __ARM_ARCH_8_2A__ 1
Oliver Stannard3086c042016-02-11 16:05:52 +0000674// CHECK-V82A: #define __ARM_ARCH_PROFILE 'A'
Sjoerd Meijercb75f612017-06-30 08:07:34 +0000675// CHECK-V82A: #define __ARM_FEATURE_QRDMX 1
Benjamin Kramer3a13ed62017-12-28 16:58:54 +0000676// CHECK-V82A: #define __ARM_FP 0xe