[llvm] [RISCV] Custom lower fixed length partial.reduce to zvqdotq (PR #141180)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Fri May 23 02:33:58 PDT 2025


================
@@ -8389,12 +8400,26 @@ SDValue RISCVTargetLowering::lowerPARTIAL_REDUCE_MLA(SDValue Op,
          VT.getVectorElementType() == MVT::i32);
   SDValue A = Op.getOperand(1);
   SDValue B = Op.getOperand(2);
-  assert(A.getSimpleValueType() == B.getSimpleValueType() &&
-         A.getSimpleValueType().getVectorElementType() == MVT::i8);
+  MVT ArgVT = A.getSimpleValueType();
+  assert(ArgVT == B.getSimpleValueType() &&
+         ArgVT.getVectorElementType() == MVT::i8);
+
+  MVT ContainerVT = VT;
+  if (VT.isFixedLengthVector()) {
+    ContainerVT = getContainerForFixedLengthVector(VT);
+    Accum = convertToScalableVector(ContainerVT, Accum, DAG, Subtarget);
+    MVT ArgContainerVT = getContainerForFixedLengthVector(ArgVT);
+    A = convertToScalableVector(ArgContainerVT, A, DAG, Subtarget);
+    B = convertToScalableVector(ArgContainerVT, B, DAG, Subtarget);
----------------
lukel97 wrote:

Given that this lowering seems to be just converting fixed vectors to scalable vectors, can we just reuse the generic `lowerToScalableOp` path and fill out `getRISCVVLOp`?

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


More information about the llvm-commits mailing list