1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -O0 -mtriple=riscv32 -mattr=+m -mattr=+xcvalu -verify-machineinstrs < %s \
5 declare i32 @llvm.abs.i32(i32, i1)
6 declare i32 @llvm.smin.i32(i32, i32)
7 declare i32 @llvm.smax.i32(i32, i32)
8 declare i32 @llvm.umin.i32(i32, i32)
9 declare i32 @llvm.umax.i32(i32, i32)
11 define i32 @abs(i32 %a) {
14 ; CHECK-NEXT: cv.abs a0, a0
16 %1 = call i32 @llvm.abs.i32(i32 %a, i1 false)
20 define i1 @slet(i32 %a, i32 %b) {
23 ; CHECK-NEXT: cv.slet a0, a0, a1
25 %1 = icmp sle i32 %a, %b
29 define i1 @sletu(i32 %a, i32 %b) {
32 ; CHECK-NEXT: cv.sletu a0, a0, a1
34 %1 = icmp ule i32 %a, %b
38 define i32 @smin(i32 %a, i32 %b) {
41 ; CHECK-NEXT: cv.min a0, a0, a1
43 %1 = call i32 @llvm.smin.i32(i32 %a, i32 %b)
47 define i32 @umin(i32 %a, i32 %b) {
50 ; CHECK-NEXT: cv.minu a0, a0, a1
52 %1 = call i32 @llvm.umin.i32(i32 %a, i32 %b)
56 define i32 @smax(i32 %a, i32 %b) {
59 ; CHECK-NEXT: cv.max a0, a0, a1
61 %1 = call i32 @llvm.smax.i32(i32 %a, i32 %b)
65 define i32 @umax(i32 %a, i32 %b) {
68 ; CHECK-NEXT: cv.maxu a0, a0, a1
70 %1 = call i32 @llvm.umax.i32(i32 %a, i32 %b)
74 define i32 @exths(i16 %a) {
77 ; CHECK-NEXT: # kill: def $x11 killed $x10
78 ; CHECK-NEXT: cv.exths a0, a0
80 %1 = sext i16 %a to i32
84 define i32 @exthz(i16 %a) {
87 ; CHECK-NEXT: # kill: def $x11 killed $x10
88 ; CHECK-NEXT: cv.exthz a0, a0
90 %1 = zext i16 %a to i32
94 declare i32 @llvm.riscv.cv.alu.clip(i32, i32)
96 define i32 @test.cv.alu.clip.case.a(i32 %a) {
97 ; CHECK-LABEL: test.cv.alu.clip.case.a:
99 ; CHECK-NEXT: cv.clip a0, a0, 5
101 %1 = call i32 @llvm.riscv.cv.alu.clip(i32 %a, i32 15)
105 define i32 @test.cv.alu.clip.case.b(i32 %a) {
106 ; CHECK-LABEL: test.cv.alu.clip.case.b:
108 ; CHECK-NEXT: li a1, 10
109 ; CHECK-NEXT: cv.clipr a0, a0, a1
111 %1 = call i32 @llvm.riscv.cv.alu.clip(i32 %a, i32 10)
115 declare i32 @llvm.riscv.cv.alu.clipu(i32, i32)
117 define i32 @test.cv.alu.clipu.case.a(i32 %a) {
118 ; CHECK-LABEL: test.cv.alu.clipu.case.a:
120 ; CHECK-NEXT: cv.clipu a0, a0, 9
122 %1 = call i32 @llvm.riscv.cv.alu.clipu(i32 %a, i32 255)
126 define i32 @test.cv.alu.clipu.case.b(i32 %a) {
127 ; CHECK-LABEL: test.cv.alu.clipu.case.b:
129 ; CHECK-NEXT: li a1, 200
130 ; CHECK-NEXT: cv.clipur a0, a0, a1
132 %1 = call i32 @llvm.riscv.cv.alu.clipu(i32 %a, i32 200)
136 declare i32 @llvm.riscv.cv.alu.addn(i32, i32, i32)
138 define i32 @test.cv.alu.addn.case.a(i32 %a, i32 %b) {
139 ; CHECK-LABEL: test.cv.alu.addn.case.a:
141 ; CHECK-NEXT: cv.addn a0, a0, a1, 15
143 %1 = call i32 @llvm.riscv.cv.alu.addn(i32 %a, i32 %b, i32 15)
147 define i32 @test.cv.alu.addn.case.b(i32 %a, i32 %b) {
148 ; CHECK-LABEL: test.cv.alu.addn.case.b:
150 ; CHECK-NEXT: li a2, 32
151 ; CHECK-NEXT: cv.addnr a0, a1, a2
153 %1 = call i32 @llvm.riscv.cv.alu.addn(i32 %a, i32 %b, i32 32)
157 declare i32 @llvm.riscv.cv.alu.addun(i32, i32, i32)
159 define i32 @test.cv.alu.addun.case.a(i32 %a, i32 %b) {
160 ; CHECK-LABEL: test.cv.alu.addun.case.a:
162 ; CHECK-NEXT: cv.addun a0, a0, a1, 15
164 %1 = call i32 @llvm.riscv.cv.alu.addun(i32 %a, i32 %b, i32 15)
168 define i32 @test.cv.alu.addun.case.b(i32 %a, i32 %b) {
169 ; CHECK-LABEL: test.cv.alu.addun.case.b:
171 ; CHECK-NEXT: li a2, 32
172 ; CHECK-NEXT: cv.addunr a0, a1, a2
174 %1 = call i32 @llvm.riscv.cv.alu.addun(i32 %a, i32 %b, i32 32)
178 declare i32 @llvm.riscv.cv.alu.addrn(i32, i32, i32)
180 define i32 @test.cv.alu.addrn.case.a(i32 %a, i32 %b) {
181 ; CHECK-LABEL: test.cv.alu.addrn.case.a:
183 ; CHECK-NEXT: cv.addrn a0, a0, a1, 15
185 %1 = call i32 @llvm.riscv.cv.alu.addrn(i32 %a, i32 %b, i32 15)
189 define i32 @test.cv.alu.addrn.case.b(i32 %a, i32 %b) {
190 ; CHECK-LABEL: test.cv.alu.addrn.case.b:
192 ; CHECK-NEXT: li a2, 32
193 ; CHECK-NEXT: cv.addrnr a0, a1, a2
195 %1 = call i32 @llvm.riscv.cv.alu.addrn(i32 %a, i32 %b, i32 32)
199 declare i32 @llvm.riscv.cv.alu.addurn(i32, i32, i32)
201 define i32 @test.cv.alu.addurn.case.a(i32 %a, i32 %b) {
202 ; CHECK-LABEL: test.cv.alu.addurn.case.a:
204 ; CHECK-NEXT: cv.addurn a0, a0, a1, 15
206 %1 = call i32 @llvm.riscv.cv.alu.addurn(i32 %a, i32 %b, i32 15)
210 define i32 @test.cv.alu.addurn.case.b(i32 %a, i32 %b) {
211 ; CHECK-LABEL: test.cv.alu.addurn.case.b:
213 ; CHECK-NEXT: li a2, 32
214 ; CHECK-NEXT: cv.addurnr a0, a1, a2
216 %1 = call i32 @llvm.riscv.cv.alu.addurn(i32 %a, i32 %b, i32 32)
220 declare i32 @llvm.riscv.cv.alu.subn(i32, i32, i32)
222 define i32 @test.cv.alu.subn.case.a(i32 %a, i32 %b) {
223 ; CHECK-LABEL: test.cv.alu.subn.case.a:
225 ; CHECK-NEXT: cv.subn a0, a0, a1, 15
227 %1 = call i32 @llvm.riscv.cv.alu.subn(i32 %a, i32 %b, i32 15)
231 define i32 @test.cv.alu.subn.case.b(i32 %a, i32 %b) {
232 ; CHECK-LABEL: test.cv.alu.subn.case.b:
234 ; CHECK-NEXT: li a2, 32
235 ; CHECK-NEXT: cv.subnr a0, a1, a2
237 %1 = call i32 @llvm.riscv.cv.alu.subn(i32 %a, i32 %b, i32 32)
241 declare i32 @llvm.riscv.cv.alu.subun(i32, i32, i32)
243 define i32 @test.cv.alu.subun.case.a(i32 %a, i32 %b) {
244 ; CHECK-LABEL: test.cv.alu.subun.case.a:
246 ; CHECK-NEXT: cv.subun a0, a0, a1, 15
248 %1 = call i32 @llvm.riscv.cv.alu.subun(i32 %a, i32 %b, i32 15)
252 define i32 @test.cv.alu.subun.case.b(i32 %a, i32 %b) {
253 ; CHECK-LABEL: test.cv.alu.subun.case.b:
255 ; CHECK-NEXT: li a2, 32
256 ; CHECK-NEXT: cv.subunr a0, a1, a2
258 %1 = call i32 @llvm.riscv.cv.alu.subun(i32 %a, i32 %b, i32 32)
262 declare i32 @llvm.riscv.cv.alu.subrn(i32, i32, i32)
264 define i32 @test.cv.alu.subrn.case.a(i32 %a, i32 %b) {
265 ; CHECK-LABEL: test.cv.alu.subrn.case.a:
267 ; CHECK-NEXT: cv.subrn a0, a0, a1, 15
269 %1 = call i32 @llvm.riscv.cv.alu.subrn(i32 %a, i32 %b, i32 15)
273 define i32 @test.cv.alu.subrn.case.b(i32 %a, i32 %b) {
274 ; CHECK-LABEL: test.cv.alu.subrn.case.b:
276 ; CHECK-NEXT: li a2, 32
277 ; CHECK-NEXT: cv.subrnr a0, a1, a2
279 %1 = call i32 @llvm.riscv.cv.alu.subrn(i32 %a, i32 %b, i32 32)
283 declare i32 @llvm.riscv.cv.alu.suburn(i32, i32, i32)
285 define i32 @test.cv.alu.suburn.case.a(i32 %a, i32 %b) {
286 ; CHECK-LABEL: test.cv.alu.suburn.case.a:
288 ; CHECK-NEXT: cv.suburn a0, a0, a1, 15
290 %1 = call i32 @llvm.riscv.cv.alu.suburn(i32 %a, i32 %b, i32 15)
294 define i32 @test.cv.alu.suburn.case.b(i32 %a, i32 %b) {
295 ; CHECK-LABEL: test.cv.alu.suburn.case.b:
297 ; CHECK-NEXT: li a2, 32
298 ; CHECK-NEXT: cv.suburnr a0, a1, a2
300 %1 = call i32 @llvm.riscv.cv.alu.suburn(i32 %a, i32 %b, i32 32)