Tidy up spacing in LowerVECTOR_SHUFFLEtoBlend. Remove code that checks if shuffle operand has a different type than the the shuffle result since it can never happen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155333 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2012-04-23 06:38:28 +00:00
parent 731dfd0da9
commit 1842ba0dfc

View File

@ -5390,25 +5390,19 @@ X86TargetLowering::LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const {
}
// Try to lower a shuffle node into a simple blend instruction.
static SDValue LowerVECTOR_SHUFFLEtoBlend(SDValue Op,
static SDValue LowerVECTOR_SHUFFLEtoBlend(ShuffleVectorSDNode *SVOp,
const X86Subtarget *Subtarget,
SelectionDAG &DAG) {
ShuffleVectorSDNode *SVOp = cast<ShuffleVectorSDNode>(Op);
SDValue V1 = SVOp->getOperand(0);
SDValue V2 = SVOp->getOperand(1);
DebugLoc dl = SVOp->getDebugLoc();
EVT VT = Op.getValueType();
EVT InVT = V1.getValueType();
int MaskSize = VT.getVectorNumElements();
int InSize = InVT.getVectorNumElements();
EVT VT = SVOp->getValueType(0);
unsigned NumElems = VT.getVectorNumElements();
if (!Subtarget->hasSSE41())
return SDValue();
if (MaskSize != InSize)
return SDValue();
int ISDNo = 0;
unsigned ISDNo = 0;
MVT OpTy;
switch (VT.getSimpleVT().SimpleTy) {
@ -5452,13 +5446,14 @@ static SDValue LowerVECTOR_SHUFFLEtoBlend(SDValue Op,
unsigned MaskVals = 0;
for (int i = 0; i < MaskSize; ++i) {
for (unsigned i = 0; i != NumElems; ++i) {
int EltIdx = SVOp->getMaskElt(i);
if (EltIdx == i || EltIdx == -1)
if (EltIdx == (int)i || EltIdx < 0)
MaskVals |= (1<<i);
else if (EltIdx == (i + MaskSize))
else if (EltIdx == (int)(i + NumElems))
continue; // Bit is set to zero;
else return SDValue();
else
return SDValue();
}
V1 = DAG.getNode(ISD::BITCAST, dl, OpTy, V1);
@ -6626,7 +6621,7 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const {
return getTargetShuffleNode(X86ISD::VPERM2X128, dl, VT, V1,
V2, getShuffleVPERM2X128Immediate(SVOp), DAG);
SDValue BlendOp = LowerVECTOR_SHUFFLEtoBlend(Op, Subtarget, DAG);
SDValue BlendOp = LowerVECTOR_SHUFFLEtoBlend(SVOp, Subtarget, DAG);
if (BlendOp.getNode())
return BlendOp;