blob: dc9163be93f620b3cb209eb47ee21512e3da19db [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
6
7// RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V7 %s
8// CHECK-V7: __ARMEL__ 1
9// CHECK-V7: __ARM_ARCH 7
10// CHECK-V7: __ARM_ARCH_7A__ 1
11// CHECK-NOT-V7: __ARM_FEATURE_CRC32
Silviu Barangae5690462013-10-21 10:59:33 +000012
13// Check that -mhwdiv works properly for armv8/thumbv8 (enabled by default).
14
15// RUN: %clang -target armv8 -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8 %s
16// ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
17
18// RUN: %clang -target armv8 -mthumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8 %s
19// THUMBV8:#define __ARM_ARCH_EXT_IDIV__ 1
20
21// RUN: %clang -target armv8-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8-EABI %s
22// ARMV8-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
23
24// RUN: %clang -target armv8-eabi -mthumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8-EABI %s
25// THUMBV8-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
26
27// RUN: %clang -target armv8 -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=NONEHWDIV-ARMV8 %s
28// NONEHWDIV-ARMV8-NOT:#define __ARM_ARCH_EXT_IDIV__
29
30// RUN: %clang -target armv8 -mthumb -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=NONEHWDIV-THUMBV8 %s
31// NONEHWDIV-THUMBV8-NOT:#define __ARM_ARCH_EXT_IDIV__
32
33// RUN: %clang -target armv8 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBHWDIV-ARMV8 %s
34// THUMBHWDIV-ARMV8-NOT:#define __ARM_ARCH_EXT_IDIV__
35
36// RUN: %clang -target armv8 -mthumb -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=ARMHWDIV-THUMBV8 %s
37// ARMHWDIV-THUMBV8-NOT:#define __ARM_ARCH_EXT_IDIV__
38
39// RUN: %clang -target armv8a -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8A %s
40// ARMV8A:#define __ARM_ARCH_EXT_IDIV__ 1
41
42// RUN: %clang -target armv8a -mthumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8A %s
43// THUMBV8A:#define __ARM_ARCH_EXT_IDIV__ 1
44
45// RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8A-EABI %s
46// ARMV8A-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
47
48// RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8A-EABI %s
49// THUMBV8A-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
50
51
52// Test that -mhwdiv has the right effect for a target CPU which has hwdiv enabled by default.
53// RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-ARM %s
54// DEFAULTHWDIV-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
55
56// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-THUMB %s
57// DEFAULTHWDIV-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
58
59// RUN: %clang -target armv7 -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=ARMHWDIV-ARM %s
60// ARMHWDIV-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
61
62// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBHWDIV-THUMB %s
63// THUMBHWDIV-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
64
65// RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-THUMBHWDIV-ARM %s
66// DEFAULTHWDIV-THUMBHWDIV-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
67
68// RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-ARMHWDIV-THUMB %s
69// DEFAULTHWDIV-ARMHWDIV-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
70
71// RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-NONEHWDIV-ARM %s
72// DEFAULTHWDIV-NONEHWDIV-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
73
74// RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-NONEHWDIV-THUMB %s
75// DEFAULTHWDIV-NONEHWDIV-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
76
77// FIXME: add check for further predefines
78// Test whether predefines are as expected when targeting cortex-a5.
79// RUN: %clang -target armv7 -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5-ARM %s
80// A5-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
81
82// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5-THUMB %s
83// A5-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
84
85// Test whether predefines are as expected when targeting cortex-a8.
86// RUN: %clang -target armv7 -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck --check-prefix=A8-ARM %s
87// A8-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
88
89// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck --check-prefix=A8-THUMB %s
90// A8-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
91
92// Test whether predefines are as expected when targeting cortex-a9.
93// RUN: %clang -target armv7 -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck --check-prefix=A9-ARM %s
94// A9-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
95
96// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck --check-prefix=A9-THUMB %s
97// A9-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
98
99// Test whether predefines are as expected when targeting cortex-a15.
100// RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=A15-ARM %s
101// A15-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
102
103// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=A15-THUMB %s
104// A15-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
105
106// Test whether predefines are as expected when targeting swift.
107// RUN: %clang -target armv7s -mcpu=swift -x c -E -dM %s -o - | FileCheck --check-prefix=SWIFT-ARM %s
108// SWIFT-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
109
110// RUN: %clang -target armv7s -mthumb -mcpu=swift -x c -E -dM %s -o - | FileCheck --check-prefix=SWIFT-THUMB %s
111// SWIFT-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
112
113// Test whether predefines are as expected when targeting cortex-a53.
114// RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck --check-prefix=A53-ARM %s
115// A53-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
116
117// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck --check-prefix=A53-THUMB %s
118// A53-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
119
120// Test whether predefines are as expected when targeting cortex-r5.
121// RUN: %clang -target armv7 -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck --check-prefix=R5-ARM %s
122// R5-ARM:#define __ARM_ARCH_EXT_IDIV__ 1
123
124// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck --check-prefix=R5-THUMB %s
125// R5-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
126
127// Test whether predefines are as expected when targeting cortex-m0.
128// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0 -x c -E -dM %s -o - | FileCheck --check-prefix=M0-THUMB %s
129// M0-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__
130
131// Test whether predefines are as expected when targeting cortex-m3.
132// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m3 -x c -E -dM %s -o - | FileCheck --check-prefix=M3-THUMB %s
133// M3-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
134
135// Test whether predefines are as expected when targeting cortex-m4.
136// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck --check-prefix=M4-THUMB %s
137// M4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1