[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / Driver / riscv-arch.c
blob018fa25218ea644e88126a977f04d057a4ed9fd3
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: %clang --target=riscv32-unknown-elf -march=rv32imadf -### %s \
160 // RUN: -fsyntax-only 2>&1 | FileCheck %s
162 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32imm -### %s \
163 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32IMM %s
164 // RV32IMM: error: invalid arch name 'rv32imm'
166 // RUN: not %clang --target=riscv32-unknown-elf -march=RV32I -### %s \
167 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32I-UPPER %s
168 // RV32I-UPPER: error: invalid arch name 'RV32I'
170 // RUN: not %clang --target=riscv64-unknown-elf -march=rv64 -### %s \
171 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64 %s
172 // RV64: error: invalid arch name 'rv64'
174 // RUN: not %clang --target=riscv64-unknown-elf -march=rv64m -### %s \
175 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64M %s
176 // RV64M: error: invalid arch name 'rv64m'
178 // RUN: %clang --target=riscv64-unknown-elf -march=rv64id -### %s \
179 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64ID %s
180 // RV64ID: "-target-feature" "+f" "-target-feature" "+d"
182 // RUN: not %clang --target=riscv64-unknown-elf -march=rv64l -### %s \
183 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64L %s
184 // RV64L: error: invalid arch name 'rv64l'
186 // RUN: %clang --target=riscv64-unknown-elf -march=rv64imadf -### %s \
187 // RUN: -fsyntax-only 2>&1 | FileCheck %s
189 // RUN: not %clang --target=riscv64-unknown-elf -march=rv64imm -### %s \
190 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64IMM %s
191 // RV64IMM: error: invalid arch name 'rv64imm'
193 // RUN: not %clang --target=riscv64-unknown-elf -march=RV64I -### %s \
194 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64I-UPPER %s
195 // RV64I-UPPER: error: invalid arch name 'RV64I'
197 // Testing specific messages and unsupported extensions.
199 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32imC -### %s \
200 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-LOWER %s
201 // RV32-LOWER: error: invalid arch name 'rv32imC',
202 // RV32-LOWER: string may only contain [a-z0-9_]
204 // RUN: not %clang --target=riscv32-unknown-elf -march=unknown -### %s \
205 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STR %s
206 // RV32-STR: error: invalid arch name 'unknown',
207 // RV32-STR: string must begin with rv32{i,e,g}, rv64{i,e,g}, or a supported profile name
209 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32q -### %s \
210 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-LETTER %s
211 // RV32-LETTER: error: invalid arch name 'rv32q',
212 // RV32-LETTER: first letter after 'rv32' should be 'e', 'i' or 'g'
214 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32imcq -### %s \
215 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ORDER %s
216 // RV32-ORDER: error: invalid arch name 'rv32imcq',
217 // RV32-ORDER: unsupported standard user-level extension 'q'
219 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32izvl64b -### %s \
220 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZVL64B-ER %s
221 // RV32-ZVL64B-ER: error: invalid arch name 'rv32izvl64b',
222 // RV32-ZVL64B-ER: 'zvl*b' requires 'v' or 'zve*' extension to also be specified
224 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32imw -### %s \
225 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STD-INVAL %s
226 // RV32-STD-INVAL: error: invalid arch name 'rv32imw',
227 // RV32-STD-INVAL: invalid standard user-level extension 'w'
229 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32imqc -### %s \
230 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STD %s
231 // RV32-STD: error: invalid arch name 'rv32imqc',
232 // RV32-STD: unsupported standard user-level extension 'q'
234 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32xabc -### %s \
235 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X %s
236 // RV32X: error: invalid arch name 'rv32xabc',
237 // RV32X: first letter after 'rv32' should be 'e', 'i' or 'g'
239 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32sabc -### %s \
240 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S %s
241 // RV32S: error: invalid arch name 'rv32sabc',
242 // RV32S: first letter after 'rv32' should be 'e', 'i' or 'g'
244 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ix -### %s \
245 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X-NAME %s
246 // RV32X-NAME: error: invalid arch name 'rv32ix',
247 // RV32X-NAME: non-standard user-level extension name missing after 'x'
249 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32is -### %s \
250 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S-NAME %s
251 // RV32S-NAME: error: invalid arch name 'rv32is',
252 // RV32S-NAME: standard supervisor-level extension
253 // RV32S-NAME: name missing after 's'
255 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ix_s -### %s \
256 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ALL-NAME %s
257 // RV32ALL-NAME: error: invalid arch name 'rv32ix_s',
258 // RV32ALL-NAME: non-standard user-level extension
259 // RV32ALL-NAME: name missing after 'x'
261 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ixabc -### %s \
262 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X-UNS %s
263 // RV32X-UNS: error: invalid arch name 'rv32ixabc',
264 // RV32X-UNS: unsupported non-standard user-level extension 'xabc'
266 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32isa -### %s \
267 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S-UNS %s
268 // RV32S-UNS: error: invalid arch name 'rv32isa',
269 // RV32S-UNS: unsupported standard supervisor-level extension 'sa'
271 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32isp_xabc -### %s \
272 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ALL %s
273 // RV32ALL: error: invalid arch name 'rv32isp_xabc',
274 // RV32ALL: unsupported standard supervisor-level extension 'sp'
276 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32i20 -### %s \
277 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IVER %s
278 // RV32-IVER: error: invalid arch name 'rv32i20', unsupported
279 // RV32-IVER: version number 20 for extension 'i'
281 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32imc5 -### %s \
282 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-CVER %s
283 // RV32-CVER: error: invalid arch name 'rv32imc5', unsupported
284 // RV32-CVER: version number 5 for extension 'c'
286 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32i2p -### %s \
287 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IMINOR-MISS %s
288 // RV32-IMINOR-MISS: error: invalid arch name 'rv32i2p',
289 // RV32-IMINOR-MISS: minor version number missing after 'p' for extension 'i'
291 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32i2p2 -### %s \
292 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IMINOR1 %s
293 // RV32-IMINOR1: error: invalid arch name 'rv32i2p2', unsupported
294 // RV32-IMINOR1: version number 2.2 for extension 'i'
296 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ixt2p -### %s \
297 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XMINOR-MISS %s
298 // RV32-XMINOR-MISS: error: invalid arch name 'rv32ixt2p',
299 // RV32-XMINOR-MISS: minor version number missing after 'p' for extension 'xt'
301 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ist2p0 -### %s \
302 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-SMINOR0 %s
303 // RV32-SMINOR0: error: invalid arch name 'rv32ist2p0',
304 // RV32-SMINOR0: unsupported standard supervisor-level extension 'st'
306 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ixabc_ -### %s \
307 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XSEP %s
308 // RV32-XSEP: error: invalid arch name 'rv32ixabc_',
309 // RV32-XSEP: unsupported non-standard user-level extension 'xabc'
311 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ixabc_a -### %s \
312 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-PREFIX %s
313 // RV32-PREFIX: error: invalid arch name 'rv32ixabc_a',
314 // RV32-PREFIX: unsupported non-standard user-level extension 'xabc'
316 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ixdef_sabc -### %s \
317 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-ORDER %s
318 // RV32-X-ORDER: error: invalid arch name 'rv32ixdef_sabc',
319 // RV32-X-ORDER unsupported non-standard user-level extension 'xdef'
321 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32im_m -### %s \
322 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XDUP %s
323 // RV32-XDUP: error: invalid arch name 'rv32im_m',
324 // RV32-XDUP: duplicated standard user-level extension 'm'
326 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ixabc_xdef -### %s \
327 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-X-INVAL %s
328 // RV32-X-X-INVAL: error: invalid arch name 'rv32ixabc_xdef', unsupported
329 // RV32-X-X-INVAL: non-standard user-level extension 'xabc'
331 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32isdef_xabc -### %s \
332 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-S-INVAL %s
333 // RV32-X-S-INVAL: error: invalid arch name 'rv32isdef_xabc',
334 // RV32-X-S-INVAL: unsupported standard supervisor-level extension 'sdef'
336 // RUN: %clang --target=riscv32-unknown-elf -march=rv32i -### %s \
337 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-TARGET %s
338 // RUN: %clang --target=riscv64-unknown-elf -march=rv32i -### %s \
339 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-TARGET %s
340 // RUN: %clang --target=riscv32-unknown-elf -mcpu=generic-rv32 -### %s \
341 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-TARGET %s
342 // RUN: %clang --target=riscv64-unknown-elf -mcpu=generic-rv32 -### %s \
343 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-TARGET %s
344 // RV32-TARGET: "-triple" "riscv32-unknown-unknown-elf"
346 // RUN: %clang --target=riscv32-unknown-elf -march=rv64i -### %s \
347 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64-TARGET %s
348 // RUN: %clang --target=riscv64-unknown-elf -march=rv64i -### %s \
349 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64-TARGET %s
350 // RUN: %clang --target=riscv32-unknown-elf -mcpu=generic-rv64 -### %s \
351 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64-TARGET %s
352 // RUN: %clang --target=riscv64-unknown-elf -mcpu=generic-rv64 -### %s \
353 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64-TARGET %s
354 // RV64-TARGET: "-triple" "riscv64-unknown-unknown-elf"
356 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzfh01p0 -### %s \
357 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFH %s
358 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzfh -### %s \
359 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFH %s
360 // RV32-ZFH: "-target-feature" "+zfh"
362 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzfhmin01p0 -### %s \
363 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFHMIN %s
364 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzfhmin -### %s \
365 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFHMIN %s
366 // RV32-ZFHMIN: "-target-feature" "+zfhmin"
368 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32izalasr -### %s \
369 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-NOFLAG %s
370 // RV32-EXPERIMENTAL-NOFLAG: error: invalid arch name 'rv32izalasr'
371 // RV32-EXPERIMENTAL-NOFLAG: requires '-menable-experimental-extensions'
373 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32izalasr -menable-experimental-extensions -### %s \
374 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-NOVERS %s
375 // RV32-EXPERIMENTAL-NOVERS: error: invalid arch name 'rv32izalasr'
376 // RV32-EXPERIMENTAL-NOVERS: experimental extension requires explicit version number
378 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32izalasr0p7 -menable-experimental-extensions -### %s \
379 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-BADVERS %s
380 // RV32-EXPERIMENTAL-BADVERS: error: invalid arch name 'rv32izalasr0p7'
381 // RV32-EXPERIMENTAL-BADVERS: unsupported version number 0.7 for experimental extension 'zalasr' (this compiler supports 0.1)
383 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izalasr0p1 -menable-experimental-extensions -### %s \
384 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-GOODVERS %s
385 // RV32-EXPERIMENTAL-GOODVERS: "-target-feature" "+experimental-zalasr"
387 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iztso1p0 -### %s \
388 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZTSO %s
389 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iztso -### %s \
390 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZTSO %s
391 // RV32-ZTSO: "-target-feature" "+ztso"
393 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbb1p0 -### %s \
394 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBB %s
395 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbb -### %s \
396 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBB %s
397 // RV32-ZBB: "-target-feature" "+zbb"
399 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32izbb1p0zbs1p0 -menable-experimental-extensions -### %s \
400 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBB-ZBS-UNDERSCORE %s
401 // RV32-EXPERIMENTAL-ZBB-ZBS-UNDERSCORE: error: invalid arch name 'rv32izbb1p0zbs1p0', unsupported standard user-level extension 'zbb1p0zbs'
403 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izba1p0 -### %s \
404 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBA %s
405 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izba -### %s \
406 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBA %s
407 // RV32-ZBA: "-target-feature" "+zba"
409 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32iv0p1 -### %s -c 2>&1 | \
410 // RUN: FileCheck -check-prefix=RV32-V-BADVERS %s
411 // RV32-V-BADVERS: error: invalid arch name 'rv32iv0p1'
412 // RV32-V-BADVERS: unsupported version number 0.1 for extension 'v'
414 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iv1p0 -### %s -c 2>&1 | \
415 // RUN: FileCheck -check-prefix=RV32-V-GOODVERS %s
416 // RV32-V-GOODVERS: "-target-feature" "+v"
418 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32iv1p0_zvl32b0p1 -### %s -c 2>&1 | \
419 // RUN: FileCheck -check-prefix=RV32-ZVL-BADVERS %s
420 // RV32-ZVL-BADVERS: error: invalid arch name 'rv32iv1p0_zvl32b0p1'
421 // RV32-ZVL-BADVERS: unsupported version number 0.1 for extension 'zvl32b'
423 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iv1p0_zvl32b1p0 -### %s -c 2>&1 | \
424 // RUN: FileCheck -check-prefix=RV32-ZVL-GOODVERS %s
425 // RV32-ZVL-GOODVERS: "-target-feature" "+zvl32b"
427 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbkc1p0 -### %s \
428 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBKC %s
429 // RV32-ZBKC: "-target-feature" "+zbkc"
431 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbkx1p0 -### %s \
432 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBKX %s
433 // RV32-ZBKX: "-target-feature" "+zbkx"
435 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbkb1p0 -### %s \
436 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBKB %s
437 // RV32-ZBKB: "-target-feature" "+zbkb"
439 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izknd1p0 -### %s \
440 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKND %s
441 // RV32-ZKND: "-target-feature" "+zknd"
443 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izkne1p0 -### %s \
444 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKNE %s
445 // RV32-ZKNE: "-target-feature" "+zkne"
447 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izknh1p0 -### %s \
448 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKNH %s
449 // RV32-ZKNH: "-target-feature" "+zknh"
451 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izksed1p0 -### %s \
452 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKSED %s
453 // RV32-ZKSED: "-target-feature" "+zksed"
455 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izksh1p0 -### %s \
456 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKSH %s
457 // RV32-ZKSH: "-target-feature" "+zksh"
459 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izkr1p0 -### %s \
460 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKR %s
461 // RV32-ZKR: "-target-feature" "+zkr"
463 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izkt1p0 -### %s \
464 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKT %s
465 // RV32-ZKT: "-target-feature" "+zkt"
467 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izk1p0 -### %s \
468 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZK %s
469 // RV32-ZK: "-target-feature" "+zk"
471 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izfh1p0 -### %s \
472 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-RV32-ZFH %s
473 // CHECK-RV32-ZFH: "-target-feature" "+zfh"
475 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izfhmin1p0 -### %s \
476 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-RV32-ZFHMIN %s
477 // CHECK-RV32-ZFHMIN: "-target-feature" "+zfhmin"
479 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32izve32x0p1 -### %s -c 2>&1 | \
480 // RUN: FileCheck -check-prefix=RV32-ZVE32X-BADVERS %s
481 // RV32-ZVE32X-BADVERS: error: invalid arch name 'rv32izve32x0p1'
482 // RV32-ZVE32X-BADVERS: unsupported version number 0.1 for extension 'zve32x'
484 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve32x -### %s -c 2>&1 | \
485 // RUN: FileCheck -check-prefix=RV32-ZVE32X-GOODVERS %s
486 // RV32-ZVE32X-GOODVERS: "-target-feature" "+zve32x"
488 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve32f -### %s -c 2>&1 | \
489 // RUN: FileCheck -check-prefix=RV32-ZVE32F-GOOD %s
490 // RV32-ZVE32F-GOOD: "-target-feature" "+zve32f"
492 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve64x -### %s -c 2>&1 | \
493 // RUN: FileCheck -check-prefix=RV32-ZVE64X %s
494 // RV32-ZVE64X: "-target-feature" "+zve64x"
496 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve64f -### %s -c 2>&1 | \
497 // RUN: FileCheck -check-prefix=RV32-ZVE64F-GOOD %s
498 // RV32-ZVE64F-GOOD: "-target-feature" "+zve64f"
500 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve64d -### %s -c 2>&1 | \
501 // RUN: FileCheck -check-prefix=RV32-ZVE64D-GOOD %s
502 // RV32-ZVE64D-GOOD: "-target-feature" "+zve64d"
504 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izfinx -### %s \
505 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFINX-GOOD %s
506 // RV32-ZFINX-GOOD: "-target-feature" "+zfinx"
508 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izdinx -### %s \
509 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZDINX-GOOD %s
510 // RV32-ZDINX-GOOD: "-target-feature" "+zdinx"
512 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izhinxmin -### %s \
513 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZHINXMIN-GOOD %s
514 // RV32-ZHINXMIN-GOOD: "-target-feature" "+zhinxmin"
516 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izhinx1p0 -### %s \
517 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZHINX-GOOD %s
518 // RV32-ZHINX-GOOD: "-target-feature" "+zhinx"
520 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32izhinx0p1 -### %s \
521 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZHINX-BADVERS %s
522 // RV32-ZHINX-BADVERS: error: invalid arch name 'rv32izhinx0p1'
523 // RV32-ZHINX-BADVERS: unsupported version number 0.1 for extension 'zhinx'
525 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32i_zmmul2p0 -### %s \
526 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZMMUL-BADVERS %s
527 // RV32-ZMMUL-BADVERS: error: invalid arch name 'rv32i_zmmul2p0'
528 // RV32-ZMMUL-BADVERS: unsupported version number 2.0 for extension
530 // RUN: %clang --target=riscv32-unknown-elf -march=rv32i_zmmul1p0 -### %s \
531 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZMMUL-GOODVERS %s
532 // RV32-ZMMUL-GOODVERS: "-target-feature" "+zmmul"
534 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32ifzfinx -### %s \
535 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-F-ZFINX-ER %s
536 // RV32-F-ZFINX-ER: error: invalid arch name 'rv32ifzfinx',
537 // RV32-F-ZFINX-ER: 'f' and 'zfinx' extensions are incompatible
539 // RUN: not %clang --target=riscv32-unknown-elf -march=rv32idzdinx -### %s \
540 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-D-ZDINX-ER %s
541 // RV32-D-ZDINX-ER: error: invalid arch name 'rv32idzdinx',
542 // RV32-D-ZFINX-ER: 'f' and 'zfinx' extensions are incompatible