mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 23:23:38 -04:00
[APInt] Make behavior of ashr by BitWidth consistent between single and multi word.
Previously single word would always return 0 regardless of the original sign. Multi word would return all 0s or all 1s based on the original sign. Now single word takes into account the sign as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301159 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user