1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -mattr=+experimental-b -verify-machineinstrs < %s \
3 ; RUN: | FileCheck %s -check-prefix=RV64B
4 ; RUN: llc -mtriple=riscv64 -mattr=+experimental-zbp -verify-machineinstrs < %s \
5 ; RUN: | FileCheck %s -check-prefix=RV64ZBP
7 declare i32 @llvm.riscv.grev.i32(i32 %a, i32 %b)
9 define signext i32 @grev32(i32 signext %a, i32 signext %b) nounwind {
10 ; RV64B-LABEL: grev32:
12 ; RV64B-NEXT: grevw a0, a0, a1
15 ; RV64ZBP-LABEL: grev32:
17 ; RV64ZBP-NEXT: grevw a0, a0, a1
19 %tmp = call i32 @llvm.riscv.grev.i32(i32 %a, i32 %b)
23 define signext i32 @grev32_demandedbits(i32 signext %a, i32 signext %b, i32 signext %c) nounwind {
24 ; RV64B-LABEL: grev32_demandedbits:
26 ; RV64B-NEXT: add a0, a0, a1
27 ; RV64B-NEXT: grevw a0, a0, a2
30 ; RV64ZBP-LABEL: grev32_demandedbits:
32 ; RV64ZBP-NEXT: add a0, a0, a1
33 ; RV64ZBP-NEXT: grevw a0, a0, a2
37 %tmp = call i32 @llvm.riscv.grev.i32(i32 %d, i32 %e)
41 declare i32 @llvm.riscv.grevi.i32(i32 %a)
43 define signext i32 @grevi32(i32 signext %a) nounwind {
44 ; RV64B-LABEL: grevi32:
46 ; RV64B-NEXT: greviw a0, a0, 13
49 ; RV64ZBP-LABEL: grevi32:
51 ; RV64ZBP-NEXT: greviw a0, a0, 13
53 %tmp = call i32 @llvm.riscv.grev.i32(i32 %a, i32 13)
57 declare i32 @llvm.riscv.gorc.i32(i32 %a, i32 %b)
59 define signext i32 @gorc32(i32 signext %a, i32 signext %b) nounwind {
60 ; RV64B-LABEL: gorc32:
62 ; RV64B-NEXT: gorcw a0, a0, a1
65 ; RV64ZBP-LABEL: gorc32:
67 ; RV64ZBP-NEXT: gorcw a0, a0, a1
69 %tmp = call i32 @llvm.riscv.gorc.i32(i32 %a, i32 %b)
73 define signext i32 @gorc32_demandedbits(i32 signext %a, i32 signext %b, i32 signext %c) nounwind {
74 ; RV64B-LABEL: gorc32_demandedbits:
76 ; RV64B-NEXT: add a0, a0, a1
77 ; RV64B-NEXT: gorcw a0, a0, a2
80 ; RV64ZBP-LABEL: gorc32_demandedbits:
82 ; RV64ZBP-NEXT: add a0, a0, a1
83 ; RV64ZBP-NEXT: gorcw a0, a0, a2
87 %tmp = call i32 @llvm.riscv.gorc.i32(i32 %d, i32 %e)
91 define signext i32 @gorci32(i32 signext %a) nounwind {
92 ; RV64B-LABEL: gorci32:
94 ; RV64B-NEXT: gorciw a0, a0, 13
97 ; RV64ZBP-LABEL: gorci32:
99 ; RV64ZBP-NEXT: gorciw a0, a0, 13
101 %tmp = call i32 @llvm.riscv.gorc.i32(i32 %a, i32 13)
105 declare i32 @llvm.riscv.shfl.i32(i32 %a, i32 %b)
107 define signext i32 @shfl32(i32 signext %a, i32 signext %b) nounwind {
108 ; RV64B-LABEL: shfl32:
110 ; RV64B-NEXT: shflw a0, a0, a1
113 ; RV64ZBP-LABEL: shfl32:
115 ; RV64ZBP-NEXT: shflw a0, a0, a1
117 %tmp = call i32 @llvm.riscv.shfl.i32(i32 %a, i32 %b)
121 define signext i32 @shfl32_demandedbits(i32 signext %a, i32 signext %b, i32 signext %c) nounwind {
122 ; RV64B-LABEL: shfl32_demandedbits:
124 ; RV64B-NEXT: add a0, a0, a1
125 ; RV64B-NEXT: shflw a0, a0, a2
128 ; RV64ZBP-LABEL: shfl32_demandedbits:
130 ; RV64ZBP-NEXT: add a0, a0, a1
131 ; RV64ZBP-NEXT: shflw a0, a0, a2
135 %tmp = call i32 @llvm.riscv.shfl.i32(i32 %d, i32 %e)
139 define signext i32 @shfli32(i32 signext %a) nounwind {
140 ; RV64B-LABEL: shfli32:
142 ; RV64B-NEXT: shfli a0, a0, 13
145 ; RV64ZBP-LABEL: shfli32:
147 ; RV64ZBP-NEXT: shfli a0, a0, 13
149 %tmp = call i32 @llvm.riscv.shfl.i32(i32 %a, i32 13)
153 declare i32 @llvm.riscv.unshfl.i32(i32 %a, i32 %b)
155 define signext i32 @unshfl32(i32 signext %a, i32 signext %b) nounwind {
156 ; RV64B-LABEL: unshfl32:
158 ; RV64B-NEXT: unshflw a0, a0, a1
161 ; RV64ZBP-LABEL: unshfl32:
163 ; RV64ZBP-NEXT: unshflw a0, a0, a1
165 %tmp = call i32 @llvm.riscv.unshfl.i32(i32 %a, i32 %b)
169 define signext i32 @unshfl32_demandedbits(i32 signext %a, i32 signext %b, i32 signext %c) nounwind {
170 ; RV64B-LABEL: unshfl32_demandedbits:
172 ; RV64B-NEXT: add a0, a0, a1
173 ; RV64B-NEXT: unshflw a0, a0, a2
176 ; RV64ZBP-LABEL: unshfl32_demandedbits:
178 ; RV64ZBP-NEXT: add a0, a0, a1
179 ; RV64ZBP-NEXT: unshflw a0, a0, a2
183 %tmp = call i32 @llvm.riscv.unshfl.i32(i32 %d, i32 %e)
187 define signext i32 @unshfli32(i32 signext %a) nounwind {
188 ; RV64B-LABEL: unshfli32:
190 ; RV64B-NEXT: unshfli a0, a0, 13
193 ; RV64ZBP-LABEL: unshfli32:
195 ; RV64ZBP-NEXT: unshfli a0, a0, 13
197 %tmp = call i32 @llvm.riscv.unshfl.i32(i32 %a, i32 13)
201 declare i64 @llvm.riscv.grev.i64(i64 %a, i64 %b)
203 define i64 @grev64(i64 %a, i64 %b) nounwind {
204 ; RV64B-LABEL: grev64:
206 ; RV64B-NEXT: grev a0, a0, a1
209 ; RV64ZBP-LABEL: grev64:
211 ; RV64ZBP-NEXT: grev a0, a0, a1
213 %tmp = call i64 @llvm.riscv.grev.i64(i64 %a, i64 %b)
217 define i64 @grev64_demandedbits(i64 %a, i64 %b) nounwind {
218 ; RV64B-LABEL: grev64_demandedbits:
220 ; RV64B-NEXT: grev a0, a0, a1
223 ; RV64ZBP-LABEL: grev64_demandedbits:
225 ; RV64ZBP-NEXT: grev a0, a0, a1
228 %tmp = call i64 @llvm.riscv.grev.i64(i64 %a, i64 %c)
232 define i64 @grevi64(i64 %a) nounwind {
233 ; RV64B-LABEL: grevi64:
235 ; RV64B-NEXT: grevi a0, a0, 13
238 ; RV64ZBP-LABEL: grevi64:
240 ; RV64ZBP-NEXT: grevi a0, a0, 13
242 %tmp = call i64 @llvm.riscv.grev.i64(i64 %a, i64 13)
246 declare i64 @llvm.riscv.gorc.i64(i64 %a, i64 %b)
248 define i64 @gorc64(i64 %a, i64 %b) nounwind {
249 ; RV64B-LABEL: gorc64:
251 ; RV64B-NEXT: gorc a0, a0, a1
254 ; RV64ZBP-LABEL: gorc64:
256 ; RV64ZBP-NEXT: gorc a0, a0, a1
258 %tmp = call i64 @llvm.riscv.gorc.i64(i64 %a, i64 %b)
262 define i64 @gorc64_demandedbits(i64 %a, i64 %b) nounwind {
263 ; RV64B-LABEL: gorc64_demandedbits:
265 ; RV64B-NEXT: gorc a0, a0, a1
268 ; RV64ZBP-LABEL: gorc64_demandedbits:
270 ; RV64ZBP-NEXT: gorc a0, a0, a1
273 %tmp = call i64 @llvm.riscv.gorc.i64(i64 %a, i64 %c)
277 declare i64 @llvm.riscv.gorci.i64(i64 %a)
279 define i64 @gorci64(i64 %a) nounwind {
280 ; RV64B-LABEL: gorci64:
282 ; RV64B-NEXT: gorci a0, a0, 13
285 ; RV64ZBP-LABEL: gorci64:
287 ; RV64ZBP-NEXT: gorci a0, a0, 13
289 %tmp = call i64 @llvm.riscv.gorc.i64(i64 %a, i64 13)
293 declare i64 @llvm.riscv.shfl.i64(i64 %a, i64 %b)
295 define i64 @shfl64(i64 %a, i64 %b) nounwind {
296 ; RV64B-LABEL: shfl64:
298 ; RV64B-NEXT: shfl a0, a0, a1
301 ; RV64ZBP-LABEL: shfl64:
303 ; RV64ZBP-NEXT: shfl a0, a0, a1
305 %tmp = call i64 @llvm.riscv.shfl.i64(i64 %a, i64 %b)
309 define i64 @shfl64_demandedbits(i64 %a, i64 %b) nounwind {
310 ; RV64B-LABEL: shfl64_demandedbits:
312 ; RV64B-NEXT: shfl a0, a0, a1
315 ; RV64ZBP-LABEL: shfl64_demandedbits:
317 ; RV64ZBP-NEXT: shfl a0, a0, a1
320 %tmp = call i64 @llvm.riscv.shfl.i64(i64 %a, i64 %c)
324 define i64 @shfli64(i64 %a) nounwind {
325 ; RV64B-LABEL: shfli64:
327 ; RV64B-NEXT: shfli a0, a0, 13
330 ; RV64ZBP-LABEL: shfli64:
332 ; RV64ZBP-NEXT: shfli a0, a0, 13
334 %tmp = call i64 @llvm.riscv.shfl.i64(i64 %a, i64 13)
338 declare i64 @llvm.riscv.unshfl.i64(i64 %a, i64 %b)
340 define i64 @unshfl64(i64 %a, i64 %b) nounwind {
341 ; RV64B-LABEL: unshfl64:
343 ; RV64B-NEXT: unshfl a0, a0, a1
346 ; RV64ZBP-LABEL: unshfl64:
348 ; RV64ZBP-NEXT: unshfl a0, a0, a1
350 %tmp = call i64 @llvm.riscv.unshfl.i64(i64 %a, i64 %b)
354 define i64 @unshfl64_demandedbits(i64 %a, i64 %b) nounwind {
355 ; RV64B-LABEL: unshfl64_demandedbits:
357 ; RV64B-NEXT: unshfl a0, a0, a1
360 ; RV64ZBP-LABEL: unshfl64_demandedbits:
362 ; RV64ZBP-NEXT: unshfl a0, a0, a1
365 %tmp = call i64 @llvm.riscv.unshfl.i64(i64 %a, i64 %c)
369 define i64 @unshfli64(i64 %a) nounwind {
370 ; RV64B-LABEL: unshfli64:
372 ; RV64B-NEXT: unshfli a0, a0, 13
375 ; RV64ZBP-LABEL: unshfli64:
377 ; RV64ZBP-NEXT: unshfli a0, a0, 13
379 %tmp = call i64 @llvm.riscv.unshfl.i64(i64 %a, i64 13)
383 declare i64 @llvm.riscv.xperm.n.i64(i64 %a, i64 %b)
385 define i64 @xpermn64(i64 %a, i64 %b) nounwind {
386 ; RV64B-LABEL: xpermn64:
388 ; RV64B-NEXT: xperm.n a0, a0, a1
391 ; RV64ZBP-LABEL: xpermn64:
393 ; RV64ZBP-NEXT: xperm.n a0, a0, a1
395 %tmp = call i64 @llvm.riscv.xperm.n.i64(i64 %a, i64 %b)
399 declare i64 @llvm.riscv.xperm.b.i64(i64 %a, i64 %b)
401 define i64 @xpermb64(i64 %a, i64 %b) nounwind {
402 ; RV64B-LABEL: xpermb64:
404 ; RV64B-NEXT: xperm.b a0, a0, a1
407 ; RV64ZBP-LABEL: xpermb64:
409 ; RV64ZBP-NEXT: xperm.b a0, a0, a1
411 %tmp = call i64 @llvm.riscv.xperm.b.i64(i64 %a, i64 %b)
415 declare i64 @llvm.riscv.xperm.h.i64(i64 %a, i64 %b)
417 define i64 @xpermh64(i64 %a, i64 %b) nounwind {
418 ; RV64B-LABEL: xpermh64:
420 ; RV64B-NEXT: xperm.h a0, a0, a1
423 ; RV64ZBP-LABEL: xpermh64:
425 ; RV64ZBP-NEXT: xperm.h a0, a0, a1
427 %tmp = call i64 @llvm.riscv.xperm.h.i64(i64 %a, i64 %b)
431 declare i64 @llvm.riscv.xperm.w.i64(i64 %a, i64 %b)
433 define i64 @xpermw64(i64 %a, i64 %b) nounwind {
434 ; RV64B-LABEL: xpermw64:
436 ; RV64B-NEXT: xperm.w a0, a0, a1
439 ; RV64ZBP-LABEL: xpermw64:
441 ; RV64ZBP-NEXT: xperm.w a0, a0, a1
443 %tmp = call i64 @llvm.riscv.xperm.w.i64(i64 %a, i64 %b)