[llvm] [AArch64][SelectionDAG] Add type legalization for partial reduce wide adds (PR #141075)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri May 23 07:35:58 PDT 2025
================
@@ -29530,6 +29537,35 @@ AArch64TargetLowering::LowerPARTIAL_REDUCE_MLA(SDValue Op,
SDValue LHS = Op.getOperand(1);
SDValue RHS = Op.getOperand(2);
EVT ResultVT = Op.getValueType();
+
+ // Recognise Op as a wide add, if it is then we leave it as-is
+ // Base: nxv2i64, Subdivision: nxv4i32
+ auto IsEVTSubdivision = [](EVT Base, EVT Subdivision) -> bool {
+ assert(Base.isVector() && Subdivision.isVector());
+ assert(Base.isScalableVector() == Subdivision.isScalableVector());
+
+ ElementCount BaseCount = Base.getVectorElementCount();
+ ElementCount SubCount = Subdivision.getVectorElementCount();
+ if (BaseCount * 2 != SubCount)
+ return false;
+
+ uint64_t BaseScalarSize = Base.getScalarSizeInBits();
+ uint64_t SubScalarSize = Subdivision.getScalarSizeInBits();
+ if (BaseScalarSize != SubScalarSize * 2)
+ return false;
+
+ return true;
+ };
+ if (IsEVTSubdivision(ResultVT, LHS.getValueType())) {
----------------
preames wrote:
To clarify, this is matching "partial_reduce_mla accum, ext-by-2x(A), splat(1)" as a widening add with one narrow operand and one wide operand? As a non-aarch64 person, which instruction does this correspond to? (Including that in the comment would help.)
https://github.com/llvm/llvm-project/pull/141075
More information about the llvm-commits
mailing list