[llvm] [SLP]Add cost estimation for gather node reshuffling (PR #115201)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 15 04:35:38 PST 2024
================
@@ -4846,8 +4846,21 @@ getShuffleCost(const TargetTransformInfo &TTI, TTI::ShuffleKind Kind,
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput,
int Index = 0, VectorType *SubTp = nullptr,
ArrayRef<const Value *> Args = {}) {
- if (Kind != TTI::SK_PermuteTwoSrc)
+ if (Kind != TTI::SK_PermuteTwoSrc) {
+ int SplatIdx = PoisonMaskElem;
+ if (!Mask.empty() && all_of(Mask, [&](int Idx) {
+ if (Idx == PoisonMaskElem)
+ return true;
+ if (SplatIdx == PoisonMaskElem) {
+ SplatIdx = Idx;
+ return true;
+ }
+ return SplatIdx == Idx;
+ }))
+ return TTI.getShuffleCost(TTI::SK_Broadcast, Tp, Mask, CostKind, Index,
+ SubTp, Args);
return TTI.getShuffleCost(Kind, Tp, Mask, CostKind, Index, SubTp, Args);
+ }
----------------
alexey-bataev wrote:
Will do
https://github.com/llvm/llvm-project/pull/115201
More information about the llvm-commits
mailing list