summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-03-24 16:38:05 +0000
committerDan Gohman <gohman@apple.com>2008-03-24 16:38:05 +0000
commitd8ea040c310540e14ba9064f68744f79ef122cc0 (patch)
tree8a3bc5ef84f6f530c72808dbaa162a4c4f5fd58c /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent3471ae8c5d3de87f5b064a3b0705830fc44bc328 (diff)
downloadbcm5719-llvm-d8ea040c310540e14ba9064f68744f79ef122cc0.tar.gz
bcm5719-llvm-d8ea040c310540e14ba9064f68744f79ef122cc0.zip
APIntify SelectionDAG's EXTRACT_ELEMENT code.
llvm-svn: 48726
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 2f109a2018a..05f7edb47cc 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2119,8 +2119,10 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
// EXTRACT_ELEMENT of a constant int is also very common.
if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(N1)) {
- unsigned Shift = MVT::getSizeInBits(VT) * N2C->getValue();
- return getConstant(C->getValue() >> Shift, VT);
+ unsigned ElementSize = MVT::getSizeInBits(VT);
+ unsigned Shift = ElementSize * N2C->getValue();
+ APInt ShiftedVal = C->getAPIntValue().lshr(Shift);
+ return getConstant(ShiftedVal.trunc(ElementSize), VT);
}
break;
case ISD::EXTRACT_SUBVECTOR:
OpenPOWER on IntegriCloud