1 # RUN: llvm-mc -triple riscv32 -mattr=+c -show-encoding < %s \
2 # RUN: | FileCheck -check-prefixes=CHECK,CHECK-ALIAS %s
3 # RUN: llvm-mc -triple riscv32 -mattr=+c -show-encoding \
4 # RUN: -riscv-no-aliases <%s | FileCheck -check-prefixes=CHECK,CHECK-INST %s
5 # RUN: llvm-mc -triple riscv32 -mattr=+c -filetype=obj < %s \
6 # RUN: | llvm-objdump -triple riscv32 -mattr=+c -d - \
7 # RUN: | FileCheck -check-prefixes=CHECK-BYTES,CHECK-ALIAS %s
8 # RUN: llvm-mc -triple riscv32 -mattr=+c -filetype=obj < %s \
9 # RUN: | llvm-objdump -triple riscv32 -mattr=+c -d -M no-aliases - \
10 # RUN: | FileCheck -check-prefixes=CHECK-BYTES,CHECK-INST %s
12 # RUN: llvm-mc -triple riscv64 -mattr=+c -show-encoding < %s \
13 # RUN: | FileCheck -check-prefixes=CHECK-ALIAS %s
14 # RUN: llvm-mc -triple riscv64 -mattr=+c -show-encoding \
15 # RUN: -riscv-no-aliases <%s | FileCheck -check-prefixes=CHECK-INST %s
16 # RUN: llvm-mc -triple riscv64 -mattr=+c -filetype=obj < %s \
17 # RUN: | llvm-objdump -triple riscv64 -mattr=+c -d - \
18 # RUN: | FileCheck -check-prefixes=CHECK-BYTES,CHECK-ALIAS %s
19 # RUN: llvm-mc -triple riscv64 -mattr=+c -filetype=obj < %s \
20 # RUN: | llvm-objdump -triple riscv64 -mattr=+c -d -M no-aliases - \
21 # RUN: | FileCheck -check-prefixes=CHECK-BYTES,CHECK-INST %s
24 # CHECK-ALIAS: add a0, zero, a1
25 # CHECK-INST: c.mv a0, a1
26 # CHECK: # encoding: [0x2e,0x85]
30 # CHECK-ALIAS: addi s0, sp, 1020
31 # CHECK-INST: c.addi4spn s0, sp, 1020
32 # CHECK: # encoding: [0xe0,0x1f]
36 # CHECK-ALIAS: lw s0, 124(a5)
37 # CHECK-INST: c.lw s0, 124(a5)
38 # CHECK: # encoding: [0xe0,0x5f]
42 # CHECK-ALIAS: sw s0, 124(a5)
43 # CHECK-INST: c.sw s0, 124(a5)
44 # CHECK: # encoding: [0xe0,0xdf]
50 # CHECK: # encoding: [0x01,0x00]
54 # CHECK-ALIAS: addi ra, ra, -32
55 # CHECK-INST: c.addi ra, -32
56 # CHECK: # encoding: [0x81,0x10]
60 # CHECK-ALIAS: addi ra, zero, -31
61 # CHECK-INST: c.li ra, -31
62 # CHECK: # encoding: [0x85,0x50]
66 # CHECK-ALIAS: addi sp, sp, -64
67 # CHECK-INST: c.addi16sp sp, -64
68 # CHECK: # encoding: [0x39,0x71]
72 # CHECK-ALIAS: lui gp, 31
73 # CHECK-INST: c.lui gp, 31
74 # CHECK: # encoding: [0xfd,0x61]
78 # CHECK-ALIAS: srli s0, s0, 31
79 # CHECK-INST: c.srli s0, 31
80 # CHECK: # encoding: [0x7d,0x80]
84 # CHECK-ALIAS: srai s0, s0, 31
85 # CHECK-INST: c.srai s0, 31
86 # CHECK: # encoding: [0x7d,0x84]
90 # CHECK-ALIAS: andi s0, s0, 31
91 # CHECK-INST: c.andi s0, 31
92 # CHECK: # encoding: [0x7d,0x88]
96 # CHECK-ALIAS: sub s0, s0, a5
97 # CHECK-INST: c.sub s0, a5
98 # CHECK: # encoding: [0x1d,0x8c]
102 # CHECK-ALIAS: xor s0, s0, a5
103 # CHECK-INST: c.xor s0, a5
104 # CHECK: # encoding: [0x3d,0x8c]
108 # CHECK-ALIAS: xor s0, s0, a5
109 # CHECK-INST: c.xor s0, a5
110 # CHECK: # encoding: [0x3d,0x8c]
114 # CHECK-ALIAS: or s0, s0, a5
115 # CHECK-INST: c.or s0, a5
116 # CHECK: # encoding: [0x5d,0x8c]
120 # CHECK-ALIAS: or s0, s0, s1
121 # CHECK-INST: c.or s0, s1
122 # CHECK: # encoding: [0x45,0x8c]
126 # CHECK-ALIAS: and s0, s0, a5
127 # CHECK-INST: c.and s0, a5
128 # CHECK: # encoding: [0x7d,0x8c]
132 # CHECK-ALIAS: and s0, s0, a5
133 # CHECK-INST: c.and s0, a5
134 # CHECK: # encoding: [0x7d,0x8c]
138 # CHECK-ALIAS: j -2048
139 # CHECK-INST: c.j -2048
140 # CHECK: # encoding: [0x01,0xb0]
144 # CHECK-ALIAS: beqz s0, -256
145 # CHECK-INST: c.beqz s0, -256
146 # CHECK: # encoding: [0x01,0xd0]
150 # CHECk-ALIAS: bnez s0, 254
151 # CHECK-INST: c.bnez s0, 254
152 # CHECK: # encoding: [0x7d,0xec]
156 # CHECK-ALIAS: slli s0, s0, 31
157 # CHECK-INST: c.slli s0, 31
158 # CHECK: # encoding: [0x7e,0x04]
162 # CHECK-ALIAS: lw ra, 252(sp)
163 # CHECK-INST: c.lwsp ra, 252(sp)
164 # CHECK: # encoding: [0xfe,0x50]
169 # CHECK-INST: c.jr ra
170 # CHECK: # encoding: [0x82,0x80]
174 # CHECK-ALIAS: add ra, zero, tp
175 # CHECK-INST: c.mv ra, tp
176 # CHECK: # encoding: [0x92,0x80]
180 # CHECK-ALIAS: add ra, zero, tp
181 # CHECK-INST: c.mv ra, tp
182 # CHECK: # encoding: [0x92,0x80]
186 # CHECK-ALIAS: ebreak
187 # CHECK-INST: c.ebreak
188 # CHECK: # encoding: [0x02,0x90]
192 # CHECK-ALIAS: jalr s0
193 # CHECK-INST: c.jalr s0
194 # CHECK: # encoding: [0x02,0x94]
198 # CHECK-ALIAS: add s0, s0, a5
199 # CHECK-INST: c.add s0, a5
200 # CHECK: # encoding: [0x3e,0x94]
204 # CHECK-ALIAS: add s0, s0, a5
205 # CHECK-INST: c.add s0, a5
206 # CHECK: # encoding: [0x3e,0x94]
210 # CHECK-ALIAS: sw zero, 252(sp)
211 # CHECK-INST: c.swsp zero, 252(sp)
212 # CHECK: # encoding: [0x82,0xdf]
217 # CHECK-INST: c.unimp
218 # CHECK: # encoding: [0x00,0x00]