[llvm] 805148e - [X86][SSE] combineHorizOpWithShuffle - consistently use getTargetShuffleInputs to decode shuffles
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 29 03:31:36 PDT 2021
Author: Simon Pilgrim
Date: 2021-03-29T11:31:19+01:00
New Revision: 805148eaf27f61f214bc6193bf8ec7f076cbb40e
URL: https://github.com/llvm/llvm-project/commit/805148eaf27f61f214bc6193bf8ec7f076cbb40e
DIFF: https://github.com/llvm/llvm-project/commit/805148eaf27f61f214bc6193bf8ec7f076cbb40e.diff
LOG: [X86][SSE] combineHorizOpWithShuffle - consistently use getTargetShuffleInputs to decode shuffles
Minor cleanup before I start trying to merge the unary/binary shuffle combining paths.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index bf89782ea017..9cbfae445a54 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -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);
More information about the llvm-commits
mailing list