[llvm] [RISCV] Merge shuffle sources if lanes are disjoint (PR #119401)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 10 20:40:47 PST 2024
================
@@ -11,21 +11,18 @@ define void @deinterleave3_0_i8(ptr %in, ptr %out) {
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
; CHECK-NEXT: vle8.v v8, (a0)
+; CHECK-NEXT: lui a0, %hi(.LCPI0_0)
+; CHECK-NEXT: addi a0, a0, %lo(.LCPI0_0)
; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
-; CHECK-NEXT: vmv.v.i v9, -8
-; CHECK-NEXT: vid.v v10
-; CHECK-NEXT: li a0, 3
-; CHECK-NEXT: vmadd.vx v10, a0, v9
+; CHECK-NEXT: vle8.v v9, (a0)
; CHECK-NEXT: li a0, 73
-; CHECK-NEXT: vmv.s.x v9, a0
-; CHECK-NEXT: li a0, 56
; CHECK-NEXT: vmv.s.x v0, a0
-; CHECK-NEXT: vcompress.vm v11, v8, v9
; CHECK-NEXT: vsetivli zero, 8, e8, m1, ta, ma
-; CHECK-NEXT: vslidedown.vi v8, v8, 8
-; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, mu
-; CHECK-NEXT: vrgather.vv v11, v8, v10, v0.t
-; CHECK-NEXT: vse8.v v11, (a1)
+; CHECK-NEXT: vslidedown.vi v10, v8, 8
----------------
preames wrote:
This is a fascinating accident, I hadn't considered this would catch the general deinterleave case. I'd been exploring a targeted change specific for deinterleave type cases, and this gets it generically. Nice!
(The new codegen is fairly neutral on m1, but if the result is > m1, the vslidedown and smaller shuffle helps a ton.)
https://github.com/llvm/llvm-project/pull/119401
More information about the llvm-commits
mailing list