summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2011-08-11 02:49:41 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2011-08-11 02:49:41 +0000
commit572c9aaf537b5600e37ea65aee593cf540de1809 (patch)
treedad67c6fe6e265c3aa5ed24344e16611063e9346 /llvm/lib/Target
parentaa149cbd863d1722f8e5263cac26b9c9f4461f57 (diff)
downloadbcm5719-llvm-572c9aaf537b5600e37ea65aee593cf540de1809.tar.gz
bcm5719-llvm-572c9aaf537b5600e37ea65aee593cf540de1809.zip
Use the splat index to generate the desired shuffle. Otherwise we
could only get undefs and the vector shuffle becomes an undef, generating wrong code. llvm-svn: 137295
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 217a7bcf530..ae573284d7d 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -4125,15 +4125,15 @@ static SDValue PromoteVectorToScalarSplat(ShuffleVectorSDNode *SV,
int NumElems = SrcVT.getVectorNumElements();
assert(SrcVT.is256BitVector() && "unknown howto handle vector type");
+ assert(SV->isSplat() && "shuffle must be a splat");
- SmallVector<int, 4> Mask;
- for (int i = 0; i < NumElems/2; ++i)
- Mask.push_back(SV->getMaskElt(i));
+ int SplatIdx = SV->getSplatIndex();
+ const int Mask[4] = { SplatIdx, SplatIdx, SplatIdx, SplatIdx };
EVT SVT = EVT::getVectorVT(*DAG.getContext(), SrcVT.getVectorElementType(),
NumElems/2);
SDValue SV1 = DAG.getVectorShuffle(SVT, dl, V1.getOperand(1),
- DAG.getUNDEF(SVT), &Mask[0]);
+ DAG.getUNDEF(SVT), Mask);
SDValue InsV = Insert128BitVector(DAG.getUNDEF(SrcVT), SV1,
DAG.getConstant(0, MVT::i32), DAG, dl);
OpenPOWER on IntegriCloud