[llvm] [SelectionDAG] Add PARTIAL_REDUCE_U/SMLA ISD Nodes (PR #125207)

James Chesterman via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 04:08:43 PST 2025


================
@@ -11890,6 +11891,62 @@ SDValue TargetLowering::expandVECTOR_COMPRESS(SDNode *Node,
   return DAG.getLoad(VecVT, DL, Chain, StackPtr, PtrInfo);
 }
 
+SDValue TargetLowering::expandPartialReduceMLA(SDNode *N,
+                                               SelectionDAG &DAG) const {
+  SDLoc DL(N);
+  SDValue Acc = N->getOperand(0);
+  SDValue MulLHS = N->getOperand(1);
+  SDValue MulRHS = N->getOperand(2);
+  EVT ReducedTy = Acc.getValueType();
+  EVT FullTy = MulLHS.getValueType();
+
+  EVT NewVT =
+      EVT::getVectorVT(*DAG.getContext(), ReducedTy.getVectorElementType(),
+                       FullTy.getVectorElementCount());
+  unsigned ExtOpc = N->getOpcode() == ISD::PARTIAL_REDUCE_SMLA
+                        ? ISD::SIGN_EXTEND
+                        : ISD::ZERO_EXTEND;
+  EVT MulLHSVT = MulLHS.getValueType();
+  assert(MulLHSVT == MulRHS.getValueType() &&
+         "The second and third operands of a PARTIAL_REDUCE_MLA node must have "
+         "the same value type!");
+  EVT ExtVT = MulLHSVT.changeVectorElementType(
+      Acc.getValueType().getVectorElementType());
----------------
JamesChesterman wrote:

Done, removed `ExtVT` initialisation and renamed `NewVT` to `ExtMulOpVT`.

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


More information about the llvm-commits mailing list