[llvm] [PowerPC] Fix vector_shuffle combines when inputs are scalar_to_vector of differing types. (PR #80784)
Amy Kwan via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 31 08:22:59 PDT 2024
================
@@ -15771,33 +15808,33 @@ SDValue PPCTargetLowering::combineVectorShuffle(ShuffleVectorSDNode *SVN,
// the value into element zero. Since scalar size of LHS and RHS may differ
// after isScalarToVec, this should be checked using their own sizes.
if (SToVLHS) {
- if (!IsLittleEndian && SToVLHS.getValueType().getScalarSizeInBits() >= 64)
+ int LHSScalarSize = SToVLHS.getValueType().getScalarSizeInBits();
+ if (!IsLittleEndian && LHSScalarSize >= 64)
return Res;
- // Set up the values for the shuffle vector fixup.
- LHSMaxIdx = NumEltsOut / NumEltsIn;
- SToVLHS = getSToVPermuted(SToVLHS, DAG, Subtarget);
- if (SToVLHS.getValueType() != LHS.getValueType())
- SToVLHS = DAG.getBitcast(LHS.getValueType(), SToVLHS);
- LHS = SToVLHS;
+ LHS = generateSToVPermutedForVecShuffle(
+ LHSScalarSize, ShuffleEltWidth, LHSNumValidElts, LHSFirstElt,
+ LHSLastElt, LHS, SToVLHS, DAG, Subtarget);
}
if (SToVRHS) {
- if (!IsLittleEndian && SToVRHS.getValueType().getScalarSizeInBits() >= 64)
+ int RHSScalarSize = SToVRHS.getValueType().getScalarSizeInBits();
+ if (!IsLittleEndian && RHSScalarSize >= 64)
----------------
amy-kwan wrote:
Do you mean, do we still need to run `isShuffleMaskInRange()` if we generate a `SCALAR_TO_VECTOR_PERMUTED` for the LHS, but not the RHS side?
I don't think so. I think this is due to the above comment:
```
// On big endian systems, this only makes sense for element sizes smaller
// than 64 bits since for 64-bit elements, all instructions already put
// the value into element zero. Since scalar size of LHS and RHS may differ
// after isScalarToVec, this should be checked using their own sizes.
```
https://github.com/llvm/llvm-project/pull/80784
More information about the llvm-commits
mailing list