[llvm] [SLP]Cost-based choice of the i1 reduction form (PR #223163)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 13 03:40:08 PDT 2026
================
@@ -32219,27 +32234,66 @@ class HorizontalReduction {
return {ReducedSubTree, ResNegated};
}
+ /// Emits an i1 reduction in the cheaper of the plain and the bitcast-based
+ /// form. Returns nullptr if not an i1 reduction handled here.
+ Value *emitI1Reduction(Value *VectorizedValue, IRBuilderBase &Builder,
+ const TargetTransformInfo &TTI,
+ TTI::CastContextHint Ctx, Type *DestTy, Value *Start) {
+ auto *FTy = cast<FixedVectorType>(VectorizedValue->getType());
+ bool IsAdd = RdxKind == RecurKind::Add &&
+ DestTy->getScalarType() != FTy->getScalarType();
+ bool IsBoolLogic =
+ (RdxKind == RecurKind::And || RdxKind == RecurKind::Or) &&
+ DestTy->getScalarType() == FTy->getScalarType();
+ if (Start || FTy->getScalarType() != Builder.getInt1Ty() ||
----------------
arsenm wrote:
```suggestion
if (Start || !FTy->getScalarType()->isIntegerTy(1) ||
```
https://github.com/llvm/llvm-project/pull/223163
More information about the llvm-commits
mailing list