[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Driver / riscv-arch.c
blob26a58418fe457703c2fa3e5620b9e89c7f8c592b
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=rv32i2p0 -### %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=rv64i2p0 -### %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: %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: %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: error: invalid arch name 'rv32id'
155 // RUN: %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 -check-prefix=RV32IMADF %s
161 // RV32IMADF: error: invalid arch name 'rv32imadf'
163 // RUN: %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: %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: %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: %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: error: invalid arch name 'rv64id'
183 // RUN: %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: %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: %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: %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: %clang --target=riscv64-unknown-elf -march=rv64e -### %s \
202 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64E %s
203 // RV64E: error: invalid arch name 'rv64e',
204 // RV64E: standard user-level extension 'e' requires 'rv32'
206 // RUN: %clang --target=riscv32-unknown-elf -march=rv32imC -### %s \
207 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-LOWER %s
208 // RV32-LOWER: error: invalid arch name 'rv32imC',
209 // RV32-LOWER: string must be lowercase
211 // RUN: %clang --target=riscv32-unknown-elf -march=unknown -### %s \
212 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STR %s
213 // RV32-STR: error: invalid arch name 'unknown',
214 // RV32-STR: string must begin with rv32{i,e,g} or rv64{i,g}
216 // RUN: %clang --target=riscv32-unknown-elf -march=rv32q -### %s \
217 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-LETTER %s
218 // RV32-LETTER: error: invalid arch name 'rv32q',
219 // RV32-LETTER: first letter should be 'e', 'i' or 'g'
221 // RUN: %clang --target=riscv32-unknown-elf -march=rv32imcq -### %s \
222 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ORDER %s
223 // RV32-ORDER: error: invalid arch name 'rv32imcq',
224 // RV32-ORDER: standard user-level extension not given in canonical order 'q'
226 // RUN: %clang --target=riscv32-unknown-elf -march=rv64e -### %s \
227 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64-EER %s
228 // RV64-EER: error: invalid arch name 'rv64e',
229 // RV64-EER: standard user-level extension 'e' requires 'rv32'
231 // RUN: %clang --target=riscv32-unknown-elf -march=rv32id -### %s \
232 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-DER %s
233 // RV32-DER: error: invalid arch name 'rv32id',
234 // RV32-DER: d requires f extension to also be specified
236 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve32f -### %s \
237 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZVE32F-ER %s
238 // RV32-ZVE32F-ER: error: invalid arch name 'rv32izve32f',
239 // RV32-ZVE32F-ER: zve32f requires f or zfinx extension to also be specified
241 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzve64d -### %s \
242 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZVE64D-ER %s
243 // RV32-ZVE64D-ER: error: invalid arch name 'rv32ifzve64d',
244 // RV32-ZVE64D-ER: zve64d requires d or zdinx extension to also be specified
246 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izvl64b -### %s \
247 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZVL64B-ER %s
248 // RV32-ZVL64B-ER: error: invalid arch name 'rv32izvl64b',
249 // RV32-ZVL64B-ER: zvl*b requires v or zve* extension to also be specified
251 // RUN: %clang --target=riscv32-unknown-elf -march=rv32imw -### %s \
252 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STD-INVAL %s
253 // RV32-STD-INVAL: error: invalid arch name 'rv32imw',
254 // RV32-STD-INVAL: invalid standard user-level extension 'w'
256 // RUN: %clang --target=riscv32-unknown-elf -march=rv32imqc -### %s \
257 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STD %s
258 // RV32-STD: error: invalid arch name 'rv32imqc',
259 // RV32-STD: unsupported standard user-level extension 'q'
261 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ib -### %s \
262 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-B %s
263 // RV32-B: error: invalid arch name 'rv32ib',
264 // RV32-B: unsupported standard user-level extension 'b'
266 // RUN: %clang --target=riscv32-unknown-elf -march=rv32xabc -### %s \
267 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X %s
268 // RV32X: error: invalid arch name 'rv32xabc',
269 // RV32X: first letter should be 'e', 'i' or 'g'
271 // RUN: %clang --target=riscv32-unknown-elf -march=rv32sxabc -### %s \
272 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32SX %s
273 // RV32SX: error: invalid arch name 'rv32sxabc',
274 // RV32SX: first letter should be 'e', 'i' or 'g'
276 // RUN: %clang --target=riscv32-unknown-elf -march=rv32sabc -### %s \
277 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S %s
278 // RV32S: error: invalid arch name 'rv32sabc',
279 // RV32S: first letter should be 'e', 'i' or 'g'
281 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ix -### %s \
282 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X-NAME %s
283 // RV32X-NAME: error: invalid arch name 'rv32ix',
284 // RV32X-NAME: non-standard user-level extension name missing after 'x'
286 // RUN: %clang --target=riscv32-unknown-elf -march=rv32isx -### %s \
287 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32SX-NAME %s
288 // RV32SX-NAME: error: invalid arch name 'rv32isx',
289 // RV32SX-NAME: non-standard supervisor-level extension
290 // RV32SX-NAME: name missing after 'sx'
292 // RUN: %clang --target=riscv32-unknown-elf -march=rv32is -### %s \
293 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S-NAME %s
294 // RV32S-NAME: error: invalid arch name 'rv32is',
295 // RV32S-NAME: standard supervisor-level extension
296 // RV32S-NAME: name missing after 's'
298 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ix_s_sx -### %s \
299 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ALL-NAME %s
300 // RV32ALL-NAME: error: invalid arch name 'rv32ix_s_sx',
301 // RV32ALL-NAME: non-standard user-level extension
302 // RV32ALL-NAME: name missing after 'x'
304 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ixabc -### %s \
305 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X-UNS %s
306 // RV32X-UNS: error: invalid arch name 'rv32ixabc',
307 // RV32X-UNS: unsupported non-standard user-level extension 'xabc'
309 // RUN: %clang --target=riscv32-unknown-elf -march=rv32isa -### %s \
310 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S-UNS %s
311 // RV32S-UNS: error: invalid arch name 'rv32isa',
312 // RV32S-UNS: unsupported standard supervisor-level extension 'sa'
314 // RUN: %clang --target=riscv32-unknown-elf -march=rv32isxabc -### %s \
315 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32SX-UNS %s
316 // RV32SX-UNS: error: invalid arch name 'rv32isxabc',
317 // RV32SX-UNS: unsupported non-standard supervisor-level extension 'sxabc'
319 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ixabc_sp_sxlw -### %s \
320 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ALL %s
321 // RV32ALL: error: invalid arch name 'rv32ixabc_sp_sxlw',
322 // RV32ALL: unsupported non-standard user-level extension 'xabc'
324 // RUN: %clang --target=riscv32-unknown-elf -march=rv32i20 -### %s \
325 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IVER %s
326 // RV32-IVER: error: invalid arch name 'rv32i20', unsupported
327 // RV32-IVER: version number 20 for extension 'i'
329 // RUN: %clang --target=riscv32-unknown-elf -march=rv32imc5 -### %s \
330 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-CVER %s
331 // RV32-CVER: error: invalid arch name 'rv32imc5', unsupported
332 // RV32-CVER: version number 5 for extension 'c'
334 // RUN: %clang --target=riscv32-unknown-elf -march=rv32i2p -### %s \
335 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IMINOR-MISS %s
336 // RV32-IMINOR-MISS: error: invalid arch name 'rv32i2p',
337 // RV32-IMINOR-MISS: minor version number missing after 'p' for extension 'i'
339 // RUN: %clang --target=riscv32-unknown-elf -march=rv32i2p1 -### %s \
340 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IMINOR1 %s
341 // RV32-IMINOR1: error: invalid arch name 'rv32i2p1', unsupported
342 // RV32-IMINOR1: version number 2.1 for extension 'i'
344 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ixt2p -### %s \
345 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XMINOR-MISS %s
346 // RV32-XMINOR-MISS: error: invalid arch name 'rv32ixt2p',
347 // RV32-XMINOR-MISS: minor version number missing after 'p' for extension 'xt'
349 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ist2p0 -### %s \
350 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-SMINOR0 %s
351 // RV32-SMINOR0: error: invalid arch name 'rv32ist2p0',
352 // RV32-SMINOR0: unsupported version number 2.0 for extension 'st'
354 // RUN: %clang --target=riscv32-unknown-elf -march=rv32isxt2p1 -### %s \
355 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-SXMINOR1 %s
356 // RV32-SXMINOR1: error: invalid arch name 'rv32isxt2p1', unsupported
357 // RV32-SXMINOR1: version number 2.1 for extension 'sxt'
359 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ixabc_ -### %s \
360 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XSEP %s
361 // RV32-XSEP: error: invalid arch name 'rv32ixabc_',
362 // RV32-XSEP: extension name missing after separator '_'
364 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ixabc_a -### %s \
365 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-PREFIX %s
366 // RV32-PREFIX: error: invalid arch name 'rv32ixabc_a',
367 // RV32-PREFIX: invalid extension prefix 'a'
369 // RUN: %clang --target=riscv32-unknown-elf -march=rv32isabc_xdef -### %s \
370 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-ORDER %s
371 // RV32-X-ORDER: error: invalid arch name 'rv32isabc_xdef',
372 // RV32-X-ORDER: non-standard user-level extension not given
373 // RV32-X-ORDER: in canonical order 'xdef'
375 // RUN: %clang --target=riscv32-unknown-elf -march=rv32isxabc_sdef -### %s \
376 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-S-ORDER %s
377 // RV32-S-ORDER: error: invalid arch name 'rv32isxabc_sdef',
378 // RV32-S-ORDER: standard supervisor-level extension not given
379 // RV32-S-ORDER: in canonical order 'sdef'
381 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ixabc_xabc -### %s \
382 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XDUP %s
383 // RV32-XDUP: error: invalid arch name 'rv32ixabc_xabc',
384 // RV32-XDUP: duplicated non-standard user-level extension 'xabc'
386 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ixabc_xdef -### %s \
387 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-X-INVAL %s
388 // RV32-X-X-INVAL: error: invalid arch name 'rv32ixabc_xdef', unsupported
389 // RV32-X-X-INVAL: non-standard user-level extension 'xabc'
391 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ixabc_sdef_sxghi -### %s \
392 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-S-SX-INVAL %s
393 // RV32-X-S-SX-INVAL: error: invalid arch name 'rv32ixabc_sdef_sxghi',
394 // RV32-X-S-SX-INVAL: unsupported non-standard user-level extension 'xabc'
396 // RUN: %clang --target=riscv32-unknown-elf -march=rv32i -### %s \
397 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-TARGET %s
398 // RUN: %clang --target=riscv64-unknown-elf -march=rv32i -### %s \
399 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-TARGET %s
400 // RV32-TARGET: "-triple" "riscv32-unknown-unknown-elf"
402 // RUN: %clang --target=riscv32-unknown-elf -march=rv64i -### %s \
403 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64-TARGET %s
404 // RUN: %clang --target=riscv64-unknown-elf -march=rv64i -### %s \
405 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64-TARGET %s
406 // RV64-TARGET: "-triple" "riscv64-unknown-unknown-elf"
408 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzfh01p0 -### %s \
409 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFH %s
410 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzfh -### %s \
411 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFH %s
412 // RV32-ZFH: "-target-feature" "+zfh"
414 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzfhmin01p0 -### %s \
415 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFHMIN %s
416 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzfhmin -### %s \
417 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFHMIN %s
418 // RV32-ZFHMIN: "-target-feature" "+zfhmin"
420 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izca -### %s \
421 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-NOFLAG %s
422 // RV32-EXPERIMENTAL-NOFLAG: error: invalid arch name 'rv32izca'
423 // RV32-EXPERIMENTAL-NOFLAG: requires '-menable-experimental-extensions'
425 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izca -menable-experimental-extensions -### %s \
426 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-NOVERS %s
427 // RV32-EXPERIMENTAL-NOVERS: error: invalid arch name 'rv32izca'
428 // RV32-EXPERIMENTAL-NOVERS: experimental extension requires explicit version number
430 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izca0p1 -menable-experimental-extensions -### %s \
431 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-BADVERS %s
432 // RV32-EXPERIMENTAL-BADVERS: error: invalid arch name 'rv32izca0p1'
433 // RV32-EXPERIMENTAL-BADVERS: unsupported version number 0.1 for experimental extension 'zca' (this compiler supports 1.0)
435 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izca1p0 -menable-experimental-extensions -### %s \
436 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-GOODVERS %s
437 // RV32-EXPERIMENTAL-GOODVERS: "-target-feature" "+experimental-zca"
439 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbb1p0 -### %s \
440 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBB %s
441 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbb -### %s \
442 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBB %s
443 // RV32-ZBB: "-target-feature" "+zbb"
445 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbb1p0zbs1p0 -menable-experimental-extensions -### %s \
446 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBB-ZBS-UNDERSCORE %s
447 // RV32-EXPERIMENTAL-ZBB-ZBS-UNDERSCORE: error: invalid arch name 'rv32izbb1p0zbs1p0', unsupported version number 1.0 for extension 'zbb1p0zbs'
449 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izba1p0 -### %s \
450 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBA %s
451 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izba -### %s \
452 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBA %s
453 // RV32-ZBA: "-target-feature" "+zba"
455 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iv0p1 -### %s -c 2>&1 | \
456 // RUN: FileCheck -check-prefix=RV32-V-BADVERS %s
457 // RV32-V-BADVERS: error: invalid arch name 'rv32iv0p1'
458 // RV32-V-BADVERS: unsupported version number 0.1 for extension 'v'
460 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iv1p0 -### %s -c 2>&1 | \
461 // RUN: FileCheck -check-prefix=RV32-V-GOODVERS %s
462 // RV32-V-GOODVERS: "-target-feature" "+v"
464 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iv1p0_zvl32b0p1 -### %s -c 2>&1 | \
465 // RUN: FileCheck -check-prefix=RV32-ZVL-BADVERS %s
466 // RV32-ZVL-BADVERS: error: invalid arch name 'rv32iv1p0_zvl32b0p1'
467 // RV32-ZVL-BADVERS: unsupported version number 0.1 for extension 'zvl32b'
469 // RUN: %clang --target=riscv32-unknown-elf -march=rv32iv1p0_zvl32b1p0 -### %s -c 2>&1 | \
470 // RUN: FileCheck -check-prefix=RV32-ZVL-GOODVERS %s
471 // RV32-ZVL-GOODVERS: "-target-feature" "+zvl32b"
473 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbkc1p0 -### %s \
474 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBKC %s
475 // RV32-ZBKC: "-target-feature" "+zbkc"
477 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbkx1p0 -### %s \
478 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBKX %s
479 // RV32-ZBKX: "-target-feature" "+zbkx"
481 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbkb1p0 -### %s \
482 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBKB %s
483 // RV32-ZBKB: "-target-feature" "+zbkb"
485 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izknd1p0 -### %s \
486 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKND %s
487 // RV32-ZKND: "-target-feature" "+zknd"
489 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izkne1p0 -### %s \
490 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKNE %s
491 // RV32-ZKNE: "-target-feature" "+zkne"
493 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izknh1p0 -### %s \
494 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKNH %s
495 // RV32-ZKNH: "-target-feature" "+zknh"
497 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izksed1p0 -### %s \
498 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKSED %s
499 // RV32-ZKSED: "-target-feature" "+zksed"
501 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izksh1p0 -### %s \
502 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKSH %s
503 // RV32-ZKSH: "-target-feature" "+zksh"
505 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izkr1p0 -### %s \
506 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKR %s
507 // RV32-ZKR: "-target-feature" "+zkr"
509 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izkt1p0 -### %s \
510 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZKT %s
511 // RV32-ZKT: "-target-feature" "+zkt"
513 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izk1p0 -### %s \
514 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZK %s
515 // RV32-ZK: "-target-feature" "+zk"
517 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izfh1p0 -### %s \
518 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-RV32-ZFH %s
519 // CHECK-RV32-ZFH: "-target-feature" "+zfh"
521 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izfhmin1p0 -### %s \
522 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-RV32-ZFHMIN %s
523 // CHECK-RV32-ZFHMIN: "-target-feature" "+zfhmin"
525 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve32x0p1 -### %s -c 2>&1 | \
526 // RUN: FileCheck -check-prefix=RV32-ZVE32X-BADVERS %s
527 // RV32-ZVE32X-BADVERS: error: invalid arch name 'rv32izve32x0p1'
528 // RV32-ZVE32X-BADVERS: unsupported version number 0.1 for extension 'zve32x'
530 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve32x -### %s -c 2>&1 | \
531 // RUN: FileCheck -check-prefix=RV32-ZVE32X-GOODVERS %s
532 // RV32-ZVE32X-GOODVERS: "-target-feature" "+zve32x"
534 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve32f -### %s -c 2>&1 | \
535 // RUN: FileCheck -check-prefix=RV32-ZVE32F-REQUIRE-F %s
536 // RV32-ZVE32F-REQUIRE-F: error: invalid arch name 'rv32izve32f', zve32f requires f or zfinx extension to also be specified
538 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzve32f -### %s -c 2>&1 | \
539 // RUN: FileCheck -check-prefix=RV32-ZVE32F-GOOD %s
540 // RV32-ZVE32F-GOOD: "-target-feature" "+zve32f"
542 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve64x -### %s -c 2>&1 | \
543 // RUN: FileCheck -check-prefix=RV32-ZVE64X %s
544 // RV32-ZVE64X: "-target-feature" "+zve64x"
546 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve64f -### %s -c 2>&1 | \
547 // RUN: FileCheck -check-prefix=RV32-ZVE64F-REQUIRE-F %s
548 // RV32-ZVE64F-REQUIRE-F: error: invalid arch name 'rv32izve64f', zve32f requires f or zfinx extension to also be specified
550 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzve64f -### %s -c 2>&1 | \
551 // RUN: FileCheck -check-prefix=RV32-ZVE64F-GOOD %s
552 // RV32-ZVE64F-GOOD: "-target-feature" "+zve64f"
554 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzve64d -### %s -c 2>&1 | \
555 // RUN: FileCheck -check-prefix=RV32-ZVE64D-REQUIRE-D %s
556 // RV32-ZVE64D-REQUIRE-D: error: invalid arch name 'rv32ifzve64d', zve64d requires d or zdinx extension to also be specified
558 // RUN: %clang --target=riscv32-unknown-elf -march=rv32ifdzve64d -### %s -c 2>&1 | \
559 // RUN: FileCheck -check-prefix=RV32-ZVE64D-GOOD %s
560 // RV32-ZVE64D-GOOD: "-target-feature" "+zve64d"
562 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izfinx -### %s \
563 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFINX-GOOD %s
564 // RV32-ZFINX-GOOD: "-target-feature" "+zfinx"
566 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izdinx -### %s \
567 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZDINX-GOOD %s
568 // RV32-ZDINX-GOOD: "-target-feature" "+zdinx"
570 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izhinxmin -### %s \
571 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZHINXMIN-GOOD %s
572 // RV32-ZHINXMIN-GOOD: "-target-feature" "+zhinxmin"
574 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izhinx1p0 -### %s \
575 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZHINX-GOOD %s
576 // RV32-ZHINX-GOOD: "-target-feature" "+zhinx"
578 // RUN: %clang --target=riscv32-unknown-elf -march=rv32izhinx0p1 -### %s \
579 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZHINX-BADVERS %s
580 // RV32-ZHINX-BADVERS: error: invalid arch name 'rv32izhinx0p1'
581 // RV32-ZHINX-BADVERS: unsupported version number 0.1 for extension 'zhinx'
583 // RUN: %clang -target riscv32-unknown-elf -march=rv32i_zmmul2p0 -### %s \
584 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZMMUL-BADVERS %s
585 // RV32-ZMMUL-BADVERS: error: invalid arch name 'rv32i_zmmul2p0'
586 // RV32-ZMMUL-BADVERS: unsupported version number 2.0 for extension
588 // RUN: %clang -target riscv32-unknown-elf -march=rv32i_zmmul1p0 -### %s \
589 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZMMUL-GOODVERS %s
590 // RV32-ZMMUL-GOODVERS: "-target-feature" "+zmmul"