[llvm] [RISCV] Recognize VLA shift pairs from shuffle masks (PR #127710)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 19 12:02:51 PST 2025


================
@@ -924,13 +894,12 @@ define <8 x float> @shuffle_v8f32_as_i64_exact(<8 x float> %v) vscale_range(2,2)
 ;
 ; ZVKB-ZVE32X-LABEL: shuffle_v8f32_as_i64_exact:
 ; ZVKB-ZVE32X:       # %bb.0:
-; ZVKB-ZVE32X-NEXT:    lui a0, 8240
-; ZVKB-ZVE32X-NEXT:    addi a0, a0, 1
-; ZVKB-ZVE32X-NEXT:    vsetivli zero, 4, e32, m1, ta, ma
-; ZVKB-ZVE32X-NEXT:    vmv.s.x v10, a0
-; ZVKB-ZVE32X-NEXT:    vsext.vf4 v12, v10
-; ZVKB-ZVE32X-NEXT:    vrgather.vv v11, v9, v12
-; ZVKB-ZVE32X-NEXT:    vrgather.vv v10, v8, v12
+; ZVKB-ZVE32X-NEXT:    vsetivli zero, 4, e32, m1, ta, mu
+; ZVKB-ZVE32X-NEXT:    vmv.v.i v0, 10
+; ZVKB-ZVE32X-NEXT:    vslidedown.vi v11, v9, 1
+; ZVKB-ZVE32X-NEXT:    vslideup.vi v11, v9, 1, v0.t
+; ZVKB-ZVE32X-NEXT:    vslidedown.vi v10, v8, 1
+; ZVKB-ZVE32X-NEXT:    vslideup.vi v10, v8, 1, v0.t
 ; ZVKB-ZVE32X-NEXT:    vmv2r.v v8, v10
 ; ZVKB-ZVE32X-NEXT:    ret
   %shuffle = shufflevector <8 x float> %v, <8 x float> poison, <8 x i32> <i32 1, i32 0, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6>
----------------
preames wrote:

This is a bad interaction with the exact VLS lowering.  I want to sink the VLS splitting below some of the linear lowering, but that's definitely a separate change.  

p.s. Though in this case, this isn't a pair of slides at m2.  This pattern wouldn't apply at all if we hadn't split using VLS.  

https://github.com/llvm/llvm-project/pull/127710


More information about the llvm-commits mailing list