As comments said, for negative value, the arithmetic

over-shift-right should return -1. So here it should be signed-extended,
when bitwidth larger than 64.

test case: llvm/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll

llvm-svn: 51999
This commit is contained in:
Zhou Sheng 2008-06-05 13:27:38 +00:00
parent 380c3aac60
commit 0d32cd97e1

View File

@ -1113,7 +1113,7 @@ APInt APInt::ashr(uint32_t shiftAmt) const {
// issues in the algorithm below.
if (shiftAmt == BitWidth) {
if (isNegative())
return APInt(BitWidth, -1ULL);
return APInt(BitWidth, -1ULL, true);
else
return APInt(BitWidth, 0);
}