summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86ISelLowering.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-03-09 15:48:56 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-03-09 15:48:56 +0000
commit322c521ed7bc67d0f173c7f67a7ebe25e29fc9c6 (patch)
tree138ef2d8f8c2a7e89d3ac82e9a3df3b3d6a86524 /llvm/lib/Target/X86/X86ISelLowering.cpp
parent2a7053128c3338e05c4b35b18e1dbfbf9bd078d2 (diff)
downloadbcm5719-llvm-322c521ed7bc67d0f173c7f67a7ebe25e29fc9c6.tar.gz
bcm5719-llvm-322c521ed7bc67d0f173c7f67a7ebe25e29fc9c6.zip
[X86][SSE] createVariablePermute - move index 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: 327140
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelLowering.cpp')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 0d771964f03..ade69220c4c 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -7914,9 +7914,19 @@ static SDValue materializeVectorConstant(SDValue Op, SelectionDAG &DAG,
SDValue createVariablePermute(MVT VT, SDValue SrcVec, SDValue IndicesVec,
SDLoc &DL, SelectionDAG &DAG,
const X86Subtarget &Subtarget) {
- unsigned Opcode = 0;
MVT ShuffleVT = VT;
+ EVT IndicesVT = EVT(VT).changeVectorElementTypeToInteger();
+ unsigned NumElts = VT.getVectorNumElements();
+ // Adjust IndicesVec to match VT size.
+ assert(IndicesVec.getValueType().getVectorNumElements() >= NumElts &&
+ "Illegal variable permute mask size");
+ if (IndicesVec.getValueType().getVectorNumElements() > NumElts)
+ IndicesVec = extractSubVector(IndicesVec, 0, DAG, SDLoc(IndicesVec),
+ NumElts * VT.getScalarSizeInBits());
+ IndicesVec = DAG.getZExtOrTrunc(IndicesVec, SDLoc(IndicesVec), IndicesVT);
+
+ unsigned Opcode = 0;
switch (VT.SimpleTy) {
default:
break;
@@ -7994,16 +8004,6 @@ SDValue createVariablePermute(MVT VT, SDValue SrcVec, SDValue IndicesVec,
(VT.getScalarSizeInBits() % ShuffleVT.getScalarSizeInBits()) == 0 &&
"Illegal variable permute shuffle type");
- unsigned NumElts = VT.getVectorNumElements();
- if (IndicesVec.getValueType().getVectorNumElements() < NumElts)
- return SDValue();
- else if (IndicesVec.getValueType().getVectorNumElements() > NumElts)
- IndicesVec = extractSubVector(IndicesVec, 0, DAG, SDLoc(IndicesVec),
- NumElts * VT.getScalarSizeInBits());
-
- MVT IndicesVT = EVT(VT).changeVectorElementTypeToInteger().getSimpleVT();
- IndicesVec = DAG.getZExtOrTrunc(IndicesVec, SDLoc(IndicesVec), IndicesVT);
-
if (SrcVec.getValueSizeInBits() > VT.getSizeInBits())
return SDValue();
else if (SrcVec.getValueSizeInBits() < VT.getSizeInBits()) {
OpenPOWER on IntegriCloud