summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-06-24 21:15:36 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-06-24 21:15:36 +0000
commit0399226cf9b4a0684549973eb64775d617137d5d (patch)
tree3f5019c87366aea4a8bb73c40114f71cb71cbc14
parenta895a0cd01cd529b126708c312b3358c30dabe41 (diff)
downloadbcm5719-llvm-0399226cf9b4a0684549973eb64775d617137d5d.tar.gz
bcm5719-llvm-0399226cf9b4a0684549973eb64775d617137d5d.zip
[APInt] Don't shift into the sign bit
llvm-svn: 273727
-rw-r--r--llvm/lib/Support/APInt.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 348f807c91a..9eed2147746 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -880,7 +880,7 @@ double APInt::roundToDouble(bool isSigned) const {
// It is wrong to optimize getWord(0) to VAL; there might be more than one word.
if (isSingleWord() || getActiveBits() <= APINT_BITS_PER_WORD) {
if (isSigned) {
- int64_t sext = (int64_t(getWord(0)) << (64-BitWidth)) >> (64-BitWidth);
+ int64_t sext = SignExtend64(getWord(0), BitWidth);
return double(sext);
} else
return double(getWord(0));
OpenPOWER on IntegriCloud