[llvm] [RISCV][VLOPT] Add support for checkUsers when UserMI is a Single-Width Integer Reduction (PR #120345)

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 30 19:37:53 PST 2024


================
@@ -12,9 +12,11 @@ define i16 @ctz_v4i32(<4 x i32> %a) {
 ; RV32-NEXT:    vsetvli zero, zero, e8, mf4, ta, ma
 ; RV32-NEXT:    vmv.v.i v8, 0
 ; RV32-NEXT:    vmerge.vim v8, v8, -1, v0
+; RV32-NEXT:    vsetivli zero, 1, e8, mf4, ta, ma
 ; RV32-NEXT:    vid.v v9
----------------
wangpc-pp wrote:

This can be further optimized? since `vl=1` so there is only one element `0` in `v9`, thus `vrsub.vi v9, v9, 4` equals to `vmv.x.i v9, 4`.

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


More information about the llvm-commits mailing list