[llvm] [PowerPC] Fix shuffle combine with undef elements (PR #77787)
Kai Luo via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 11 19:13:08 PST 2024
================
@@ -15428,15 +15428,15 @@ SDValue PPCTargetLowering::combineVectorShuffle(ShuffleVectorSDNode *SVN,
// vector_shuffle<0,16,1,17,2,18,3,19,4,20,5,21,6,22,7,23> t1, <zero>
if (Mask[0] < NumElts)
for (int i = 1, e = Mask.size(); i < e; i += 2) {
- if (ShuffV[i] < 0)
+ if (ShuffV[i] < 0 || ShuffV[i - 1] < 0)
----------------
bzEq wrote:
The change looks good to me(keeping the index as it is if `undef` found in consecutive elements). However, I think what @nemanja suggested in https://github.com/llvm/llvm-project/issues/77748#issuecomment-1887670450 might be potential better for later instruction selection. That's to say, the more same elements in the mask, the more chance we can use single PPC vector splat instruction to materialize the mask immediate.
https://github.com/llvm/llvm-project/pull/77787
More information about the llvm-commits
mailing list