[llvm] [LV] Use VPReductionRecipe for partial reductions (PR #144908)

Sam Tebbs via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 02:30:08 PDT 2025


================
@@ -994,11 +994,22 @@ InstructionCost TargetTransformInfo::getShuffleCost(
 }
 
 TargetTransformInfo::PartialReductionExtendKind
-TargetTransformInfo::getPartialReductionExtendKind(Instruction *I) {
-  if (isa<SExtInst>(I))
-    return PR_SignExtend;
-  if (isa<ZExtInst>(I))
+TargetTransformInfo::getPartialReductionExtendKind(
+    Instruction::CastOps CastOpc) {
+  switch (CastOpc) {
+  case Instruction::CastOps::ZExt:
     return PR_ZeroExtend;
+  case Instruction::CastOps::SExt:
+    return PR_SignExtend;
+  default:
+    return PR_None;
+  }
+}
+
+TargetTransformInfo::PartialReductionExtendKind
+TargetTransformInfo::getPartialReductionExtendKind(Instruction *I) {
----------------
SamTebbs33 wrote:

The call to `getPartialReductionCost` in `getScaledReductions` needs to know have the extend kind as, for example, mixed extension partial reductions are only valid in AArch64 with the i8mm extension. In the future if we change the interface of `getPartialReductionCost` to not need the extend kinds, I can remove this one.

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


More information about the llvm-commits mailing list