[llvm] [RISCV] Add vector hasAndNot to enable optimizations (PR #132438)

Piotr Fusik via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 24 08:05:47 PDT 2025


================
@@ -2580,9 +2580,9 @@ define <vscale x 1 x i8> @not_signbit_mask_nxv1i8(<vscale x 1 x i8> %a, <vscale
 ; CHECK-ZVKB-LABEL: not_signbit_mask_nxv1i8:
 ; CHECK-ZVKB:       # %bb.0:
 ; CHECK-ZVKB-NEXT:    vsetvli a0, zero, e8, mf8, ta, ma
-; CHECK-ZVKB-NEXT:    vmsgt.vi v0, v8, -1
-; CHECK-ZVKB-NEXT:    vmv.v.i v8, 0
-; CHECK-ZVKB-NEXT:    vmerge.vvm v8, v8, v9, v0
+; CHECK-ZVKB-NEXT:    vsra.vi v8, v8, 7
+; CHECK-ZVKB-NEXT:    vnot.v v8, v8
+; CHECK-ZVKB-NEXT:    vand.vv v8, v8, v9
----------------
pfusik wrote:

@topperc Thanks. I added your latter change. It affects no other test. Or do you prefer it as a separate PR or to work on it yourself?
I do not understand why VNOT is matched with a simpler pattern, i.e. at which point the constants are stripped to SEW.

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


More information about the llvm-commits mailing list