[llvm] [RISCV] Fold vmand of mask comparisons into a masked comparison (PR #216264)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 05:06:24 PDT 2026


================
@@ -0,0 +1,54 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc < %s -mtriple=riscv64 -mattr=+v,+zvfh -verify-machineinstrs | FileCheck %s
+
+; Test that vmand(vmsxx(a, b), vmsxx(c, d)) is folded into a mask-undisturbed
+; masked comparison, saving a vmand.mm. See RISCVVectorPeephole.
+
+declare <vscale x 2 x i1> @llvm.riscv.vmslt.nxv2i32.nxv2i32.i64(<vscale x 2 x i32>, <vscale x 2 x i32>, i64)
+declare <vscale x 2 x i1> @llvm.riscv.vmflt.nxv2f32.nxv2f32.i64(<vscale x 2 x float>, <vscale x 2 x float>, i64)
+declare <vscale x 2 x i1> @llvm.riscv.vmand.nxv2i1.i64(<vscale x 2 x i1>, <vscale x 2 x i1>, i64)
----------------
lukel97 wrote:

No need to declare intrinsics

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


More information about the llvm-commits mailing list