diff options
author | Dan Gohman <gohman@apple.com> | 2008-03-24 16:38:05 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-03-24 16:38:05 +0000 |
commit | 4c931fc6e2a901f86ef20d5844bcad3cfd99c781 (patch) | |
tree | a16e12d95401bc5fa95e34b0950dcb1e148a65e2 /lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 8d84d5b62cdf2a772d51338136c7022a6e1ff931 (diff) |
APIntify SelectionDAG's EXTRACT_ELEMENT code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48726 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 2f109a2018..05f7edb47c 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/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: |