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

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 06:18:36 PST 2025


================
@@ -5624,7 +5624,14 @@ class TargetLowering : public TargetLoweringBase {
 
   // Expands PARTIAL_REDUCE_S/UMLA nodes to a series of simpler operations,
   // consisting of zext/sext, extract_subvector, mul and add operations.
-  SDValue expandPartialReduceMLA(SDNode *N, SelectionDAG &DAG) const;
+  SDValue expandPartialReduceMLA(SDLoc DL, SDValue Acc, SDValue Input1,
+                                 SDValue Input2, SelectionDAG &DAG) const;
+
+  // Create the DAG equivalent of vector_partial_reduce where Op1 and Op2 are
+  // its operands and ReducedTY is the return type.
+  static SDValue getPartialReduceAdd(SDLoc DL, EVT ReducedTy, EVT FullTy,
+                                     SDValue Op1, SDValue Op2,
+                                     SelectionDAG &DAG);
----------------
sdesmalen-arm wrote:

Sorry if I was unclear about this, but I meant to suggest making it a local function to `TargetLowering.cpp` using static (so that the symbol is not exported), because the function isn't needed anywhere else other than by `expandPartialReduceMLA`. I didn't intend to suggest making it a static member function.

Maybe you can remove the need for this function entirely (see also my other comments below), by folding the code from this function into `expandPartialReduceMLA` and replacing the remaining use of `getPartialReduceAdd` by `expandPartialReduceMLA`.

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


More information about the llvm-commits mailing list