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