1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[X86][AVX] combineX86ShuffleChainWithExtract - widen to at least original root size. NFCI.

We're relying on the source inputs for shuffle combining having already been widened to the root size (otherwise the offset logic falls over) - we're going to be supporting different sized shuffle inputs soon, so we need to explicitly make the minimum widened width the original root size.
This commit is contained in:
Simon Pilgrim 2021-01-25 13:45:19 +00:00
parent 559ef0a573
commit 1c92cd102a

View File

@ -35997,12 +35997,16 @@ static SDValue combineX86ShuffleChainWithExtract(
if (NumInputs == 0) if (NumInputs == 0)
return SDValue(); return SDValue();
EVT RootVT = Root.getValueType();
unsigned RootSizeInBits = RootVT.getSizeInBits();
assert((RootSizeInBits % NumMaskElts) == 0 && "Unexpected root shuffle mask");
SmallVector<SDValue, 4> WideInputs(Inputs.begin(), Inputs.end()); SmallVector<SDValue, 4> WideInputs(Inputs.begin(), Inputs.end());
SmallVector<unsigned, 4> Offsets(NumInputs, 0); SmallVector<unsigned, 4> Offsets(NumInputs, 0);
// Peek through subvectors. // Peek through subvectors.
// TODO: Support inter-mixed EXTRACT_SUBVECTORs + BITCASTs? // TODO: Support inter-mixed EXTRACT_SUBVECTORs + BITCASTs?
unsigned WideSizeInBits = WideInputs[0].getValueSizeInBits(); unsigned WideSizeInBits = RootSizeInBits;
for (unsigned i = 0; i != NumInputs; ++i) { for (unsigned i = 0; i != NumInputs; ++i) {
SDValue &Src = WideInputs[i]; SDValue &Src = WideInputs[i];
unsigned &Offset = Offsets[i]; unsigned &Offset = Offsets[i];
@ -36025,8 +36029,6 @@ static SDValue combineX86ShuffleChainWithExtract(
if (llvm::all_of(Offsets, [](unsigned Offset) { return Offset == 0; })) if (llvm::all_of(Offsets, [](unsigned Offset) { return Offset == 0; }))
return SDValue(); return SDValue();
EVT RootVT = Root.getValueType();
unsigned RootSizeInBits = RootVT.getSizeInBits();
unsigned Scale = WideSizeInBits / RootSizeInBits; unsigned Scale = WideSizeInBits / RootSizeInBits;
assert((WideSizeInBits % RootSizeInBits) == 0 && assert((WideSizeInBits % RootSizeInBits) == 0 &&
"Unexpected subvector extraction"); "Unexpected subvector extraction");