[X86][SSE] combineHorizOpWithShuffle - consistently use getTargetShuffleInputs to decode shuffles

Minor cleanup before I start trying to merge the unary/binary shuffle combining paths.
This commit is contained in:
Simon Pilgrim 2021-03-28 13:00:36 +01:00
parent 19601a4c6c
commit 805148eaf2
1 changed files with 12 additions and 6 deletions

View File

@ -43196,15 +43196,21 @@ static SDValue combineHorizOpWithShuffle(SDNode *N, SelectionDAG &DAG,
// If the op is an unary shuffle that can scale to v2x64,
// then we can perform this as a v4x32 post shuffle.
auto AdjustOp = [&](SDValue V, int Offset) {
auto *SVN = dyn_cast<ShuffleVectorSDNode>(V);
SmallVector<int, 2> ScaledMask;
if (!SVN || !SVN->getOperand(1).isUndef() ||
!scaleShuffleElements(SVN->getMask(), 2, ScaledMask) ||
!N->isOnlyUserOf(V.getNode()))
SmallVector<SDValue> ShuffleOps;
SmallVector<int> ShuffleMask, ScaledMask;
if (!getTargetShuffleInputs(V, ShuffleOps, ShuffleMask, DAG))
return SDValue();
resolveTargetShuffleInputsAndMask(ShuffleOps, ShuffleMask);
if (isAnyZero(ShuffleMask) || ShuffleOps.size() != 1 ||
!ShuffleOps[0].getValueType().is128BitVector() ||
!N->isOnlyUserOf(V.getNode()) ||
!scaleShuffleElements(ShuffleMask, 2, ScaledMask))
return SDValue();
PostShuffle[Offset + 0] = ScaledMask[0] < 0 ? -1 : Offset + ScaledMask[0];
PostShuffle[Offset + 1] = ScaledMask[1] < 0 ? -1 : Offset + ScaledMask[1];
return SVN->getOperand(0);
return DAG.getBitcast(V.getValueType(), ShuffleOps[0]);
};
SDValue Src0 = AdjustOp(N0, 0);