Skip to content

Commit 821a51a

Browse files
committed
[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.
1 parent 978444d commit 821a51a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35997,12 +35997,16 @@ static SDValue combineX86ShuffleChainWithExtract(
3599735997
if (NumInputs == 0)
3599835998
return SDValue();
3599935999

36000+
EVT RootVT = Root.getValueType();
36001+
unsigned RootSizeInBits = RootVT.getSizeInBits();
36002+
assert((RootSizeInBits % NumMaskElts) == 0 && "Unexpected root shuffle mask");
36003+
3600036004
SmallVector<SDValue, 4> WideInputs(Inputs.begin(), Inputs.end());
3600136005
SmallVector<unsigned, 4> Offsets(NumInputs, 0);
3600236006

3600336007
// Peek through subvectors.
3600436008
// TODO: Support inter-mixed EXTRACT_SUBVECTORs + BITCASTs?
36005-
unsigned WideSizeInBits = WideInputs[0].getValueSizeInBits();
36009+
unsigned WideSizeInBits = RootSizeInBits;
3600636010
for (unsigned i = 0; i != NumInputs; ++i) {
3600736011
SDValue &Src = WideInputs[i];
3600836012
unsigned &Offset = Offsets[i];
@@ -36025,8 +36029,6 @@ static SDValue combineX86ShuffleChainWithExtract(
3602536029
if (llvm::all_of(Offsets, [](unsigned Offset) { return Offset == 0; }))
3602636030
return SDValue();
3602736031

36028-
EVT RootVT = Root.getValueType();
36029-
unsigned RootSizeInBits = RootVT.getSizeInBits();
3603036032
unsigned Scale = WideSizeInBits / RootSizeInBits;
3603136033
assert((WideSizeInBits % RootSizeInBits) == 0 &&
3603236034
"Unexpected subvector extraction");

0 commit comments

Comments
 (0)