[ARM] Better OR's for MVE compares
[llvm-core.git] / test / MC / RISCV / rvi-aliases-valid.s
blob71a50ec95aa4190c53785b63d23a8780d08ad4b3
1 # RUN: llvm-mc %s -triple=riscv32 -riscv-no-aliases \
2 # RUN: | FileCheck -check-prefixes=CHECK-S-NOALIAS,CHECK-S-OBJ-NOALIAS %s
3 # RUN: llvm-mc %s -triple=riscv32 \
4 # RUN: | FileCheck -check-prefixes=CHECK-S,CHECK-S-OBJ %s
5 # RUN: llvm-mc %s -triple=riscv64 -riscv-no-aliases\
6 # RUN: | FileCheck -check-prefixes=CHECK-S-NOALIAS,CHECK-S-OBJ-NOALIAS %s
7 # RUN: llvm-mc %s -triple=riscv64 \
8 # RUN: | FileCheck -check-prefixes=CHECK-S,CHECK-S-OBJ %s
9 # RUN: llvm-mc -filetype=obj -triple riscv32 < %s \
10 # RUN: | llvm-objdump -d -r -riscv-no-aliases - \
11 # RUN: | FileCheck -check-prefixes=CHECK-OBJ-NOALIAS,CHECK-S-OBJ-NOALIAS %s
12 # RUN: llvm-mc -filetype=obj -triple riscv32 < %s \
13 # RUN: | llvm-objdump -d -r - \
14 # RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-S-OBJ %s
15 # RUN: llvm-mc -filetype=obj -triple riscv64 < %s \
16 # RUN: | llvm-objdump -d -r -riscv-no-aliases - \
17 # RUN: | FileCheck -check-prefixes=CHECK-OBJ-NOALIAS,CHECK-S-OBJ-NOALIAS %s
18 # RUN: llvm-mc -filetype=obj -triple riscv64 < %s \
19 # RUN: | llvm-objdump -d -r - \
20 # RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-S-OBJ %s
22 # The following check prefixes are used in this test:
23 # CHECK-S Match the .s output with aliases enabled
24 # CHECK-S-NOALIAS Match the .s output with aliases disabled
25 # CHECK-OBJ Match the objdumped object output with aliases enabled
26 # CHECK-OBJ-NOALIAS Match the objdumped object output with aliases enabled
27 # CHECK-S-OBJ Match both the .s and objdumped object output with
28 # aliases enabled
29 # CHECK-S-OBJ-NOALIAS Match both the .s and objdumped object output with
30 # aliases disabled
32 # TODO la
33 # TODO lb lh lw
34 # TODO sb sh sw
36 # CHECK-S-OBJ-NOALIAS: addi zero, zero, 0
37 # CHECK-S-OBJ: nop
38 nop
40 # CHECK-S-OBJ-NOALIAS: addi t6, zero, 0
41 # CHECK-S-OBJ: mv t6, zero
42 mv x31, zero
43 # CHECK-S-OBJ-NOALIAS: addi a2, a3, 0
44 # CHECK-S-OBJ: mv a2, a3
45 move a2,a3
46 # CHECK-S-OBJ-NOALIAS: xori t6, ra, -1
47 # CHECK-S-OBJ: not t6, ra
48 not x31, x1
49 # CHECK-S-OBJ-NOALIAS: sub t6, zero, ra
50 # CHECK-S-OBJ: neg t6, ra
51 neg x31, x1
52 # CHECK-S-OBJ-NOALIAS: sltiu t6, ra, 1
53 # CHECK-S-OBJ: seqz t6, ra
54 seqz x31, x1
55 # CHECK-S-OBJ-NOALIAS: sltu t6, zero, ra
56 # CHECK-S-OBJ: snez t6, ra
57 snez x31, x1
58 # CHECK-S-OBJ-NOALIAS: slt t6, ra, zero
59 # CHECK-S-OBJ: sltz t6, ra
60 sltz x31, x1
61 # CHECK-S-OBJ-NOALIAS: slt t6, zero, ra
62 # CHECK-S-OBJ: sgtz t6, ra
63 sgtz x31, x1
65 # CHECK-S-OBJ-NOALIAS: slt ra, gp, sp
66 # CHECK-S-OBJ: slt ra, gp, sp
67 sgt x1, x2, x3
68 # CHECK-S-OBJ-NOALIAS: sltu tp, t1, t0
69 # CHECK-S-OBJ: sltu tp, t1, t0
70 sgtu x4, x5, x6
72 # CHECK-S-OBJ-NOALIAS: beq a0, zero, 512
73 # CHECK-S-OBJ: beqz a0, 512
74 beqz x10, 512
75 # CHECK-S-OBJ-NOALIAS: bne a1, zero, 1024
76 # CHECK-S-OBJ: bnez a1, 1024
77 bnez x11, 1024
78 # CHECK-S-OBJ-NOALIAS: bge zero, a2, 4
79 # CHECK-S-OBJ: blez a2, 4
80 blez x12, 4
81 # CHECK-S-OBJ-NOALIAS: bge a3, zero, 8
82 # CHECK-S-OBJ: bgez a3, 8
83 bgez x13, 8
84 # CHECK-S-OBJ-NOALIAS: blt a4, zero, 12
85 # CHECK-S-OBJ: bltz a4, 12
86 bltz x14, 12
87 # CHECK-S-OBJ-NOALIAS: blt zero, a5, 16
88 # CHECK-S-OBJ: bgtz a5, 16
89 bgtz x15, 16
91 # Always output the canonical mnemonic for the pseudo branch instructions.
92 # CHECK-S-OBJ-NOALIAS: blt a6, a5, 20
93 # CHECK-S-OBJ: blt a6, a5, 20
94 bgt x15, x16, 20
95 # CHECK-S-OBJ-NOALIAS: bge a7, a6, 24
96 # CHECK-S-OBJ: bge a7, a6, 24
97 ble x16, x17, 24
98 # CHECK-S-OBJ-NOALIAS: bltu s2, a7, 28
99 # CHECK-S-OBJ: bltu s2, a7, 28
100 bgtu x17, x18, 28
101 # CHECK-S-OBJ-NOALIAS: bgeu s3, s2, 32
102 # CHECK-S-OBJ: bgeu s3, s2, 32
103 bleu x18, x19, 32
105 # CHECK-S-OBJ-NOALIAS: jal zero, 2044
106 # CHECK-S-OBJ: j 2044
107 j 2044
108 # CHECK-S-NOALIAS: jal zero, foo
109 # CHECK-S: j foo
110 # CHECK-OBJ-NOALIAS: jal zero, 0
111 # CHECK-OBJ: j 0
112 # CHECK-OBJ: R_RISCV_JAL foo
113 j foo
114 # CHECK-S-NOALIAS: jal zero, a0
115 # CHECK-S: j a0
116 # CHECK-OBJ-NOALIAS: jal zero, 0
117 # CHECK-OBJ: j 0
118 # CHECK-OBJ: R_RISCV_JAL a0
119 j a0
120 # CHECK-S-NOALIAS: [[LABEL:.L[[:alnum:]_]+]]:
121 # CHECK-S-NOALIAS-NEXT: jal zero, [[LABEL]]
122 # CHECK-S: [[LABEL:.L[[:alnum:]_]+]]:
123 # CHECK-S-NEXT: j [[LABEL]]
124 # CHECK-OBJ-NOALIAS: jal zero, 0
125 # CHECK-OBJ: j 0
127 # CHECK-S-OBJ-NOALIAS: jal ra, 2040
128 # CHECK-S-OBJ: jal 2040
129 jal 2040
130 # CHECK-S-NOALIAS: jal ra, foo
131 # CHECK-S: jal foo
132 # CHECK-OBJ-NOALIAS: jal ra, 0
133 # CHECK-OBJ: jal 0
134 # CHECK-OBJ: R_RISCV_JAL foo
135 jal foo
136 # CHECK-S-NOALIAS: jal ra, a0
137 # CHECK-S: jal a0
138 # CHECK-OBJ-NOALIAS: jal ra, 0
139 # CHECK-OBJ: jal 0
140 # CHECK-OBJ: R_RISCV_JAL a0
141 jal a0
142 # CHECK-S-OBJ-NOALIAS: jalr zero, 0(s4)
143 # CHECK-S-OBJ: jr s4
144 jr x20
145 # CHECK-S-OBJ-NOALIAS: jalr zero, 6(s5)
146 # CHECK-S-OBJ: jr 6(s5)
147 jr 6(x21)
148 # CHECK-S-OBJ-NOALIAS: jalr zero, 7(s6)
149 # CHECK-S-OBJ: jr 7(s6)
150 jr x22, 7
151 # CHECK-S-OBJ-NOALIAS: jalr ra, 0(s4)
152 # CHECK-S-OBJ: jalr s4
153 jalr x20
154 # CHECK-S-OBJ-NOALIAS: jalr ra, 8(s5)
155 # CHECK-S-OBJ: jalr 8(s5)
156 jalr 8(x21)
157 # CHECK-S-OBJ-NOALIAS: jalr s6, 0(s7)
158 # CHECK-S-OBJ: jalr s6, s7
159 jalr x22, x23
160 # CHECK-S-OBJ-NOALIAS: jalr ra, 9(s8)
161 # CHECK-S-OBJ: jalr 9(s8)
162 jalr x24, 9
163 # CHECK-S-OBJ-NOALIAS: jalr s9, 11(s10)
164 # CHECK-S-OBJ: jalr s9, 11(s10)
165 jalr x25, x26, 11
166 # CHECK-S-OBJ-NOALIAS: jalr zero, 0(ra)
167 # CHECK-S-OBJ: ret
169 # TODO call
170 # TODO tail
172 # CHECK-S-OBJ-NOALIAS: fence iorw, iorw
173 # CHECK-S-OBJ: fence
174 fence
176 # CHECK-S-OBJ-NOALIAS: csrrs s10, instret, zero
177 # CHECK-S-OBJ: rdinstret s10
178 rdinstret x26
179 # CHECK-S-OBJ-NOALIAS: csrrs s8, cycle, zero
180 # CHECK-S-OBJ: rdcycle s8
181 rdcycle x24
182 # CHECK-S-OBJ-NOALIAS: csrrs s9, time, zero
183 # CHECK-S-OBJ: rdtime s9
184 rdtime x25
186 # CHECK-S-OBJ-NOALIAS: csrrs s0, 336, zero
187 # CHECK-S-OBJ: csrr s0, 336
188 csrr x8, 0x150
189 # CHECK-S-OBJ-NOALIAS: csrrw zero, sscratch, s1
190 # CHECK-S-OBJ: csrw sscratch, s1
191 csrw 0x140, x9
192 # CHECK-S-OBJ-NOALIAS: csrrs zero, 4095, s6
193 # CHECK-S-OBJ: csrs 4095, s6
194 csrs 0xfff, x22
195 # CHECK-S-OBJ-NOALIAS: csrrc zero, 4095, s7
196 # CHECK-S-OBJ: csrc 4095, s7
197 csrc 0xfff, x23
199 # CHECK-S-OBJ-NOALIAS: csrrwi zero, 336, 15
200 # CHECK-S-OBJ: csrwi 336, 15
201 csrwi 0x150, 0xf
202 # CHECK-S-OBJ-NOALIAS: csrrsi zero, 4095, 16
203 # CHECK-S-OBJ: csrsi 4095, 16
204 csrsi 0xfff, 0x10
205 # CHECK-S-OBJ-NOALIAS: csrrci zero, sscratch, 17
206 # CHECK-S-OBJ: csrci sscratch, 17
207 csrci 0x140, 0x11
209 # CHECK-S-OBJ-NOALIAS: csrrwi zero, 336, 7
210 # CHECK-S-OBJ: csrwi 336, 7
211 csrw 0x150, 7
212 # CHECK-S-OBJ-NOALIAS: csrrsi zero, 336, 7
213 # CHECK-S-OBJ: csrsi 336, 7
214 csrs 0x150, 7
215 # CHECK-S-OBJ-NOALIAS: csrrci zero, 336, 7
216 # CHECK-S-OBJ: csrci 336, 7
217 csrc 0x150, 7
219 # CHECK-S-OBJ-NOALIAS: csrrwi t0, 336, 15
220 # CHECK-S-OBJ: csrrwi t0, 336, 15
221 csrrw t0, 0x150, 0xf
222 # CHECK-S-OBJ-NOALIAS: csrrsi t0, 4095, 16
223 # CHECK-S-OBJ: csrrsi t0, 4095, 16
224 csrrs t0, 0xfff, 0x10
225 # CHECK-S-OBJ-NOALIAS: csrrci t0, sscratch, 17
226 # CHECK-S-OBJ: csrrci t0, sscratch, 17
227 csrrc t0, 0x140, 0x11
229 # CHECK-S-OBJ-NOALIAS: sfence.vma zero, zero
230 # CHECK-S-OBJ: sfence.vma
231 sfence.vma
232 # CHECK-S-OBJ-NOALIAS: sfence.vma a0, zero
233 # CHECK-S-OBJ: sfence.vma a0
234 sfence.vma a0
236 # The following aliases are accepted as input but the canonical form
237 # of the instruction will always be printed.
238 # CHECK-S-OBJ-NOALIAS: addi a2, a3, 4
239 # CHECK-S-OBJ: addi a2, a3, 4
240 add a2, a3, 4
241 # CHECK-S-OBJ-NOALIAS: andi a2, a3, 4
242 # CHECK-S-OBJ: andi a2, a3, 4
243 and a2, a3, 4
244 # CHECK-S-OBJ-NOALIAS: xori a2, a3, 4
245 # CHECK-S-OBJ: xori a2, a3, 4
246 xor a2, a3, 4
247 # CHECK-S-OBJ-NOALIAS: ori a2, a3, 4
248 # CHECK-S-OBJ: ori a2, a3, 4
249 or a2, a3, 4
250 # CHECK-S-OBJ-NOALIAS: slli a2, a3, 4
251 # CHECK-S-OBJ: slli a2, a3, 4
252 sll a2, a3, 4
253 # CHECK-S-OBJ-NOALIAS: srli a2, a3, 4
254 # CHECK-S-OBJ: srli a2, a3, 4
255 srl a2, a3, 4
256 # CHECK-S-OBJ-NOALIAS: srai a2, a3, 4
257 # CHECK-S-OBJ: srai a2, a3, 4
258 sra a2, a3, 4
259 # CHECK-S-OBJ-NOALIAS: slti a2, a3, 4
260 # CHECK-S-OBJ: slti a2, a3, 4
261 slt a2, a3, 4
262 # CHECK-S-OBJ-NOALIAS: sltiu a2, a3, 4
263 # CHECK-S-OBJ: sltiu a2, a3, 4
264 sltu a2, a3, 4
266 # CHECK-S-OBJ-NOALIAS: ebreak
267 # CHECK-S-OBJ: ebreak
268 sbreak
270 # CHECK-S-OBJ-NOALIAS: ecall
271 # CHECK-S-OBJ: ecall
272 scall