forked from OSchip/llvm-project
Fix a nondeterministic bug in APInt::roundToDouble;
when !isSingleWord() but getActiveBits() is small, we were using the pointer value instead of the low word of the integer value. llvm-svn: 78821
This commit is contained in:
parent
cecfe61cd1
commit
34c08bbbf9
|
@ -897,10 +897,10 @@ double APInt::roundToDouble(bool isSigned) const {
|
||||||
// Handle the simple case where the value is contained in one uint64_t.
|
// Handle the simple case where the value is contained in one uint64_t.
|
||||||
if (isSingleWord() || getActiveBits() <= APINT_BITS_PER_WORD) {
|
if (isSingleWord() || getActiveBits() <= APINT_BITS_PER_WORD) {
|
||||||
if (isSigned) {
|
if (isSigned) {
|
||||||
int64_t sext = (int64_t(VAL) << (64-BitWidth)) >> (64-BitWidth);
|
int64_t sext = (int64_t(getWord(0)) << (64-BitWidth)) >> (64-BitWidth);
|
||||||
return double(sext);
|
return double(sext);
|
||||||
} else
|
} else
|
||||||
return double(VAL);
|
return double(getWord(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine if the value is negative.
|
// Determine if the value is negative.
|
||||||
|
|
Loading…
Reference in New Issue