[llvm] r327157 - [X86][SSE] createVariablePermute - move source vector canonicalization to top of function. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 9 10:08:09 PST 2018
Author: rksimon
Date: Fri Mar 9 10:08:08 2018
New Revision: 327157
URL: http://llvm.org/viewvc/llvm-project?rev=327157&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=327157&r1=327156&r2=327157&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Mar 9 10:08:08 2018
@@ -7926,6 +7926,14 @@ SDValue createVariablePermute(MVT VT, SD
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, SD
(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");
More information about the llvm-commits
mailing list