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 # User Counter and Timers
9 ##################################
13 # CHECK-INST: csrrs t1, cycleh, zero
14 # CHECK-ENC: encoding: [0x73,0x23,0x00,0xc8]
15 # CHECK-INST-ALIAS: rdcycleh t1
17 # CHECK-INST: csrrs t2, cycleh, zero
18 # CHECK-ENC: encoding: [0xf3,0x23,0x00,0xc8]
19 # CHECK-INST-ALIAS: rdcycleh t2
21 csrrs t1
, cycleh
, zero
27 # CHECK-INST: csrrs t1, timeh, zero
28 # CHECK-ENC: encoding: [0x73,0x23,0x10,0xc8]
29 # CHECK-INST-ALIAS: rdtimeh t1
31 # CHECK-INST: csrrs t2, timeh, zero
32 # CHECK-ENC: encoding: [0xf3,0x23,0x10,0xc8]
33 # CHECK-INST-ALIAS: rdtimeh t2
41 # CHECK-INST: csrrs t1, instreth, zero
42 # CHECK-ENC: encoding: [0x73,0x23,0x20,0xc8]
43 # CHECK-INST-ALIAS: rdinstreth t1
45 # CHECK-INST: csrrs t2, instreth, zero
46 # CHECK-ENC: encoding: [0xf3,0x23,0x20,0xc8]
47 # CHECK-INST-ALIAS: rdinstreth t2
49 csrrs t1
, instreth
, zero
55 # CHECK-INST: csrrs t1, hpmcounter3h, zero
56 # CHECK-ENC: encoding: [0x73,0x23,0x30,0xc8]
57 # CHECK-INST-ALIAS: csrr t1, hpmcounter3h
59 # CHECK-INST: csrrs t2, hpmcounter3h, zero
60 # CHECK-ENC: encoding: [0xf3,0x23,0x30,0xc8]
61 # CHECK-INST-ALIAS: csrr t2, hpmcounter3h
63 csrrs t1
, hpmcounter3h
, zero
69 # CHECK-INST: csrrs t1, hpmcounter4h, zero
70 # CHECK-ENC: encoding: [0x73,0x23,0x40,0xc8]
71 # CHECK-INST-ALIAS: csrr t1, hpmcounter4h
73 # CHECK-INST: csrrs t2, hpmcounter4h, zero
74 # CHECK-ENC: encoding: [0xf3,0x23,0x40,0xc8]
75 # CHECK-INST-ALIAS: csrr t2, hpmcounter4h
77 csrrs t1
, hpmcounter4h
, zero
83 # CHECK-INST: csrrs t1, hpmcounter5h, zero
84 # CHECK-ENC: encoding: [0x73,0x23,0x50,0xc8]
85 # CHECK-INST-ALIAS: csrr t1, hpmcounter5h
87 # CHECK-INST: csrrs t2, hpmcounter5h, zero
88 # CHECK-ENC: encoding: [0xf3,0x23,0x50,0xc8]
89 # CHECK-INST-ALIAS: csrr t2, hpmcounter5h
91 csrrs t1
, hpmcounter5h
, zero
97 # CHECK-INST: csrrs t1, hpmcounter6h, zero
98 # CHECK-ENC: encoding: [0x73,0x23,0x60,0xc8]
99 # CHECK-INST-ALIAS: csrr t1, hpmcounter6h
101 # CHECK-INST: csrrs t2, hpmcounter6h, zero
102 # CHECK-ENC: encoding: [0xf3,0x23,0x60,0xc8]
103 # CHECK-INST-ALIAS: csrr t2, hpmcounter6h
105 csrrs t1
, hpmcounter6h
, zero
107 csrrs t2
, 0xC86, zero
111 # CHECK-INST: csrrs t1, hpmcounter7h, zero
112 # CHECK-ENC: encoding: [0x73,0x23,0x70,0xc8]
113 # CHECK-INST-ALIAS: csrr t1, hpmcounter7h
115 # CHECK-INST: csrrs t2, hpmcounter7h, zero
116 # CHECK-ENC: encoding: [0xf3,0x23,0x70,0xc8]
117 # CHECK-INST-ALIAS: csrr t2, hpmcounter7h
119 csrrs t1
, hpmcounter7h
, zero
121 csrrs t2
, 0xC87, zero
125 # CHECK-INST: csrrs t1, hpmcounter8h, zero
126 # CHECK-ENC: encoding: [0x73,0x23,0x80,0xc8]
127 # CHECK-INST-ALIAS: csrr t1, hpmcounter8h
129 # CHECK-INST: csrrs t2, hpmcounter8h, zero
130 # CHECK-ENC: encoding: [0xf3,0x23,0x80,0xc8]
131 # CHECK-INST-ALIAS: csrr t2, hpmcounter8h
133 csrrs t1
, hpmcounter8h
, zero
135 csrrs t2
, 0xC88, zero
139 # CHECK-INST: csrrs t1, hpmcounter9h, zero
140 # CHECK-ENC: encoding: [0x73,0x23,0x90,0xc8]
141 # CHECK-INST-ALIAS: csrr t1, hpmcounter9h
143 # CHECK-INST: csrrs t2, hpmcounter9h, zero
144 # CHECK-ENC: encoding: [0xf3,0x23,0x90,0xc8]
145 # CHECK-INST-ALIAS: csrr t2, hpmcounter9h
147 csrrs t1
, hpmcounter9h
, zero
149 csrrs t2
, 0xC89, zero
153 # CHECK-INST: csrrs t1, hpmcounter10h, zero
154 # CHECK-ENC: encoding: [0x73,0x23,0xa0,0xc8]
155 # CHECK-INST-ALIAS: csrr t1, hpmcounter10h
157 # CHECK-INST: csrrs t2, hpmcounter10h, zero
158 # CHECK-ENC: encoding: [0xf3,0x23,0xa0,0xc8]
159 # CHECK-INST-ALIAS: csrr t2, hpmcounter10h
161 csrrs t1
, hpmcounter10h
, zero
163 csrrs t2
, 0xC8A, zero
167 # CHECK-INST: csrrs t1, hpmcounter11h, zero
168 # CHECK-ENC: encoding: [0x73,0x23,0xb0,0xc8]
169 # CHECK-INST-ALIAS: csrr t1, hpmcounter11h
171 # CHECK-INST: csrrs t2, hpmcounter11h, zero
172 # CHECK-ENC: encoding: [0xf3,0x23,0xb0,0xc8]
173 # CHECK-INST-ALIAS: csrr t2, hpmcounter11h
175 csrrs t1
, hpmcounter11h
, zero
177 csrrs t2
, 0xC8B, zero
181 # CHECK-INST: csrrs t1, hpmcounter12h, zero
182 # CHECK-ENC: encoding: [0x73,0x23,0xc0,0xc8]
183 # CHECK-INST-ALIAS: csrr t1, hpmcounter12h
185 # CHECK-INST: csrrs t2, hpmcounter12h, zero
186 # CHECK-ENC: encoding: [0xf3,0x23,0xc0,0xc8]
187 # CHECK-INST-ALIAS: csrr t2, hpmcounter12h
189 csrrs t1
, hpmcounter12h
, zero
191 csrrs t2
, 0xC8C, zero
195 # CHECK-INST: csrrs t1, hpmcounter13h, zero
196 # CHECK-ENC: encoding: [0x73,0x23,0xd0,0xc8]
197 # CHECK-INST-ALIAS: csrr t1, hpmcounter13h
199 # CHECK-INST: csrrs t2, hpmcounter13h, zero
200 # CHECK-ENC: encoding: [0xf3,0x23,0xd0,0xc8]
201 # CHECK-INST-ALIAS: csrr t2, hpmcounter13h
203 csrrs t1
, hpmcounter13h
, zero
205 csrrs t2
, 0xC8D, zero
209 # CHECK-INST: csrrs t1, hpmcounter14h, zero
210 # CHECK-ENC: encoding: [0x73,0x23,0xe0,0xc8]
211 # CHECK-INST-ALIAS: csrr t1, hpmcounter14h
213 # CHECK-INST: csrrs t2, hpmcounter14h, zero
214 # CHECK-ENC: encoding: [0xf3,0x23,0xe0,0xc8]
215 # CHECK-INST-ALIAS: csrr t2, hpmcounter14h
217 csrrs t1
, hpmcounter14h
, zero
219 csrrs t2
, 0xC8E, zero
223 # CHECK-INST: csrrs t1, hpmcounter15h, zero
224 # CHECK-ENC: encoding: [0x73,0x23,0xf0,0xc8]
225 # CHECK-INST-ALIAS: csrr t1, hpmcounter15h
227 # CHECK-INST: csrrs t2, hpmcounter15h, zero
228 # CHECK-ENC: encoding: [0xf3,0x23,0xf0,0xc8]
229 # CHECK-INST-ALIAS: csrr t2, hpmcounter15h
231 csrrs t1
, hpmcounter15h
, zero
233 csrrs t2
, 0xC8F, zero
237 # CHECK-INST: csrrs t1, hpmcounter16h, zero
238 # CHECK-ENC: encoding: [0x73,0x23,0x00,0xc9]
239 # CHECK-INST-ALIAS: csrr t1, hpmcounter16h
241 # CHECK-INST: csrrs t2, hpmcounter16h, zero
242 # CHECK-ENC: encoding: [0xf3,0x23,0x00,0xc9]
243 # CHECK-INST-ALIAS: csrr t2, hpmcounter16h
245 csrrs t1
, hpmcounter16h
, zero
247 csrrs t2
, 0xC90, zero
251 # CHECK-INST: csrrs t1, hpmcounter17h, zero
252 # CHECK-ENC: encoding: [0x73,0x23,0x10,0xc9]
253 # CHECK-INST-ALIAS: csrr t1, hpmcounter17h
255 # CHECK-INST: csrrs t2, hpmcounter17h, zero
256 # CHECK-ENC: encoding: [0xf3,0x23,0x10,0xc9]
257 # CHECK-INST-ALIAS: csrr t2, hpmcounter17h
259 csrrs t1
, hpmcounter17h
, zero
261 csrrs t2
, 0xC91, zero
265 # CHECK-INST: csrrs t1, hpmcounter18h, zero
266 # CHECK-ENC: encoding: [0x73,0x23,0x20,0xc9]
267 # CHECK-INST-ALIAS: csrr t1, hpmcounter18h
269 # CHECK-INST: csrrs t2, hpmcounter18h, zero
270 # CHECK-ENC: encoding: [0xf3,0x23,0x20,0xc9]
271 # CHECK-INST-ALIAS: csrr t2, hpmcounter18h
273 csrrs t1
, hpmcounter18h
, zero
275 csrrs t2
, 0xC92, zero
279 # CHECK-INST: csrrs t1, hpmcounter19h, zero
280 # CHECK-ENC: encoding: [0x73,0x23,0x30,0xc9]
281 # CHECK-INST-ALIAS: csrr t1, hpmcounter19h
283 # CHECK-INST: csrrs t2, hpmcounter19h, zero
284 # CHECK-ENC: encoding: [0xf3,0x23,0x30,0xc9]
285 # CHECK-INST-ALIAS: csrr t2, hpmcounter19h
287 csrrs t1
, hpmcounter19h
, zero
289 csrrs t2
, 0xC93, zero
293 # CHECK-INST: csrrs t1, hpmcounter20h, zero
294 # CHECK-ENC: encoding: [0x73,0x23,0x40,0xc9]
295 # CHECK-INST-ALIAS: csrr t1, hpmcounter20h
297 # CHECK-INST: csrrs t2, hpmcounter20h, zero
298 # CHECK-ENC: encoding: [0xf3,0x23,0x40,0xc9]
299 # CHECK-INST-ALIAS: csrr t2, hpmcounter20h
301 csrrs t1
, hpmcounter20h
, zero
303 csrrs t2
, 0xC94, zero
307 # CHECK-INST: csrrs t1, hpmcounter21h, zero
308 # CHECK-ENC: encoding: [0x73,0x23,0x50,0xc9]
309 # CHECK-INST-ALIAS: csrr t1, hpmcounter21h
311 # CHECK-INST: csrrs t2, hpmcounter21h, zero
312 # CHECK-ENC: encoding: [0xf3,0x23,0x50,0xc9]
313 # CHECK-INST-ALIAS: csrr t2, hpmcounter21h
315 csrrs t1
, hpmcounter21h
, zero
317 csrrs t2
, 0xC95, zero
321 # CHECK-INST: csrrs t1, hpmcounter22h, zero
322 # CHECK-ENC: encoding: [0x73,0x23,0x60,0xc9]
323 # CHECK-INST-ALIAS: csrr t1, hpmcounter22h
325 # CHECK-INST: csrrs t2, hpmcounter22h, zero
326 # CHECK-ENC: encoding: [0xf3,0x23,0x60,0xc9]
327 # CHECK-INST-ALIAS: csrr t2, hpmcounter22h
329 csrrs t1
, hpmcounter22h
, zero
331 csrrs t2
, 0xC96, zero
335 # CHECK-INST: csrrs t1, hpmcounter23h, zero
336 # CHECK-ENC: encoding: [0x73,0x23,0x70,0xc9]
337 # CHECK-INST-ALIAS: csrr t1, hpmcounter23h
339 # CHECK-INST: csrrs t2, hpmcounter23h, zero
340 # CHECK-ENC: encoding: [0xf3,0x23,0x70,0xc9]
341 # CHECK-INST-ALIAS: csrr t2, hpmcounter23h
343 csrrs t1
, hpmcounter23h
, zero
345 csrrs t2
, 0xC97, zero
349 # CHECK-INST: csrrs t1, hpmcounter24h, zero
350 # CHECK-ENC: encoding: [0x73,0x23,0x80,0xc9]
351 # CHECK-INST-ALIAS: csrr t1, hpmcounter24h
353 # CHECK-INST: csrrs t2, hpmcounter24h, zero
354 # CHECK-ENC: encoding: [0xf3,0x23,0x80,0xc9]
355 # CHECK-INST-ALIAS: csrr t2, hpmcounter24h
357 csrrs t1
, hpmcounter24h
, zero
359 csrrs t2
, 0xC98, zero
363 # CHECK-INST: csrrs t1, hpmcounter25h, zero
364 # CHECK-ENC: encoding: [0x73,0x23,0x90,0xc9]
365 # CHECK-INST-ALIAS: csrr t1, hpmcounter25h
367 # CHECK-INST: csrrs t2, hpmcounter25h, zero
368 # CHECK-ENC: encoding: [0xf3,0x23,0x90,0xc9]
369 # CHECK-INST-ALIAS: csrr t2, hpmcounter25h
371 csrrs t1
, hpmcounter25h
, zero
373 csrrs t2
, 0xC99, zero
377 # CHECK-INST: csrrs t1, hpmcounter26h, zero
378 # CHECK-ENC: encoding: [0x73,0x23,0xa0,0xc9]
379 # CHECK-INST-ALIAS: csrr t1, hpmcounter26h
381 # CHECK-INST: csrrs t2, hpmcounter26h, zero
382 # CHECK-ENC: encoding: [0xf3,0x23,0xa0,0xc9]
383 # CHECK-INST-ALIAS: csrr t2, hpmcounter26h
385 csrrs t1
, hpmcounter26h
, zero
387 csrrs t2
, 0xC9A, zero
391 # CHECK-INST: csrrs t1, hpmcounter27h, zero
392 # CHECK-ENC: encoding: [0x73,0x23,0xb0,0xc9]
393 # CHECK-INST-ALIAS: csrr t1, hpmcounter27h
395 # CHECK-INST: csrrs t2, hpmcounter27h, zero
396 # CHECK-ENC: encoding: [0xf3,0x23,0xb0,0xc9]
397 # CHECK-INST-ALIAS: csrr t2, hpmcounter27h
399 csrrs t1
, hpmcounter27h
, zero
401 csrrs t2
, 0xC9B, zero
405 # CHECK-INST: csrrs t1, hpmcounter28h, zero
406 # CHECK-ENC: encoding: [0x73,0x23,0xc0,0xc9]
407 # CHECK-INST-ALIAS: csrr t1, hpmcounter28h
409 # CHECK-INST: csrrs t2, hpmcounter28h, zero
410 # CHECK-ENC: encoding: [0xf3,0x23,0xc0,0xc9]
411 # CHECK-INST-ALIAS: csrr t2, hpmcounter28h
413 csrrs t1
, hpmcounter28h
, zero
415 csrrs t2
, 0xC9C, zero
419 # CHECK-INST: csrrs t1, hpmcounter29h, zero
420 # CHECK-ENC: encoding: [0x73,0x23,0xd0,0xc9]
421 # CHECK-INST-ALIAS: csrr t1, hpmcounter29h
423 # CHECK-INST: csrrs t2, hpmcounter29h, zero
424 # CHECK-ENC: encoding: [0xf3,0x23,0xd0,0xc9]
425 # CHECK-INST-ALIAS: csrr t2, hpmcounter29h
427 csrrs t1
, hpmcounter29h
, zero
429 csrrs t2
, 0xC9D, zero
433 # CHECK-INST: csrrs t1, hpmcounter30h, zero
434 # CHECK-ENC: encoding: [0x73,0x23,0xe0,0xc9]
435 # CHECK-INST-ALIAS: csrr t1, hpmcounter30h
437 # CHECK-INST: csrrs t2, hpmcounter30h, zero
438 # CHECK-ENC: encoding: [0xf3,0x23,0xe0,0xc9]
439 # CHECK-INST-ALIAS: csrr t2, hpmcounter30h
441 csrrs t1
, hpmcounter30h
, zero
443 csrrs t2
, 0xC9E, zero
447 # CHECK-INST: csrrs t1, hpmcounter31h, zero
448 # CHECK-ENC: encoding: [0x73,0x23,0xf0,0xc9]
449 # CHECK-INST-ALIAS: csrr t1, hpmcounter31h
451 # CHECK-INST: csrrs t2, hpmcounter31h, zero
452 # CHECK-ENC: encoding: [0xf3,0x23,0xf0,0xc9]
453 # CHECK-INST-ALIAS: csrr t2, hpmcounter31h
455 csrrs t1
, hpmcounter31h
, zero
457 csrrs t2
, 0xC9F, zero