[InstCombine] Signed saturation patterns
[llvm-core.git] / test / MC / RISCV / compress-rv32i.s
blob909e49254209d26986f62815efae414be7a2c69a
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
23 # CHECK-BYTES: 2e 85
24 # CHECK-ALIAS: add a0, zero, a1
25 # CHECK-INST: c.mv a0, a1
26 # CHECK: # encoding: [0x2e,0x85]
27 addi a0, a1, 0
29 # CHECK-BYTES: e0 1f
30 # CHECK-ALIAS: addi s0, sp, 1020
31 # CHECK-INST: c.addi4spn s0, sp, 1020
32 # CHECK: # encoding: [0xe0,0x1f]
33 addi s0, sp, 1020
35 # CHECK-BYTES: e0 5f
36 # CHECK-ALIAS: lw s0, 124(a5)
37 # CHECK-INST: c.lw s0, 124(a5)
38 # CHECK: # encoding: [0xe0,0x5f]
39 lw s0, 124(a5)
41 # CHECK-BYTES: e0 df
42 # CHECK-ALIAS: sw s0, 124(a5)
43 # CHECK-INST: c.sw s0, 124(a5)
44 # CHECK: # encoding: [0xe0,0xdf]
45 sw s0, 124(a5)
47 # CHECK-BYTES: 01 00
48 # CHECK-ALIAS: nop
49 # CHECK-INST: c.nop
50 # CHECK: # encoding: [0x01,0x00]
51 nop
53 # CHECK-BYTES: 81 10
54 # CHECK-ALIAS: addi ra, ra, -32
55 # CHECK-INST: c.addi ra, -32
56 # CHECK: # encoding: [0x81,0x10]
57 addi ra, ra, -32
59 # CHECK-BYTES: 85 50
60 # CHECK-ALIAS: addi ra, zero, -31
61 # CHECK-INST: c.li ra, -31
62 # CHECK: # encoding: [0x85,0x50]
63 addi ra, zero, -31
65 # CHECK-BYTES: 39 71
66 # CHECK-ALIAS: addi sp, sp, -64
67 # CHECK-INST: c.addi16sp sp, -64
68 # CHECK: # encoding: [0x39,0x71]
69 addi sp, sp, -64
71 # CHECK-BYTES: fd 61
72 # CHECK-ALIAS: lui gp, 31
73 # CHECK-INST: c.lui gp, 31
74 # CHECK: # encoding: [0xfd,0x61]
75 lui gp, 31
77 # CHECK-BYTES: 7d 80
78 # CHECK-ALIAS: srli s0, s0, 31
79 # CHECK-INST: c.srli s0, 31
80 # CHECK: # encoding: [0x7d,0x80]
81 srli s0, s0, 31
83 # CHECK-BYTES: 7d 84
84 # CHECK-ALIAS: srai s0, s0, 31
85 # CHECK-INST: c.srai s0, 31
86 # CHECK: # encoding: [0x7d,0x84]
87 srai s0, s0, 31
89 # CHECK-BYTES: 7d 88
90 # CHECK-ALIAS: andi s0, s0, 31
91 # CHECK-INST: c.andi s0, 31
92 # CHECK: # encoding: [0x7d,0x88]
93 andi s0, s0, 31
95 # CHECK-BYTES: 1d 8c
96 # CHECK-ALIAS: sub s0, s0, a5
97 # CHECK-INST: c.sub s0, a5
98 # CHECK: # encoding: [0x1d,0x8c]
99 sub s0, s0, a5
101 # CHECK-BYTES: 3d 8c
102 # CHECK-ALIAS: xor s0, s0, a5
103 # CHECK-INST: c.xor s0, a5
104 # CHECK: # encoding: [0x3d,0x8c]
105 xor s0, s0, a5
107 # CHECK-BYTES: 3d 8c
108 # CHECK-ALIAS: xor s0, s0, a5
109 # CHECK-INST: c.xor s0, a5
110 # CHECK: # encoding: [0x3d,0x8c]
111 xor s0, a5, s0
113 # CHECK-BYTES: 5d 8c
114 # CHECK-ALIAS: or s0, s0, a5
115 # CHECK-INST: c.or s0, a5
116 # CHECK: # encoding: [0x5d,0x8c]
117 or s0, s0, a5
119 # CHECK-BYTES: 45 8c
120 # CHECK-ALIAS: or s0, s0, s1
121 # CHECK-INST: c.or s0, s1
122 # CHECK: # encoding: [0x45,0x8c]
123 or s0, s1, s0
125 # CHECK-BYTES: 7d 8c
126 # CHECK-ALIAS: and s0, s0, a5
127 # CHECK-INST: c.and s0, a5
128 # CHECK: # encoding: [0x7d,0x8c]
129 and s0, s0, a5
131 # CHECK-BYTES: 7d 8c
132 # CHECK-ALIAS: and s0, s0, a5
133 # CHECK-INST: c.and s0, a5
134 # CHECK: # encoding: [0x7d,0x8c]
135 and s0, a5, s0
137 # CHECK-BYTES: 01 b0
138 # CHECK-ALIAS: j -2048
139 # CHECK-INST: c.j -2048
140 # CHECK: # encoding: [0x01,0xb0]
141 jal zero, -2048
143 # CHECK-BYTES: 01 d0
144 # CHECK-ALIAS: beqz s0, -256
145 # CHECK-INST: c.beqz s0, -256
146 # CHECK: # encoding: [0x01,0xd0]
147 beq s0, zero, -256
149 # CHECK-BYTES: 7d ec
150 # CHECk-ALIAS: bnez s0, 254
151 # CHECK-INST: c.bnez s0, 254
152 # CHECK: # encoding: [0x7d,0xec]
153 bne s0, zero, 254
155 # CHECK-BYTES: 7e 04
156 # CHECK-ALIAS: slli s0, s0, 31
157 # CHECK-INST: c.slli s0, 31
158 # CHECK: # encoding: [0x7e,0x04]
159 slli s0, s0, 31
161 # CHECK-BYTES: fe 50
162 # CHECK-ALIAS: lw ra, 252(sp)
163 # CHECK-INST: c.lwsp ra, 252(sp)
164 # CHECK: # encoding: [0xfe,0x50]
165 lw ra, 252(sp)
167 # CHECK-BYTES: 82 80
168 # CHECK-ALIAS: ret
169 # CHECK-INST: c.jr ra
170 # CHECK: # encoding: [0x82,0x80]
171 jalr zero, 0(ra)
173 # CHECK-BYTES: 92 80
174 # CHECK-ALIAS: add ra, zero, tp
175 # CHECK-INST: c.mv ra, tp
176 # CHECK: # encoding: [0x92,0x80]
177 add ra, zero, tp
179 # CHECK-BYTES: 92 80
180 # CHECK-ALIAS: add ra, zero, tp
181 # CHECK-INST: c.mv ra, tp
182 # CHECK: # encoding: [0x92,0x80]
183 add ra, tp, zero
185 # CHECK-BYTES: 02 90
186 # CHECK-ALIAS: ebreak
187 # CHECK-INST: c.ebreak
188 # CHECK: # encoding: [0x02,0x90]
189 ebreak
191 # CHECK-BYTES: 02 94
192 # CHECK-ALIAS: jalr s0
193 # CHECK-INST: c.jalr s0
194 # CHECK: # encoding: [0x02,0x94]
195 jalr ra, 0(s0)
197 # CHECK-BYTES: 3e 94
198 # CHECK-ALIAS: add s0, s0, a5
199 # CHECK-INST: c.add s0, a5
200 # CHECK: # encoding: [0x3e,0x94]
201 add s0, a5, s0
203 # CHECK-BYTES: 3e 94
204 # CHECK-ALIAS: add s0, s0, a5
205 # CHECK-INST: c.add s0, a5
206 # CHECK: # encoding: [0x3e,0x94]
207 add s0, s0, a5
209 # CHECK-BYTES: 82 df
210 # CHECK-ALIAS: sw zero, 252(sp)
211 # CHECK-INST: c.swsp zero, 252(sp)
212 # CHECK: # encoding: [0x82,0xdf]
213 sw zero, 252(sp)
215 # CHECK-BYTES: 00 00
216 # CHECK-ALIAS: unimp
217 # CHECK-INST: c.unimp
218 # CHECK: # encoding: [0x00,0x00]
219 unimp