VALIGND and VALIGNQ are similar to PALIGNR but instead of working on a 128-bit lane they work on the entire vector register. This change leverages the shuffle rotate detection code used for PALIGNR to detect these cases.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Please can you add the new tests to trunk with the existing lowering?
For 128-bit vectors, we favor VALIGND/Q over PALIGNR so that we naturely match the vector element size in case the shuffle is part of a masked operation
Would we be better off putting this logic into combineSelect() and keep to PALIGNR? Detect mask/maskz selects taking a bitcasted target shuffles/logicals/whatever and attempt to narrow/widen them back? Not certain if this would actually work in general, its just a thought.
That sounds like a good idea. We can leave it as PALIGNR and not even try to do PALIGND/Q for 128-bit until combineSelect. Less code in shuffle lowering is probably best.
Add current codegen to trunk to show the diffs in the tests?
lib/Target/X86/X86ISelLowering.cpp | ||
---|---|---|
12215 ↗ | (On Diff #77144) | Will this ever fire? |
Updating tests to only show difference in codegen with this patch.
lib/Target/X86/X86ISelLowering.cpp | ||
---|---|---|
12215 ↗ | (On Diff #77144) | VALIGND/Q work on the whole vector. PALIGNR works on 128-bit lanes so they should cover different cases. |
LGTM - please can you create a PR about the AVX512 combineSelect shuffle/logical widening/narrowing idea (unless you intend to do it very soon).
I'll see if we can add matchVectorShuffleAsRotate to matchBinaryPermuteVectorShuffle.