diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-19 20:37:47 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-19 20:37:47 +0000 |
commit | 6fae35acd3bf02e697e162402a4be22e61b7805e (patch) | |
tree | 1c00358c47c14bf5bd34a0b42ed3e97a3fe2edfd /llvm/lib/Support | |
parent | 568b8b54dce764bdf6b3f5e3f9ede09f44fa6e18 (diff) | |
download | bcm5719-llvm-6fae35acd3bf02e697e162402a4be22e61b7805e.tar.gz bcm5719-llvm-6fae35acd3bf02e697e162402a4be22e61b7805e.zip |
Implement extension of sign bits for negative values in the uint64_t
constructor. This helps to fix test/Assembler/2007-03-19-NegValue.ll
llvm-svn: 35180
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 08ec2362007..0d0f9ffca49 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -43,7 +43,8 @@ inline static uint64_t* getMemory(uint32_t numWords) { return result; } -APInt::APInt(uint32_t numBits, uint64_t val) : BitWidth(numBits), VAL(0) { +APInt::APInt(uint32_t numBits, uint64_t val, bool isSigned ) + : BitWidth(numBits), VAL(0) { assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small"); assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large"); if (isSingleWord()) @@ -51,6 +52,9 @@ APInt::APInt(uint32_t numBits, uint64_t val) : BitWidth(numBits), VAL(0) { else { pVal = getClearedMemory(getNumWords()); pVal[0] = val; + if (isSigned && int64_t(val) < 0) + for (unsigned i = 1; i < getNumWords(); ++i) + pVal[i] = -1ULL; } clearUnusedBits(); } |