Debian Codegraph @

clang/test/Driver/riscv-arch.c

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