mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-13 00:10:37 +00:00
Fix a problem where shifting by 64-bits leads to incorrect results on PPC
but not on X86 becuase shift by word size is "undefined". llvm-svn: 34825
This commit is contained in:
parent
a6003a9eb6
commit
eabc981a60
@ -938,7 +938,10 @@ APInt &APInt::sext(uint32_t width) {
|
||||
if (wordsBefore == wordsAfter) {
|
||||
uint32_t newWordBits = width % APINT_BITS_PER_WORD;
|
||||
// The extension is contained to the wordsBefore-1th word.
|
||||
uint64_t mask = (~0ULL >> (APINT_BITS_PER_WORD - newWordBits)) << wordBits;
|
||||
uint64_t mask = ~0ULL;
|
||||
if (newWordBits)
|
||||
mask >>= APINT_BITS_PER_WORD - newWordBits;
|
||||
mask <<= wordBits;
|
||||
if (wordsBefore == 1)
|
||||
VAL |= mask;
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user