xref: /llvm-project/clang/test/Driver/linux-as.c (revision 2b67eceeef6e04ae5a4093bec9a0f0b048c70958)
1 // Check passing options to the assembler for various linux targets.
2 //
3 // RUN: %clang -target arm-linux -### \
4 // RUN:   -no-integrated-as -c %s 2>&1 \
5 // RUN:   | FileCheck -check-prefix=CHECK-ARM %s
6 // CHECK-ARM: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft"
7 //
8 // RUN: %clang -target arm-linux -mcpu=cortex-a8 -### \
9 // RUN:   -no-integrated-as -c %s 2>&1 \
10 // RUN:   | FileCheck -check-prefix=CHECK-ARM-MCPU %s
11 // CHECK-ARM-MCPU: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-mcpu=cortex-a8"
12 //
13 // RUN: %clang -target arm-linux -mfpu=neon -### \
14 // RUN:   -no-integrated-as -c %s 2>&1 \
15 // RUN:   | FileCheck -check-prefix=CHECK-ARM-MFPU %s
16 // CHECK-ARM-MFPU: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-mfpu=neon"
17 //
18 // RUN: %clang --target=arm-linux -march=armv7-a -mabi=aapcs-linux -### \
19 // RUN:   -no-integrated-as -c %s 2>&1 \
20 // RUN:   | FileCheck -check-prefix=CHECK-ARM-MARCH %s
21 // CHECK-ARM-MARCH: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-march=armv7-a"
22 // CHECK-ARM-MARCH-NOT: "-mabi=
23 //
24 // RUN: %clang -target armeb-linux -mlittle-endian -mcpu=cortex-a8 -mfpu=neon -march=armv7-a -### \
25 // RUN:   -no-integrated-as -c %s 2>&1 \
26 // RUN:   | FileCheck -check-prefix=CHECK-ARM-ALL %s
27 // CHECK-ARM-ALL: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-march=armv7-a" "-mcpu=cortex-a8" "-mfpu=neon"
28 //
29 // RUN: %clang -target arm-linux -mcpu=cortex-a8 -mfpu=neon -march=armv7-a -### \
30 // RUN:   -no-integrated-as -c %s 2>&1 \
31 // RUN:   | FileCheck -check-prefix=CHECK-ARM-ALL %s
32 //
33 // RUN: %clang -target armeb-linux -mlittle-endian -mcpu=cortex-a8 -mfpu=neon -march=armv7-a -### \
34 // RUN:   -no-integrated-as -c %s 2>&1 \
35 // RUN:   | FileCheck -check-prefix=CHECK-ARM-ALL %s
36 //
37 // RUN: %clang -target armeb-linux -mcpu=cortex-a8 -mfpu=neon -march=armebv7-a -### \
38 // RUN:   -no-integrated-as -c %s 2>&1 \
39 // RUN:   | FileCheck -check-prefix=CHECK-ARMEB-ALL %s
40 // CHECK-ARMEB-ALL: as{{(.exe)?}}" "-EB" "-mfloat-abi=soft" "-march=armebv7-a" "-mcpu=cortex-a8" "-mfpu=neon"
41 //
42 // RUN: %clang -target arm-linux -mcpu=cortex-a8 -mfpu=neon -march=armebv7-a -mbig-endian -### \
43 // RUN:   -no-integrated-as -c %s 2>&1 \
44 // RUN:   | FileCheck -check-prefix=CHECK-ARMEB-ALL %s
45 //
46 // RUN: %clang -target thumb-linux -mcpu=cortex-a8 -mfpu=neon -march=thumbv7-a -### \
47 // RUN:   -no-integrated-as -c %s 2>&1 \
48 // RUN:   | FileCheck -check-prefix=CHECK-THUMB-ALL %s
49 // CHECK-THUMB-ALL: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-march=thumbv7-a" "-mcpu=cortex-a8" "-mfpu=neon"
50 //
51 // RUN: %clang -target thumbeb-linux -mcpu=cortex-a8 -mfpu=neon -march=thumbv7-a -mlittle-endian -### \
52 // RUN:   -no-integrated-as -c %s 2>&1 \
53 // RUN:   | FileCheck -check-prefix=CHECK-THUMB-ALL %s
54 //
55 // RUN: %clang -target thumbeb-linux -mcpu=cortex-a8 -mfpu=neon -march=thumbebv7-a -### \
56 // RUN:   -no-integrated-as -c %s 2>&1 \
57 // RUN:   | FileCheck -check-prefix=CHECK-THUMBEB-ALL %s
58 // CHECK-THUMBEB-ALL: as{{(.exe)?}}" "-EB" "-mfloat-abi=soft" "-march=thumbebv7-a" "-mcpu=cortex-a8" "-mfpu=neon"
59 //
60 // RUN: %clang -target thumb-linux -mcpu=cortex-a8 -mfpu=neon -march=thumbebv7-a -mbig-endian -### \
61 // RUN:   -no-integrated-as -c %s 2>&1 \
62 // RUN:   | FileCheck -check-prefix=CHECK-THUMBEB-ALL %s
63 //
64 // RUN: %clang -target armv7-linux -mcpu=cortex-a8 -### \
65 // RUN:   -no-integrated-as -c %s 2>&1 \
66 // RUN:   | FileCheck -check-prefix=CHECK-ARM-TARGET %s
67 // CHECK-ARM-TARGET: as{{(.exe)?}}" "-EL" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8"
68 //
69 // RUN: %clang -target armebv7-linux -mcpu=cortex-a8 -### \
70 // RUN:   -no-integrated-as -c %s 2>&1 \
71 // RUN:   | FileCheck -check-prefix=CHECK-ARMEB-TARGET %s
72 // CHECK-ARMEB-TARGET: as{{(.exe)?}}" "-EB" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8"
73 //
74 // RUN: %clang -target thumbv7-linux -mcpu=cortex-a8 -### \
75 // RUN:   -no-integrated-as -c %s 2>&1 \
76 // RUN:   | FileCheck -check-prefix=CHECK-THUMB-TARGET %s
77 // CHECK-THUMB-TARGET: as{{(.exe)?}}" "-EL" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8"
78 //
79 // RUN: %clang -target thumbebv7-linux -mcpu=cortex-a8 -### \
80 // RUN:   -no-integrated-as -c %s 2>&1 \
81 // RUN:   | FileCheck -check-prefix=CHECK-THUMBEB-TARGET %s
82 // CHECK-THUMBEB-TARGET: as{{(.exe)?}}" "-EB" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8"
83 //
84 // RUN: %clang -target armv8-linux -mcpu=cortex-a53 -### \
85 // RUN:   -no-integrated-as -c %s 2>&1 \
86 // RUN:   | FileCheck -check-prefix=CHECK-ARM-TARGET-V8 %s
87 // CHECK-ARM-TARGET-V8: as{{(.exe)?}}" "-EL" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53"
88 //
89 // RUN: %clang -target armebv8-linux -mcpu=cortex-a53 -### \
90 // RUN:   -no-integrated-as -c %s 2>&1 \
91 // RUN:   | FileCheck -check-prefix=CHECK-ARMEB-TARGET-V8 %s
92 // CHECK-ARMEB-TARGET-V8: as{{(.exe)?}}" "-EB" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53"
93 //
94 // RUN: %clang -target thumbv8-linux -mcpu=cortex-a53 -### \
95 // RUN:   -no-integrated-as -c %s 2>&1 \
96 // RUN:   | FileCheck -check-prefix=CHECK-THUMB-TARGET-V8 %s
97 // CHECK-THUMB-TARGET-V8: as{{(.exe)?}}" "-EL" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53"
98 //
99 // RUN: %clang -target thumbebv8-linux -mcpu=cortex-a53 -### \
100 // RUN:   -no-integrated-as -c %s 2>&1 \
101 // RUN:   | FileCheck -check-prefix=CHECK-THUMBEB-TARGET-V8 %s
102 // CHECK-THUMBEB-TARGET-V8: as{{(.exe)?}}" "-EB" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53"
103 //
104 // RUN: %clang -target arm-linux -mfloat-abi=hard -### \
105 // RUN:   -no-integrated-as -c %s 2>&1 \
106 // RUN:   | FileCheck -check-prefix=CHECK-ARM-MFLOAT-ABI %s
107 // CHECK-ARM-MFLOAT-ABI: as{{(.exe)?}}" "-EL" "-mfloat-abi=hard"
108 //
109 // RUN: %clang -target arm-linux-androideabi -march=armv7-a -### \
110 // RUN:   -no-integrated-as -c %s 2>&1 \
111 // RUN:   | FileCheck -check-prefix=CHECK-ARM-ANDROID-SOFTFP %s
112 // CHECK-ARM-ANDROID-SOFTFP: as{{(.exe)?}}" "-EL" "-mfloat-abi=softfp" "-march=armv7-a"
113 //
114 // RUN: %clang -target arm-linux-eabi -mhard-float -### \
115 // RUN:   -no-integrated-as -c %s 2>&1 \
116 // RUN:   | FileCheck -check-prefix=CHECK-ARM-HARDFP %s
117 // CHECK-ARM-HARDFP: as{{(.exe)?}}" "-EL" "-mfloat-abi=hard"
118 //
119 // RUN: %clang -target aarch64-linux-gnu -mcpu=cortex-a53 -### \
120 // RUN:   -no-integrated-as -c %s 2>&1 \
121 // RUN:   | FileCheck -check-prefix=CHECK-ARM64-MCPU %s
122 // CHECK-ARM64-MCPU: as{{(.exe)?}}" "-EL" "-mcpu=cortex-a53"
123 //
124 // RUN: %clang -target aarch64-linux-gnu -march=armv8-a -### \
125 // RUN:   -no-integrated-as -c %s 2>&1 \
126 // RUN:   | FileCheck -check-prefix=CHECK-ARM64-MARCH %s
127 // CHECK-ARM64-MARCH: as{{(.exe)?}}" "-EL" "-march=armv8-a"
128 //
129 // RUN: %clang -target aarch64-linux-gnu -mcpu=cortex-a53 -march=armv8-a -### \
130 // RUN:   -no-integrated-as -c %s 2>&1 \
131 // RUN:   | FileCheck -check-prefix=CHECK-ARM64-ALL %s
132 // CHECK-ARM64-ALL: as{{(.exe)?}}" "-EL" "-march=armv8-a" "-mcpu=cortex-a53"
133 //
134 // RUN: %clang -target aarch64_be-linux-gnu -mcpu=cortex-a53 -march=armv8-a -mlittle-endian -### \
135 // RUN:   -no-integrated-as -c %s 2>&1 \
136 // RUN:   | FileCheck -check-prefix=CHECK-ARM64-ALL %s
137 //
138 // RUN: %clang -target aarch64_be-linux-gnu -mcpu=cortex-a53 -### \
139 // RUN:   -no-integrated-as -c %s 2>&1 \
140 // RUN:   | FileCheck -check-prefix=CHECK-ARM64BE-MCPU %s
141 // CHECK-ARM64BE-MCPU: as{{(.exe)?}}" "-EB" "-mcpu=cortex-a53"
142 //
143 // RUN: %clang -target aarch64_be-linux-gnu -march=armv8-a -### \
144 // RUN:   -no-integrated-as -c %s 2>&1 \
145 // RUN:   | FileCheck -check-prefix=CHECK-ARM64BE-MARCH %s
146 // CHECK-ARM64BE-MARCH: as{{(.exe)?}}" "-EB" "-march=armv8-a"
147 //
148 // RUN: %clang -target aarch64_be-linux-gnu -mcpu=cortex-a53 -march=armv8-a -### \
149 // RUN:   -no-integrated-as -c %s 2>&1 \
150 // RUN:   | FileCheck -check-prefix=CHECK-ARM64BE-ALL %s
151 // CHECK-ARM64BE-ALL: as{{(.exe)?}}" "-EB" "-march=armv8-a" "-mcpu=cortex-a53"
152 //
153 // RUN: %clang -target aarch64-linux-gnu -mcpu=cortex-a53 -march=armv8-a -mbig-endian -### \
154 // RUN:   -no-integrated-as -c %s 2>&1 \
155 // RUN:   | FileCheck -check-prefix=CHECK-ARM64BE-ALL %s
156 //
157 // RUN: %clang -target ppc-linux -mcpu=invalid-cpu -### \
158 // RUN:   -no-integrated-as -c %s 2>&1 \
159 // RUN:   | FileCheck -check-prefix=CHECK-PPC-NO-MCPU %s
160 // CHECK-PPC-NO-MCPU-NOT: as{{.*}} "-mcpu=invalid-cpu"
161 //
162 // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
163 // RUN:   -no-integrated-as -fno-pic -c %s 2>&1 \
164 // RUN:   | FileCheck -check-prefix=CHECK-SPARCV9 %s
165 // CHECK-SPARCV9: as
166 // CHECK-SPARCV9: -64
167 // CHECK-SPARCV9: -Av9a
168 // CHECK-SPARCV9-NOT: -KPIC
169 // CHECK-SPARCV9: -o
170 //
171 // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
172 // RUN:   -no-integrated-as -fpic -c %s 2>&1 \
173 // RUN:   | FileCheck -check-prefix=CHECK-SPARCV9PIC %s
174 // CHECK-SPARCV9PIC: as
175 // CHECK-SPARCV9PIC: -64
176 // CHECK-SPARCV9PIC: -Av9a
177 // CHECK-SPARCV9PIC: -KPIC
178 // CHECK-SPARCV9PIC: -o
179 //
180 // RUN: %clang -target sparc-linux -mcpu=invalid-cpu -### \
181 // RUN:   -no-integrated-as -c %s 2>&1 \
182 // RUN:   | FileCheck -check-prefix=CHECK-SPARCV8 %s
183 // CHECK-SPARCV8: as
184 // CHECK-SPARCV8: -32
185 // CHECK-SPARCV8: -Av8
186 // CHECK-SPARCV8: -o
187 //
188 // RUN: %clang -target sparcel-linux -mcpu=invalid-cpu -### \
189 // RUN:   -no-integrated-as -c %s 2>&1 \
190 // RUN:   | FileCheck -check-prefix=CHECK-SPARCV8EL %s
191 // CHECK-SPARCV8EL: as
192 // CHECK-SPARCV8EL: -32
193 // CHECK-SPARCV8EL: -Av8
194 // CHECK-SPARCV8EL: -o
195 //
196 // RUN: %clang -target s390x-linux -### -no-integrated-as -c %s 2>&1 \
197 // RUN:   | FileCheck -check-prefix=CHECK-Z-DEFAULT-ARCH %s
198 // CHECK-Z-DEFAULT-ARCH: as{{.*}} "-march=z10"
199 //
200 // RUN: %clang -target s390x-linux -march=z196 -### \
201 // RUN:   -no-integrated-as -c %s 2>&1 \
202 // RUN:   | FileCheck -check-prefix=CHECK-Z-ARCH-Z196 %s
203 // CHECK-Z-ARCH-Z196: as{{.*}} "-march=z196"
204 //
205 // RUN: %clang -target powerpc64le-linux -### \
206 // RUN:   -no-integrated-as -c %s 2>&1 \
207 // RUN:   | FileCheck -check-prefix=CHECK-PPC64LE %s
208 // CHECK-PPC64LE: as{{.*}} "-mpower8"
209 //
210 // RUN: %clang -target powerpc64-linux -mcpu=pwr7 -### \
211 // RUN:   -no-integrated-as -c %s 2>&1 \
212 // RUN:   | FileCheck -check-prefix=CHECK-PPC64 %s
213 // CHECK-PPC64: as{{.*}} "-mpower7"
214 //
215 // RUN: %clang -target powerpc-linux -mcpu=pwr9 -### \
216 // RUN:   -no-integrated-as -c %s 2>&1 \
217 // RUN:   | FileCheck -check-prefix=CHECK-PPC32 %s
218 // CHECK-PPC32: as{{.*}} "-mpower9"
219