[llvm] [AArch64][SelectionDAG] Add support for 8to64 partial reduction cases (PR #138269)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Fri May 2 08:32:56 PDT 2025


================
@@ -29509,6 +29514,28 @@ SDValue AArch64TargetLowering::LowerVECTOR_HISTOGRAM(SDValue Op,
   return Scatter;
 }
 
+SDValue
+AArch64TargetLowering::LowerPARTIAL_REDUCE_MLA(SDValue Op,
+                                               SelectionDAG &DAG) const {
+  SDLoc DL(Op);
+
+  auto Acc = Op.getOperand(0);
+  auto LHS = Op.getOperand(1);
+  auto RHS = Op.getOperand(2);
+  auto ResultVT = Op.getValueType();
+  assert(ResultVT == MVT::nxv2i64 && LHS.getValueType() == MVT::nxv16i8);
+
+  EVT InputVT = MVT::nxv4i32;
+  SDValue DotNode = DAG.getNode(Op.getOpcode(), DL, InputVT,
+                                DAG.getConstant(0, DL, InputVT), LHS, RHS);
+
+  bool IsUnsigned = Op.getOpcode() == ISD::PARTIAL_REDUCE_UMLA;
+  unsigned LoOpcode = IsUnsigned ? AArch64ISD::UADDWB : AArch64ISD::SADDWB;
+  unsigned HiOpcode = IsUnsigned ? AArch64ISD::UADDWT : AArch64ISD::SADDWT;
----------------
MacDue wrote:

You need to check `Subtarget->hasSVE2() || Subtarget->isStreamingSVEAvailable()` before using the wide adds IIRC. They're gated under `if !IsFeatureImplemented(FEAT_SVE2) && !IsFeatureImplemented(FEAT_SME)`.

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


More information about the llvm-commits mailing list