[llvm] [RISCV] Use ISD::XOR instead of RISCVISD::VMXOR_VL in lowerVectorMaskVecReduction of scalable ISD::VECREDUCE_AND (PR #121812)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 13:29:20 PST 2025


================
@@ -10154,7 +10154,10 @@ SDValue RISCVTargetLowering::lowerVectorMaskVecReduction(SDValue Op,
   case ISD::VP_REDUCE_AND: {
     // vcpop ~x == 0
     SDValue TrueMask = DAG.getNode(RISCVISD::VMSET_VL, DL, ContainerVT, VL);
-    Vec = DAG.getNode(RISCVISD::VMXOR_VL, DL, ContainerVT, Vec, TrueMask, VL);
+    if (IsVP || VecVT.isFixedLengthVector())
----------------
preames wrote:

Do we need the special case?  I'm somewhat surprised that the plain ISD::XOR doesn't work out fine for the fixed case at least.  Any idea why?  Even for the VP case, I think we only need the mask and VL on the vcpop itself?

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


More information about the llvm-commits mailing list