[llvm] [AArch64] Lower partial add reduction to udot or svdot (PR #101010)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 07:46:11 PDT 2024


================
@@ -3533,6 +3533,36 @@ AArch64TTIImpl::getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) {
   return Cost;
 }
 
+bool AArch64TTIImpl::isPartialReductionSupported(
+    const Instruction *ReductionInstr, Type *InputType, unsigned ScaleFactor,
+    bool IsInputASignExtended, bool IsInputBSignExtended,
+    const Instruction *BinOp) const {
+  if (ReductionInstr->getOpcode() != Instruction::Add)
+    return false;
+
+  // Check that both extends are of the same type
+  if (IsInputASignExtended != IsInputBSignExtended)
+    return false;
+
+  if (!BinOp || BinOp->getOpcode() != Instruction::Mul)
+    return false;
+
+  // Dot product only supports a scale factor of 4
+  if (ScaleFactor != 4)
+    return false;
+
+  Type *ReductionType = ReductionInstr->getType();
----------------
sdesmalen-arm wrote:

This function is not testing that the type must be scalable. Is that on purpose?

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


More information about the llvm-commits mailing list