summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-06-25 20:52:59 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-06-25 20:52:59 +0000
commit3fc2372d3a8cc7a321bf364cc73a6d1bcc1a4bdd (patch)
tree0134169c4211a13b7fdcc05b3b5a8fcb5c08f1f6 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent33ff5c8d0d4c5304e20b1a449aa9b64da334556b (diff)
downloadbcm5719-llvm-3fc2372d3a8cc7a321bf364cc73a6d1bcc1a4bdd.tar.gz
bcm5719-llvm-3fc2372d3a8cc7a321bf364cc73a6d1bcc1a4bdd.zip
- Fix a x86 vector isel bug: illegal transformation of a vector_shuffle into a
shift. - Add a readme entry for a missing vector_shuffle optimization that results in awful codegen. llvm-svn: 52740
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index fdff418a615..f1c2ecf19d3 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1859,12 +1859,16 @@ bool SelectionDAG::isVerifiedDebugInfoDesc(SDOperand Op) const {
/// getShuffleScalarElt - Returns the scalar element that will make up the ith
/// element of the result of the vector shuffle.
-SDOperand SelectionDAG::getShuffleScalarElt(const SDNode *N, unsigned Idx) {
+SDOperand SelectionDAG::getShuffleScalarElt(const SDNode *N, unsigned i) {
MVT VT = N->getValueType(0);
SDOperand PermMask = N->getOperand(2);
+ SDOperand Idx = PermMask.getOperand(i);
+ if (Idx.getOpcode() == ISD::UNDEF)
+ return getNode(ISD::UNDEF, VT.getVectorElementType());
+ unsigned Index = cast<ConstantSDNode>(Idx)->getValue();
unsigned NumElems = PermMask.getNumOperands();
- SDOperand V = (Idx < NumElems) ? N->getOperand(0) : N->getOperand(1);
- Idx %= NumElems;
+ SDOperand V = (Index < NumElems) ? N->getOperand(0) : N->getOperand(1);
+ Index %= NumElems;
if (V.getOpcode() == ISD::BIT_CONVERT) {
V = V.getOperand(0);
@@ -1872,16 +1876,12 @@ SDOperand SelectionDAG::getShuffleScalarElt(const SDNode *N, unsigned Idx) {
return SDOperand();
}
if (V.getOpcode() == ISD::SCALAR_TO_VECTOR)
- return (Idx == 0) ? V.getOperand(0)
+ return (Index == 0) ? V.getOperand(0)
: getNode(ISD::UNDEF, VT.getVectorElementType());
if (V.getOpcode() == ISD::BUILD_VECTOR)
- return V.getOperand(Idx);
- if (V.getOpcode() == ISD::VECTOR_SHUFFLE) {
- SDOperand Elt = PermMask.getOperand(Idx);
- if (Elt.getOpcode() == ISD::UNDEF)
- return getNode(ISD::UNDEF, VT.getVectorElementType());
- return getShuffleScalarElt(V.Val,cast<ConstantSDNode>(Elt)->getValue());
- }
+ return V.getOperand(Index);
+ if (V.getOpcode() == ISD::VECTOR_SHUFFLE)
+ return getShuffleScalarElt(V.Val, Index);
return SDOperand();
}
OpenPOWER on IntegriCloud