aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/APInt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 3f552db..e056f8b 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -1041,7 +1041,9 @@ APInt APInt::ashr(unsigned shiftAmt) const {
// Handle single word shifts with built-in ashr
if (isSingleWord()) {
if (shiftAmt == BitWidth)
- return APInt(BitWidth, 0); // undefined
+ // Undefined
+ return APInt(BitWidth,
+ SignExtend64(VAL, BitWidth) >> (APINT_BITS_PER_WORD - 1));
return APInt(BitWidth, SignExtend64(VAL, BitWidth) >> shiftAmt);
}