blob: b56eb7ccc9eb4009754a08c6c8fc847a2a98c60a [file] [log] [blame]
Joey Gouly1e8637b2013-09-18 10:07:09 +00001// RUN: %clang -target armv8a-none-linux-gnu -x c -E -dM %s -o - | FileCheck %s
2// CHECK: __ARMEL__ 1
3// CHECK: __ARM_ARCH 8
4// CHECK: __ARM_ARCH_8A__ 1
5// CHECK: __ARM_FEATURE_CRC32 1
James Molloy0ffb0932014-09-15 11:25:38 +00006// CHECK: __ARM_FEATURE_DIRECTED_ROUNDING 1
7// CHECK: __ARM_FEATURE_NUMERIC_MAXMIN 1
Joey Gouly1e8637b2013-09-18 10:07:09 +00008
9// RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V7 %s
10// CHECK-V7: __ARMEL__ 1
11// CHECK-V7: __ARM_ARCH 7
12// CHECK-V7: __ARM_ARCH_7A__ 1
Nico Riecke6a158252014-02-16 07:29:41 +000013// CHECK-V7-NOT: __ARM_FEATURE_CRC32
James Molloy0ffb0932014-09-15 11:25:38 +000014// CHECK-V7-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
15// CHECK-V7-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
Silviu Barangae5690462013-10-21 10:59:33 +000016
Bernard Ogdenda13af32013-10-24 18:32:51 +000017// RUN: %clang -target armv8a -mfloat-abi=hard -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF %s
18// CHECK-V8-BAREHF: __ARMEL__ 1
19// CHECK-V8-BAREHF: __ARM_ARCH 8
20// CHECK-V8-BAREHF: __ARM_ARCH_8A__ 1
21// CHECK-V8-BAREHF: __ARM_FEATURE_CRC32 1
James Molloy0ffb0932014-09-15 11:25:38 +000022// CHECK-V8-BAREHF: __ARM_FEATURE_DIRECTED_ROUNDING 1
23// CHECK-V8-BAREHF: __ARM_FEATURE_NUMERIC_MAXMIN 1
Bernard Ogdenda13af32013-10-24 18:32:51 +000024// CHECK-V8-BAREHF: __ARM_NEON__ 1
25// CHECK-V8-BAREHF: __VFP_FP__ 1
26
27// RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-FP %s
28// CHECK-V8-BAREHF-FP-NOT: __ARM_NEON__ 1
29// CHECK-V8-BAREHF-FP: __VFP_FP__ 1
30
31// RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=neon-fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-NEON-FP %s
32// RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=crypto-neon-fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-NEON-FP %s
33// CHECK-V8-BAREHF-NEON-FP: __ARM_NEON__ 1
34// CHECK-V8-BAREHF-NEON-FP: __VFP_FP__ 1
35
Bernard Ogden18b57012013-10-29 09:47:51 +000036// RUN: %clang -target armv8a -mnocrc -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-NOCRC %s
37// CHECK-V8-NOCRC-NOT: __ARM_FEATURE_CRC32 1
38
Silviu Barangae5690462013-10-21 10:59:33 +000039// Check that -mhwdiv works properly for armv8/thumbv8 (enabled by default).
40
41// RUN: %clang -target armv8 -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8 %s
42// ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
43
44// RUN: %clang -target armv8 -mthumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8 %s
45// THUMBV8:#define __ARM_ARCH_EXT_IDIV__ 1
46
47// RUN: %clang -target armv8-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8-EABI %s
48// ARMV8-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
49
50// RUN: %clang -target armv8-eabi -mthumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8-EABI %s
51// THUMBV8-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
52
53// RUN: %clang -target armv8 -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=NONEHWDIV-ARMV8 %s
54// NONEHWDIV-ARMV8-NOT:#define __ARM_ARCH_EXT_IDIV__
55
56// RUN: %clang -target armv8 -mthumb -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=NONEHWDIV-THUMBV8 %s
57// NONEHWDIV-THUMBV8-NOT:#define __ARM_ARCH_EXT_IDIV__
58
59// RUN: %clang -target armv8 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBHWDIV-ARMV8 %s
60// THUMBHWDIV-ARMV8-NOT:#define __ARM_ARCH_EXT_IDIV__
61
62// RUN: %clang -target armv8 -mthumb -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=ARMHWDIV-THUMBV8 %s
63// ARMHWDIV-THUMBV8-NOT:#define __ARM_ARCH_EXT_IDIV__
64
65// RUN: %clang -target armv8a -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8A %s
66// ARMV8A:#define __ARM_ARCH_EXT_IDIV__ 1
67
68// RUN: %clang -target armv8a -mthumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8A %s
69// THUMBV8A:#define __ARM_ARCH_EXT_IDIV__ 1
70
71// RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8A-EABI %s
72// ARMV8A-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
73
74// RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8A-EABI %s
75// THUMBV8A-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
76
Bradley Smith0f28f0c2014-01-20 10:52:00 +000077// RUN: %clang -target arm-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-DEFS %s
78// CHECK-DEFS:#define __ARM_SIZEOF_MINIMAL_ENUM 4
79// CHECK-DEFS:#define __ARM_SIZEOF_WCHAR_T 4
80
81// RUN: %clang -target arm-none-linux-gnu -fshort-wchar -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SHORTWCHAR %s
82// CHECK-SHORTWCHAR:#define __ARM_SIZEOF_WCHAR_T 2
83
84// RUN: %clang -target arm-none-linux-gnu -fshort-enums -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SHORTENUMS %s
85// CHECK-SHORTENUMS:#define __ARM_SIZEOF_MINIMAL_ENUM 1
Silviu Barangae5690462013-10-21 10:59:33 +000086
87// Test that -mhwdiv has the right effect for a target CPU which has hwdiv enabled by default.
88// RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-ARM %s
89// DEFAULTHWDIV-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
90
91// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-THUMB %s
92// DEFAULTHWDIV-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
93
94// RUN: %clang -target armv7 -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=ARMHWDIV-ARM %s
95// ARMHWDIV-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
96
97// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBHWDIV-THUMB %s
98// THUMBHWDIV-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
99
100// RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-THUMBHWDIV-ARM %s
101// DEFAULTHWDIV-THUMBHWDIV-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
102
103// RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-ARMHWDIV-THUMB %s
104// DEFAULTHWDIV-ARMHWDIV-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
105
106// RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-NONEHWDIV-ARM %s
107// DEFAULTHWDIV-NONEHWDIV-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
108
109// RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-NONEHWDIV-THUMB %s
110// DEFAULTHWDIV-NONEHWDIV-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
111
Artyom Skrobov53b000a82013-11-21 14:04:38 +0000112
113// Check that -mfpu works properly for Cortex-A7 (enabled by default).
114// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A7 %s
115// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A7 %s
116// DEFAULTFPU-A7:#define __ARM_NEON__ 1
117// DEFAULTFPU-A7:#define __ARM_VFPV4__ 1
118
119// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A7 %s
120// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A7 %s
121// FPUNONE-A7-NOT:#define __ARM_NEON__ 1
122// FPUNONE-A7-NOT:#define __ARM_VFPV4__ 1
123
124// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A7 %s
125// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A7 %s
126// NONEON-A7-NOT:#define __ARM_NEON__ 1
127// NONEON-A7:#define __ARM_VFPV4__ 1
128
Amara Emersona1daec72013-11-25 13:18:59 +0000129// Check that -mfpu works properly for Cortex-A5 (enabled by default).
130// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A5 %s
131// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A5 %s
132// DEFAULTFPU-A5:#define __ARM_NEON__ 1
133// DEFAULTFPU-A5:#define __ARM_VFPV4__ 1
134
135// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a5 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A5 %s
136// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a5 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A5 %s
137// FPUNONE-A5-NOT:#define __ARM_NEON__ 1
138// FPUNONE-A5-NOT:#define __ARM_VFPV4__ 1
139
140// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a5 -mfpu=vfp3-d16 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A5 %s
141// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a5 -mfpu=vfp3-d16 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A5 %s
142// NONEON-A5-NOT:#define __ARM_NEON__ 1
143// NONEON-A5:#define __ARM_VFPV4__ 1
144
Silviu Barangae5690462013-10-21 10:59:33 +0000145// FIXME: add check for further predefines
146// Test whether predefines are as expected when targeting cortex-a5.
147// RUN: %clang -target armv7 -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5-ARM %s
148// A5-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
149
150// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5-THUMB %s
151// A5-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
152
Amara Emersona1daec72013-11-25 13:18:59 +0000153// RUN: %clang -target armv7 -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5 %s
154// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5 %s
155// A5:#define __ARM_ARCH 7
156// A5:#define __ARM_ARCH_7A__ 1
Saleem Abdulrasool52a5d412014-06-15 18:48:41 +0000157// A5:#define __ARM_ARCH_PROFILE 'A'
James Molloy0ffb0932014-09-15 11:25:38 +0000158// A5-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN
159// A5-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING
Amara Emersona1daec72013-11-25 13:18:59 +0000160
Artyom Skrobov53b000a82013-11-21 14:04:38 +0000161// Test whether predefines are as expected when targeting cortex-a7.
162// RUN: %clang -target armv7 -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck --check-prefix=A7 %s
163// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck --check-prefix=A7 %s
164// A7:#define __ARM_ARCH 7
165// A7:#define __ARM_ARCH_7A__ 1
166// A7:#define __ARM_ARCH_EXT_IDIV__ 1
Saleem Abdulrasool52a5d412014-06-15 18:48:41 +0000167// A7:#define __ARM_ARCH_PROFILE 'A'
Artyom Skrobov53b000a82013-11-21 14:04:38 +0000168
Silviu Barangae5690462013-10-21 10:59:33 +0000169// Test whether predefines are as expected when targeting cortex-a8.
170// RUN: %clang -target armv7 -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck --check-prefix=A8-ARM %s
171// A8-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
172
173// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck --check-prefix=A8-THUMB %s
174// A8-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
175
176// Test whether predefines are as expected when targeting cortex-a9.
177// RUN: %clang -target armv7 -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck --check-prefix=A9-ARM %s
178// A9-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
179
180// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck --check-prefix=A9-THUMB %s
181// A9-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
182
Richard Barton3b82ed32013-11-22 11:53:28 +0000183
184// Check that -mfpu works properly for Cortex-A12 (enabled by default).
185// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A12 %s
186// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A12 %s
187// DEFAULTFPU-A12:#define __ARM_NEON__ 1
188// DEFAULTFPU-A12:#define __ARM_VFPV4__ 1
189
190// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a12 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A12 %s
191// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a12 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A12 %s
192// FPUNONE-A12-NOT:#define __ARM_NEON__ 1
193// FPUNONE-A12-NOT:#define __ARM_VFPV4__ 1
194
195// Test whether predefines are as expected when targeting cortex-a12.
196// RUN: %clang -target armv7 -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck --check-prefix=A12 %s
197// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck --check-prefix=A12 %s
198// A12:#define __ARM_ARCH 7
199// A12:#define __ARM_ARCH_7A__ 1
200// A12:#define __ARM_ARCH_EXT_IDIV__ 1
Saleem Abdulrasool52a5d412014-06-15 18:48:41 +0000201// A12:#define __ARM_ARCH_PROFILE 'A'
Richard Barton3b82ed32013-11-22 11:53:28 +0000202
Silviu Barangae5690462013-10-21 10:59:33 +0000203// Test whether predefines are as expected when targeting cortex-a15.
204// RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=A15-ARM %s
205// A15-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
206
207// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=A15-THUMB %s
208// A15-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
209
210// Test whether predefines are as expected when targeting swift.
211// RUN: %clang -target armv7s -mcpu=swift -x c -E -dM %s -o - | FileCheck --check-prefix=SWIFT-ARM %s
212// SWIFT-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
213
214// RUN: %clang -target armv7s -mthumb -mcpu=swift -x c -E -dM %s -o - | FileCheck --check-prefix=SWIFT-THUMB %s
215// SWIFT-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
216
217// Test whether predefines are as expected when targeting cortex-a53.
218// RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck --check-prefix=A53-ARM %s
219// A53-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
220
221// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck --check-prefix=A53-THUMB %s
222// A53-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
223
224// Test whether predefines are as expected when targeting cortex-r5.
225// RUN: %clang -target armv7 -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck --check-prefix=R5-ARM %s
226// R5-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
227
228// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck --check-prefix=R5-THUMB %s
229// R5-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
230
231// Test whether predefines are as expected when targeting cortex-m0.
232// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0 -x c -E -dM %s -o - | FileCheck --check-prefix=M0-THUMB %s
233// M0-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
234
235// Test whether predefines are as expected when targeting cortex-m3.
236// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m3 -x c -E -dM %s -o - | FileCheck --check-prefix=M3-THUMB %s
237// M3-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
238
239// Test whether predefines are as expected when targeting cortex-m4.
240// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck --check-prefix=M4-THUMB %s
241// M4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
Ana Pazosdd6068d2013-12-06 22:43:17 +0000242
Oliver Stannardbfd3ea32014-10-01 09:03:02 +0000243// Test whether predefines are as expected when targeting cortex-m7.
244// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck --check-prefix=M7-THUMB %s
245// M7-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
246
Ana Pazosdd6068d2013-12-06 22:43:17 +0000247// Test whether predefines are as expected when targeting krait.
248// RUN: %clang -target armv7 -mcpu=krait -x c -E -dM %s -o - | FileCheck --check-prefix=KRAIT-ARM %s
249// KRAIT-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
250// KRAIT-ARM:#define __ARM_VFPV4__ 1
251
252// RUN: %clang -target armv7 -mthumb -mcpu=krait -x c -E -dM %s -o - | FileCheck --check-prefix=KRAIT-THUMB %s
253// KRAIT-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
254// KRAIT-THUMB:#define __ARM_VFPV4__ 1
255