16 #ifndef LLVM_ADT_APINT_H
17 #define LLVM_ADT_APINT_H
29 class FoldingSetNodeID;
89 static_cast<unsigned int>(
sizeof(uint64_t)) * CHAR_BIT,
91 APINT_WORD_SIZE =
static_cast<unsigned int>(
sizeof(uint64_t))
98 APInt(uint64_t *val,
unsigned bits) : BitWidth(bits),
pVal(val) {}
103 bool isSingleWord()
const {
return BitWidth <= APINT_BITS_PER_WORD; }
108 static unsigned whichWord(
unsigned bitPosition) {
109 return bitPosition / APINT_BITS_PER_WORD;
116 static unsigned whichBit(
unsigned bitPosition) {
117 return bitPosition % APINT_BITS_PER_WORD;
126 static uint64_t maskBit(
unsigned bitPosition) {
127 return 1ULL << whichBit(bitPosition);
136 APInt &clearUnusedBits() {
138 unsigned wordBits = BitWidth % APINT_BITS_PER_WORD;
146 uint64_t mask = ~uint64_t(0ULL) >> (APINT_BITS_PER_WORD - wordBits);
156 uint64_t getWord(
unsigned bitPosition)
const {
157 return isSingleWord() ?
VAL :
pVal[whichWord(bitPosition)];
172 void fromString(
unsigned numBits, StringRef str, uint8_t radix);
180 static void divide(
const APInt LHS,
unsigned lhsWords,
const APInt &RHS,
181 unsigned rhsWords,
APInt *Quotient,
APInt *Remainder);
184 void initSlowCase(
unsigned numBits, uint64_t val,
bool isSigned);
187 void initFromArray(ArrayRef<uint64_t> array);
190 void initSlowCase(
const APInt &that);
193 APInt shlSlowCase(
unsigned shiftAmt)
const;
208 bool EqualSlowCase(
const APInt &RHS)
const;
211 bool EqualSlowCase(uint64_t Val)
const;
214 unsigned countLeadingZerosSlowCase()
const;
217 unsigned countTrailingOnesSlowCase()
const;
220 unsigned countPopulationSlowCase()
const;
236 APInt(
unsigned numBits, uint64_t val,
bool isSigned =
false)
237 : BitWidth(numBits),
VAL(0) {
238 assert(BitWidth &&
"bitwidth too small");
242 initSlowCase(numBits, val, isSigned);
262 APInt(
unsigned numBits,
unsigned numWords,
const uint64_t bigVal[]);
280 assert(BitWidth &&
"bitwidth too small");
287 #if LLVM_HAS_RVALUE_REFERENCES
342 return VAL == ~
integerPart(0) >> (APINT_BITS_PER_WORD - BitWidth);
343 return countPopulationSlowCase() == BitWidth;
357 return BitWidth == 1 ?
VAL == 0
377 assert(N &&
"N == 0 ???");
383 assert(N &&
"N == 0 ???");
393 return countPopulationSlowCase() == 1;
434 APInt API(numBits, 0);
451 return APInt(numBits, UINT64_MAX,
true);
477 APInt Res(numBits, 0);
496 assert(hiBit <= numBits &&
"hiBit out of range");
497 assert(loBit < numBits &&
"loBit out of range");
511 assert(hiBitsSet <= numBits &&
"Too many bits to set!");
514 return APInt(numBits, 0);
515 unsigned shiftAmt = numBits - hiBitsSet;
517 if (numBits <= APINT_BITS_PER_WORD)
518 return APInt(numBits, ~0ULL << shiftAmt);
529 assert(loBitsSet <= numBits &&
"Too many bits to set!");
532 return APInt(numBits, 0);
533 if (loBitsSet == APINT_BITS_PER_WORD)
534 return APInt(numBits, UINT64_MAX);
536 if (loBitsSet <= APINT_BITS_PER_WORD)
537 return APInt(numBits, UINT64_MAX >> (APINT_BITS_PER_WORD - loBitsSet));
543 assert(NewLen >= V.
getBitWidth() &&
"Can't splat to smaller bit width!");
650 if (isSingleWord() && RHS.isSingleWord()) {
652 BitWidth = RHS.BitWidth;
653 return clearUnusedBits();
656 return AssignSlowCase(RHS);
659 #if LLVM_HAS_RVALUE_REFERENCES
665 BitWidth = that.BitWidth;
705 if (isSingleWord()) {
749 *
this =
shl(shiftAmt);
763 assert(BitWidth == RHS.BitWidth &&
"Bit widths must be the same");
766 return AndSlowCase(RHS);
778 assert(BitWidth == RHS.BitWidth &&
"Bit widths must be the same");
781 return OrSlowCase(RHS);
800 assert(BitWidth == RHS.BitWidth &&
"Bit widths must be the same");
803 return XorSlowCase(RHS);
857 assert(shiftAmt <= BitWidth &&
"Invalid shift amount");
858 if (isSingleWord()) {
859 if (shiftAmt >= BitWidth)
860 return APInt(BitWidth, 0);
861 return APInt(BitWidth,
VAL << shiftAmt);
863 return shlSlowCase(shiftAmt);
949 assert(bitPosition <
getBitWidth() &&
"Bit position out of bounds!");
950 return (maskBit(bitPosition) &
951 (isSingleWord() ?
VAL :
pVal[whichWord(bitPosition)])) !=
964 assert(BitWidth == RHS.BitWidth &&
"Comparison requires equal bit widths");
967 return EqualSlowCase(RHS);
979 return EqualSlowCase(Val);
988 bool eq(
const APInt &RHS)
const {
return (*
this) == RHS; }
1004 bool operator!=(uint64_t Val)
const {
return !((*this) == Val); }
1012 bool ne(
const APInt &RHS)
const {
return !((*this) == RHS); }
1206 pVal[i] = UINT64_MAX;
1215 void setBit(
unsigned bitPosition);
1228 void clearBit(
unsigned bitPosition);
1236 pVal[i] ^= UINT64_MAX;
1245 void flipBit(
unsigned bitPosition);
1268 return (BitWidth + APINT_BITS_PER_WORD - 1) / APINT_BITS_PER_WORD;
1284 return numActiveBits ? whichWord(numActiveBits - 1) + 1 : 1;
1309 assert(
getActiveBits() <= 64 &&
"Too many bits for uint64_t");
1320 return int64_t(
VAL << (APINT_BITS_PER_WORD - BitWidth)) >>
1321 (APINT_BITS_PER_WORD - BitWidth);
1323 return int64_t(
pVal[0]);
1341 if (isSingleWord()) {
1342 unsigned unusedBits = APINT_BITS_PER_WORD - BitWidth;
1345 return countLeadingZerosSlowCase();
1385 return countTrailingOnesSlowCase();
1397 return countPopulationSlowCase();
1408 bool formatAsCLiteral =
false)
const;
1413 toString(Str, Radix,
false,
false);
1451 T.I = (isSingleWord() ?
VAL :
pVal[0]);
1479 return APInt(
sizeof T * CHAR_BIT,
T.I);
1492 return APInt(
sizeof T * CHAR_BIT,
T.I);
1540 mu
magicu(
unsigned LeadingZeros = 0)
const;
1571 unsigned int srcLSB);
1607 unsigned int srcParts,
unsigned int dstParts,
1634 unsigned int parts);
1639 unsigned int count);
1644 unsigned int count);
1693 namespace APIntOps {
1725 return isMask(numBits, (APIVal -
APInt(numBits, 1)) | APIVal);
1784 return LHS.
ashr(shiftAmt);
1791 return LHS.
lshr(shiftAmt);
1798 return LHS.
shl(shiftAmt);
APInt operator|(const APInt &RHS) const
Bitwise OR operator.
void clearAllBits()
Set every bit to 0.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT ashr(unsigned shiftAmt) const
Arithmetic right-shift function.
APInt multiplicativeInverse(const APInt &modulo) const
static void tcExtract(integerPart *, unsigned int dstCount, const integerPart *, unsigned int srcBits, unsigned int srcLSB)
mu magicu(unsigned LeadingZeros=0) const
static APInt getSignBit(unsigned BitWidth)
Get the SignBit for a specific bit width.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT byteSwap() const
double signedRoundToDouble() const
Converts this signed APInt to a double value.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT And(const APInt &RHS) const
static void tcXor(integerPart *, const integerPart *, unsigned int)
void flipAllBits()
Toggle every bit to its opposite value.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT abs() const
Get the absolute value;.
static int tcDivide(integerPart *lhs, const integerPart *rhs, integerPart *remainder, integerPart *scratch, unsigned int parts)
#define LLVM_ATTRIBUTE_UNUSED_RESULT
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
uint64_t getZExtValue() const
Get zero extended value.
static void tcSetLeastSignificantBits(integerPart *, unsigned int, unsigned int bits)
Set the least significant BITS and clear the rest.
double RoundAPIntToDouble(const APInt &APIVal)
Converts the given APInt to a double value.
APInt & operator+=(const APInt &RHS)
Addition assignment operator.
APInt GreatestCommonDivisor(const APInt &Val1, const APInt &Val2)
Compute GCD of two APInt values.
float RoundAPIntToFloat(const APInt &APIVal)
Converts the given APInt to a float vlalue.
bool operator!() const
Logical negation operator.
APInt byteSwap(const APInt &APIVal)
Returns a byte-swapped representation of the specified APInt Value.
void setBit(unsigned bitPosition)
Set a given bit to 1.
void print(raw_ostream &OS, bool isSigned) const
static unsigned getBitsNeeded(StringRef str, uint8_t radix)
Get bits required for string value.
bool sgt(uint64_t RHS) const
Signed greater than comparison.
bool ule(uint64_t RHS) const
Unsigned less or equal comparison.
bool isNonNegative() const
Determine if this APInt Value is non-negative (>= 0)
APInt smul_ov(const APInt &RHS, bool &Overflow) const
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
unsigned getActiveWords() const
Compute the number of active words in the value of this APInt.
static void sdivrem(const APInt &LHS, const APInt &RHS, APInt &Quotient, APInt &Remainder)
uint64_t getLimitedValue(uint64_t Limit=~0ULL) const
bool isMask(unsigned numBits, const APInt &APIVal)
void setAllBits()
Set every bit to 1.
APInt mul(const APInt &LHS, const APInt &RHS)
Function for multiplication operation.
double roundToDouble(bool isSigned) const
Converts this APInt to a double value.
bool operator!=(uint64_t Val) const
Inequality operator.
unsigned getNumSignBits() const
static integerPart tcIncrement(integerPart *, unsigned int)
Increment a bignum in-place. Return the carry flag.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
APInt operator+(const APInt &RHS) const
Addition operator.
bool uge(uint64_t RHS) const
Unsigned greater or equal comparison.
Magic data for optimising unsigned division by a constant.
static unsigned int tcLSB(const integerPart *, unsigned int)
void toStringUnsigned(SmallVectorImpl< char > &Str, unsigned Radix=10) const
static APInt getSignedMaxValue(unsigned numBits)
Gets maximum signed value of APInt for a specific bit width.
APInt add(const APInt &LHS, const APInt &RHS)
Function for addition operation.
APInt ssub_ov(const APInt &RHS, bool &Overflow) const
APInt Not(const APInt &APIVal)
Bitwise complement function.
bool isNegative() const
Determine sign of this APInt.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT rotl(unsigned rotateAmt) const
Rotate left by rotateAmt.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT urem(const APInt &RHS) const
Unsigned remainder operation.
unsigned CountTrailingOnes_64(uint64_t Value)
APInt & operator*=(const APInt &RHS)
Multiplication assignment operator.
bool isSignedIntN(unsigned N, const APInt &APIVal)
Check if the specified APInt has a N-bits signed integer value.
APInt urem(const APInt &LHS, const APInt &RHS)
Function for unsigned remainder operation.
APInt()
Default constructor that creates an uninitialized APInt.
uint64_t VAL
Used to store the <= 64 bits integer value.
static int tcMultiplyPart(integerPart *dst, const integerPart *src, integerPart multiplier, integerPart carry, unsigned int srcParts, unsigned int dstParts, bool add)
APInt LLVM_ATTRIBUTE_UNUSED_RESULT lshr(unsigned shiftAmt) const
Logical right-shift function.
APInt sshl_ov(unsigned Amt, bool &Overflow) const
static bool tcIsZero(const integerPart *, unsigned int)
Returns true if a bignum is zero, false otherwise.
unsigned logBase2(const APInt &APIVal)
Returns the floor log base 2 of the specified APInt value.
bool isShiftedMask(unsigned numBits, const APInt &APIVal)
Return true if the argument APInt value contains a sequence of ones with the remainder zero...
APInt umax(const APInt &A, const APInt &B)
Determine the larger of two APInts considered to be unsigned.
bool isIntN(unsigned N) const
Check if this APInt has an N-bits unsigned integer value.
enable_if_c< std::numeric_limits< T >::is_integer &&!std::numeric_limits< T >::is_signed, std::size_t >::type countLeadingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the most significant bit to the least stopping at the first 1...
static void tcNegate(integerPart *, unsigned int)
Negate a bignum in-place.
bool getBoolValue() const
Convert APInt to a boolean value.
APInt lshr(const APInt &LHS, unsigned shiftAmt)
Logical right-shift function.
static void tcAssign(integerPart *, const integerPart *, unsigned int)
Assign one bignum to another.
APInt operator-() const
Unary negation operator.
bool isIntN(unsigned N, const APInt &APIVal)
Check if the specified APInt has a N-bits unsigned integer value.
static void tcShiftLeft(integerPart *, unsigned int parts, unsigned int count)
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zextOrSelf(unsigned width) const
Zero extend or truncate to width.
APInt usub_ov(const APInt &RHS, bool &Overflow) const
APInt sub(const APInt &LHS, const APInt &RHS)
Function for subtraction operation.
APInt udiv(const APInt &LHS, const APInt &RHS)
Unsigned division function for APInt.
static int tcExtractBit(const integerPart *, unsigned int bit)
Extract the given bit of a bignum; returns 0 or 1. Zero-based.
bool slt(uint64_t RHS) const
Signed less than comparison.
static bool add(uint64_t *dest, const uint64_t *x, const uint64_t *y, unsigned len)
General addition of 64-bit integer arrays.
bool sgt(const APInt &RHS) const
Signed greather than comparison.
static void tcClearBit(integerPart *, unsigned int bit)
Clear the given bit of a bignum. Zero-based.
unsigned getActiveBits() const
Compute the number of active bits in the value.
hash_code hash_value(const APFloat &Arg)
APInt sdiv(const APInt &LHS, const APInt &RHS)
Signed division function for APInt.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT shl(unsigned shiftAmt) const
Left-shift function.
float RoundSignedAPIntToFloat(const APInt &APIVal)
Converts the given APInt to a float value.
APInt umul_ov(const APInt &RHS, bool &Overflow) const
APInt ashr(const APInt &LHS, unsigned shiftAmt)
Arithmetic right-shift function.
unsigned getMinSignedBits() const
Get the minimum bit size for this signed APInt.
APInt & operator--()
Prefix decrement operator.
bool ult(const APInt &RHS) const
Unsigned less than comparison.
bool operator==(uint64_t Val) const
Equality operator.
static integerPart tcDecrement(integerPart *, unsigned int)
Decrement a bignum in-place. Return the borrow flag.
bool needsCleanup() const
Returns whether this instance allocated memory.
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
bool operator==(const APInt &RHS) const
Equality operator.
static void tcSet(integerPart *, integerPart, unsigned int)
void toString(SmallVectorImpl< char > &Str, unsigned Radix, bool Signed, bool formatAsCLiteral=false) const
bool eq(const APInt &RHS) const
Equality comparison.
bool ugt(uint64_t RHS) const
Unsigned greater than comparison.
bool intersects(const APInt &RHS) const
APInt srem(const APInt &LHS, const APInt &RHS)
Function for signed remainder operation.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT trunc(unsigned width) const
Truncate to new width.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sextOrSelf(unsigned width) const
Sign extend or truncate to width.
APInt operator<<(const APInt &Bits) const
Left logical shift operator.
APInt operator*(const APInt &RHS) const
Multiplication operator.
bool sge(const APInt &RHS) const
Signed greather or equal comparison.
bool isMaxSignedValue() const
Determine if this is the largest signed value.
void flipBit(unsigned bitPosition)
Toggles a given bit to its opposite value.
int64_t getSExtValue() const
Get sign extended value.
APInt Or(const APInt &LHS, const APInt &RHS)
Bitwise OR function for APInt.
const unsigned int integerPartWidth
APInt Xor(const APInt &LHS, const APInt &RHS)
Bitwise XOR function for APInt.
APInt & operator=(const APInt &RHS)
Copy assignment operator.
static APInt getOneBitSet(unsigned numBits, unsigned BitNo)
Return an APInt with exactly one bit set in the result.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sext(unsigned width) const
Sign extend to a new width.
bool sle(const APInt &RHS) const
Signed less or equal comparison.
APInt getLoBits(unsigned numBits) const
Compute an APInt containing numBits lowbits from this APInt.
APInt sdiv_ov(const APInt &RHS, bool &Overflow) const
static unsigned int tcFullMultiply(integerPart *, const integerPart *, const integerPart *, unsigned, unsigned)
unsigned getBitWidth() const
Return the number of bits in the APInt.
bool uge(const APInt &RHS) const
Unsigned greater or equal comparison.
bool isMaxValue() const
Determine if this is the largest unsigned value.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sdiv(const APInt &RHS) const
Signed division function for APInt.
static unsigned getNumWords(unsigned BitWidth)
Get the number of words.
static integerPart tcAdd(integerPart *, const integerPart *, integerPart carry, unsigned)
DST += RHS + CARRY where CARRY is zero or one. Returns the carry flag.
unsigned countPopulation() const
Count the number of bits set.
unsigned CountPopulation_64(uint64_t Value)
static bool isSameValue(const APInt &I1, const APInt &I2)
Determine if two APInts have the same value, after zero-extending one of them (if needed!) to ensure ...
void dump() const
debug method
static int tcCompare(const integerPart *, const integerPart *, unsigned int)
Comparison (unsigned) of two bignums.
APInt & operator^=(const APInt &RHS)
Bitwise XOR assignment operator.
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT rotr(unsigned rotateAmt) const
Rotate right by rotateAmt.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT srem(const APInt &RHS) const
Function for signed remainder operation.
static void tcOr(integerPart *, const integerPart *, unsigned int)
static void tcSetBit(integerPart *, unsigned int bit)
Set the given bit of a bignum. Zero-based.
bool ugt(const APInt &RHS) const
Unsigned greather than comparison.
unsigned countTrailingZeros() const
Count the number of trailing zero bits.
double roundToDouble() const
Converts this unsigned APInt to a double value.
static APInt LLVM_ATTRIBUTE_UNUSED_RESULT doubleToBits(double V)
Converts a double to APInt bits.
APInt getHiBits(unsigned numBits) const
Compute an APInt containing numBits highbits from this APInt.
bool slt(const APInt &RHS) const
Signed less than comparison.
static void tcAnd(integerPart *, const integerPart *, unsigned int)
The obvious AND, OR and XOR and complement operations.
APInt & operator++()
Prefix increment operator.
unsigned logBase2() const
APInt(const APInt &that)
Copy Constructor.
bool isStrictlyPositive() const
Determine if this APInt Value is positive.
static APInt getMinValue(unsigned numBits)
Gets minimum unsigned value of APInt for a specific bit width.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sqrt() const
Compute the square root.
bool sge(uint64_t RHS) const
Signed greater or equal comparison.
int32_t exactLogBase2() const
APInt operator^(const APInt &RHS) const
Bitwise XOR operator.
APInt umin(const APInt &A, const APInt &B)
Determine the smaller of two APInts considered to be signed.
unsigned ceilLogBase2() const
APInt smax(const APInt &A, const APInt &B)
Determine the larger of two APInts considered to be signed.
static APInt getSplat(unsigned NewLen, const APInt &V)
Return a value containing V broadcasted over NewLen bits.
Class for arbitrary precision integers.
bool isSignedIntN(unsigned N) const
Check if this APInt has an N-bits signed integer value.
APInt operator<<(unsigned Bits) const
Left logical shift operator.
bool isPowerOf2_64(uint64_t Value)
APInt uadd_ov(const APInt &RHS, bool &Overflow) const
An opaque object representing a hash code.
static unsigned int tcMSB(const integerPart *parts, unsigned int n)
static APInt getMaxValue(unsigned numBits)
Gets maximum unsigned value of APInt for specific bit width.
bool isMinValue() const
Determine if this is the smallest unsigned value.
double bitsToDouble() const
Converts APInt bits to a double.
APInt And(const APInt &LHS, const APInt &RHS)
Bitwise AND function for APInt.
static APInt getBitsSet(unsigned numBits, unsigned loBit, unsigned hiBit)
Get a value with a block of bits set.
APInt & operator-=(const APInt &RHS)
Subtraction assignment operator.
APInt RoundFloatToAPInt(float Float, unsigned width)
Converts a float value into a APInt.
bool sle(uint64_t RHS) const
Signed less or equal comparison.
bool ult(uint64_t RHS) const
Unsigned less than comparison.
bool operator!=(uint64_t V1, const APInt &V2)
friend hash_code hash_value(const APInt &Arg)
Overload to compute a hash_code for an APInt value.
bool isAllOnesValue() const
Determine if all bits are set.
bool operator!=(const APInt &RHS) const
Inequality operator.
unsigned countLeadingOnes() const
Count the number of leading one bits.
Magic data for optimising signed division by a constant.
bool isMinSignedValue() const
Determine if this is the smallest signed value.
const uint64_t * getRawData() const
APInt operator~() const
Unary bitwise complement operator.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT udiv(const APInt &RHS) const
Unsigned division operation.
const unsigned int host_char_bit
static APInt LLVM_ATTRIBUTE_UNUSED_RESULT floatToBits(float V)
Converts a float to APInt bits.
APInt & operator|=(uint64_t RHS)
Bitwise OR assignment operator.
APInt & operator|=(const APInt &RHS)
Bitwise OR assignment operator.
void clearBit(unsigned bitPosition)
Set a given bit to 0.
static int tcMultiply(integerPart *, const integerPart *, const integerPart *, unsigned)
APInt(unsigned numBits, uint64_t val, bool isSigned=false)
Create a new APInt of numBits width, initialized as val.
bool isSignBit() const
Check if the APInt's value is returned by getSignBit.
APInt smin(const APInt &A, const APInt &B)
Determine the smaller of two APInts considered to be signed.
unsigned countTrailingOnes() const
Count the number of trailing one bits.
APInt & operator&=(const APInt &RHS)
Bitwise AND assignment operator.
APInt sadd_ov(const APInt &RHS, bool &Overflow) const
APInt & operator<<=(unsigned shiftAmt)
Left-shift assignment function.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
bool operator[](unsigned bitPosition) const
Array-indexing support.
static integerPart tcSubtract(integerPart *, const integerPart *, integerPart carry, unsigned)
DST -= RHS + CARRY where CARRY is zero or one. Returns the carry flag.
APInt operator&(const APInt &RHS) const
Bitwise AND operator.
APInt operator-(uint64_t RHS) const
static APInt getSignedMinValue(unsigned numBits)
Gets minimum signed value of APInt for a specific bit width.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT Or(const APInt &RHS) const
Bitwise OR function.
static void udivrem(const APInt &LHS, const APInt &RHS, APInt &Quotient, APInt &Remainder)
Dual division/remainder interface.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
APInt shl(const APInt &LHS, unsigned shiftAmt)
Left-shift function.
void Profile(FoldingSetNodeID &id) const
Profile - This method 'profiles' an APInt for use with FoldingSet.
const APInt operator--(int)
Postfix decrement operator.
static void tcComplement(integerPart *, unsigned int)
APInt LLVM_ATTRIBUTE_UNUSED_RESULT Xor(const APInt &RHS) const
Bitwise XOR function.
void toStringSigned(SmallVectorImpl< char > &Str, unsigned Radix=10) const
unsigned countLeadingZeros() const
The APInt version of the countLeadingZeros functions in MathExtras.h.
const APInt operator++(int)
Postfix increment operator.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zext(unsigned width) const
Zero extend to a new width.
bool operator==(uint64_t V1, const APInt &V2)
static APInt getNullValue(unsigned numBits)
Get the '0' value.
APInt RoundDoubleToAPInt(double Double, unsigned width)
Converts the given double value into a APInt.
static void tcShiftRight(integerPart *, unsigned int parts, unsigned int count)
bool ule(const APInt &RHS) const
Unsigned less or equal comparison.
double RoundSignedAPIntToDouble(const APInt &APIVal)
Converts the given APInt to a double value.
uint64_t * pVal
Used to store the >64 bits integer value.
bool ne(const APInt &RHS) const
Inequality comparison.
float bitsToFloat() const
Converts APInt bits to a double.
APInt operator+(uint64_t RHS) const
unsigned getNumWords() const
Get the number of words.