[llvm] [WIP][TTI] Refactor improveShuffleKindFromMask to match the pattern order of getInstructionCost (PR #151984)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 6 05:00:26 PDT 2025
davemgreen wrote:
> @davemgreen You mentioned that you wanted to make it easier to handle shuffle narrow/widening costs at the target level - do you have specific examples of this?
Hi. I haven't been able to spend as much time as I would have liked going through and updating AArch64::getShuffleCost to handle small length changing shuffles. I believe that the assumptions that the generic cost model is making is blocking that somewhat at the moment. (It assumed pad-with-undef, where as promote is the default lowering for power-2 small vectors).
One thing that is perhaps surprising is that identity shuffles are not always free with length-changing shuffles. https://godbolt.org/z/Y357nchsz.
My preference would be for getInstructionCost to call getShuffleCost directly without any extra cases trying to be handled. Then the backends can use improveShuffleKindFromMask to improve on it. I guess I would expect that if getShuffleCost was called with a particular shuffle-kind then we would just trust it (or refine-it), to save on compile-time of rechecking the mask again and again.
https://github.com/llvm/llvm-project/pull/151984
More information about the llvm-commits
mailing list