summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2019-02-20 17:58:29 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2019-02-20 17:58:29 +0000
commitdca47c659ce24413fc6fed5054c05d519a7e9a82 (patch)
treed4eb6bebdab203b8cf98ae5a7535f7017e15f9a5 /llvm/lib/Target
parent4e9b02b0da24bf3741a60ace8d14f28df2a46461 (diff)
downloadbcm5719-llvm-dca47c659ce24413fc6fed5054c05d519a7e9a82.tar.gz
bcm5719-llvm-dca47c659ce24413fc6fed5054c05d519a7e9a82.zip
[X86][SSE] combineX86ShufflesRecursively - begin generalizing the number of shuffle inputs. NFCI.
We currently bail if the target shuffle decodes to more than 2 input vectors, this is some initial cleanup that still has the limit but generalizes the opindices to an array that will be necessary when we drop the limit. llvm-svn: 354489
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index cf2c83fa1cf..69c1fa407c0 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -31712,15 +31712,10 @@ static SDValue combineX86ShufflesRecursively(
if (2 < OpInputs.size())
return SDValue();
- SDValue Input0 = (OpInputs.size() > 0 ? OpInputs[0] : SDValue());
- SDValue Input1 = (OpInputs.size() > 1 ? OpInputs[1] : SDValue());
-
// Add the inputs to the Ops list, avoiding duplicates.
SmallVector<SDValue, 16> Ops(SrcOps.begin(), SrcOps.end());
auto AddOp = [&Ops](SDValue Input, int InsertionPoint) -> int {
- if (!Input)
- return -1;
// Attempt to find an existing match.
SDValue InputBC = peekThroughBitcasts(Input);
for (int i = 0, e = Ops.size(); i < e; ++i)
@@ -31736,8 +31731,9 @@ static SDValue combineX86ShufflesRecursively(
return Ops.size() - 1;
};
- int InputIdx0 = AddOp(Input0, SrcOpIndex);
- int InputIdx1 = AddOp(Input1, -1);
+ SmallVector<int, 2> OpInputIdx;
+ for (SDValue OpInput : OpInputs)
+ OpInputIdx.push_back(AddOp(OpInput, OpInputIdx.empty() ? SrcOpIndex : -1));
assert(((RootMask.size() > OpMask.size() &&
RootMask.size() % OpMask.size() == 0) ||
@@ -31810,11 +31806,11 @@ static SDValue combineX86ShufflesRecursively(
OpMaskedIdx = OpMaskedIdx & (MaskWidth - 1);
if (OpMask[OpIdx] < (int)OpMask.size()) {
- assert(0 <= InputIdx0 && "Unknown target shuffle input");
- OpMaskedIdx += InputIdx0 * MaskWidth;
+ assert(0 <= OpInputIdx[0] && "Unknown target shuffle input");
+ OpMaskedIdx += OpInputIdx[0] * MaskWidth;
} else {
- assert(0 <= InputIdx1 && "Unknown target shuffle input");
- OpMaskedIdx += InputIdx1 * MaskWidth;
+ assert(0 <= OpInputIdx[1] && "Unknown target shuffle input");
+ OpMaskedIdx += OpInputIdx[1] * MaskWidth;
}
Mask[i] = OpMaskedIdx;
OpenPOWER on IntegriCloud