1 # RUN: llvm-mc %s -triple=riscv32 -riscv-no-aliases -show-encoding \
2 # RUN: | FileCheck -check-prefixes=CHECK-INST,CHECK-ENC %s
3 # RUN: llvm-mc -filetype=obj -triple riscv32 < %s \
4 # RUN: | llvm-objdump -d - \
5 # RUN: | FileCheck -check-prefix=CHECK-INST-ALIAS %s
7 ######################################
8 # Machine Protection and Translation
9 ######################################
13 # CHECK-INST: csrrs t1, pmpcfg1, zero
14 # CHECK-ENC: encoding: [0x73,0x23,0x10,0x3a]
15 # CHECK-INST-ALIAS: csrr t1, pmpcfg1
17 # CHECK-INST: csrrs t2, pmpcfg1, zero
18 # CHECK-ENC: encoding: [0xf3,0x23,0x10,0x3a]
19 # CHECK-INST-ALIAS: csrr t2, pmpcfg1
21 csrrs t1
, pmpcfg1
, zero
27 # CHECK-INST: csrrs t1, pmpcfg3, zero
28 # CHECK-ENC: encoding: [0x73,0x23,0x30,0x3a]
29 # CHECK-INST-ALIAS: csrr t1, pmpcfg3
31 # CHECK-INST: csrrs t2, pmpcfg3, zero
32 # CHECK-ENC: encoding: [0xf3,0x23,0x30,0x3a]
33 # CHECK-INST-ALIAS: csrr t2, pmpcfg3
35 csrrs t1
, pmpcfg3
, zero
39 ######################################
40 # Machine Counter and Timers
41 ######################################
44 # CHECK-INST: csrrs t1, mcycleh, zero
45 # CHECK-ENC: encoding: [0x73,0x23,0x00,0xb8]
46 # CHECK-INST-ALIAS: csrr t1, mcycleh
48 # CHECK-INST: csrrs t2, mcycleh, zero
49 # CHECK-ENC: encoding: [0xf3,0x23,0x00,0xb8]
50 # CHECK-INST-ALIAS: csrr t2, mcycleh
51 csrrs t1
, mcycleh
, zero
57 # CHECK-INST: csrrs t1, minstreth, zero
58 # CHECK-ENC: encoding: [0x73,0x23,0x20,0xb8]
59 # CHECK-INST-ALIAS: csrr t1, minstreth
61 # CHECK-INST: csrrs t2, minstreth, zero
62 # CHECK-ENC: encoding: [0xf3,0x23,0x20,0xb8]
63 # CHECK-INST-ALIAS: csrr t2, minstreth
65 csrrs t1
, minstreth
, zero
71 # CHECK-INST: csrrs t1, mhpmcounter3h, zero
72 # CHECK-ENC: encoding: [0x73,0x23,0x30,0xb8]
73 # CHECK-INST-ALIAS: csrr t1, mhpmcounter3h
75 # CHECK-INST: csrrs t2, mhpmcounter3h, zero
76 # CHECK-ENC: encoding: [0xf3,0x23,0x30,0xb8]
77 # CHECK-INST-ALIAS: csrr t2, mhpmcounter3h
79 csrrs t1
, mhpmcounter3h
, zero
85 # CHECK-INST: csrrs t1, mhpmcounter4h, zero
86 # CHECK-ENC: encoding: [0x73,0x23,0x40,0xb8]
87 # CHECK-INST-ALIAS: csrr t1, mhpmcounter4h
89 # CHECK-INST: csrrs t2, mhpmcounter4h, zero
90 # CHECK-ENC: encoding: [0xf3,0x23,0x40,0xb8]
91 # CHECK-INST-ALIAS: csrr t2, mhpmcounter4h
93 csrrs t1
, mhpmcounter4h
, zero
99 # CHECK-INST: csrrs t1, mhpmcounter5h, zero
100 # CHECK-ENC: encoding: [0x73,0x23,0x50,0xb8]
101 # CHECK-INST-ALIAS: csrr t1, mhpmcounter5h
103 # CHECK-INST: csrrs t2, mhpmcounter5h, zero
104 # CHECK-ENC: encoding: [0xf3,0x23,0x50,0xb8]
105 # CHECK-INST-ALIAS: csrr t2, mhpmcounter5h
107 csrrs t1
, mhpmcounter5h
, zero
109 csrrs t2
, 0xB85, zero
113 # CHECK-INST: csrrs t1, mhpmcounter6h, zero
114 # CHECK-ENC: encoding: [0x73,0x23,0x60,0xb8]
115 # CHECK-INST-ALIAS: csrr t1, mhpmcounter6h
117 # CHECK-INST: csrrs t2, mhpmcounter6h, zero
118 # CHECK-ENC: encoding: [0xf3,0x23,0x60,0xb8]
119 # CHECK-INST-ALIAS: csrr t2, mhpmcounter6h
121 csrrs t1
, mhpmcounter6h
, zero
123 csrrs t2
, 0xB86, zero
127 # CHECK-INST: csrrs t1, mhpmcounter7h, zero
128 # CHECK-ENC: encoding: [0x73,0x23,0x70,0xb8]
129 # CHECK-INST-ALIAS: csrr t1, mhpmcounter7h
131 # CHECK-INST: csrrs t2, mhpmcounter7h, zero
132 # CHECK-ENC: encoding: [0xf3,0x23,0x70,0xb8]
133 # CHECK-INST-ALIAS: csrr t2, mhpmcounter7h
135 csrrs t1
, mhpmcounter7h
, zero
137 csrrs t2
, 0xB87, zero
141 # CHECK-INST: csrrs t1, mhpmcounter8h, zero
142 # CHECK-ENC: encoding: [0x73,0x23,0x80,0xb8]
143 # CHECK-INST-ALIAS: csrr t1, mhpmcounter8h
145 # CHECK-INST: csrrs t2, mhpmcounter8h, zero
146 # CHECK-ENC: encoding: [0xf3,0x23,0x80,0xb8]
147 # CHECK-INST-ALIAS: csrr t2, mhpmcounter8h
149 csrrs t1
, mhpmcounter8h
, zero
151 csrrs t2
, 0xB88, zero
155 # CHECK-INST: csrrs t1, mhpmcounter9h, zero
156 # CHECK-ENC: encoding: [0x73,0x23,0x90,0xb8]
157 # CHECK-INST-ALIAS: csrr t1, mhpmcounter9h
159 # CHECK-INST: csrrs t2, mhpmcounter9h, zero
160 # CHECK-ENC: encoding: [0xf3,0x23,0x90,0xb8]
161 # CHECK-INST-ALIAS: csrr t2, mhpmcounter9h
163 csrrs t1
, mhpmcounter9h
, zero
165 csrrs t2
, 0xB89, zero
169 # CHECK-INST: csrrs t1, mhpmcounter10h, zero
170 # CHECK-ENC: encoding: [0x73,0x23,0xa0,0xb8]
171 # CHECK-INST-ALIAS: csrr t1, mhpmcounter10h
173 # CHECK-INST: csrrs t2, mhpmcounter10h, zero
174 # CHECK-ENC: encoding: [0xf3,0x23,0xa0,0xb8]
175 # CHECK-INST-ALIAS: csrr t2, mhpmcounter10h
177 csrrs t1
, mhpmcounter10h
, zero
179 csrrs t2
, 0xB8A, zero
183 # CHECK-INST: csrrs t1, mhpmcounter11h, zero
184 # CHECK-ENC: encoding: [0x73,0x23,0xb0,0xb8]
185 # CHECK-INST-ALIAS: csrr t1, mhpmcounter11h
187 # CHECK-INST: csrrs t2, mhpmcounter11h, zero
188 # CHECK-ENC: encoding: [0xf3,0x23,0xb0,0xb8]
189 # CHECK-INST-ALIAS: csrr t2, mhpmcounter11h
191 csrrs t1
, mhpmcounter11h
, zero
193 csrrs t2
, 0xB8B, zero
197 # CHECK-INST: csrrs t1, mhpmcounter12h, zero
198 # CHECK-ENC: encoding: [0x73,0x23,0xc0,0xb8]
199 # CHECK-INST-ALIAS: csrr t1, mhpmcounter12h
201 # CHECK-INST: csrrs t2, mhpmcounter12h, zero
202 # CHECK-ENC: encoding: [0xf3,0x23,0xc0,0xb8]
203 # CHECK-INST-ALIAS: csrr t2, mhpmcounter12h
205 csrrs t1
, mhpmcounter12h
, zero
207 csrrs t2
, 0xB8C, zero
211 # CHECK-INST: csrrs t1, mhpmcounter13h, zero
212 # CHECK-ENC: encoding: [0x73,0x23,0xd0,0xb8]
213 # CHECK-INST-ALIAS: csrr t1, mhpmcounter13h
215 # CHECK-INST: csrrs t2, mhpmcounter13h, zero
216 # CHECK-ENC: encoding: [0xf3,0x23,0xd0,0xb8]
217 # CHECK-INST-ALIAS: csrr t2, mhpmcounter13h
219 csrrs t1
, mhpmcounter13h
, zero
221 csrrs t2
, 0xB8D, zero
225 # CHECK-INST: csrrs t1, mhpmcounter14h, zero
226 # CHECK-ENC: encoding: [0x73,0x23,0xe0,0xb8]
227 # CHECK-INST-ALIAS: csrr t1, mhpmcounter14h
229 # CHECK-INST: csrrs t2, mhpmcounter14h, zero
230 # CHECK-ENC: encoding: [0xf3,0x23,0xe0,0xb8]
231 # CHECK-INST-ALIAS: csrr t2, mhpmcounter14h
233 csrrs t1
, mhpmcounter14h
, zero
235 csrrs t2
, 0xB8E, zero
239 # CHECK-INST: csrrs t1, mhpmcounter15h, zero
240 # CHECK-ENC: encoding: [0x73,0x23,0xf0,0xb8]
241 # CHECK-INST-ALIAS: csrr t1, mhpmcounter15h
243 # CHECK-INST: csrrs t2, mhpmcounter15h, zero
244 # CHECK-ENC: encoding: [0xf3,0x23,0xf0,0xb8]
245 # CHECK-INST-ALIAS: csrr t2, mhpmcounter15h
247 csrrs t1
, mhpmcounter15h
, zero
249 csrrs t2
, 0xB8F, zero
253 # CHECK-INST: csrrs t1, mhpmcounter16h, zero
254 # CHECK-ENC: encoding: [0x73,0x23,0x00,0xb9]
255 # CHECK-INST-ALIAS: csrr t1, mhpmcounter16h
257 # CHECK-INST: csrrs t2, mhpmcounter16h, zero
258 # CHECK-ENC: encoding: [0xf3,0x23,0x00,0xb9]
259 # CHECK-INST-ALIAS: csrr t2, mhpmcounter16h
261 csrrs t1
, mhpmcounter16h
, zero
263 csrrs t2
, 0xB90, zero
267 # CHECK-INST: csrrs t1, mhpmcounter17h, zero
268 # CHECK-ENC: encoding: [0x73,0x23,0x10,0xb9]
269 # CHECK-INST-ALIAS: csrr t1, mhpmcounter17h
271 # CHECK-INST: csrrs t2, mhpmcounter17h, zero
272 # CHECK-ENC: encoding: [0xf3,0x23,0x10,0xb9]
273 # CHECK-INST-ALIAS: csrr t2, mhpmcounter17h
275 csrrs t1
, mhpmcounter17h
, zero
277 csrrs t2
, 0xB91, zero
281 # CHECK-INST: csrrs t1, mhpmcounter18h, zero
282 # CHECK-ENC: encoding: [0x73,0x23,0x20,0xb9]
283 # CHECK-INST-ALIAS: csrr t1, mhpmcounter18h
285 # CHECK-INST: csrrs t2, mhpmcounter18h, zero
286 # CHECK-ENC: encoding: [0xf3,0x23,0x20,0xb9]
287 # CHECK-INST-ALIAS: csrr t2, mhpmcounter18h
289 csrrs t1
, mhpmcounter18h
, zero
291 csrrs t2
, 0xB92, zero
295 # CHECK-INST: csrrs t1, mhpmcounter19h, zero
296 # CHECK-ENC: encoding: [0x73,0x23,0x30,0xb9]
297 # CHECK-INST-ALIAS: csrr t1, mhpmcounter19h
299 # CHECK-INST: csrrs t2, mhpmcounter19h, zero
300 # CHECK-ENC: encoding: [0xf3,0x23,0x30,0xb9]
301 # CHECK-INST-ALIAS: csrr t2, mhpmcounter19h
303 csrrs t1
, mhpmcounter19h
, zero
305 csrrs t2
, 0xB93, zero
309 # CHECK-INST: csrrs t1, mhpmcounter20h, zero
310 # CHECK-ENC: encoding: [0x73,0x23,0x40,0xb9]
311 # CHECK-INST-ALIAS: csrr t1, mhpmcounter20h
313 # CHECK-INST: csrrs t2, mhpmcounter20h, zero
314 # CHECK-ENC: encoding: [0xf3,0x23,0x40,0xb9]
315 # CHECK-INST-ALIAS: csrr t2, mhpmcounter20h
317 csrrs t1
, mhpmcounter20h
, zero
319 csrrs t2
, 0xB94, zero
323 # CHECK-INST: csrrs t1, mhpmcounter21h, zero
324 # CHECK-ENC: encoding: [0x73,0x23,0x50,0xb9]
325 # CHECK-INST-ALIAS: csrr t1, mhpmcounter21h
327 # CHECK-INST: csrrs t2, mhpmcounter21h, zero
328 # CHECK-ENC: encoding: [0xf3,0x23,0x50,0xb9]
329 # CHECK-INST-ALIAS: csrr t2, mhpmcounter21h
331 csrrs t1
, mhpmcounter21h
, zero
333 csrrs t2
, 0xB95, zero
337 # CHECK-INST: csrrs t1, mhpmcounter22h, zero
338 # CHECK-ENC: encoding: [0x73,0x23,0x60,0xb9]
339 # CHECK-INST-ALIAS: csrr t1, mhpmcounter22h
341 # CHECK-INST: csrrs t2, mhpmcounter22h, zero
342 # CHECK-ENC: encoding: [0xf3,0x23,0x60,0xb9]
343 # CHECK-INST-ALIAS: csrr t2, mhpmcounter22h
345 csrrs t1
, mhpmcounter22h
, zero
347 csrrs t2
, 0xB96, zero
351 # CHECK-INST: csrrs t1, mhpmcounter23h, zero
352 # CHECK-ENC: encoding: [0x73,0x23,0x70,0xb9]
353 # CHECK-INST-ALIAS: csrr t1, mhpmcounter23h
355 # CHECK-INST: csrrs t2, mhpmcounter23h, zero
356 # CHECK-ENC: encoding: [0xf3,0x23,0x70,0xb9]
357 # CHECK-INST-ALIAS: csrr t2, mhpmcounter23h
359 csrrs t1
, mhpmcounter23h
, zero
361 csrrs t2
, 0xB97, zero
365 # CHECK-INST: csrrs t1, mhpmcounter24h, zero
366 # CHECK-ENC: encoding: [0x73,0x23,0x80,0xb9]
367 # CHECK-INST-ALIAS: csrr t1, mhpmcounter24h
369 # CHECK-INST: csrrs t2, mhpmcounter24h, zero
370 # CHECK-ENC: encoding: [0xf3,0x23,0x80,0xb9]
371 # CHECK-INST-ALIAS: csrr t2, mhpmcounter24h
373 csrrs t1
, mhpmcounter24h
, zero
375 csrrs t2
, 0xB98, zero
379 # CHECK-INST: csrrs t1, mhpmcounter25h, zero
380 # CHECK-ENC: encoding: [0x73,0x23,0x90,0xb9]
381 # CHECK-INST-ALIAS: csrr t1, mhpmcounter25h
383 # CHECK-INST: csrrs t2, mhpmcounter25h, zero
384 # CHECK-ENC: encoding: [0xf3,0x23,0x90,0xb9]
385 # CHECK-INST-ALIAS: csrr t2, mhpmcounter25h
387 csrrs t1
, mhpmcounter25h
, zero
389 csrrs t2
, 0xB99, zero
393 # CHECK-INST: csrrs t1, mhpmcounter26h, zero
394 # CHECK-ENC: encoding: [0x73,0x23,0xa0,0xb9]
395 # CHECK-INST-ALIAS: csrr t1, mhpmcounter26h
397 # CHECK-INST: csrrs t2, mhpmcounter26h, zero
398 # CHECK-ENC: encoding: [0xf3,0x23,0xa0,0xb9]
399 # CHECK-INST-ALIAS: csrr t2, mhpmcounter26h
401 csrrs t1
, mhpmcounter26h
, zero
403 csrrs t2
, 0xB9A, zero
407 # CHECK-INST: csrrs t1, mhpmcounter27h, zero
408 # CHECK-ENC: encoding: [0x73,0x23,0xb0,0xb9]
409 # CHECK-INST-ALIAS: csrr t1, mhpmcounter27h
411 # CHECK-INST: csrrs t2, mhpmcounter27h, zero
412 # CHECK-ENC: encoding: [0xf3,0x23,0xb0,0xb9]
413 # CHECK-INST-ALIAS: csrr t2, mhpmcounter27h
415 csrrs t1
, mhpmcounter27h
, zero
417 csrrs t2
, 0xB9B, zero
421 # CHECK-INST: csrrs t1, mhpmcounter28h, zero
422 # CHECK-ENC: encoding: [0x73,0x23,0xc0,0xb9]
423 # CHECK-INST-ALIAS: csrr t1, mhpmcounter28h
425 # CHECK-INST: csrrs t2, mhpmcounter28h, zero
426 # CHECK-ENC: encoding: [0xf3,0x23,0xc0,0xb9]
427 # CHECK-INST-ALIAS: csrr t2, mhpmcounter28h
429 csrrs t1
, mhpmcounter28h
, zero
431 csrrs t2
, 0xB9C, zero
435 # CHECK-INST: csrrs t1, mhpmcounter29h, zero
436 # CHECK-ENC: encoding: [0x73,0x23,0xd0,0xb9]
437 # CHECK-INST-ALIAS: csrr t1, mhpmcounter29h
439 # CHECK-INST: csrrs t2, mhpmcounter29h, zero
440 # CHECK-ENC: encoding: [0xf3,0x23,0xd0,0xb9]
441 # CHECK-INST-ALIAS: csrr t2, mhpmcounter29h
443 csrrs t1
, mhpmcounter29h
, zero
445 csrrs t2
, 0xB9D, zero
449 # CHECK-INST: csrrs t1, mhpmcounter30h, zero
450 # CHECK-ENC: encoding: [0x73,0x23,0xe0,0xb9]
451 # CHECK-INST-ALIAS: csrr t1, mhpmcounter30h
453 # CHECK-INST: csrrs t2, mhpmcounter30h, zero
454 # CHECK-ENC: encoding: [0xf3,0x23,0xe0,0xb9]
455 # CHECK-INST-ALIAS: csrr t2, mhpmcounter30h
457 csrrs t1
, mhpmcounter30h
, zero
459 csrrs t2
, 0xB9E, zero
463 # CHECK-INST: csrrs t1, mhpmcounter31h, zero
464 # CHECK-ENC: encoding: [0x73,0x23,0xf0,0xb9]
465 # CHECK-INST-ALIAS: csrr t1, mhpmcounter31h
467 # CHECK-INST: csrrs t2, mhpmcounter31h, zero
468 # CHECK-ENC: encoding: [0xf3,0x23,0xf0,0xb9]
469 # CHECK-INST-ALIAS: csrr t2, mhpmcounter31h
471 csrrs t1
, mhpmcounter31h
, zero
473 csrrs t2
, 0xB9F, zero