aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/APInt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index fe22e9b..78d5739 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -234,7 +234,8 @@ APInt& APInt::operator-=(uint64_t RHS) {
APInt APInt::operator*(const APInt& RHS) const {
assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
if (isSingleWord())
- return APInt(BitWidth, U.VAL * RHS.U.VAL);
+ return APInt(BitWidth, U.VAL * RHS.U.VAL, /*isSigned=*/false,
+ /*implicitTrunc=*/true);
APInt Result(getMemory(getNumWords()), getBitWidth());
tcMultiply(Result.U.pVal, U.pVal, RHS.U.pVal, getNumWords());
@@ -455,7 +456,8 @@ APInt APInt::extractBits(unsigned numBits, unsigned bitPosition) const {
"Illegal bit extraction");
if (isSingleWord())
- return APInt(numBits, U.VAL >> bitPosition);
+ return APInt(numBits, U.VAL >> bitPosition, /*isSigned=*/false,
+ /*implicitTrunc=*/true);
unsigned loBit = whichBit(bitPosition);
unsigned loWord = whichWord(bitPosition);
@@ -463,7 +465,8 @@ APInt APInt::extractBits(unsigned numBits, unsigned bitPosition) const {
// Single word result extracting bits from a single word source.
if (loWord == hiWord)
- return APInt(numBits, U.pVal[loWord] >> loBit);
+ return APInt(numBits, U.pVal[loWord] >> loBit, /*isSigned=*/false,
+ /*implicitTrunc=*/true);
// Extracting bits that start on a source word boundary can be done
// as a fast memory copy.
@@ -907,7 +910,8 @@ APInt APInt::trunc(unsigned width) const {
assert(width <= BitWidth && "Invalid APInt Truncate request");
if (width <= APINT_BITS_PER_WORD)
- return APInt(width, getRawData()[0]);
+ return APInt(width, getRawData()[0], /*isSigned=*/false,
+ /*implicitTrunc=*/true);
if (width == BitWidth)
return *this;
@@ -955,7 +959,7 @@ APInt APInt::sext(unsigned Width) const {
assert(Width >= BitWidth && "Invalid APInt SignExtend request");
if (Width <= APINT_BITS_PER_WORD)
- return APInt(Width, SignExtend64(U.VAL, BitWidth));
+ return APInt(Width, SignExtend64(U.VAL, BitWidth), /*isSigned=*/true);
if (Width == BitWidth)
return *this;