[llvm] [RISCV] Don't use EVL/Mask for vid when lowering vp.reverse (PR #123048)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 06:26:07 PST 2025
================
@@ -5,15 +5,17 @@
define <2 x i1> @test_vp_reverse_v2i1_masked(<2 x i1> %src, <2 x i1> %mask, i32 zeroext %evl) {
; CHECK-LABEL: test_vp_reverse_v2i1_masked:
; CHECK: # %bb.0:
-; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
-; CHECK-NEXT: vmv.v.i v9, 0
-; CHECK-NEXT: addi a0, a0, -1
-; CHECK-NEXT: vmerge.vim v9, v9, 1, v0
+; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
+; CHECK-NEXT: vmv1r.v v9, v0
; CHECK-NEXT: vmv1r.v v0, v8
-; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
-; CHECK-NEXT: vid.v v10, v0.t
+; CHECK-NEXT: addi a0, a0, -1
+; CHECK-NEXT: vid.v v10
; CHECK-NEXT: vrsub.vx v10, v10, a0, v0.t
; CHECK-NEXT: vsetvli zero, zero, e8, mf8, ta, ma
+; CHECK-NEXT: vmv.v.i v11, 0
+; CHECK-NEXT: vmv1r.v v0, v9
----------------
lukel97 wrote:
Yeah, it looks like the scheduler is now shuffling things about because the vid has one less use. And I think it's especially bad for vxi1 vectors because we need to constantly copy V0. Can we put this down to noise? Alternatively we could rewrite these tests so the mask vector comes first in v0.
As a side note, we don't even strictly need to apply the mask for this operation, or for most non-trapping VP ops either. Then we would get rid of a lot of these mask copies.
https://github.com/llvm/llvm-project/pull/123048
More information about the llvm-commits
mailing list