[llvm] [AArch64] use `isTRNMask` to calculate shuffle costs (PR #171524)

Philip Ginsbach-Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 12 09:18:02 PST 2025


ginsbach wrote:

@davemgreen I have added three more commits that should address your suggestions.

> I think that either the generic ShuffleVectorInst::isTransposeMask should match transposes like this, or the isTRNMask can be reused in the same places we currently check isZipMask/isUZPMask/etc.

With commit 3, I have picked the latter approach and used `isTRNMask` directly in `getShuffleCost` next to `isZipMask`, `isUZPMask`, etc. I have updated the PR description accordingly.

> Can you add direct cost-modelling tests for shuffles of these kinds?

Added in commit 4.

Two of the test cases added in commit 4 showed that things can go wrong with two-element shuffles
`shufflevector <2 x ???> %v0, <2 x ???> %v1, <2 x ???> <i32 2, i32 0>`.
The reason is that these get labelled as  `TTI::SK_InsertSubvector`. I have fixed the problem in commit 5.

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


More information about the llvm-commits mailing list