[X86][SSE] createVariablePermute - move source vector canonicalization to top of function. NFCI.

This is to make it easier to return early from the switch statement with custom lowering.

llvm-svn: 327157
This commit is contained in:
Simon Pilgrim 2018-03-09 18:08:08 +00:00
parent 0c483024e4
commit 230d38b559
1 changed files with 8 additions and 8 deletions

View File

@ -7926,6 +7926,14 @@ SDValue createVariablePermute(MVT VT, SDValue SrcVec, SDValue IndicesVec,
NumElts * VT.getScalarSizeInBits());
IndicesVec = DAG.getZExtOrTrunc(IndicesVec, SDLoc(IndicesVec), IndicesVT);
// Adjust SrcVec to match VT type.
if (SrcVec.getValueSizeInBits() > VT.getSizeInBits())
return SDValue();
else if (SrcVec.getValueSizeInBits() < VT.getSizeInBits())
SrcVec =
DAG.getNode(ISD::INSERT_SUBVECTOR, SDLoc(SrcVec), VT, DAG.getUNDEF(VT),
SrcVec, DAG.getIntPtrConstant(0, SDLoc(SrcVec)));
unsigned Opcode = 0;
switch (VT.SimpleTy) {
default:
@ -8004,14 +8012,6 @@ SDValue createVariablePermute(MVT VT, SDValue SrcVec, SDValue IndicesVec,
(VT.getScalarSizeInBits() % ShuffleVT.getScalarSizeInBits()) == 0 &&
"Illegal variable permute shuffle type");
if (SrcVec.getValueSizeInBits() > VT.getSizeInBits())
return SDValue();
else if (SrcVec.getValueSizeInBits() < VT.getSizeInBits()) {
SrcVec =
DAG.getNode(ISD::INSERT_SUBVECTOR, SDLoc(SrcVec), VT, DAG.getUNDEF(VT),
SrcVec, DAG.getIntPtrConstant(0, SDLoc(SrcVec)));
}
uint64_t Scale = VT.getScalarSizeInBits() / ShuffleVT.getScalarSizeInBits();
if (Scale > 1) {
assert(isPowerOf2_64(Scale) && "Illegal variable permute shuffle scale");