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 # RUN: llvm-mc %s -triple=riscv64 -riscv-no-aliases -show-encoding \
8 # RUN: | FileCheck -check-prefixes=CHECK-INST,CHECK-ENC %s
9 # RUN: llvm-mc -filetype=obj -triple riscv64 < %s \
10 # RUN: | llvm-objdump -d - \
11 # RUN: | FileCheck -check-prefix=CHECK-INST-ALIAS %s
13 ##################################
14 # Supervisor Trap Setup
15 ##################################
19 # CHECK-INST: csrrs t1, sstatus, zero
20 # CHECK-ENC: encoding: [0x73,0x23,0x00,0x10]
21 # CHECK-INST-ALIAS: csrr t1, sstatus
23 # CHECK-INST: csrrs t2, sstatus, zero
24 # CHECK-ENC: encoding: [0xf3,0x23,0x00,0x10]
25 # CHECK-INST-ALIAS: csrr t2, sstatus
27 csrrs t1
, sstatus
, zero
33 # CHECK-INST: csrrs t1, sedeleg, zero
34 # CHECK-ENC: encoding: [0x73,0x23,0x20,0x10]
35 # CHECK-INST-ALIAS: csrr t1, sedeleg
37 # CHECK-INST: csrrs t2, sedeleg, zero
38 # CHECK-ENC: encoding: [0xf3,0x23,0x20,0x10]
39 # CHECK-INST-ALIAS: csrr t2, sedeleg
41 csrrs t1
, sedeleg
, zero
47 # CHECK-INST: csrrs t1, sideleg, zero
48 # CHECK-ENC: encoding: [0x73,0x23,0x30,0x10]
49 # CHECK-INST-ALIAS: csrr t1, sideleg
51 # CHECK-INST: csrrs t2, sideleg, zero
52 # CHECK-ENC: encoding: [0xf3,0x23,0x30,0x10]
53 # CHECK-INST-ALIAS: csrr t2, sideleg
55 csrrs t1
, sideleg
, zero
61 # CHECK-INST: csrrs t1, sie, zero
62 # CHECK-ENC: [0x73,0x23,0x40,0x10]
63 # CHECK-INST-ALIAS: csrr t1, sie
65 # CHECK-INST: csrrs t2, sie, zero
66 # CHECK-ENC: encoding: [0xf3,0x23,0x40,0x10]
67 # CHECK-INST-ALIAS: csrr t2, sie
75 # CHECK-INST: csrrs t1, stvec, zero
76 # CHECK-ENC: encoding: [0x73,0x23,0x50,0x10]
77 # CHECK-INST-ALIAS: csrr t1, stvec
79 # CHECK-INST: csrrs t2, stvec, zero
80 # CHECK-ENC: encoding: [0xf3,0x23,0x50,0x10]
81 # CHECK-INST-ALIAS: csrr t2, stvec
89 # CHECK-INST: csrrs t1, scounteren, zero
90 # CHECK-ENC: encoding: [0x73,0x23,0x60,0x10]
91 # CHECK-INST-ALIAS: csrr t1, scounteren
93 # CHECK-INST: csrrs t2, scounteren, zero
94 # CHECK-ENC: encoding: [0xf3,0x23,0x60,0x10]
95 # CHECK-INST-ALIAS: csrr t2, scounteren
97 csrrs t1
, scounteren
, zero
101 ##################################
102 # Supervisor Trap Handling
103 ##################################
107 # CHECK-INST: csrrs t1, sscratch, zero
108 # CHECK-ENC: encoding: [0x73,0x23,0x00,0x14]
109 # CHECK-INST-ALIAS: csrr t1, sscratch
111 # CHECK-INST: csrrs t2, sscratch, zero
112 # CHECK-ENC: encoding: [0xf3,0x23,0x00,0x14]
113 # CHECK-INST-ALIAS: csrr t2, sscratch
115 csrrs t1
, sscratch
, zero
117 csrrs t2
, 0x140, zero
121 # CHECK-INST: csrrs t1, sepc, zero
122 # CHECK-ENC: encoding: [0x73,0x23,0x10,0x14]
123 # CHECK-INST-ALIAS: csrr t1, sepc
125 # CHECK-INST: csrrs t2, sepc, zero
126 # CHECK-ENC: encoding: [0xf3,0x23,0x10,0x14]
127 # CHECK-INST-ALIAS: csrr t2, sepc
131 csrrs t2
, 0x141, zero
135 # CHECK-INST: csrrs t1, scause, zero
136 # CHECK-ENC: encoding: [0x73,0x23,0x20,0x14]
137 # CHECK-INST-ALIAS: csrr t1, scause
139 # CHECK-INST: csrrs t2, scause, zero
140 # CHECK-ENC: encoding: [0xf3,0x23,0x20,0x14]
141 # CHECK-INST-ALIAS: csrr t2, scause
143 csrrs t1
, scause
, zero
145 csrrs t2
, 0x142, zero
149 # CHECK-INST: csrrs t1, stval, zero
150 # CHECK-ENC: encoding: [0x73,0x23,0x30,0x14]
151 # CHECK-INST-ALIAS: csrr t1, stval
153 # CHECK-INST: csrrs t2, stval, zero
154 # CHECK-ENC: encoding: [0xf3,0x23,0x30,0x14]
155 # CHECK-INST-ALIAS: csrr t2, stval
157 # aliases with uimm12
159 csrrs t1
, stval
, zero
161 csrrs t2
, 0x143, zero
165 # CHECK-INST: csrrs t1, sip, zero
166 # CHECK-ENC: encoding: [0x73,0x23,0x40,0x14]
167 # CHECK-INST-ALIAS: csrr t1, sip
169 # CHECK-INST: csrrs t2, sip, zero
170 # CHECK-ENC: encoding: [0xf3,0x23,0x40,0x14]
171 # CHECK-INST-ALIAS: csrr t2, sip
174 csrrs t2
, 0x144, zero
177 #########################################
178 # Supervisor Protection and Translation
179 #########################################
183 # CHECK-INST: csrrs t1, satp, zero
184 # CHECK-ENC: encoding: [0x73,0x23,0x00,0x18]
185 # CHECK-INST-ALIAS: csrr t1, satp
187 # CHECK-INST: csrrs t2, satp, zero
188 # CHECK-ENC: encoding: [0xf3,0x23,0x00,0x18]
189 # CHECK-INST-ALIAS: csrr t2, satp
193 csrrs t2
, 0x180, zero