Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Driver / riscv-arch.c
blob0ac81ea982f1b61ed3952c4b12676f6ae798eeca
1 // RUN: %clang --target=riscv32-unknown-elf -march=rv32i -### %s \
2 // RUN: -fsyntax-only 2>&1 | FileCheck %s
3 // RUN: %clang --target=riscv32-unknown-elf -march=rv32i2p1 -### %s \
4 // RUN: -fsyntax-only 2>&1 | FileCheck %s
5 // RUN: %clang --target=riscv32-unknown-elf -march=rv32im -### %s \
6 // RUN: -fsyntax-only 2>&1 | FileCheck %s
7 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ima -### %s \
8 // RUN: -fsyntax-only 2>&1 | FileCheck %s
9 // RUN: %clang --target=riscv32-unknown-elf -march=rv32imaf -### %s \
10 // RUN: -fsyntax-only 2>&1 | FileCheck %s
11 // RUN: %clang --target=riscv32-unknown-elf -march=rv32imafd -### %s \
12 // RUN: -fsyntax-only 2>&1 | FileCheck %s
14 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ic -### %s \
15 // RUN: -fsyntax-only 2>&1 | FileCheck %s
16 // RUN: %clang --target=riscv32-unknown-elf -march=rv32imc -### %s \
17 // RUN: -fsyntax-only 2>&1 | FileCheck %s
18 // RUN: %clang --target=riscv32-unknown-elf -march=rv32imac -### %s \
19 // RUN: -fsyntax-only 2>&1 | FileCheck %s
20 // RUN: %clang --target=riscv32-unknown-elf -march=rv32imafc -### %s \
21 // RUN: -fsyntax-only 2>&1 | FileCheck %s
22 // RUN: %clang --target=riscv32-unknown-elf -march=rv32imafdc -### %s \
23 // RUN: -fsyntax-only 2>&1 | FileCheck %s
25 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ia -### %s \
26 // RUN: -fsyntax-only 2>&1 | FileCheck %s
27 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iaf -### %s \
28 // RUN: -fsyntax-only 2>&1 | FileCheck %s
29 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iafd -### %s \
30 // RUN: -fsyntax-only 2>&1 | FileCheck %s
32 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iac -### %s \
33 // RUN: -fsyntax-only 2>&1 | FileCheck %s
34 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iafc -### %s \
35 // RUN: -fsyntax-only 2>&1 | FileCheck %s
36 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iafdc -### %s \
37 // RUN: -fsyntax-only 2>&1 | FileCheck %s
39 // RUN: %clang --target=riscv32-unknown-elf -march=rv32g -### %s \
40 // RUN: -fsyntax-only 2>&1 | FileCheck %s
41 // RUN: %clang --target=riscv32-unknown-elf -march=rv32gc -### %s \
42 // RUN: -fsyntax-only 2>&1 | FileCheck %s
44 // RUN: %clang --target=riscv32-unknown-elf -mabi=ilp32 -### %s \
45 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-ILP32 %s
47 // CHECK-ILP32: "-target-feature" "+m"
48 // CHECK-ILP32-SAME: {{^}} "-target-feature" "+a"
49 // CHECK-ILP32-SAME: {{^}} "-target-feature" "+f"
50 // CHECK-ILP32-SAME: {{^}} "-target-feature" "+d"
51 // CHECK-ILP32-SAME: {{^}} "-target-feature" "+c"
53 // RUN: %clang --target=riscv32-unknown-elf -mabi=ilp32f -### %s \
54 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-ILP32F %s
56 // CHECK-ILP32F: "-target-feature" "+m"
57 // CHECK-ILP32F-SAME: {{^}} "-target-feature" "+a"
58 // CHECK-ILP32F-SAME: {{^}} "-target-feature" "+f"
59 // CHECK-ILP32F-SAME: {{^}} "-target-feature" "+d"
60 // CHECK-ILP32F-SAME: {{^}} "-target-feature" "+c"
62 // RUN: %clang --target=riscv32-unknown-elf -mabi=ilp32d -### %s \
63 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-ILP32D %s
65 // CHECK-ILP32D: "-target-feature" "+m"
66 // CHECK-ILP32D-SAME: {{^}} "-target-feature" "+a"
67 // CHECK-ILP32D-SAME: {{^}} "-target-feature" "+f"
68 // CHECK-ILP32D-SAME: {{^}} "-target-feature" "+d"
69 // CHECK-ILP32D-SAME: {{^}} "-target-feature" "+c"
71 // RUN: %clang --target=riscv64-unknown-elf -march=rv64i -### %s \
72 // RUN: -fsyntax-only 2>&1 | FileCheck %s
73 // RUN: %clang --target=riscv64-unknown-elf -march=rv64i2p1 -### %s \
74 // RUN: -fsyntax-only 2>&1 | FileCheck %s
75 // RUN: %clang --target=riscv64-unknown-elf -march=rv64im -### %s \
76 // RUN: -fsyntax-only 2>&1 | FileCheck %s
77 // RUN: %clang --target=riscv64-unknown-elf -march=rv64ima -### %s \
78 // RUN: -fsyntax-only 2>&1 | FileCheck %s
79 // RUN: %clang --target=riscv64-unknown-elf -march=rv64imaf -### %s \
80 // RUN: -fsyntax-only 2>&1 | FileCheck %s
81 // RUN: %clang --target=riscv64-unknown-elf -march=rv64imafd -### %s \
82 // RUN: -fsyntax-only 2>&1 | FileCheck %s
84 // RUN: %clang --target=riscv64-unknown-elf -march=rv64ic -### %s \
85 // RUN: -fsyntax-only 2>&1 | FileCheck %s
86 // RUN: %clang --target=riscv64-unknown-elf -march=rv64imc -### %s \
87 // RUN: -fsyntax-only 2>&1 | FileCheck %s
88 // RUN: %clang --target=riscv64-unknown-elf -march=rv64imac -### %s \
89 // RUN: -fsyntax-only 2>&1 | FileCheck %s
90 // RUN: %clang --target=riscv64-unknown-elf -march=rv64imafc -### %s \
91 // RUN: -fsyntax-only 2>&1 | FileCheck %s
92 // RUN: %clang --target=riscv64-unknown-elf -march=rv64imafdc -### %s \
93 // RUN: -fsyntax-only 2>&1 | FileCheck %s
95 // RUN: %clang --target=riscv64-unknown-elf -march=rv64ia -### %s \
96 // RUN: -fsyntax-only 2>&1 | FileCheck %s
97 // RUN: %clang --target=riscv64-unknown-elf -march=rv64iaf -### %s \
98 // RUN: -fsyntax-only 2>&1 | FileCheck %s
99 // RUN: %clang --target=riscv64-unknown-elf -march=rv64iafd -### %s \
100 // RUN: -fsyntax-only 2>&1 | FileCheck %s
102 // RUN: %clang --target=riscv64-unknown-elf -march=rv64iac -### %s \
103 // RUN: -fsyntax-only 2>&1 | FileCheck %s
104 // RUN: %clang --target=riscv64-unknown-elf -march=rv64iafc -### %s \
105 // RUN: -fsyntax-only 2>&1 | FileCheck %s
106 // RUN: %clang --target=riscv64-unknown-elf -march=rv64iafdc -### %s \
107 // RUN: -fsyntax-only 2>&1 | FileCheck %s
109 // RUN: %clang --target=riscv64-unknown-elf -march=rv64g -### %s \
110 // RUN: -fsyntax-only 2>&1 | FileCheck %s
111 // RUN: %clang --target=riscv64-unknown-elf -march=rv64gc -### %s \
112 // RUN: -fsyntax-only 2>&1 | FileCheck %s
114 // RUN: %clang --target=riscv64-unknown-elf -mabi=lp64 -### %s \
115 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-LP64 %s
117 // CHECK-LP64: "-target-feature" "+m"
118 // CHECK-LP64-SAME: {{^}} "-target-feature" "+a"
119 // CHECK-LP64-SAME: {{^}} "-target-feature" "+f"
120 // CHECK-LP64-SAME: {{^}} "-target-feature" "+d"
121 // CHECK-LP64-SAME: {{^}} "-target-feature" "+c"
123 // RUN: %clang --target=riscv64-unknown-elf -mabi=lp64f -### %s \
124 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-LP64F %s
126 // CHECK-LP64F: "-target-feature" "+m"
127 // CHECK-LP64F-SAME: {{^}} "-target-feature" "+a"
128 // CHECK-LP64F-SAME: {{^}} "-target-feature" "+f"
129 // CHECK-LP64F-SAME: {{^}} "-target-feature" "+d"
130 // CHECK-LP64F-SAME: {{^}} "-target-feature" "+c"
132 // RUN: %clang --target=riscv64-unknown-elf -mabi=lp64d -### %s \
133 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-LP64D %s
135 // CHECK-LP64D: "-target-feature" "+m"
136 // CHECK-LP64D-SAME: {{^}} "-target-feature" "+a"
137 // CHECK-LP64D-SAME: {{^}} "-target-feature" "+f"
138 // CHECK-LP64D-SAME: {{^}} "-target-feature" "+d"
139 // CHECK-LP64D-SAME: {{^}} "-target-feature" "+c"
141 // CHECK-NOT: error: invalid arch name '
143 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32 -### %s \
144 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32 %s
145 // RV32: error: invalid arch name 'rv32'
147 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32m -### %s \
148 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32M %s
149 // RV32M: error: invalid arch name 'rv32m'
151 // RUN: %clang --target=riscv32-unknown-elf -march=rv32id -### %s \
152 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ID %s
153 // RV32ID: "-target-feature" "+f" "-target-feature" "+d"
155 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32l -### %s \
156 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32L %s
157 // RV32L: error: invalid arch name 'rv32l'
159 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32imadf -### %s \
160 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32IMADF %s
161 // RV32IMADF: error: invalid arch name 'rv32imadf'
163 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32imm -### %s \
164 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32IMM %s
165 // RV32IMM: error: invalid arch name 'rv32imm'
167 // RUN: not %clang --target=riscv32-unknown-elf -march=RV32I -### %s \
168 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32I-UPPER %s
169 // RV32I-UPPER: error: invalid arch name 'RV32I'
171 // RUN: not %clang --target=riscv64-unknown-elf -march=rv64 -### %s \
172 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64 %s
173 // RV64: error: invalid arch name 'rv64'
175 // RUN: not %clang --target=riscv64-unknown-elf -march=rv64m -### %s \
176 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64M %s
177 // RV64M: error: invalid arch name 'rv64m'
179 // RUN: %clang --target=riscv64-unknown-elf -march=rv64id -### %s \
180 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64ID %s
181 // RV64ID: "-target-feature" "+f" "-target-feature" "+d"
183 // RUN: not %clang --target=riscv64-unknown-elf -march=rv64l -### %s \
184 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64L %s
185 // RV64L: error: invalid arch name 'rv64l'
187 // RUN: not %clang --target=riscv64-unknown-elf -march=rv64imadf -### %s \
188 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64IMADF %s
189 // RV64IMADF: error: invalid arch name 'rv64imadf'
191 // RUN: not %clang --target=riscv64-unknown-elf -march=rv64imm -### %s \
192 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64IMM %s
193 // RV64IMM: error: invalid arch name 'rv64imm'
195 // RUN: not %clang --target=riscv64-unknown-elf -march=RV64I -### %s \
196 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64I-UPPER %s
197 // RV64I-UPPER: error: invalid arch name 'RV64I'
199 // Testing specific messages and unsupported extensions.
201 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32imC -### %s \
202 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-LOWER %s
203 // RV32-LOWER: error: invalid arch name 'rv32imC',
204 // RV32-LOWER: string must be lowercase
206 // RUN: not %clang --target=riscv32-unknown-elf -march=unknown -### %s \
207 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STR %s
208 // RV32-STR: error: invalid arch name 'unknown',
209 // RV32-STR: string must begin with rv32{i,e,g} or rv64{i,e,g}
211 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32q -### %s \
212 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-LETTER %s
213 // RV32-LETTER: error: invalid arch name 'rv32q',
214 // RV32-LETTER: first letter should be 'e', 'i' or 'g'
216 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32imcq -### %s \
217 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ORDER %s
218 // RV32-ORDER: error: invalid arch name 'rv32imcq',
219 // RV32-ORDER: standard user-level extension not given in canonical order 'q'
221 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32izvl64b -### %s \
222 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZVL64B-ER %s
223 // RV32-ZVL64B-ER: error: invalid arch name 'rv32izvl64b',
224 // RV32-ZVL64B-ER: 'zvl*b' requires 'v' or 'zve*' extension to also be specified
226 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32imw -### %s \
227 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STD-INVAL %s
228 // RV32-STD-INVAL: error: invalid arch name 'rv32imw',
229 // RV32-STD-INVAL: invalid standard user-level extension 'w'
231 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32imqc -### %s \
232 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STD %s
233 // RV32-STD: error: invalid arch name 'rv32imqc',
234 // RV32-STD: unsupported standard user-level extension 'q'
236 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ib -### %s \
237 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-B %s
238 // RV32-B: error: invalid arch name 'rv32ib',
239 // RV32-B: unsupported standard user-level extension 'b'
241 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32xabc -### %s \
242 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X %s
243 // RV32X: error: invalid arch name 'rv32xabc',
244 // RV32X: first letter should be 'e', 'i' or 'g'
246 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32sabc -### %s \
247 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S %s
248 // RV32S: error: invalid arch name 'rv32sabc',
249 // RV32S: first letter should be 'e', 'i' or 'g'
251 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ix -### %s \
252 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X-NAME %s
253 // RV32X-NAME: error: invalid arch name 'rv32ix',
254 // RV32X-NAME: non-standard user-level extension name missing after 'x'
256 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32is -### %s \
257 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S-NAME %s
258 // RV32S-NAME: error: invalid arch name 'rv32is',
259 // RV32S-NAME: standard supervisor-level extension
260 // RV32S-NAME: name missing after 's'
262 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ix_s -### %s \
263 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ALL-NAME %s
264 // RV32ALL-NAME: error: invalid arch name 'rv32ix_s',
265 // RV32ALL-NAME: non-standard user-level extension
266 // RV32ALL-NAME: name missing after 'x'
268 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ixabc -### %s \
269 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X-UNS %s
270 // RV32X-UNS: error: invalid arch name 'rv32ixabc',
271 // RV32X-UNS: unsupported non-standard user-level extension 'xabc'
273 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32isa -### %s \
274 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S-UNS %s
275 // RV32S-UNS: error: invalid arch name 'rv32isa',
276 // RV32S-UNS: unsupported standard supervisor-level extension 'sa'
278 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32isp_xabc -### %s \
279 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ALL %s
280 // RV32ALL: error: invalid arch name 'rv32isp_xabc',
281 // RV32ALL: unsupported standard supervisor-level extension 'sp'
283 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32i20 -### %s \
284 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IVER %s
285 // RV32-IVER: error: invalid arch name 'rv32i20', unsupported
286 // RV32-IVER: version number 20 for extension 'i'
288 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32imc5 -### %s \
289 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-CVER %s
290 // RV32-CVER: error: invalid arch name 'rv32imc5', unsupported
291 // RV32-CVER: version number 5 for extension 'c'
293 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32i2p -### %s \
294 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IMINOR-MISS %s
295 // RV32-IMINOR-MISS: error: invalid arch name 'rv32i2p',
296 // RV32-IMINOR-MISS: minor version number missing after 'p' for extension 'i'
298 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32i2p2 -### %s \
299 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IMINOR1 %s
300 // RV32-IMINOR1: error: invalid arch name 'rv32i2p2', unsupported
301 // RV32-IMINOR1: version number 2.2 for extension 'i'
303 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ixt2p -### %s \
304 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XMINOR-MISS %s
305 // RV32-XMINOR-MISS: error: invalid arch name 'rv32ixt2p',
306 // RV32-XMINOR-MISS: minor version number missing after 'p' for extension 'xt'
308 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ist2p0 -### %s \
309 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-SMINOR0 %s
310 // RV32-SMINOR0: error: invalid arch name 'rv32ist2p0',
311 // RV32-SMINOR0: unsupported version number 2.0 for extension 'st'
313 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ixabc_ -### %s \
314 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XSEP %s
315 // RV32-XSEP: error: invalid arch name 'rv32ixabc_',
316 // RV32-XSEP: extension name missing after separator '_'
318 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ixabc_a -### %s \
319 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-PREFIX %s
320 // RV32-PREFIX: error: invalid arch name 'rv32ixabc_a',
321 // RV32-PREFIX: invalid extension prefix 'a'
323 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ixdef_sabc -### %s \
324 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-ORDER %s
325 // RV32-X-ORDER: error: invalid arch name 'rv32ixdef_sabc',
326 // RV32-X-ORDER unsupported non-standard user-level extension 'xdef'
328 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ixabc_xabc -### %s \
329 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XDUP %s
330 // RV32-XDUP: error: invalid arch name 'rv32ixabc_xabc',
331 // RV32-XDUP: duplicated non-standard user-level extension 'xabc'
333 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ixabc_xdef -### %s \
334 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-X-INVAL %s
335 // RV32-X-X-INVAL: error: invalid arch name 'rv32ixabc_xdef', unsupported
336 // RV32-X-X-INVAL: non-standard user-level extension 'xabc'
338 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32isdef_xabc -### %s \
339 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-S-INVAL %s
340 // RV32-X-S-INVAL: error: invalid arch name 'rv32isdef_xabc',
341 // RV32-X-S-INVAL: unsupported standard supervisor-level extension 'sdef'
343 // RUN: %clang --target=riscv32-unknown-elf -march=rv32i -### %s \
344 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-TARGET %s
345 // RUN: %clang --target=riscv64-unknown-elf -march=rv32i -### %s \
346 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-TARGET %s
347 // RUN: %clang --target=riscv32-unknown-elf -mcpu=generic-rv32 -### %s \
348 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-TARGET %s
349 // RUN: %clang --target=riscv64-unknown-elf -mcpu=generic-rv32 -### %s \
350 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-TARGET %s
351 // RV32-TARGET: "-triple" "riscv32-unknown-unknown-elf"
353 // RUN: %clang --target=riscv32-unknown-elf -march=rv64i -### %s \
354 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64-TARGET %s
355 // RUN: %clang --target=riscv64-unknown-elf -march=rv64i -### %s \
356 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64-TARGET %s
357 // RUN: %clang --target=riscv32-unknown-elf -mcpu=generic-rv64 -### %s \
358 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64-TARGET %s
359 // RUN: %clang --target=riscv64-unknown-elf -mcpu=generic-rv64 -### %s \
360 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64-TARGET %s
361 // RV64-TARGET: "-triple" "riscv64-unknown-unknown-elf"
363 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzfh01p0 -### %s \
364 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFH %s
365 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzfh -### %s \
366 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFH %s
367 // RV32-ZFH: "-target-feature" "+zfh"
369 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzfhmin01p0 -### %s \
370 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFHMIN %s
371 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzfhmin -### %s \
372 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFHMIN %s
373 // RV32-ZFHMIN: "-target-feature" "+zfhmin"
375 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32iztso -### %s \
376 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-NOFLAG %s
377 // RV32-EXPERIMENTAL-NOFLAG: error: invalid arch name 'rv32iztso'
378 // RV32-EXPERIMENTAL-NOFLAG: requires '-menable-experimental-extensions'
380 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32iztso -menable-experimental-extensions -### %s \
381 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-NOVERS %s
382 // RV32-EXPERIMENTAL-NOVERS: error: invalid arch name 'rv32iztso'
383 // RV32-EXPERIMENTAL-NOVERS: experimental extension requires explicit version number
385 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32iztso0p7 -menable-experimental-extensions -### %s \
386 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-BADVERS %s
387 // RV32-EXPERIMENTAL-BADVERS: error: invalid arch name 'rv32iztso0p7'
388 // RV32-EXPERIMENTAL-BADVERS: unsupported version number 0.7 for experimental extension 'ztso' (this compiler supports 0.1)
390 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iztso0p1 -menable-experimental-extensions -### %s \
391 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-GOODVERS %s
392 // RV32-EXPERIMENTAL-GOODVERS: "-target-feature" "+experimental-ztso"
394 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbb1p0 -### %s \
395 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBB %s
396 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbb -### %s \
397 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBB %s
398 // RV32-ZBB: "-target-feature" "+zbb"
400 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32izbb1p0zbs1p0 -menable-experimental-extensions -### %s \
401 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBB-ZBS-UNDERSCORE %s
402 // RV32-EXPERIMENTAL-ZBB-ZBS-UNDERSCORE: error: invalid arch name 'rv32izbb1p0zbs1p0', unsupported version number 1.0 for extension 'zbb1p0zbs'
404 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izba1p0 -### %s \
405 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBA %s
406 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izba -### %s \
407 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBA %s
408 // RV32-ZBA: "-target-feature" "+zba"
410 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32iv0p1 -### %s -c 2>&1 | \
411 // RUN: FileCheck -check-prefix=RV32-V-BADVERS %s
412 // RV32-V-BADVERS: error: invalid arch name 'rv32iv0p1'
413 // RV32-V-BADVERS: unsupported version number 0.1 for extension 'v'
415 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iv1p0 -### %s -c 2>&1 | \
416 // RUN: FileCheck -check-prefix=RV32-V-GOODVERS %s
417 // RV32-V-GOODVERS: "-target-feature" "+v"
419 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32iv1p0_zvl32b0p1 -### %s -c 2>&1 | \
420 // RUN: FileCheck -check-prefix=RV32-ZVL-BADVERS %s
421 // RV32-ZVL-BADVERS: error: invalid arch name 'rv32iv1p0_zvl32b0p1'
422 // RV32-ZVL-BADVERS: unsupported version number 0.1 for extension 'zvl32b'
424 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iv1p0_zvl32b1p0 -### %s -c 2>&1 | \
425 // RUN: FileCheck -check-prefix=RV32-ZVL-GOODVERS %s
426 // RV32-ZVL-GOODVERS: "-target-feature" "+zvl32b"
428 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbkc1p0 -### %s \
429 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBKC %s
430 // RV32-ZBKC: "-target-feature" "+zbkc"
432 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbkx1p0 -### %s \
433 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBKX %s
434 // RV32-ZBKX: "-target-feature" "+zbkx"
436 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbkb1p0 -### %s \
437 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBKB %s
438 // RV32-ZBKB: "-target-feature" "+zbkb"
440 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izknd1p0 -### %s \
441 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKND %s
442 // RV32-ZKND: "-target-feature" "+zknd"
444 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izkne1p0 -### %s \
445 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKNE %s
446 // RV32-ZKNE: "-target-feature" "+zkne"
448 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izknh1p0 -### %s \
449 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKNH %s
450 // RV32-ZKNH: "-target-feature" "+zknh"
452 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izksed1p0 -### %s \
453 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKSED %s
454 // RV32-ZKSED: "-target-feature" "+zksed"
456 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izksh1p0 -### %s \
457 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKSH %s
458 // RV32-ZKSH: "-target-feature" "+zksh"
460 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izkr1p0 -### %s \
461 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKR %s
462 // RV32-ZKR: "-target-feature" "+zkr"
464 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izkt1p0 -### %s \
465 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKT %s
466 // RV32-ZKT: "-target-feature" "+zkt"
468 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izk1p0 -### %s \
469 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZK %s
470 // RV32-ZK: "-target-feature" "+zk"
472 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izfh1p0 -### %s \
473 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-RV32-ZFH %s
474 // CHECK-RV32-ZFH: "-target-feature" "+zfh"
476 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izfhmin1p0 -### %s \
477 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-RV32-ZFHMIN %s
478 // CHECK-RV32-ZFHMIN: "-target-feature" "+zfhmin"
480 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32izve32x0p1 -### %s -c 2>&1 | \
481 // RUN: FileCheck -check-prefix=RV32-ZVE32X-BADVERS %s
482 // RV32-ZVE32X-BADVERS: error: invalid arch name 'rv32izve32x0p1'
483 // RV32-ZVE32X-BADVERS: unsupported version number 0.1 for extension 'zve32x'
485 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve32x -### %s -c 2>&1 | \
486 // RUN: FileCheck -check-prefix=RV32-ZVE32X-GOODVERS %s
487 // RV32-ZVE32X-GOODVERS: "-target-feature" "+zve32x"
489 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve32f -### %s -c 2>&1 | \
490 // RUN: FileCheck -check-prefix=RV32-ZVE32F-GOOD %s
491 // RV32-ZVE32F-GOOD: "-target-feature" "+zve32f"
493 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve64x -### %s -c 2>&1 | \
494 // RUN: FileCheck -check-prefix=RV32-ZVE64X %s
495 // RV32-ZVE64X: "-target-feature" "+zve64x"
497 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve64f -### %s -c 2>&1 | \
498 // RUN: FileCheck -check-prefix=RV32-ZVE64F-GOOD %s
499 // RV32-ZVE64F-GOOD: "-target-feature" "+zve64f"
501 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve64d -### %s -c 2>&1 | \
502 // RUN: FileCheck -check-prefix=RV32-ZVE64D-GOOD %s
503 // RV32-ZVE64D-GOOD: "-target-feature" "+zve64d"
505 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izfinx -### %s \
506 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFINX-GOOD %s
507 // RV32-ZFINX-GOOD: "-target-feature" "+zfinx"
509 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izdinx -### %s \
510 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZDINX-GOOD %s
511 // RV32-ZDINX-GOOD: "-target-feature" "+zdinx"
513 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izhinxmin -### %s \
514 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZHINXMIN-GOOD %s
515 // RV32-ZHINXMIN-GOOD: "-target-feature" "+zhinxmin"
517 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izhinx1p0 -### %s \
518 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZHINX-GOOD %s
519 // RV32-ZHINX-GOOD: "-target-feature" "+zhinx"
521 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32izhinx0p1 -### %s \
522 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZHINX-BADVERS %s
523 // RV32-ZHINX-BADVERS: error: invalid arch name 'rv32izhinx0p1'
524 // RV32-ZHINX-BADVERS: unsupported version number 0.1 for extension 'zhinx'
526 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32i_zmmul2p0 -### %s \
527 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZMMUL-BADVERS %s
528 // RV32-ZMMUL-BADVERS: error: invalid arch name 'rv32i_zmmul2p0'
529 // RV32-ZMMUL-BADVERS: unsupported version number 2.0 for extension
531 // RUN: %clang --target=riscv32-unknown-elf -march=rv32i_zmmul1p0 -### %s \
532 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZMMUL-GOODVERS %s
533 // RV32-ZMMUL-GOODVERS: "-target-feature" "+zmmul"
535 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ifzfinx -### %s \
536 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-F-ZFINX-ER %s
537 // RV32-F-ZFINX-ER: error: invalid arch name 'rv32ifzfinx',
538 // RV32-F-ZFINX-ER: 'f' and 'zfinx' extensions are incompatible
540 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32idzdinx -### %s \
541 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-D-ZDINX-ER %s
542 // RV32-D-ZDINX-ER: error: invalid arch name 'rv32idzdinx',
543 // RV32-D-ZFINX-ER: 'f' and 'zfinx' extensions are incompatible