Class for arbitrary precision integers.More...
#include "llvm/ADT/APInt.h"
Public Types | |
enum class | Rounding {DOWN,TOWARD_ZERO,UP } |
typedefuint64_t | WordType |
Public Member Functions | |
Constructors | |
APInt (unsigned numBits,uint64_t val,boolisSigned=false,bool implicitTrunc=false) | |
Create a newAPInt of numBits width, initialized as val. | |
APInt (unsigned numBits,ArrayRef<uint64_t > bigVal) | |
Construct anAPInt of numBits width, initialized as bigVal[]. | |
APInt (unsigned numBits,unsigned numWords,constuint64_t bigVal[]) | |
Equivalent to APInt(numBits, ArrayRef<uint64_t>(bigVal, numWords)), but deprecated because this constructor is prone to ambiguity with the APInt(unsigned, uint64_t, bool) constructor. | |
APInt (unsigned numBits,StringRef str,uint8_t radix) | |
Construct anAPInt from a string representation. | |
APInt () | |
Default constructor that creates anAPInt with a 1-bit zero value. | |
APInt (constAPInt &that) | |
Copy Constructor. | |
APInt (APInt &&that) | |
Move Constructor. | |
~APInt () | |
Destructor. | |
Unary Operators | |
APInt | operator++ (int) |
Postfix increment operator. | |
APInt & | operator++ () |
Prefix increment operator. | |
APInt | operator-- (int) |
Postfix decrement operator. | |
APInt & | operator-- () |
Prefix decrement operator. | |
bool | operator! ()const |
Logical negation operation on thisAPInt returns true if zero, like normal integers. | |
Assignment Operators | |
APInt & | operator= (constAPInt &RHS) |
Copy assignment operator. | |
APInt & | operator= (APInt &&that) |
Move assignment operator. | |
APInt & | operator= (uint64_tRHS) |
Assignment operator. | |
APInt & | operator&= (constAPInt &RHS) |
Bitwise AND assignment operator. | |
APInt & | operator&= (uint64_tRHS) |
Bitwise AND assignment operator. | |
APInt & | operator|= (constAPInt &RHS) |
Bitwise OR assignment operator. | |
APInt & | operator|= (uint64_tRHS) |
Bitwise OR assignment operator. | |
APInt & | operator^= (constAPInt &RHS) |
Bitwise XOR assignment operator. | |
APInt & | operator^= (uint64_tRHS) |
Bitwise XOR assignment operator. | |
APInt & | operator*= (constAPInt &RHS) |
Multiplication assignment operator. | |
APInt & | operator*= (uint64_tRHS) |
APInt & | operator+= (constAPInt &RHS) |
Addition assignment operator. | |
APInt & | operator+= (uint64_tRHS) |
APInt & | operator-= (constAPInt &RHS) |
Subtraction assignment operator. | |
APInt & | operator-= (uint64_tRHS) |
APInt & | operator<<= (unsigned ShiftAmt) |
Left-shift assignment function. | |
APInt & | operator<<= (constAPInt &ShiftAmt) |
Left-shift assignment function. | |
Comparison Operators | |
bool | operator== (constAPInt &RHS)const |
Equality operator. | |
bool | operator== (uint64_t Val)const |
Equality operator. | |
bool | eq (constAPInt &RHS)const |
Equality comparison. | |
bool | operator!= (constAPInt &RHS)const |
Inequality operator. | |
bool | operator!= (uint64_t Val)const |
Inequality operator. | |
bool | ne (constAPInt &RHS)const |
Inequality comparison. | |
bool | ult (constAPInt &RHS)const |
Unsigned less than comparison. | |
bool | ult (uint64_tRHS)const |
Unsigned less than comparison. | |
bool | slt (constAPInt &RHS)const |
Signed less than comparison. | |
bool | slt (int64_tRHS)const |
Signed less than comparison. | |
bool | ule (constAPInt &RHS)const |
Unsigned less or equal comparison. | |
bool | ule (uint64_tRHS)const |
Unsigned less or equal comparison. | |
bool | sle (constAPInt &RHS)const |
Signed less or equal comparison. | |
bool | sle (uint64_tRHS)const |
Signed less or equal comparison. | |
bool | ugt (constAPInt &RHS)const |
Unsigned greater than comparison. | |
bool | ugt (uint64_tRHS)const |
Unsigned greater than comparison. | |
bool | sgt (constAPInt &RHS)const |
Signed greater than comparison. | |
bool | sgt (int64_tRHS)const |
Signed greater than comparison. | |
bool | uge (constAPInt &RHS)const |
Unsigned greater or equal comparison. | |
bool | uge (uint64_tRHS)const |
Unsigned greater or equal comparison. | |
bool | sge (constAPInt &RHS)const |
Signed greater or equal comparison. | |
bool | sge (int64_tRHS)const |
Signed greater or equal comparison. | |
bool | intersects (constAPInt &RHS)const |
This operation tests if there are any pairs of corresponding bits between thisAPInt and RHS that are both set. | |
bool | isSubsetOf (constAPInt &RHS)const |
This operation checks that all bits set in thisAPInt are also set in RHS. | |
Resizing Operators | |
APInt | trunc (unsigned width)const |
Truncate to new width. | |
APInt | truncUSat (unsigned width)const |
Truncate to new width with unsigned saturation. | |
APInt | truncSSat (unsigned width)const |
Truncate to new width with signed saturation. | |
APInt | sext (unsigned width)const |
Sign extend to a new width. | |
APInt | zext (unsigned width)const |
Zero extend to a new width. | |
APInt | sextOrTrunc (unsigned width)const |
Sign extend or truncate to width. | |
APInt | zextOrTrunc (unsigned width)const |
Zero extend or truncate to width. | |
Bit Manipulation Operators | |
void | setAllBits () |
Set every bit to 1. | |
void | setBit (unsigned BitPosition) |
Set the given bit to 1 whose position is given as "bitPosition". | |
void | setSignBit () |
Set the sign bit to 1. | |
void | setBitVal (unsigned BitPosition,bool BitValue) |
Set a given bit to a given value. | |
void | setBitsWithWrap (unsigned loBit,unsigned hiBit) |
Set the bits from loBit (inclusive) to hiBit (exclusive) to 1. | |
void | setBits (unsigned loBit,unsigned hiBit) |
Set the bits from loBit (inclusive) to hiBit (exclusive) to 1. | |
void | setBitsFrom (unsigned loBit) |
Set the top bits starting from loBit. | |
void | setLowBits (unsigned loBits) |
Set the bottom loBits bits. | |
void | setHighBits (unsigned hiBits) |
Set the top hiBits bits. | |
void | clearAllBits () |
Set every bit to 0. | |
void | clearBit (unsigned BitPosition) |
Set a given bit to 0. | |
void | clearLowBits (unsigned loBits) |
Set bottom loBits bits to 0. | |
void | clearHighBits (unsigned hiBits) |
Set top hiBits bits to 0. | |
void | clearSignBit () |
Set the sign bit to 0. | |
void | flipAllBits () |
Toggle every bit to its opposite value. | |
void | flipBit (unsigned bitPosition) |
Toggles a given bit to its opposite value. | |
void | negate () |
Negate thisAPInt in place. | |
void | insertBits (constAPInt &SubBits,unsigned bitPosition) |
Insert the bits from a smallerAPInt starting at bitPosition. | |
void | insertBits (uint64_t SubBits,unsigned bitPosition,unsigned numBits) |
APInt | extractBits (unsigned numBits,unsigned bitPosition)const |
Return anAPInt with the extracted bits [bitPosition,bitPosition+numBits). | |
uint64_t | extractBitsAsZExtValue (unsigned numBits,unsigned bitPosition)const |
Mathematics Operations | |
unsigned | logBase2 ()const |
unsigned | ceilLogBase2 ()const |
unsigned | nearestLogBase2 ()const |
int32_t | exactLogBase2 ()const |
APInt | sqrt ()const |
Compute the square root. | |
APInt | abs ()const |
Get the absolute value. | |
APInt | multiplicativeInverse ()const |
Static Public Member Functions | |
Value Generators | |
staticAPInt | getZero (unsigned numBits) |
Get the '0' value for the specified bit-width. | |
staticAPInt | getZeroWidth () |
Return anAPInt zero bits wide. | |
staticAPInt | getMaxValue (unsigned numBits) |
Gets maximum unsigned value ofAPInt for specific bit width. | |
staticAPInt | getSignedMaxValue (unsigned numBits) |
Gets maximum signed value ofAPInt for a specific bit width. | |
staticAPInt | getMinValue (unsigned numBits) |
Gets minimum unsigned value ofAPInt for a specific bit width. | |
staticAPInt | getSignedMinValue (unsigned numBits) |
Gets minimum signed value ofAPInt for a specific bit width. | |
staticAPInt | getSignMask (unsigned BitWidth) |
Get the SignMask for a specific bit width. | |
staticAPInt | getAllOnes (unsigned numBits) |
Return anAPInt of a specified width with all bits set. | |
staticAPInt | getOneBitSet (unsigned numBits,unsigned BitNo) |
Return anAPInt with exactly one bit set in the result. | |
staticAPInt | getBitsSet (unsigned numBits,unsigned loBit,unsigned hiBit) |
Get a value with a block of bits set. | |
staticAPInt | getBitsSetWithWrap (unsigned numBits,unsigned loBit,unsigned hiBit) |
Wrap version of getBitsSet. | |
staticAPInt | getBitsSetFrom (unsigned numBits,unsigned loBit) |
Constructs anAPInt value that has a contiguous range of bits set. | |
staticAPInt | getHighBitsSet (unsigned numBits,unsigned hiBitsSet) |
Constructs anAPInt value that has the top hiBitsSet bits set. | |
staticAPInt | getLowBitsSet (unsigned numBits,unsigned loBitsSet) |
Constructs anAPInt value that has the bottom loBitsSet bits set. | |
staticAPInt | getSplat (unsigned NewLen,constAPInt &V) |
Return a value containing V broadcasted over NewLen bits. | |
Static Public Attributes | |
static constexprunsigned | APINT_WORD_SIZE = sizeof(WordType) |
Byte size of a word. | |
static constexprunsigned | APINT_BITS_PER_WORD =APINT_WORD_SIZE * CHAR_BIT |
Bits in a word. | |
static constexprWordType | WORDTYPE_MAX = ~WordType(0) |
Building-block Operations for APInt and APFloat | |
struct | DenseMapInfo< APInt, void > |
class | APSInt |
void | Profile (FoldingSetNodeID &id)const |
Used to insertAPInt objects, or objects that containAPInt objects, into FoldingSets. | |
void | dump ()const |
debug method | |
bool | needsCleanup ()const |
Returns whether this instance allocated memory. | |
static void | tcSet (WordType *,WordType,unsigned) |
Sets the least significant part of a bignum to the input value, and zeroes out higher parts. | |
static void | tcAssign (WordType *,constWordType *,unsigned) |
Assign one bignum to another. | |
staticbool | tcIsZero (constWordType *,unsigned) |
Returns true if a bignum is zero, false otherwise. | |
static int | tcExtractBit (constWordType *,unsigned bit) |
Extract the given bit of a bignum; returns 0 or 1. Zero-based. | |
static void | tcExtract (WordType *,unsigned dstCount,constWordType *,unsigned srcBits,unsigned srcLSB) |
Copy the bit vector of width srcBITS from SRC, starting at bit srcLSB, to DST, of dstCOUNT parts, such that the bit srcLSB becomes the least significant bit of DST. | |
static void | tcSetBit (WordType *,unsigned bit) |
Set the given bit of a bignum. Zero-based. | |
static void | tcClearBit (WordType *,unsigned bit) |
Clear the given bit of a bignum. Zero-based. | |
staticunsigned | tcLSB (constWordType *,unsigned n) |
Returns the bit number of the least or most significant set bit of a number. | |
staticunsigned | tcMSB (constWordType *parts,unsigned n) |
Returns the bit number of the most significant set bit of a number. | |
static void | tcNegate (WordType *,unsigned) |
Negate a bignum in-place. | |
staticWordType | tcAdd (WordType *,constWordType *,WordType carry,unsigned) |
DST += RHS + CARRY where CARRY is zero or one. Returns the carry flag. | |
staticWordType | tcAddPart (WordType *,WordType,unsigned) |
DST += RHS. Returns the carry flag. | |
staticWordType | tcSubtract (WordType *,constWordType *,WordType carry,unsigned) |
DST -= RHS + CARRY where CARRY is zero or one. Returns the carry flag. | |
staticWordType | tcSubtractPart (WordType *,WordType,unsigned) |
DST -= RHS. Returns the carry flag. | |
static int | tcMultiplyPart (WordType *dst,constWordType *src,WordType multiplier,WordType carry,unsigned srcParts,unsigned dstParts,bool add) |
DST += SRC * MULTIPLIER + PART if add is true DST = SRC * MULTIPLIER + PART if add is false. | |
static int | tcMultiply (WordType *,constWordType *,constWordType *,unsigned) |
DST = LHS * RHS, where DST has the same width as the operands and is filled with the least significant parts of the result. | |
static void | tcFullMultiply (WordType *,constWordType *,constWordType *,unsigned,unsigned) |
DST = LHS * RHS, where DST has width the sum of the widths of the operands. | |
static int | tcDivide (WordType *lhs,constWordType *rhs,WordType *remainder,WordType *scratch,unsigned parts) |
If RHS is zero LHS and REMAINDER are left unchanged, return one. | |
static void | tcShiftLeft (WordType *,unsigned Words,unsigned Count) |
Shift a bignum left Count bits. | |
static void | tcShiftRight (WordType *,unsigned Words,unsigned Count) |
Shift a bignum right Count bits. | |
static int | tcCompare (constWordType *,constWordType *,unsigned) |
Comparison (unsigned) of two bignums. | |
staticWordType | tcIncrement (WordType *dst,unsigned parts) |
Increment a bignum in-place. Return the carry flag. | |
staticWordType | tcDecrement (WordType *dst,unsigned parts) |
Decrement a bignum in-place. Return the borrow flag. | |
Value Tests | |
hash_code | hash_value (constAPInt &Arg) |
Overload to compute ahash_code for anAPInt value. | |
bool | isSingleWord ()const |
Determine if thisAPInt just has one word to store value. | |
bool | isNegative ()const |
Determine sign of thisAPInt. | |
bool | isNonNegative ()const |
Determine if thisAPIntValue is non-negative (>= 0) | |
bool | isSignBitSet ()const |
Determine if sign bit of thisAPInt is set. | |
bool | isSignBitClear ()const |
Determine if sign bit of thisAPInt is clear. | |
bool | isStrictlyPositive ()const |
Determine if thisAPIntValue is positive. | |
bool | isNonPositive ()const |
Determine if thisAPIntValue is non-positive (<= 0). | |
bool | isOneBitSet (unsigned BitNo)const |
Determine if thisAPIntValue only has the specified bit set. | |
bool | isAllOnes ()const |
Determine if all bits are set. This is true for zero-width values. | |
bool | isZero ()const |
Determine if this value is zero, i.e. all bits are clear. | |
bool | isOne ()const |
Determine if this is a value of 1. | |
bool | isMaxValue ()const |
Determine if this is the largest unsigned value. | |
bool | isMaxSignedValue ()const |
Determine if this is the largest signed value. | |
bool | isMinValue ()const |
Determine if this is the smallest unsigned value. | |
bool | isMinSignedValue ()const |
Determine if this is the smallest signed value. | |
bool | isIntN (unsignedN)const |
Check if thisAPInt has an N-bits unsigned integer value. | |
bool | isSignedIntN (unsignedN)const |
Check if thisAPInt has an N-bits signed integer value. | |
bool | isPowerOf2 ()const |
Check if thisAPInt's value is a power of two greater than zero. | |
bool | isNegatedPowerOf2 ()const |
Check if thisAPInt's negated value is a power of two greater than zero. | |
bool | isAligned (AlignA)const |
Checks if thisAPInt -interpreted as an address- is aligned to the provided value. | |
bool | isSignMask ()const |
Check if theAPInt's value is returned by getSignMask. | |
bool | getBoolValue ()const |
ConvertAPInt to a boolean value. | |
uint64_t | getLimitedValue (uint64_t Limit=UINT64_MAX)const |
If this value is smaller than the specified limit, return it, otherwise return the limit value. | |
bool | isSplat (unsigned SplatSizeInBits)const |
Check if theAPInt consists of a repeated bit pattern. | |
bool | isMask (unsigned numBits)const |
bool | isMask ()const |
bool | isShiftedMask ()const |
Return true if thisAPInt value contains a non-empty sequence of ones with the remainder zero. | |
bool | isShiftedMask (unsigned &MaskIdx,unsigned &MaskLen)const |
Return true if thisAPInt value contains a non-empty sequence of ones with the remainder zero. | |
APInt | getHiBits (unsigned numBits)const |
Compute anAPInt containing numBits highbits from thisAPInt. | |
APInt | getLoBits (unsigned numBits)const |
Compute anAPInt containing numBits lowbits from thisAPInt. | |
constuint64_t * | getRawData ()const |
This function returns a pointer to the internal storage of theAPInt. | |
staticbool | isSameValue (constAPInt &I1,constAPInt &I2) |
Determine if two APInts have the same value, after zero-extending one of them (if needed!) to ensure that the bit-widths match. | |
Binary Operators | |
APInt | operator* (constAPInt &RHS)const |
Multiplication operator. | |
APInt | operator<< (unsigned Bits)const |
Left logical shift operator. | |
APInt | operator<< (constAPInt &Bits)const |
Left logical shift operator. | |
APInt | ashr (unsigned ShiftAmt)const |
Arithmetic right-shift function. | |
void | ashrInPlace (unsigned ShiftAmt) |
Arithmetic right-shift thisAPInt by ShiftAmt in place. | |
APInt | lshr (unsigned shiftAmt)const |
Logical right-shift function. | |
void | lshrInPlace (unsigned ShiftAmt) |
Logical right-shift thisAPInt by ShiftAmt in place. | |
APInt | shl (unsigned shiftAmt)const |
Left-shift function. | |
APInt | relativeLShr (int RelativeShift)const |
relative logical shift right | |
APInt | relativeLShl (int RelativeShift)const |
relative logical shift left | |
APInt | relativeAShr (int RelativeShift)const |
relative arithmetic shift right | |
APInt | relativeAShl (int RelativeShift)const |
relative arithmetic shift left | |
APInt | rotl (unsigned rotateAmt)const |
Rotate left by rotateAmt. | |
APInt | rotr (unsigned rotateAmt)const |
Rotate right by rotateAmt. | |
APInt | ashr (constAPInt &ShiftAmt)const |
Arithmetic right-shift function. | |
void | ashrInPlace (constAPInt &shiftAmt) |
Arithmetic right-shift thisAPInt by shiftAmt in place. | |
APInt | lshr (constAPInt &ShiftAmt)const |
Logical right-shift function. | |
void | lshrInPlace (constAPInt &ShiftAmt) |
Logical right-shift thisAPInt by ShiftAmt in place. | |
APInt | shl (constAPInt &ShiftAmt)const |
Left-shift function. | |
APInt | rotl (constAPInt &rotateAmt)const |
Rotate left by rotateAmt. | |
APInt | rotr (constAPInt &rotateAmt)const |
Rotate right by rotateAmt. | |
APInt | concat (constAPInt &NewLSB)const |
Concatenate the bits from "NewLSB" onto the bottom of *this. | |
APInt | udiv (constAPInt &RHS)const |
Unsigned division operation. | |
APInt | udiv (uint64_tRHS)const |
APInt | sdiv (constAPInt &RHS)const |
Signed division function forAPInt. | |
APInt | sdiv (int64_tRHS)const |
APInt | urem (constAPInt &RHS)const |
Unsigned remainder operation. | |
uint64_t | urem (uint64_tRHS)const |
APInt | srem (constAPInt &RHS)const |
Function for signed remainder operation. | |
int64_t | srem (int64_tRHS)const |
APInt | sadd_ov (constAPInt &RHS,bool &Overflow)const |
APInt | uadd_ov (constAPInt &RHS,bool &Overflow)const |
APInt | ssub_ov (constAPInt &RHS,bool &Overflow)const |
APInt | usub_ov (constAPInt &RHS,bool &Overflow)const |
APInt | sdiv_ov (constAPInt &RHS,bool &Overflow)const |
APInt | smul_ov (constAPInt &RHS,bool &Overflow)const |
APInt | umul_ov (constAPInt &RHS,bool &Overflow)const |
APInt | sshl_ov (constAPInt &Amt,bool &Overflow)const |
APInt | sshl_ov (unsigned Amt,bool &Overflow)const |
APInt | ushl_ov (constAPInt &Amt,bool &Overflow)const |
APInt | ushl_ov (unsigned Amt,bool &Overflow)const |
APInt | sfloordiv_ov (constAPInt &RHS,bool &Overflow)const |
Signed integer floor division operation. | |
APInt | sadd_sat (constAPInt &RHS)const |
APInt | uadd_sat (constAPInt &RHS)const |
APInt | ssub_sat (constAPInt &RHS)const |
APInt | usub_sat (constAPInt &RHS)const |
APInt | smul_sat (constAPInt &RHS)const |
APInt | umul_sat (constAPInt &RHS)const |
APInt | sshl_sat (constAPInt &RHS)const |
APInt | sshl_sat (unsignedRHS)const |
APInt | ushl_sat (constAPInt &RHS)const |
APInt | ushl_sat (unsignedRHS)const |
bool | operator[] (unsigned bitPosition)const |
Array-indexing support. | |
static void | udivrem (constAPInt &LHS,constAPInt &RHS,APInt &Quotient,APInt &Remainder) |
Dual division/remainder interface. | |
static void | udivrem (constAPInt &LHS,uint64_tRHS,APInt &Quotient,uint64_t &Remainder) |
static void | sdivrem (constAPInt &LHS,constAPInt &RHS,APInt &Quotient,APInt &Remainder) |
static void | sdivrem (constAPInt &LHS, int64_tRHS,APInt &Quotient, int64_t &Remainder) |
Value Characterization Functions | |
unsigned | getBitWidth ()const |
Return the number of bits in theAPInt. | |
unsigned | getNumWords ()const |
Get the number of words. | |
unsigned | getActiveBits ()const |
Compute the number of active bits in the value. | |
unsigned | getActiveWords ()const |
Compute the number of active words in the value of thisAPInt. | |
unsigned | getSignificantBits ()const |
Get the minimum bit size for this signedAPInt. | |
uint64_t | getZExtValue ()const |
Get zero extended value. | |
std::optional<uint64_t > | tryZExtValue ()const |
Get zero extended value if possible. | |
int64_t | getSExtValue ()const |
Get sign extended value. | |
std::optional< int64_t > | trySExtValue ()const |
Get sign extended value if possible. | |
unsigned | countl_zero ()const |
TheAPInt version of std::countl_zero. | |
unsigned | countLeadingZeros ()const |
unsigned | countl_one ()const |
Count the number of leading one bits. | |
unsigned | countLeadingOnes ()const |
unsigned | getNumSignBits ()const |
Computes the number of leading bits of thisAPInt that are equal to its sign bit. | |
unsigned | countr_zero ()const |
Count the number of trailing zero bits. | |
unsigned | countTrailingZeros ()const |
unsigned | countr_one ()const |
Count the number of trailing one bits. | |
unsigned | countTrailingOnes ()const |
unsigned | popcount ()const |
Count the number of bits set. | |
staticunsigned | getNumWords (unsigned BitWidth) |
Get the number of words. | |
staticunsigned | getBitsNeeded (StringRef str,uint8_t radix) |
Get bits required for string value. | |
staticunsigned | getSufficientBitsNeeded (StringRef Str,uint8_t Radix) |
Get the bits that are sufficient to represent the string value. | |
Conversion Functions | |
void | print (raw_ostream &OS,boolisSigned)const |
void | toString (SmallVectorImpl<char > &Str,unsigned Radix,boolSigned,bool formatAsCLiteral=false,bool UpperCase=true,bool InsertSeparators=false)const |
Converts anAPInt to a string and append it to Str. | |
void | toStringUnsigned (SmallVectorImpl<char > &Str,unsigned Radix=10)const |
Considers theAPInt to be unsigned and converts it into a string in the radix given. | |
void | toStringSigned (SmallVectorImpl<char > &Str,unsigned Radix=10)const |
Considers theAPInt to be signed and converts it into a string in the radix given. | |
APInt | byteSwap ()const |
APInt | reverseBits ()const |
double | roundToDouble (boolisSigned)const |
Converts thisAPInt to a double value. | |
double | roundToDouble ()const |
Converts this unsignedAPInt to a double value. | |
double | signedRoundToDouble ()const |
Converts this signedAPInt to a double value. | |
double | bitsToDouble ()const |
ConvertsAPInt bits to a double. | |
float | bitsToFloat ()const |
ConvertsAPInt bits to a float. | |
staticAPInt | doubleToBits (double V) |
Converts a double toAPInt bits. | |
staticAPInt | floatToBits (float V) |
Converts a float toAPInt bits. | |
Class for arbitrary precision integers.
APInt is a functional replacement for common case unsigned integer type like "unsigned", "unsigned long" or "uint64_t", but also allows non-byte-width integer sizes and large integer value types such as 3-bits, 15-bits, or more than 64-bits of precision.APInt provides a variety of arithmetic operators and methods to manipulate integer values of any bit-width. It supports both the typical integer arithmetic and comparison operations as well as bitwise manipulation.
The class has several invariants worth noting:
| strong |
| inline |
Create a newAPInt of numBits width, initialized as val.
If isSigned is true then val is treated as if it were a signed value (i.e. as an int64_t) and the appropriate sign extension to the bit width will be done. Otherwise, no sign extension occurs (high order bits beyond the range of val are zero filled).
numBits | the bit width of the constructedAPInt |
val | the initial value of theAPInt |
isSigned | how to treat signedness of val |
implicitTrunc | allow implicit truncation of non-zero/sign bits of val beyond the range of numBits |
Definition at line111 of fileAPInt.h.
Referencesassert(),BitWidth,clearUnusedBits(),llvm::isIntN(),isSigned(), andllvm::isUIntN().
Equivalent to APInt(numBits, ArrayRef<uint64_t>(bigVal, numWords)), but deprecated because this constructor is prone to ambiguity with the APInt(unsigned, uint64_t, bool) constructor.
If this overload is ever deleted, care should be taken to prevent calls from being incorrectly captured by the APInt(unsigned, uint64_t, bool) constructor.
Construct anAPInt from a string representation.
This constructor interprets the stringstr
in the given radix. The interpretation stops when the first character that is not suitable for the radix is encountered, or the end of the string. Acceptable radix values are 2, 8, 10, 16, and 36. It is an error for the value implied by the string to require more bits than numBits.
numBits | the bit width of the constructedAPInt |
str | the string to be interpreted |
radix | the radix to use for the conversion |
| inlineexplicit |
Default constructor that creates anAPInt with a 1-bit zero value.
Definition at line173 of fileAPInt.h.
Referenced bybyteSwap(),extractBits(),operator*(),reverseBits(),sext(),sqrt(),sshl_ov(),trunc(),udiv(),udivrem(),urem(),ushl_ov(),usub_sat(), andzext().
| inline |
Get the absolute value.
If *this is < 0 then return -(*this), otherwise *this. Note that the "most negative" signed number (e.g. -128 for 8 bit wideAPInt) is unchanged due to how negation works.
Definition at line1773 of fileAPInt.h.
Referenced bycombineSelectOfTwoConstants(),findGCD(),llvm::SelectionDAG::FoldConstantArithmetic(),llvm::InstCombinerImpl::foldICmpBinOp(),llvm::InstCombinerImpl::foldICmpSRemConstant(),gcd(),llvm::ScalarEvolution::getAddExpr(),llvm::ExpressionFormat::getMatchingString(), andgetRangeForAffineARHelper().
Arithmetic right-shift function.
Arithmetic right-shift thisAPInt by shiftAmt.
Definition at line827 of fileAPInt.h.
Referenced byllvm::ConstantRange::ashr(),llvm::ConstantFoldBinaryInstruction(),llvm::ConstantFoldBinOp(),llvm::InstCombinerImpl::foldICmpAndShift(),llvm::InstCombinerImpl::foldICmpShlConstant(),llvm::InstCombinerImpl::foldICmpShrConstant(),llvm::InstCombinerImpl::foldICmpShrConstConst(),FoldValue(),llvm::AArch64TTIImpl::getIntImmCost(),llvm::X86TTIImpl::getIntImmCost(),llvm::RISCVMatInt::getIntMatCost(),isNonZeroShift(),LowerShift(),performMulCombine(),setLimitsForBinOp(),llvm::InstCombinerImpl::simplifyShrShlDemandedBits(),llvm::Interpreter::visitAShr(), andllvm::InstCombinerImpl::visitSwitchInst().
Arithmetic right-shift thisAPInt by shiftAmt in place.
Arithmetic right-shift thisAPInt by shiftAmt.
Arithmetic right-shift function.
Definition at line1025 of fileAPInt.cpp.
ReferencesashrInPlace(), andgetLimitedValue().
| inline |
Arithmetic right-shift thisAPInt by ShiftAmt in place.
Definition at line834 of fileAPInt.h.
Referencesassert(),BitWidth,clearUnusedBits(), andllvm::SignExtend64().
Referenced byllvm::KnownBits::ashr(),ashrInPlace(),BuildExactSDIV(),llvm::CombinerHelper::buildSDivUsingMul(),combineVectorShiftImm(),llvm::X86TargetLowering::computeKnownBitsForTargetNode(), andllvm::SelectionDAG::FoldConstantArithmetic().
| inline |
ConvertsAPInt bits to a double.
The conversion does not do a translation from integer to double, it just re-interprets the bits as a double. Note that it is valid to do this on any bit width. Exactly 64 bits will be translated.
Definition at line1700 of fileAPInt.h.
Referenced byllvm::detail::IEEEFloat::convertToDouble(),llvm::convertToNonDenormSingle(), andllvm::ExecutionEngine::getConstantValue().
| inline |
ConvertsAPInt bits to a float.
The conversion does not do a translation from integer to float, it just re-interprets the bits as a float. Note that it is valid to do this on any bit width. Exactly 32 bits will be translated.
Definition at line1714 of fileAPInt.h.
Referenced byllvm::detail::IEEEFloat::convertToFloat(), andllvm::ExecutionEngine::getConstantValue().
APInt APInt::byteSwap | ( | ) | const |
Definition at line719 of fileAPInt.cpp.
ReferencesAPInt(),APINT_BITS_PER_WORD,assert(),getNumWords(),I, andN.
Referenced byllvm::DwarfExpression::addConstantFP(),llvm::KnownBits::byteSwap(),computeKnownBitsFromOperator(),foldBitwiseLogicWithIntrinsics(),llvm::SelectionDAG::FoldConstantArithmetic(), andllvm::TargetLowering::SimplifyDemandedBits().
| inline |
Definition at line1742 of fileAPInt.h.
ReferencesgetActiveBits().
Referenced byComputeNumSignBitsImpl(), andllvm::InstCombinerImpl::foldICmpUsingKnownBits().
| inline |
Set every bit to 0.
Definition at line1397 of fileAPInt.h.
Referenced byllvm::slpvectorizer::BoUpSLP::canVectorizeLoads(),combineAnd(),combineAndnp(),computeForSatAddSub(),llvm::SelectionDAG::computeKnownBits(),llvm::RISCVTargetLowering::computeKnownBitsForTargetNode(),llvm::X86TargetLowering::computeKnownBitsForTargetNode(),computeKnownBitsFromOperator(),llvm::KnownBits::resetAll(),llvm::KnownBits::setAllOnes(),llvm::KnownBits::setAllZero(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::InstCombinerImpl::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),llvm::X86TargetLowering::SimplifyMultipleUseDemandedBitsForTargetNode(), andllvm::InstCombinerImpl::simplifyShrShlDemandedBits().
| inline |
Set a given bit to 0.
Set the given bit to 0 whose position is given as "bitPosition".
Definition at line1407 of fileAPInt.h.
Referencesassert(), andBitWidth.
Referenced byllvm::SelectionDAG::computeKnownBits(),computeKnownBitsFromOperator(),computeKnownFPClass(),llvm::SelectionDAG::ComputeNumSignBits(),defaultComponentBroadcast(),llvm::TargetLowering::expandIS_FPCLASS(),getHopForBuildVector(),getSignedMaxValue(),isKnownNonZeroFromOperator(),llvm::possiblyDemandedEltsInMask(),llvm::recognizeBSwapOrBitReverseIdiom(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::InstCombinerImpl::SimplifyDemandedVectorElts(),llvm::X86TTIImpl::simplifyDemandedVectorEltsIntrinsic(),trimTrailingZerosInVector(), andllvm::ConstantRange::truncate().
| inline |
Set top hiBits bits to 0.
Definition at line1424 of fileAPInt.h.
Referencesassert(),BitWidth, andllvm::Keep.
Referenced byllvm::TargetLowering::SimplifyDemandedBits().
| inline |
Set bottom loBits bits to 0.
Definition at line1417 of fileAPInt.h.
Referencesassert(),BitWidth, andllvm::Keep.
Referenced bycomputeForSatAddSub(),llvm::SelectionDAG::computeKnownBits(),llvm::GISelKnownBits::computeKnownBitsImpl(),llvm::KnownBits::makeGE(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(), andllvm::ConstantRange::toKnownBits().
| inline |
Set the sign bit to 0.
Definition at line1431 of fileAPInt.h.
ReferencesBitWidth.
Referenced byllvm::KnownBits::abs(),computeForSatAddSub(),computeKnownBitsFromOperator(),foldLogOpOfMaskedICmps_NotAllZeros_BMask_Mixed(), andllvm::ConstantRange::fromKnownBits().
Concatenate the bits from "NewLSB" onto the bottom of *this.
This is equivalent to: (this->zext(NewWidth) << NewLSB.getBitWidth()) | NewLSB.zext(NewWidth)
If the result will be small, then both the merged values are small.
Definition at line947 of fileAPInt.h.
ReferencesgetBitWidth(),getBitWidth(), andVAL.
Referenced byllvm::KnownBits::concat().
| inline |
Count the number of leading one bits.
This function is anAPInt version of std::countl_one. It counts the number of ones from the most significant bit to the first zero bit.
Definition at line1594 of fileAPInt.h.
ReferencesBitWidth,llvm::countl_one(), andLLVM_UNLIKELY.
Referenced byllvm::KnownBits::computeForAddSub(),llvm::KnownBits::countMinLeadingOnes(),llvm::KnownBits::countMinLeadingZeros(),llvm::ConstantRange::ctpop(),llvm::InstCombinerImpl::foldICmpShrConstConst(),lower1BitShuffle(),lowerShuffleAsByteShiftMask(),lowerShuffleAsVALIGN(),lowerShuffleAsVTRUNCAndUnpack(),llvm::CombinerHelper::matchCombineShlOfExtend(),llvm::ConstantRange::shl(), andsshl_ov().
| inline |
TheAPInt version of std::countl_zero.
It counts the number of zeros from the most significant bit to the first one bit.
Definition at line1577 of fileAPInt.h.
ReferencesBitWidth, andllvm::countl_zero().
Referenced byareUsedBitsDense(),bitTrackingDCE(),llvm::TargetLowering::BuildUDIV(),llvm::CombinerHelper::buildUDivUsingMul(),llvm::KnownBits::computeForAddSub(),llvm::SelectionDAG::computeKnownBits(),llvm::KnownBits::countMaxLeadingOnes(),llvm::KnownBits::countMaxLeadingZeros(),llvm::SelectionDAG::FoldConstantArithmetic(),llvm::InstCombinerImpl::foldICmpShrConstant(),llvm::InstCombinerImpl::foldICmpShrConstConst(),llvm::ShuffleVectorInst::isInsertSubvectorMask(),llvm::KnownBits::mul(),PerformBFICombine(),processUMulZExtIdiom(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::InstCombinerImpl::SimplifyMultipleUseDemandedBits(),sshl_ov(),tryBitfieldInsertOpFromOr(),umul_ov(),ushl_ov(), andllvm::InstCombinerImpl::visitAdd().
| inline |
Definition at line1603 of fileAPInt.h.
Referencesllvm::countl_one().
Referenced bycomputeShlNSWWithNegLHS(), andfoldNegativePower2AndShiftedMask().
| inline |
Definition at line1585 of fileAPInt.h.
Referencesllvm::countl_zero().
Referenced bycomputeShlNSWWithNNegLHS(),computeShlNUW(),foldNegativePower2AndShiftedMask(),foldSelectICmpAndZeroShl(),llvm::KnownBits::sdiv(),llvm::TargetLowering::SimplifyDemandedBits(), andllvm::KnownBits::udiv().
| inline |
Count the number of trailing one bits.
This function is anAPInt version of std::countr_one. It counts the number of ones from the least significant bit to the first zero bit.
Definition at line1635 of fileAPInt.h.
Referencesllvm::countr_one().
Referenced bycombineAndMaskToShift(),combineShiftRightLogical(),llvm::KnownBits::countMinTrailingOnes(),llvm::KnownBits::countMinTrailingZeros(),llvm::InstCombinerImpl::foldICmpEquality(),foldSubCtlzNot(),lowerShuffleAsByteShiftMask(),lowerShuffleAsVALIGN(),llvm::CombinerHelper::matchCombineLoadWithAndMask(),PerformMinMaxToSatCombine(),llvm::TargetLowering::SimplifySetCC(), andllvm::ConstantRange::truncate().
| inline |
Count the number of trailing zero bits.
This function is anAPInt version of std::countr_zero. It counts the number of zeros from the least significant bit to the first set bit.
Definition at line1618 of fileAPInt.h.
ReferencesBitWidth, andllvm::countr_zero().
Referenced byareUsedBitsDense(),BuildExactSDIV(),BuildExactUDIV(),llvm::TargetLowering::buildSDIVPow2WithCMov(),llvm::CombinerHelper::buildSDivUsingMul(),llvm::CombinerHelper::buildUDivUsingMul(),canEvaluateShifted(),canonicalizeLogicFirst(),checkForNegativeOperand(),llvm::X86TargetLowering::computeKnownBitsForTargetNode(),llvm::KnownBits::countMaxTrailingOnes(),llvm::KnownBits::countMaxTrailingZeros(),EltsFromConsecutiveLoads(),llvm::TargetLowering::expandDIVREMByConstant(),llvm::SelectionDAG::FoldConstantArithmetic(),llvm::InstCombinerImpl::foldICmpShlConstant(),llvm::InstCombinerImpl::foldICmpShlConstConst(),llvm::InstCombinerImpl::foldICmpUsingKnownBits(),getPowerOf2Factor(),llvm::BuildVectorSDNode::getSplatValue(),isAligned(),llvm::ShuffleVectorInst::isInsertSubvectorMask(),PerformBFICombine(),performMulCombine(),processUGT_ADDCST_ADD(),simplifyAMDGCNMemoryIntrinsicDemanded(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),simplifyDiv(),llvm::X86TargetLowering::SimplifyMultipleUseDemandedBitsForTargetNode(),llvm::TargetLowering::SimplifySetCC(),tryBitfieldInsertOpFromOr(),llvm::InstCombinerImpl::visitAdd(),llvm::InstCombinerImpl::visitAnd(),llvm::InstCombinerImpl::visitMul(),llvm::InstCombinerImpl::visitSDiv(), andllvm::InstCombinerImpl::visitSub().
| inline |
Definition at line1641 of fileAPInt.h.
Referencesllvm::countr_one().
| inline |
Definition at line1626 of fileAPInt.h.
Referencesllvm::countr_zero().
Referenced byllvm::ScalarEvolution::getSmallConstantTripMultiple().
| inlinestatic |
Converts a double toAPInt bits.
The conversion does not do a translation from double to integer, it just re-interprets the bits of the double.
Definition at line1722 of fileAPInt.h.
Referenced byllvm::ExecutionEngine::getConstantValue(), andllvm::detail::IEEEFloat::IEEEFloat().
LLVM_DUMP_METHOD void APInt::dump | ( | ) | const |
debug method
Definition at line2272 of fileAPInt.cpp.
Referencesllvm::dbgs(),toStringSigned(), andtoStringUnsigned().
Equality comparison.
Compares thisAPInt with RHS for the validity of the equality relationship.
Definition at line1079 of fileAPInt.h.
ReferencesRHS.
Referenced bycombineShiftRightArithmetic(),llvm::omp::getBestVariantMatchForContext(),processUMulZExtIdiom(), andllvm::InstCombinerImpl::visitLShr().
| inline |
Definition at line1761 of fileAPInt.h.
Referenced bycombineAnd(),foldAddToAshr(),isSaturatingMinMax(),llvm::LoongArchDAGToDAGISel::selectVSplatUimmPow2(),llvm::InstCombinerImpl::visitAnd(), andllvm::InstCombinerImpl::visitTrunc().
Return anAPInt with the extracted bits [bitPosition,bitPosition+numBits).
Definition at line455 of fileAPInt.cpp.
ReferencesAPInt(),APINT_BITS_PER_WORD,assert(),getNumWords(), andisSingleWord().
Referenced bycombineX86ShufflesRecursively(),llvm::SelectionDAG::computeKnownBits(),llvm::SelectionDAG::ComputeNumSignBits(),computeZeroableShuffleElements(),EltsFromConsecutiveLoads(),llvm::KnownBits::extractBits(),llvm::extractConstantMask(),llvm::SelectionDAG::getConstant(),getConstantVector(),getExactInteger(),llvm::SelectionDAG::getNode(),llvm::X86TTIImpl::getScalarizationOverhead(),getTargetConstantBitsFromNode(),llvm::BuildVectorSDNode::isConstantSplat(),llvm::SelectionDAG::isSplatValue(),LowerBuildVectorv16i8(),lowerShuffleAsVTRUNC(),lowerShuffleWithVPMOV(),matchShuffleAsVTRUNC(),llvm::APIntOps::mulhs(),llvm::APIntOps::mulhu(),llvm::BuildVectorSDNode::recastRawBits(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::TargetLowering::SimplifyDemandedVectorElts(), andllvm::TargetLowering::SimplifyMultipleUseDemandedBits().
Definition at line493 of fileAPInt.cpp.
ReferencesAPINT_BITS_PER_WORD,assert(), andisSingleWord().
Referenced bygetMaxShiftAmount().
| inline |
Toggle every bit to its opposite value.
Definition at line1434 of fileAPInt.h.
ReferencesclearUnusedBits().
Referenced byllvm::InstCombinerImpl::foldICmpSRemConstant(),getUsefulBits(),getUsefulBitsFromBFM(), andinsert1BitVector().
void APInt::flipBit | ( | unsigned | bitPosition | ) |
Toggles a given bit to its opposite value.
Toggle a given bit to its opposite value whose position is given as "bitPosition".
Toggles a given bit to its opposite value.
Definition at line365 of fileAPInt.cpp.
Referencesassert(), andsetBitVal().
| inlinestatic |
Converts a float toAPInt bits.
The conversion does not do a translation from float to integer, it just re-interprets the bits of the float.
Definition at line1730 of fileAPInt.h.
Referenced byllvm::ExecutionEngine::getConstantValue(), andllvm::detail::IEEEFloat::IEEEFloat().
| inline |
Compute the number of active bits in the value.
This function returns the number of active bits which is defined as the bit width minus the number of leading zeros. This is used in several computations to see how "wide" the value is.
Definition at line1492 of fileAPInt.h.
ReferencesBitWidth, andllvm::countl_zero().
Referenced byllvm::APSInt::APSInt(),areUsedBitsDense(),canSafelyConvertTo16Bit(),ceilLogBase2(),llvm::TargetLowering::expandIS_FPCLASS(),llvm::InstCombinerImpl::foldICmpUsingKnownBits(),llvm::ConstantRange::getActiveBits(),llvm::getBitwiseNotOperand(),getConstantTripCount(),getPreferredVectorIndex(),llvm::ScalarEvolution::getSmallConstantTripMultiple(),llvm::LegalizerHelper::lowerISFPCLASS(),llvm::ARMTargetLowering::PerformCMOVToBFICombine(),performSETCCCombine(),rebuildExtCst(),roundToDouble(),simplifyAMDGCNMemoryIntrinsicDemanded(),simplifyAndInst(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::TargetLowering::SimplifySetCC(),sqrt(),llvm::X86TargetLowering::targetShrinkDemandedConstant(),llvm::ConstantRange::truncate(),llvm::tryPromoteCall(),udiv(),urem(), andllvm::InstCombinerImpl::visitICmpInst().
| inline |
Compute the number of active words in the value of thisAPInt.
This is used in conjunction with getActiveData to extract the raw value of theAPInt.
Definition at line1498 of fileAPInt.h.
Referenced byemitConstantRange().
Return anAPInt of a specified width with all bits set.
Definition at line234 of fileAPInt.h.
Referenced byllvm::analyzeKnownBitsFromAndXorOr(),llvm::ConstantRange::binaryNot(),llvm::buildSelectInst(),llvm::SelectionDAG::canCreateUndefOrPoison(),canTryToConstantAddTwoShiftAmounts(),llvm::slpvectorizer::BoUpSLP::canVectorizeLoads(),combineAddOfPMADDWD(),combineAnd(),combineAndnp(),combineBEXTR(),combineExtractVectorElt(),combineKSHIFT(),combineMOVMSK(),combinePDEP(),combinePMULDQ(),combinePredicateReduction(),combineShuffle(),combineTESTP(),combineVectorCompare(),combineVectorInsert(),combineVectorPack(),combineVectorShiftImm(),combineVectorShiftVar(),combineVPMADD(),combineVTRUNC(),combineX86INT_TO_FP(),combineX86ShuffleChain(),llvm::computeKnownBits(),llvm::SelectionDAG::computeKnownBits(),llvm::ARMTargetLowering::computeKnownBitsForTargetNode(),llvm::X86TargetLowering::computeKnownBitsForTargetNode(),computeKnownBitsFromOperator(),llvm::GISelKnownBits::computeKnownBitsImpl(),llvm::computeKnownFPClass(),computeKnownFPClass(),ComputeNumSignBits(),llvm::GISelKnownBits::computeNumSignBits(),llvm::SelectionDAG::ComputeNumSignBits(),computeShlNSW(),defaultComponentBroadcast(),detectSSatPattern(),llvm::TargetLowering::expandIS_FPCLASS(),findDemandedEltsByAllUsers(),findDemandedEltsBySingleUser(),llvm::InstCombinerImpl::foldICmpUsingKnownBits(),foldICmpUSubSatOrUAddSatWithConstant(),foldSelectICmpLshrAshr(),foldShiftIntoShiftInAnotherHandOfAndInICmp(),llvm::SelectionDAG::getAllOnesConstant(),llvm::APFloat::getAllOnesValue(),llvm::Constant::getAllOnesValue(),getBitcastWiderVectorElementOffset(),llvm::DemandedBits::getDemandedBits(),getDemandedBitsLHSMask(),getDemandedSrcElements(),getFauxShuffleMask(),getHopForBuildVector(),llvm::LoopVectorizationCostModel::getInstructionCost(),llvm::BasicTTIImplBase< T >::getInterleavedMemoryOpCost(),llvm::X86TTIImpl::getInterleavedMemoryOpCostAVX512(),llvm::GISelKnownBits::getKnownBits(),llvm::X86TTIImpl::getMaskedMemoryOpCost(),getRangeForIntrinsic(),llvm::BuildVectorSDNode::getRepeatedSequence(),llvm::BasicTTIImplBase< T >::getScalarizationOverhead(),llvm::SelectionDAG::getSplatSourceVector(),llvm::BuildVectorSDNode::getSplatValue(),getTargetConstantBitsFromNode(),getTargetShuffleInputs(),llvm::SelectionDAG::getValidMaximumShiftAmount(),llvm::SelectionDAG::getValidMinimumShiftAmount(),llvm::SelectionDAG::getValidShiftAmount(),llvm::isConstOrConstSplat(),llvm::isConstOrConstSplatFP(),llvm::SelectionDAG::isGuaranteedNotToBeUndefOrPoison(),llvm::isKnownNonEqual(),llvm::isKnownNonZero(),isKnownNonZeroFromOperator(),isNonZeroShift(),llvm::SelectionDAG::isSplatValue(),llvm::slpvectorizer::BoUpSLP::isTreeTinyAndNotFullyVectorizable(),llvm::LegalizerHelper::lowerISFPCLASS(),lowerShuffleAsElementInsertion(),LowerVectorAllEqual(),llvm::detail::IEEEFloat::makeNaN(),MatchVectorAllEqualTest(),narrowSDivOrSRem(),llvm::AArch64TargetLowering::PerformDAGCombine(),llvm::PPCTargetLowering::PerformDAGCombine(),llvm::possiblyDemandedEltsInMask(),llvm::recognizeBSwapOrBitReverseIdiom(),setLimitsForBinOp(),llvm::TargetLowering::ShrinkDemandedConstant(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::ARMTargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedInstructionBits(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::InstCombinerImpl::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),llvm::TargetLowering::SimplifyMultipleUseDemandedBits(),llvm::X86TargetLowering::SimplifyMultipleUseDemandedBitsForTargetNode(),llvm::TargetLowering::SimplifyMultipleUseDemandedVectorElts(),llvm::InstCombinerImpl::simplifyShrShlDemandedBits(),llvm::APFixedPoint::toString(),trimTrailingZerosInVector(),llvm::LegalizationArtifactCombiner::tryCombineZExt(),llvm::InstCombinerImpl::visitCallInst(),llvm::InstCombinerImpl::visitGetElementPtrInst(),llvm::InstCombinerImpl::visitInsertElementInst(),llvm::InstCombinerImpl::visitLShr(),llvm::InstCombinerImpl::visitShuffleVectorInst(),llvm::InstCombinerImpl::visitXor(), andllvm::LegalizerHelper::widenScalar().
Get bits required for string value.
This method determines how many bits are required to hold theAPInt equivalent of the string given bystr
.
Definition at line549 of fileAPInt.cpp.
Referencesassert(),llvm::StringRef::begin(),getSufficientBitsNeeded(),isNegative(),isPowerOf2(),logBase2(), andllvm::StringRef::size().
Get a value with a block of bits set.
Constructs anAPInt value that has a contiguous range of bits set. The bits from loBit (inclusive) to hiBit (exclusive) will be set. All other bits will be zero. For example, with parameters(32, 0, 16) you would get 0x0000FFFF. Please call getBitsSetWithWrap ifloBit
may be greater thanhiBit
.
numBits | the intended bit width of the result |
loBit | the index of the lowest bit set. |
hiBit | the index of the highest bit set. |
Definition at line258 of fileAPInt.h.
ReferencessetBits().
Referenced bycombineToExtendBoolVectorInReg(),computeShlNSWWithNNegLHS(),llvm::X86TTIImpl::getMemoryOpCost(),insert1BitVector(),LowerShift(),llvm::AMDGPUTargetLowering::PerformDAGCombine(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),simplifyX86immShift(),tryBitfieldInsertOpFromOr(),tryToMergePartialOverlappingStores(), andllvm::RegisterBankInfo::ValueMapping::verify().
Constructs anAPInt value that has a contiguous range of bits set.
The bits from loBit (inclusive) to numBits (exclusive) will be set. All other bits will be zero. For example, with parameters(32, 12) you would get 0xFFFFF000.
numBits | the intended bit width of the result |
loBit | the index of the lowest bit to set. |
Definition at line286 of fileAPInt.h.
ReferencessetBitsFrom().
Referenced bycanEvaluateTruncated(),combine_CC(),combineAddOfBooleanXor(),combineCMP(),combineDeMorganOfBoolean(),combineSetCC(),llvm::SelectionDAG::computeKnownBits(),llvm::slpvectorizer::BoUpSLP::computeMinimumValueSizes(),llvm::APFixedPoint::convert(),extractBits(),getDemandedBitsLHSMask(),llvm::SelectionDAG::getNode(),getTruncatedUSUBSAT(),isCTTZTable(),LowerPARITY(),llvm::RISCVTargetLowering::PerformDAGCombine(),llvm::RISCVDAGToDAGISel::selectZExtBits(),setLimitsForBinOp(),llvm::ConstantRange::shl(),llvm::TargetLowering::SimplifySetCC(),llvm::ConstantRange::truncate(),tryDemorganOfBooleanCondition(), andllvm::InstCombinerImpl::visitTrunc().
| inlinestatic |
Wrap version of getBitsSet.
IfhiBit
is bigger thanloBit
, this is same with getBitsSet. IfhiBit
is not bigger thanloBit
, the set bits "wrap". For example, with parameters (32, 28, 4), you would get 0xF000000F. IfhiBit
is equal toloBit
, you would get a result with all bits set.
Definition at line270 of fileAPInt.h.
ReferencessetBitsWithWrap().
Referenced byllvm::PPCInstrInfo::combineRLWINM(), andllvm::LegalizerHelper::lowerInsert().
| inline |
Return the number of bits in theAPInt.
Definition at line1468 of fileAPInt.h.
ReferencesBitWidth.
Referenced byllvm::DwarfExpression::addConstantFP(),llvm::DwarfUnit::addConstantValue(),llvm::APFixedPoint::APFixedPoint(),APIntToHexString(),llvm::TargetLowering::BuildUDIV(),llvm::CombinerHelper::buildUDivUsingMul(),canonicalizeGEPOfConstGEPI8(),combineCMov(),combineConcatVectorOps(),combineConstantPoolLoads(),combineSetCCMOVMSK(),combineShiftOfShiftedLogic(),CombineVMOVDRRCandidateWithVecOp(),llvm::InstCombinerImpl::commonIDivTransforms(),CompareSCEVComplexity(),llvm::APSInt::compareValues(),llvm::ObjectSizeOffsetVisitor::compute(),computeKnownBits(),llvm::SelectionDAG::computeKnownBits(),llvm::SystemZTargetLowering::computeKnownBitsForTargetNode(),llvm::X86TargetLowering::computeKnownBitsForTargetNode(),computeKnownBitsFromOperator(),llvm::GISelKnownBits::computeKnownBitsImpl(),computeKnownFPClass(),llvm::SelectionDAG::ComputeNumSignBits(),ComputeNumSignBitsImpl(),llvm::FunctionLoweringInfo::ComputePHILiveOutRegInfo(),computeShlNSWWithNegLHS(),computeShlNSWWithNNegLHS(),llvm::SelectionDAG::computeVectorKnownZeroElements(),concat(),llvm::ConstantFoldBinaryInstruction(),llvm::ConstantFoldBinOp(),llvm::ConstantRange::ConstantRange(),llvm::APFixedPoint::convert(),llvm::APFloat::convertToInteger(),emitGlobalConstantFP(),llvm::BinaryOperation::eval(),llvm::TargetLowering::expandDIVREMByConstant(),extractConstantWithoutWrapping(),extractShiftForRotate(),llvm::InstCombinerImpl::foldAddLikeCommutative(),llvm::SelectionDAG::FoldConstantArithmetic(),llvm::InstCombinerImpl::foldICmpAndConstConst(),llvm::InstCombinerImpl::foldICmpDivConstant(),llvm::InstCombinerImpl::foldICmpEquality(),llvm::InstCombinerImpl::foldICmpShlConstConst(),foldNoWrapAdd(),foldSelectICmpAnd(),FoldValueWithUndef(),getAVX512Node(),llvm::detail::SlowDynamicAPInt::getBitWidth(),llvm::ConstantInt::getBitWidth(),llvm::KnownBits::getBitWidth(),llvm::ExecutionEngine::getConstantValue(),getConstVector(),getFauxShuffleMask(),llvm::getHorizDemandedEltsForFirstOperand(),llvm::SwitchCG::getJumpTableRange(),getKnownUndefForVectorBinop(),llvm::SelectionDAG::getNode(),llvm::ScalarEvolution::getNonZeroConstantMultiple(),getPackDemandedElts(),llvm::getPtrStride(),GetQuadraticEquation(),getRangeForAffineARHelper(),llvm::BuildVectorSDNode::getRepeatedSequence(),llvm::BasicTTIImplBase< T >::getReplicationShuffleCost(),llvm::X86TTIImpl::getScalarizationOverhead(),getShiftAmount(),llvm::BuildVectorSDNode::getSplatValue(),llvm::SelectionDAG::getStepVector(),getStrideFromPointer(),getTargetConstantBitsFromNode(),getUsefulBits(),getUsefulBitsForUse(),getUsefulBitsFromAndWithImmediate(),getUsefulBitsFromBFM(),getUsefulBitsFromBitfieldMoveOpd(),llvm::SelectionDAG::getVScale(),insertBits(),llvm::ConstantRange::intrinsic(),llvm::TargetTransformInfoImplBase::isConstantStridedAccessLessThan(),llvm::TargetLowering::isConstTrueVal(),llvm::SelectionDAG::isGuaranteedNotToBeUndefOrPoison(),llvm::X86TargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode(),llvm::ARMTTIImpl::isHardwareLoopProfitable(),isKnownNonZero(),isKnownNonZeroFromOperator(),isMultiple(),isPoisonShift(),isSameValue(),isSaturatingMinMax(),isSplat(),llvm::SelectionDAG::isSplatValue(),llvm::X86TargetLowering::isSplatValueForTargetNode(),LowerVectorAllEqual(),MatchDiv(),MatchMul(),llvm::APIntOps::mulhs(),llvm::APIntOps::mulhu(),llvm::detail::SlowDynamicAPInt::operator%(),operator*(),llvm::detail::SlowDynamicAPInt::operator-(),optimizeIncrementingWhile(),ParseBFI(),parseHexOcta(),performANDCombine(),performMulCombine(),performORCombine(),PerformORCombine(),PerformSHLSimplify(),PerformUMinFpToSatCombine(),printConstant(),processUMulZExtIdiom(),llvm::BuildVectorSDNode::recastRawBits(),resolveTargetShuffleFromZeroables(),rotateModulo(),llvm::LoongArchDAGToDAGISel::selectShiftMask(),llvm::RISCVDAGToDAGISel::selectShiftMask(),llvm::LoongArchDAGToDAGISel::selectVSplatImm(),llvm::LoongArchDAGToDAGISel::selectVSplatUimmInvPow2(),llvm::LoongArchDAGToDAGISel::selectVSplatUimmPow2(),llvm::APFixedPoint::shl(),llvm::TargetLoweringBase::shouldFoldSelectWithSingleBitTest(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetShuffle(),simplifyICmpWithBinOpOnLHS(),simplifyIntrinsic(),simplifyIRemMulShl(),llvm::InstCombinerImpl::SimplifyMultipleUseDemandedBits(),llvm::TargetLowering::SimplifyMultipleUseDemandedBits(),llvm::X86TargetLowering::SimplifyMultipleUseDemandedBitsForTargetNode(),llvm::TargetLowering::SimplifySetCC(),sshl_ov(),sshl_sat(),llvm::ConstantRange::subtract(),llvm::SystemZVectorConstantInfo::SystemZVectorConstantInfo(),llvm::X86TargetLowering::targetShrinkDemandedConstant(),toSigned(),toString(),tryToMergePartialOverlappingStores(),ushl_ov(),ushl_sat(),llvm::SCEVDivision::visitConstant(), andllvm::InstCombinerImpl::visitICmpInst().
| inline |
ConvertAPInt to a boolean value.
This converts theAPInt to a boolean value as a test against zero.
Definition at line471 of fileAPInt.h.
ReferencesisZero().
Referenced byllvm::KnownBits::computeForAddCarry(),llvm::KnownBits::computeForSubBorrow(),llvm::APFixedPoint::getBoolValue(),getPowerOf2Factor(),getTargetConstantBitsFromNode(),llvm::ConstantRange::intrinsic(),isDereferenceableAndAlignedPointer(),llvm::isKnownToBeAPowerOfTwo(),provablyDisjointOr(),llvm::PPCTargetLowering::SelectAddressRegReg(),simplifyAndOfICmpsWithAdd(),simplifyOrOfICmpsWithAdd(),toString(), andwalkToAllocaAndPrependOffsetDeref().
Compute anAPInt containing numBits highbits from thisAPInt.
This function returns the high "numBits" bits of thisAPInt.
Get anAPInt with the same BitWidth as thisAPInt, just zero mask the low bits and right shift to the least significant bit.
Definition at line612 of fileAPInt.cpp.
Referenceslshr().
Referenced byllvm::SelectionDAG::computeKnownBits(),parseHexOcta(), andWriteAPFloatInternal().
Constructs anAPInt value that has the top hiBitsSet bits set.
numBits | the bitwidth of the result |
hiBitsSet | the number of high-order bits set in the result. |
Definition at line296 of fileAPInt.h.
ReferencessetHighBits().
Referenced bycanEvaluateZExtd(),combineAnd(),combineCMP(),combineMulToPMADDWD(),combineMulToPMULDQ(),combineOr(),combineTargetShuffle(),combineVectorPack(),combineZext(),llvm::ARMTargetLowering::computeKnownBitsForTargetNode(),llvm::AArch64TargetLowering::computeKnownBitsForTargetNode(),llvm::AMDGPUTargetLowering::computeKnownBitsForTargetNode(),llvm::X86TargetLowering::computeKnownBitsForTargetNode(),llvm::computeKnownBitsFromRangeMetadata(),computeShlNUW(),ConstantBuildVector(),EmitCmp(),llvm::TargetLowering::expandFixedPointMul(),llvm::TargetLowering::expandMUL_LOHI(),llvm::InstCombinerImpl::foldAddWithConstant(),llvm::InstCombinerImpl::foldICmpAndConstConst(),llvm::InstCombinerImpl::foldICmpEqIntrinsicWithConstant(),llvm::InstCombinerImpl::foldICmpShrConstant(),llvm::InstCombinerImpl::foldICmpTruncConstant(),foldMaskAndShiftToScale(),foldShiftedShift(),getFauxShuffleMask(),getValueFromICmpCtpop(),isFPSatMinMaxPattern(),llvm::AArch64TTIImpl::isProfitableToSinkOperands(),isTruncWithZeroHighBitsInput(),LowerFunnelShift(),LowerMUL(),LowerShiftByScalarImmediate(),llvm::AMDGPUTargetLowering::LowerUDIVREM64(),matchShuffleWithPACK(),llvm::ARMTargetLowering::PerformDAGCombine(),PerformSHLSimplify(),PerformVMOVNCombine(),PerformVQMOVNCombine(),llvm::RISCVTargetLowering::ReplaceNodeResults(),SaturateWidenedDIVFIX(),selectUmullSmull(),llvm::LoongArchDAGToDAGISel::selectZExti32(),setLimitsForBinOp(),llvm::ConstantRange::signExtend(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),llvm::ARMTTIImpl::simplifyDemandedVectorEltsIntrinsic(),llvm::TargetLowering::SimplifySetCC(),simplifyUnaryIntrinsic(),tryLowerToSLI(),llvm::InstCombinerImpl::visitBitCast(),llvm::InstCombinerImpl::visitShl(),llvm::InstCombinerImpl::visitSub(), andllvm::InstCombinerImpl::visitZExt().
| inline |
If this value is smaller than the specified limit, return it, otherwise return the limit value.
This causes the value to saturate to the limit.
Definition at line475 of fileAPInt.h.
Referenced byadjustByValArgAlignment(),ashrInPlace(),decompose(),extractBits(),llvm::InstCombinerImpl::foldICmpEquality(),llvm::InstCombinerImpl::foldICmpShlConstant(),llvm::InstCombinerImpl::foldICmpShrConstant(),llvm::InstCombinerImpl::foldICmpXorShiftConst(),getAssignmentInfoImpl(),llvm::ConstantInt::getLimitedValue(),getMaxShiftAmount(),llvm::BlockFrequencyInfoImplBase::getProfileCountFromFreq(),getUnsigned(),getValueFromICmpCtpop(),isConstantSplatVectorMaskForType(),lshrInPlace(),operator<<=(),ParseBFI(),rotateModulo(),llvm::scaleProfData(),setShiftFlags(),simplifyAndInst(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),simplifySetCCWithCTPOP(),sshl_ov(),switchToLookupTable(), andushl_ov().
Compute anAPInt containing numBits lowbits from thisAPInt.
This function returns the low "numBits" bits of thisAPInt.
Get anAPInt with the same BitWidth as thisAPInt, just zero mask the high bits.
Definition at line617 of fileAPInt.cpp.
ReferencesgetLowBitsSet().
Referenced bymatchRotateSub(),llvm::KnownBits::mul(),parseHexOcta(),llvm::X86TTIImpl::simplifyDemandedVectorEltsIntrinsic(), andWriteAPFloatInternal().
Constructs anAPInt value that has the bottom loBitsSet bits set.
numBits | the bitwidth of the result |
loBitsSet | the number of low-order bits set in the result. |
Definition at line306 of fileAPInt.h.
ReferencessetLowBits().
Referenced bybuildBitFieldInsert(),llvm::TargetLowering::buildSDIVPow2WithCMov(),llvm::MachineIRBuilder::buildZExtInReg(),canEvaluateShiftedShift(),clampDynamicVectorIndex(),clampVectorIndex(),combineBT(),combineCMP(),combineCVTPH2PS(),combineMOVMSK(),combinePredicateReduction(),combineSetCCMOVMSK(),combineVEXTRACT_STORE(),llvm::SelectionDAG::computeKnownBits(),llvm::ConstantFoldBinaryInstruction(),llvm::TargetLowering::expandDIVREMByConstant(),llvm::TargetLowering::expandFixedPointMul(),llvm::TargetLowering::expandUnalignedStore(),extractBits(),llvm::InstCombinerImpl::foldICmpBinOp(),llvm::InstCombinerImpl::foldICmpEqIntrinsicWithConstant(),llvm::InstCombinerImpl::foldICmpEquality(),llvm::InstCombinerImpl::foldICmpIntrinsicWithConstant(),llvm::InstCombinerImpl::foldICmpShlConstant(),llvm::InstCombinerImpl::foldICmpTruncConstant(),foldShiftedShift(),llvm::TargetLowering::forceExpandMultiply(),llvm::UnsignedDivisionByConstantInfo::get(),getLoBits(),getShiftedValue(),getTruncatedUSUBSAT(),getValueFromICmpCtpop(),llvm::SelectionDAG::getVPZeroExtendInReg(),llvm::SelectionDAG::getZeroExtendInReg(),llvm::ARMTTIImpl::instCombineIntrinsic(),llvm::X86TTIImpl::instCombineIntrinsic(),lowerBuildVectorViaPacking(),LowerEXTEND_VECTOR_INREG(),llvm::LegalizerHelper::lowerFCopySign(),LowerFunnelShift(),LowerMUL(),LowerShiftByScalarImmediate(),matchRotateSub(),MatchVectorAllEqualTest(),ParseBFI(),llvm::ARMTargetLowering::PerformDAGCombine(),llvm::RISCVTargetLowering::PerformDAGCombine(),llvm::ARMTargetLowering::PerformIntrinsicCombine(),PerformPREDICATE_CASTCombine(),performTBISimplification(),performTruncateCombine(),performVectorShiftCombine(),PerformVMOVhrCombine(),PerformVMOVNCombine(),PerformVQMOVNCombine(),performZExtUZPCombine(),processUGT_ADDCST_ADD(),SaturateWidenedDIVFIX(),llvm::TargetLowering::scalarizeVectorLoad(),llvm::ConstantRange::signExtend(),simplifyAndInst(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),llvm::ARMTTIImpl::simplifyDemandedVectorEltsIntrinsic(),simplifyMul24(),llvm::InstCombinerImpl::SimplifyMultipleUseDemandedBits(),llvm::TargetLowering::SimplifySetCC(),simplifyX86insertq(),simplifyX86pack(),simplifyX86VPERMMask(),llvm::X86TargetLowering::targetShrinkDemandedConstant(),tryLowerToSLI(),llvm::InstCombinerImpl::visitAnd(),llvm::InstCombinerImpl::visitCallInst(),llvm::InstCombinerImpl::visitLShr(),llvm::InstCombinerImpl::visitSwitchInst(), andllvm::InstCombinerImpl::visitZExt().
Gets maximum unsigned value ofAPInt for specific bit width.
Definition at line206 of fileAPInt.h.
Referenced byllvm::calculateUpperBound(),llvm::cannotBeMaxInLoop(),llvm::ConstantRange::castOp(),computeForSatAddSub(),detectSSatUPattern(),detectUSatUPattern(),llvm::TargetLowering::expandFixedPointMul(),llvm::TargetLowering::expandFP_TO_INT_SAT(),llvm::TargetLowering::expandShlSat(),foldBoxMultiply(),llvm::InstCombinerImpl::foldFCmpIntToFPConst(),llvm::InstCombinerImpl::foldICmpAddOpConst(),llvm::SCEVExpander::generateOverflowCheck(),getIdentityValueForAtomicOp(),llvm::getMinMaxLimit(),getRangeForAffineARHelper(),getRangeForIntrinsic(),llvm::MinMaxIntrinsic::getSaturationPoint(),llvm::ScalarEvolution::getTripCountFromExitCount(),llvm::ConstantRange::getUnsignedMax(),llvm::ScalarEvolution::getZeroExtendExprImpl(),isSafeIncreasingBound(),llvm::ConstantRange::isSizeLargerThan(),llvm::LegalizerHelper::lowerFPTOINT_SAT(),llvm::LegalizerHelper::lowerShlSat(),llvm::fuzzerop::makeConstantsWithType(),makeExactMulNUWRegion(),llvm::ConstantRange::makeGuaranteedNoWrapRegion(),llvm::X86InstrInfo::optimizeCompareInstr(),processUMulZExtIdiom(),setLimitsForBinOp(),llvm::TargetLowering::SimplifySetCC(),llvm::ConstantRange::truncate(),truncUSat(),uadd_sat(),umul_sat(),ushl_sat(), andllvm::ScalarEvolution::willNotOverflow().
Gets minimum unsigned value ofAPInt for a specific bit width.
Definition at line216 of fileAPInt.h.
Referenced byllvm::cannotBeMinInLoop(),llvm::ConstantRange::castOp(),computeForSatAddSub(),llvm::TargetLowering::expandFP_TO_INT_SAT(),llvm::InstCombinerImpl::foldFCmpIntToFPConst(),getIdentityValueForAtomicOp(),llvm::getMinMaxLimit(),llvm::MinMaxIntrinsic::getSaturationPoint(),llvm::ConstantRange::getUnsignedMin(),getUnsignedOverflowLimitForStep(),isSafeDecreasingBound(),llvm::LegalizerHelper::lowerFPTOINT_SAT(),llvm::ConstantRange::makeAllowedICmpRegion(),llvm::fuzzerop::makeConstantsWithType(),makeExactMulNUWRegion(),llvm::ConstantRange::makeGuaranteedNoWrapRegion(),llvm::TargetLowering::SimplifySetCC(), andllvm::ScalarEvolution::willNotOverflow().
| inline |
Computes the number of leading bits of thisAPInt that are equal to its sign bit.
Definition at line1607 of fileAPInt.h.
Referencesllvm::countl_one(), andllvm::countl_zero().
Referenced byllvm::SelectionDAG::computeKnownBits(),llvm::SelectionDAG::ComputeNumSignBits(),computeNumSignBitsFromRangeMetadata(),ComputeNumSignBitsImpl(),llvm::FunctionLoweringInfo::ComputePHILiveOutRegInfo(), andllvm::X86TargetLowering::targetShrinkDemandedConstant().
| inline |
Get the number of words.
Here one word's bitwidth equals to that of uint64_t.
Definition at line1475 of fileAPInt.h.
ReferencesBitWidth, andgetNumWords().
Referenced bybyteSwap(),llvm::detail::IEEEFloat::convertFromAPInt(),llvm::APFloat::convertToInteger(),emitGlobalConstantFP(),extractBits(),getNumWords(),llvm::hash_value(),llvm::detail::IEEEFloat::makeNaN(),operator*(),operator*=(),operator++(),operator+=(),operator--(),operator-=(),printConstant(),Profile(),sext(),trunc(),udiv(),udivrem(),urem(),writeFunctionTypeMetadataRecords(), andzext().
Return anAPInt with exactly one bit set in the result.
Definition at line239 of fileAPInt.h.
ReferencessetBit().
Referenced byBinomialCoefficient(),llvm::TargetLowering::BuildUDIV(),llvm::CombinerHelper::buildUDivUsingMul(),llvm::slpvectorizer::BoUpSLP::canVectorizeLoads(),combineCMP(),combineShiftAnd1ToBitTest(),llvm::InstCombinerImpl::commonIDivTransforms(),llvm::SelectionDAG::computeKnownBits(),llvm::ARMTargetLowering::computeKnownBitsForTargetNode(),llvm::X86TargetLowering::computeKnownBitsForTargetNode(),computeKnownBitsFromOperator(),computeKnownFPClass(),llvm::SelectionDAG::ComputeNumSignBits(),llvm::SelectionDAG::computeVectorKnownZeroElements(),llvm::TargetLowering::expandBITREVERSE(),llvm::TargetLowering::expandDIVREMByConstant(),llvm::TargetLowering::expandIS_FPCLASS(),extractShiftForRotate(),findDemandedEltsBySingleUser(),llvm::InstCombinerImpl::foldICmpEqIntrinsicWithConstant(),llvm::InstCombinerImpl::foldICmpEquality(),llvm::InstCombinerImpl::foldICmpIntrinsicWithConstant(),llvm::InstCombinerImpl::foldICmpShlConstant(),foldSelectICmpAndBinOp(),llvm::ScalarEvolution::getPowerOfTwo(),getStrideAndModOffsetOfGEP(),llvm::ARMTTIImpl::instCombineIntrinsic(),isKnownNonZeroFromOperator(),llvm::SelectionDAG::isSplatValue(),lowerFTRUNC_FCEIL_FFLOOR_FROUND(),llvm::LegalizerHelper::lowerISFPCLASS(),LowerShift(),lowerVectorFTRUNC_FCEIL_FFLOOR_FROUND(),lowerVectorStrictFTRUNC_FCEIL_FFLOOR_FROUND(),llvm::fuzzerop::makeConstantsWithType(),llvm::ConstantRange::makeMaskNotEqualRange(),matchBinaryOp(),MatchBinaryOp(),matchBinaryShuffle(),performSETCCCombine(),processUMulZExtIdiom(),scalarizeMaskedCompressStore(),scalarizeMaskedExpandLoad(),scalarizeMaskedGather(),scalarizeMaskedLoad(),scalarizeMaskedScatter(),scalarizeMaskedStore(),setLimitsForBinOp(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),simplifyIntrinsic(),llvm::X86TargetLowering::SimplifyMultipleUseDemandedBitsForTargetNode(),simplifyX86immShift(),SolveLinEquationWithOverflow(),llvm::APIntOps::SolveQuadraticEquationWrap(),llvm::InstCombinerImpl::visitICmpInst(),llvm::LegalizerHelper::widenScalar(), andllvm::ConstantRange::zeroExtend().
This function returns a pointer to the internal storage of theAPInt.
This is useful for writing out theAPInt in binary form without any conversions.
Definition at line569 of fileAPInt.h.
Referenced byllvm::DwarfUnit::addConstantValue(),llvm::detail::IEEEFloat::convertFromAPInt(),llvm::detail::IEEEFloat::convertFromZeroExtendedInteger(),emitGlobalConstantFP(),emitGlobalConstantLargeInt(),llvm::getExpressionForConstant(),llvm::HexagonLowerToMC(),insertBits(),llvm::detail::IEEEFloat::makeNaN(),printConstant(),sext(),llvm::ExecutionEngine::StoreValueToMemory(),toString(),trunc(),writeFunctionTypeMetadataRecords(), andzext().
| inline |
Get sign extended value.
This method attempts to return the value of thisAPInt as a sign extended int64_t. The bit width must be <= 64 or the value must fit within an int64_t. Otherwise an assertion will result.
Definition at line1542 of fileAPInt.h.
Referencesassert(),BitWidth, andllvm::SignExtend64().
Referenced byllvm::DwarfUnit::addConstantValue(),llvm::InterleavedAccessInfo::analyzeInterleaving(),llvm::TargetLowering::BuildSDIV(),checkIfSafeAddSequence(),combineAndOrForCcmpCtest(),combineX86SubCmpForFlags(),emitConstantRange(),llvm::TargetTransformInfoImplCRTPBase< T >::getGEPCost(),llvm::CoroSubFnInst::getIndex(),llvm::AArch64TTIImpl::getIntImmCost(),llvm::X86TTIImpl::getIntImmCost(),llvm::RISCVMatInt::getIntMatCost(),getMinimalBaseOfPointer(),llvm::GetPointerBaseWithConstantOffset(),llvm::getPointersDiff(),llvm::getPtrStride(),getSalvageOpsForGEP(),llvm::ConstantInt::getSExtValue(),getStrideFromPointer(),llvm::remarks::Argument::getValAsInt(),getVShiftImm(),instCombineSVESDIV(),llvm::TargetTransformInfoImplBase::isConstantStridedAccessLessThan(),llvm::RISCVTargetLowering::isDesirableToCommuteWithShift(),llvm::SIInstrInfo::isInlineConstant(),llvm::AArch64TargetLowering::isMulAddWithConstProfitable(),llvm::ARMTargetLowering::isMulAddWithConstProfitable(),isSimpleVIDSequence(),LLVMGenericValueToInt(),llvm::AsmPrinter::lowerConstant(),llvm::CombinerHelper::matchPtrAddImmedChain(),rotateSign(),llvm::RISCVDAGToDAGISel::Select(),llvm::RISCVDAGToDAGISel::selectScalarFPAsInt(),llvm::LoongArchDAGToDAGISel::selectVSplatImm(),selectVSplatImmHelper(),llvm::LoopVectorizationCostModel::setVectorizedCallDecision(),llvm::TargetLowering::SimplifySetCC(),toString(),tryCombineShiftImm(), andtryFoldHelper().
Gets maximum signed value ofAPInt for a specific bit width.
Definition at line209 of fileAPInt.h.
ReferencesclearBit().
Referenced byllvm::calculateUpperBound(),llvm::cannotBeMaxInLoop(),llvm::ConstantRange::castOp(),combineMinMaxReduction(),combineTruncToVnclip(),computeForSatAddSub(),detectSSatPattern(),detectSSatSPattern(),llvm::TargetLowering::expandAddSubSat(),llvm::TargetLowering::expandFixedPointMul(),llvm::TargetLowering::expandFP_TO_INT_SAT(),llvm::TargetLowering::expandIS_FPCLASS(),llvm::TargetLowering::expandRoundInexactToOdd(),llvm::TargetLowering::expandShlSat(),llvm::InstCombinerImpl::foldFCmpIntToFPConst(),llvm::InstCombinerImpl::foldICmpAddConstant(),llvm::InstCombinerImpl::foldICmpAddOpConst(),foldICmpXNegX(),llvm::UnsignedDivisionByConstantInfo::get(),getIdentityValueForAtomicOp(),llvm::ConstantExpr::getIntrinsicIdentity(),llvm::getMinMaxLimit(),llvm::SelectionDAG::getNeutralElement(),getRangeForIntrinsic(),getRangeForSelectPattern(),llvm::MinMaxIntrinsic::getSaturationPoint(),llvm::ConstantRange::getSignedMax(),getSignedOverflowLimitForStep(),isNonZeroAdd(),isSafeIncreasingBound(),LowerADDSAT_SUBSAT(),llvm::LegalizerHelper::lowerAddSubSatToMinMax(),llvm::LegalizerHelper::lowerFAbs(),LowerFABSorFNEG(),lowerFABSorFNEG(),LowerFCOPYSIGN(),lowerFCOPYSIGN(),llvm::LegalizerHelper::lowerFPTOINT_SAT(),llvm::LegalizerHelper::lowerISFPCLASS(),llvm::LegalizerHelper::lowerShlSat(),llvm::fuzzerop::makeConstantsWithType(),makeExactMulNSWRegion(),llvm::ConstantRange::makeGuaranteedNoWrapRegion(),llvm::X86InstrInfo::optimizeCompareInstr(),sadd_sat(),llvm::KnownBits::sdiv(),setLimitsForBinOp(),llvm::ConstantRange::signedAddMayOverflow(),llvm::ConstantRange::signedSubMayOverflow(),llvm::TargetLowering::SimplifySetCC(),simplifyX86pack(),smul_sat(),sshl_sat(),ssub_sat(),truncSSat(),llvm::LegalizerHelper::widenScalar(), andllvm::ScalarEvolution::willNotOverflow().
Gets minimum signed value ofAPInt for a specific bit width.
Definition at line219 of fileAPInt.h.
ReferencessetBit().
Referenced byllvm::ConstantRange::abs(),llvm::cannotBeMinInLoop(),canonicalizeForInvariantConditionInjection(),llvm::ConstantRange::castOp(),combineMinMaxReduction(),combineTruncToVnclip(),computeForSatAddSub(),detectSSatPattern(),detectSSatSPattern(),llvm::TargetLowering::expandAddSubSat(),llvm::TargetLowering::expandFixedPointMul(),llvm::TargetLowering::expandFP_TO_INT_SAT(),llvm::TargetLowering::expandShlSat(),foldAddToAshr(),llvm::InstCombinerImpl::foldFCmpIntToFPConst(),llvm::InstCombinerImpl::foldICmpAddConstant(),llvm::InstCombinerImpl::foldICmpAndConstant(),llvm::InstCombinerImpl::foldICmpCommutative(),foldMinimumOverTrailingOrLeadingZeroCount(),llvm::SignedDivisionByConstantInfo::get(),llvm::UnsignedDivisionByConstantInfo::get(),getIdentityValueForAtomicOp(),llvm::ConstantExpr::getIntrinsicIdentity(),llvm::getMinMaxLimit(),llvm::ScalarEvolution::getMulExpr(),llvm::SelectionDAG::getNeutralElement(),getRangeForIntrinsic(),getRangeForSelectPattern(),llvm::MinMaxIntrinsic::getSaturationPoint(),llvm::RecurrenceDescriptor::getSentinelValue(),llvm::ConstantRange::getSignedMin(),getSignedOverflowLimitForStep(),llvm::RecurrenceDescriptor::isFindLastIVPattern(),isSafeDecreasingBound(),LowerADDSAT_SUBSAT(),llvm::LegalizerHelper::lowerAddSubSatToAddoSubo(),llvm::LegalizerHelper::lowerAddSubSatToMinMax(),llvm::LegalizerHelper::lowerFPTOINT_SAT(),llvm::LegalizerHelper::lowerShlSat(),llvm::ConstantRange::makeAllowedICmpRegion(),llvm::fuzzerop::makeConstantsWithType(),makeExactMulNSWRegion(),llvm::ConstantRange::makeGuaranteedNoWrapRegion(),llvm::ConstantRange::multiplyWithNoWrap(),narrowSDivOrSRem(),llvm::X86InstrInfo::optimizeCompareInstr(),processAbsIntrinsic(),sadd_sat(),llvm::ConstantRange::sdiv(),llvm::RISCVDAGToDAGISel::Select(),setLimitsForBinOp(),llvm::ConstantRange::signedAddMayOverflow(),llvm::ConstantRange::signedSubMayOverflow(),llvm::TargetLowering::SimplifySetCC(),simplifyX86pack(),smul_sat(),sshl_sat(),ssub_sat(),truncSSat(),llvm::InstCombinerImpl::visitCallInst(),llvm::InstCombinerImpl::visitSDiv(),llvm::LegalizerHelper::widenScalar(), andllvm::ScalarEvolution::willNotOverflow().
| inline |
Get the minimum bit size for this signedAPInt.
Computes the minimum bit width for thisAPInt while considering it to be a signed (and probably negative) value. If the value is not negative, this function returns the same value asgetActiveBits()+1. Otherwise, it returns the smallest bit width that will retain the negative value. For example, -1 can be written as 0b1 or 0xFFFFFFFFFF. 0b1 is shorter and so for -1, this function will always return 1.
Definition at line1511 of fileAPInt.h.
ReferencesBitWidth.
Referenced byllvm::APSInt::APSInt(),canFoldIVIncExpr(),combineShiftRightLogical(),eliminateDeadSwitchCases(),llvm::RISCVTargetLowering::isDesirableToCommuteWithShift(),rebuildExtCst(),llvm::TargetLowering::SimplifySetCC(),llvm::RISCVTargetLowering::targetShrinkDemandedConstant(), andllvm::InstCombinerImpl::visitSDiv().
Get the SignMask for a specific bit width.
This is just a wrapper function ofgetSignedMinValue(), and it helps code readability when we want to get a SignMask.
Definition at line229 of fileAPInt.h.
ReferencesBitWidth.
Referenced bycheckSignTestSetCCCombine(),combineAVG(),combineGatherScatter(),combineMaskedLoad(),combineMaskedStore(),combinePTESTCC(),combineStore(),combineVSelectToBLENDV(),combineX86GatherScatter(),computeShlNSWWithNegLHS(),llvm::decomposeBitTestICmp(),llvm::TargetLowering::expandFP_TO_SINT(),llvm::TargetLowering::expandFP_TO_UINT(),llvm::TargetLowering::expandIS_FPCLASS(),llvm::TargetLowering::expandRoundInexactToOdd(),foldAndToUsubsat(),llvm::InstCombinerImpl::foldICmpSRemConstant(),getDemandedBitsLHSMask(),llvm::LegalizerHelper::lower(),LowerFABSorFNEG(),lowerFABSorFNEG(),llvm::LegalizerHelper::lowerFCopySign(),LowerFCOPYSIGN(),lowerFCOPYSIGN(),llvm::LegalizerHelper::lowerFPTOSI(),llvm::LegalizerHelper::lowerFPTOUI(),llvm::LegalizerHelper::lowerISFPCLASS(),LowerShift(),LowerVSETCC(),llvm::RISCVTargetLowering::PerformDAGCombine(),llvm::GISelKnownBits::signBitIsZero(),llvm::SelectionDAG::SignBitIsZero(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::InstCombinerImpl::visitAShr(),llvm::InstCombinerImpl::visitCallInst(),llvm::InstCombinerImpl::visitShl(), andllvm::InstCombinerImpl::visitSRem().
Return a value containing V broadcasted over NewLen bits.
Definition at line624 of fileAPInt.cpp.
Referenced bycombineAddOfPMADDWD(),combineSubShiftToOrcB(),computeKnownBitsForPMADDUBSW(),computeKnownBitsForPMADDWD(),llvm::TargetLowering::expandBITREVERSE(),llvm::TargetLowering::expandCTPOP(),llvm::TargetLowering::expandVPBITREVERSE(),llvm::TargetLowering::expandVPCTPOP(),extractConstantBits(),getAvailableLoadStore(),llvm::VNCoercion::getConstantMemInstValueForLoad(),getMemsetValue(),getTargetConstantBitsFromNode(),llvm::X86TTIImpl::instCombineIntrinsic(),llvm::SelectionDAG::isSplatValue(),llvm::LegalizerHelper::lowerBitCount(),llvm::LegalizerHelper::lowerBitreverse(),LowerShift(),PerformVMOVNCombine(),PerformVQMOVNCombine(),llvm::InstCombinerImpl::SimplifyAnyMemSet(),llvm::ARMTTIImpl::simplifyDemandedVectorEltsIntrinsic(),llvm::X86TTIImpl::simplifyDemandedVectorEltsIntrinsic(), andtryToRecognizePopCount().
Get the bits that are sufficient to represent the string value.
This may over estimate the amount of bits required, but it does not require parsing the value in the string.
Definition at line517 of fileAPInt.cpp.
Referencesassert().
Referenced bygetBitsNeeded().
Get the '0' value for the specified bit-width.
Definition at line200 of fileAPInt.h.
Referenced byllvm::ConstantRange::abs(),adjustByValArgAlignment(),llvm::SwitchCG::SwitchLowering::buildBitTests(),llvm::TargetLowering::BuildUDIV(),llvm::CombinerHelper::buildUDivUsingMul(),cmpExcludesZero(),combineCONCAT_VECTORS(),combineConcatVectorOps(),combineMOVMSK(),combineOr(),combineShuffleToZeroExtendVectorInReg(),combineVectorCompare(),combineVectorPack(),combineX86ShuffleChain(),combineX86ShufflesConstants(),combineX86ShufflesRecursively(),llvm::ObjectSizeOffsetVisitor::compute(),llvm::SelectionDAG::computeKnownBits(),computeKnownBitsFromOperator(),llvm::SelectionDAG::ComputeNumSignBits(),computeShlNSW(),llvm::SelectionDAG::computeVectorKnownZeroElements(),computeZeroableShuffleElements(),llvm::ConstantFoldCastInstruction(),llvm::ConstantRange::ctlz(),llvm::ConstantRange::ctpop(),llvm::ConstantRange::cttz(),llvm::decomposeBitTestICmp(),detectSSatPattern(),EltsFromConsecutiveLoads(),estimateBitMaskedAndLowerBound(),llvm::TargetLowering::expandFP_TO_UINT(),extractConstantBits(),llvm::SelectionDAG::FoldConstantArithmetic(),foldCtpop(),foldICmpUSubSatOrUAddSatWithConstant(),foldSelectICmpLshrAshr(),foldSwitchToSelect(),FoldValueWithUndef(),llvm::SCEVExpander::generateOverflowCheck(),llvm::BuildVectorSDNode::getConstantRawBits(),getConstVector(),getDomain(),getElementIndex(),getExtractedDemandedElts(),llvm::getHorizDemandedEltsForFirstOperand(),llvm::TargetTransformInfoImplCRTPBase< T >::getInstructionCost(),llvm::BasicTTIImplBase< T >::getInterleavedMemoryOpCost(),llvm::X86TTIImpl::getInterleavedMemoryOpCostAVX512(),llvm::APFixedPoint::getIntPart(),llvm::BasicTTIImplBase< T >::getIntrinsicInstrCost(),getKnownUndefForVectorBinop(),getPackDemandedElts(),getRangeForIntrinsic(),getRangeForSelectPattern(),llvm::getShuffleDemandedElts(),getSizeWithOverflow(),getSplatableConstant(),getTargetConstantBitsFromNode(),getTargetShuffleAndZeroables(),llvm::slpvectorizer::BoUpSLP::getTreeCost(),getUnsignedCountTrailingZerosRange(),llvm::getVScaleRange(),isCompletePermute(),llvm::X86TargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode(),llvm::ShuffleVectorInst::isInsertSubvectorMask(),isKnownNonZeroFromOperator(),llvm::SelectionDAG::isSplatValue(),llvm::X86TargetLowering::isSplatValueForTargetNode(),isTargetShuffleEquivalent(),LowerFMINIMUM_FMAXIMUM(),llvm::LegalizerHelper::lowerFPTOUI(),LowerShift(),lowerShuffleAsElementInsertion(),lowerShuffleAsLanePermuteAndPermute(),llvm::ConstantRange::makeAllowedICmpRegion(),llvm::ConstantRange::makeGuaranteedNoWrapRegion(),llvm::detail::IEEEFloat::makeNaN(),matchBinaryShuffle(),matchScalarReduction(),MatchVectorAllEqualTest(),llvm::ConstantRange::multiply(),llvm::ConstantRange::multiplyWithNoWrap(),rebuildExtCst(),llvm::BuildVectorSDNode::recastRawBits(),resolveZeroablesFromTargetShuffle(),scalarConstantToHexString(),llvm::APIntOps::ScaleBitMask(),llvm::ConstantRange::sdiv(),llvm::ConstantRange::shl(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),llvm::TargetLowering::SimplifyMultipleUseDemandedBits(),simplifyX86pack(),llvm::ConstantRange::srem(),stripAndComputeConstantOffsets(),llvm::ConstantRange::urem(), andllvm::reassociate::XorOpnd::XorOpnd().
| inlinestatic |
| inline |
Get zero extended value.
This method attempts to return the value of thisAPInt as a zero extended uint64_t. The bitwidth must be <= 64 or the value must fit within a uint64_t. Otherwise an assertion will result.
Definition at line1520 of fileAPInt.h.
Referencesassert().
Referenced byllvm::DwarfExpression::addConstantFP(),llvm::DwarfUnit::addConstantValue(),llvm::CombinerHelper::applyFunnelShiftConstantModulo(),llvm::buildSelectInst(),canEvaluateShiftedShift(),canEvaluateZExtd(),collectBitParts(),combineCMov(),combineCMP(),combineExtractWithShuffle(),llvm::PPCInstrInfo::combineRLWINM(),combineTargetShuffle(),CombineVMOVDRRCandidateWithVecOp(),llvm::InstCombinerImpl::commonIDivTransforms(),llvm::ProfileSummaryBuilder::computeDetailedSummary(),computeFlagsForAddressComputation(),llvm::RISCVTargetLowering::computeKnownBitsForTargetNode(),llvm::AMDGPUTargetLowering::computeKnownBitsForTargetNode(),computeKnownBitsFromOperator(),llvm::X86TargetLowering::ComputeNumSignBitsForTargetNode(),ComputeNumSignBitsImpl(),convertIntToDoubleImm(),llvm::TargetLowering::CTTZTableLookup(),DecodeXR32RegisterClass(),llvm::Interpreter::exitCalled(),llvm::extractConstantMask(),extractShiftForRotate(),llvm::InstCombinerImpl::foldICmpShlConstant(),llvm::InstCombinerImpl::foldICmpTruncConstant(),foldLoadsRecursive(),foldSelectICmpAndZeroShl(),llvm::InstCombinerImpl::FoldShiftByConstant(),foldShiftedShift(),foldSubCtlzNot(),foldVecExtTruncToExtElt(),llvm::generateSpecConstantInst(),getArrayComponentCount(),getConstant(),llvm::ExecutionEngine::getConstantValue(),llvm::getConstFromIntrinsic(),llvm::getExpressionForConstant(),llvm::getObjectSize(),llvm::SelectionDAG::getShiftAmountConstant(),llvm::ScalarEvolution::getSmallConstantTripMultiple(),llvm::GStepVector::getStep(),llvm::AArch64TargetMachine::getSubtargetImpl(),getVariantMatchScore(),llvm::ConstantInt::getZExtValue(),llvm::mca::initializeUsedResources(),llvm::GCNTTIImpl::instCombineIntrinsic(),isEXTMask(),llvm::AArch64TargetLowering::isFPImmLegal(),isKnownTypeIdMember(),llvm::AArch64TargetLowering::isMulAddWithConstProfitable(),llvm::ARMTargetLowering::isMulAddWithConstProfitable(),llvm::SystemZVectorConstantInfo::isVectorConstantLegal(),LLVMGenericValueToInt(),LowerShiftByScalarImmediate(),matchAndOrChain(),matchIntPart(),matchPMADDWD(),matchPMADDWD_2(),narrowIndex(),optimizeIncrementingWhile(),optimizeLogicalImm(),parseHexOcta(),parseJumpTable(),PerformANDCombine(),llvm::AMDGPUTargetLowering::PerformDAGCombine(),performDSPShiftCombine(),performMulCombine(),PerformORCombine(),PerformSHLSimplify(),llvm::X86TargetLowering::preferedOpcodeForCmpEqPiecesOfOperand(),printConstant(),llvm::NVPTXFloatMCExpr::printImpl(),llvm::ExecutionEngine::runFunctionAsMain(),llvm::PPCTargetLowering::SelectAddressRegImm(),llvm::PPCTargetLowering::SelectAddressRegImm34(),llvm::LoopVectorizationPlanner::selectEpilogueVectorizationFactor(),selectI64ImmDirect(),selectI64ImmDirectPrefix(),llvm::LoongArchDAGToDAGISel::selectVSplatImm(),llvm::InstCombinerImpl::SimplifyMultipleUseDemandedBits(),llvm::InstCombinerImpl::simplifyShrShlDemandedBits(),simplifyX86extrq(),simplifyX86insertq(),simplifyX86varShift(),splitGlobal(),llvm::SystemZVectorConstantInfo::SystemZVectorConstantInfo(),toString(),toString(),tryBitfieldInsertOpFromOrAndImm(),tryCombineToBSL(),llvm::tryPromoteCall(),urem(),llvm::Interpreter::visitAllocaInst(),llvm::InstCombinerImpl::visitAnd(),llvm::Interpreter::visitAShr(),llvm::InstCombinerImpl::visitAShr(),llvm::Interpreter::visitExtractElementInst(),llvm::Interpreter::visitInsertElementInst(),llvm::Interpreter::visitLShr(),llvm::InstCombinerImpl::visitLShr(),llvm::Interpreter::visitShl(),llvm::InstCombinerImpl::visitShl(),walkToAllocaAndPrependOffsetDeref(), andWriteAPFloatInternal().
Insert the bits from a smallerAPInt starting at bitPosition.
Definition at line370 of fileAPInt.cpp.
ReferencesAPINT_BITS_PER_WORD,APINT_WORD_SIZE,assert(),getBitWidth(),getRawData(),isSingleWord(),setBitVal(),VAL, andWORDTYPE_MAX.
Referenced bycombineConcatVectorOps(),llvm::SelectionDAG::computeKnownBits(),llvm::SelectionDAG::ComputeNumSignBits(),llvm::extractConstantMask(),getDemandedSrcElements(),getSplatableConstant(),getTargetConstantBitsFromNode(),llvm::KnownBits::insertBits(),llvm::BuildVectorSDNode::isConstantSplat(),llvm::RISCVTargetLowering::PerformDAGCombine(),rebuildExtCst(),llvm::BuildVectorSDNode::recastRawBits(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::TargetLowering::SimplifyDemandedVectorElts(), andllvm::TargetLowering::SimplifyMultipleUseDemandedBits().
Definition at line428 of fileAPInt.cpp.
ReferencesisSingleWord().
This operation tests if there are any pairs of corresponding bits between thisAPInt and RHS that are both set.
Definition at line1249 of fileAPInt.h.
Referencesassert(),BitWidth, andRHS.
Referenced bybitTrackingDCE(),combineBlendOfPermutes(),eliminateDeadSwitchCases(),llvm::InstCombinerImpl::foldICmpAndConstant(),foldLogOpOfMaskedICmps_NotAllZeros_BMask_Mixed(),foldSignedTruncationCheck(),llvm::KnownBits::hasConflict(),isKnownNonEqual(),isNonZeroAdd(),simplifyAndInst(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),llvm::TargetLowering::SimplifySetCC(), andllvm::KnownBits::srem().
Checks if thisAPInt -interpreted as an address- is aligned to the provided value.
Definition at line169 of fileAPInt.cpp.
ReferencesA,countr_zero(),isZero(), andllvm::Log2().
| inline |
Determine if all bits are set. This is true for zero-width values.
Definition at line371 of fileAPInt.h.
ReferencesBitWidth.
Referenced byareUsedBitsDense(),bitTrackingDCE(),llvm::TargetLowering::BuildSDIV(),llvm::slpvectorizer::BoUpSLP::canVectorizeLoads(),combineX86ShufflesRecursively(),llvm::InstCombinerImpl::commonIDivTransforms(),createAndInstr(),EltsFromConsecutiveLoads(),EmitVectorComparison(),llvm::extractConstantMask(),findDemandedEltsByAllUsers(),foldAndOrOfSETCC(),foldBinOpIntoSelectIfProfitable(),llvm::InstCombinerImpl::foldICmpAddConstant(),llvm::InstCombinerImpl::foldICmpDivConstant(),llvm::InstCombinerImpl::foldICmpMulConstant(),llvm::InstCombinerImpl::foldICmpShrConstConst(),llvm::X86TTIImpl::getScalarizationOverhead(),getTargetConstantBitsFromNode(),llvm::KnownBits::isAllOnes(),llvm::SelectionDAG::isBoolConstant(),isCompletePermute(),llvm::ISD::isConstantSplatVectorAllOnes(),llvm::TargetLowering::isConstTrueVal(),llvm::ConstantInt::isMinusOne(),isMultiple(),llvm::isSafeToSpeculativelyExecuteWithOpcode(),isSelect01(),isVectorAllOnes(),llvm::KnownBits::isZero(),lowerShuffleAsVTRUNC(),lowerShuffleWithVPMOV(),lowerVECTOR_SHUFFLE(),llvm::SDPatternMatch::m_True(),matchMinMax(),matchShuffleAsEXTRQ(),matchShuffleAsVTRUNC(),PerformReduceShuffleCombine(),llvm::recognizeBSwapOrBitReverseIdiom(),llvm::ConstantRange::sdiv(),llvm::KnownBits::sdiv(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::InstCombinerImpl::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetShuffle(),llvm::RegisterBankInfo::ValueMapping::verify(),llvm::InstCombinerImpl::visitExtractElementInst(),llvm::InstCombinerImpl::visitGetElementPtrInst(),llvm::InstCombinerImpl::visitMul(), andllvm::InstCombinerImpl::visitOr().
Check if thisAPInt has an N-bits unsigned integer value.
Definition at line432 of fileAPInt.h.
ReferencesN.
Referenced byAreMulWideOperandsDemotable(),combineVectorPack(),llvm::ScalarEvolution::getUDivExactExpr(),mustBeFiniteCountedLoop(),parseHexOcta(),llvm::LoongArchDAGToDAGISel::selectVSplatImm(), andtruncUSat().
| inline |
Definition at line501 of fileAPInt.h.
ReferencesBitWidth, andllvm::isMask_64().
numBits | ones starting at the least significant bit with the remainder zero. |
Definition at line488 of fileAPInt.h.
Referencesassert(), andBitWidth.
Referenced bycombineAndMaskToShift(),combineSetCCMOVMSK(),combineShiftRightLogical(),combineTruncToVnclip(),combineVectorMulToSraBitcast(),detectUSatPattern(),llvm::InstCombinerImpl::foldAddWithConstant(),llvm::InstCombinerImpl::foldICmpAndConstant(),foldSelectICmpAndZeroShl(),foldSubCtlzNot(),llvm::CombinerHelper::matchCombineLoadWithAndMask(),performMulVectorCmpZeroCombine(),performSubsToAndsCombine(),simplifyAMDGCNMemoryIntrinsicDemanded(),simplifyOrInst(), andllvm::InstCombinerImpl::visitSub().
| inline |
Determine if this is the largest signed value.
This checks to see if the value of thisAPInt is the maximum signed value for theAPInt's bit width.
Definition at line405 of fileAPInt.h.
Referencesassert(), andBitWidth.
Referenced byllvm::InstCombinerImpl::foldICmpXorConstant(),incDecVectorConstant(),llvm::ConstantInt::isMaxValue(),LowerVSETCC(),matchMinMax(),llvm::TargetLowering::SimplifySetCC(), andsimplifySubInst().
| inline |
Determine if this is the largest unsigned value.
This checks to see if the value of thisAPInt is the maximum unsigned value for theAPInt's bit width.
Definition at line399 of fileAPInt.h.
Referenced byllvm::ConstantRange::ConstantRange(),incDecVectorConstant(),llvm::ConstantRange::isFullSet(), andllvm::ConstantInt::isMaxValue().
| inline |
Determine if this is the smallest signed value.
This checks to see if the value of thisAPInt is the minimum signed value for theAPInt's bit width.
Definition at line423 of fileAPInt.h.
Referencesassert(), andBitWidth.
Referenced byllvm::KnownBits::abs(),cannotBeIntMin(),combineSetCC(),llvm::InstCombinerImpl::commonIRemTransforms(),llvm::ConstantFoldBinaryInstruction(),llvm::InstCombinerImpl::foldAddWithConstant(),llvm::InstCombinerImpl::foldICmpXorShiftConst(),llvm::InstCombinerImpl::FoldShiftByConstant(),llvm::ConstantRange::getEquivalentICmp(),llvm::ScalarEvolution::getMinusSCEV(),llvm::ScalarEvolution::getUDivExpr(),incDecVectorConstant(),llvm::ConstantInt::isMinValue(),isMultiple(),llvm::isSafeToSpeculativelyExecuteWithOpcode(),llvm::ConstantRange::isSignWrappedSet(),LowerVSETCC(),matchMinMax(),llvm::ConstantRange::multiply(),llvm::APFixedPoint::negate(),llvm::detail::SlowDynamicAPInt::operator-(),llvm::ConstantRange::sdiv(),llvm::KnownBits::sdiv(),sdiv_ov(),llvm::ConstantRange::signExtend(),llvm::TargetLowering::SimplifySetCC(),smul_ov(),tryFactorization(), andllvm::InstCombinerImpl::visitSDiv().
| inline |
Determine if this is the smallest unsigned value.
This checks to see if the value of thisAPInt is the minimum unsigned value for theAPInt's bit width.
Definition at line417 of fileAPInt.h.
ReferencesisZero().
Referenced byllvm::InstCombinerImpl::commonIRemTransforms(),llvm::ConstantRange::ConstantRange(),llvm::ConstantRange::isEmptySet(),llvm::ConstantInt::isMinValue(), andisMultiple().
| inline |
Check if thisAPInt's negated value is a power of two greater than zero.
Definition at line449 of fileAPInt.h.
Referencesassert(),BitWidth,llvm::countl_one(), andllvm::countr_zero().
Referenced byllvm::PPCTargetLowering::BuildSDIVPow2(),canEvaluateShifted(),llvm::decomposeBitTestICmp(),llvm::InstCombinerImpl::foldICmpAndConstConst(),llvm::SystemZTTIImpl::getArithmeticInstrCost(),instCombineSVESDIV(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::TargetLowering::SimplifySetCC(), andllvm::InstCombinerImpl::visitSub().
| inline |
Determine sign of thisAPInt.
This tests the high bit of thisAPInt to determine if it is set.
Definition at line329 of fileAPInt.h.
ReferencesBitWidth.
Referenced byllvm::TargetLowering::BuildSDIV(),combineShiftRightArithmetic(),combineVectorPack(),llvm::InstCombinerImpl::commonShiftTransforms(),llvm::KnownBits::computeForAddSub(),llvm::SelectionDAG::computeKnownBits(),computeShlNSW(),llvm::detail::IEEEFloat::convertFromAPInt(),foldAddToAshr(),foldAndOrOfSETCC(),llvm::InstCombinerImpl::foldICmpAndConstConst(),llvm::InstCombinerImpl::foldICmpAndShift(),llvm::InstCombinerImpl::foldICmpBinOp(),llvm::InstCombinerImpl::foldICmpDivConstant(),llvm::InstCombinerImpl::foldICmpMulConstant(),llvm::InstCombinerImpl::foldICmpShrConstant(),llvm::InstCombinerImpl::foldICmpShrConstConst(),llvm::InstCombinerImpl::foldICmpUsingKnownBits(),llvm::InstCombinerImpl::foldICmpXorConstant(),foldNoWrapAdd(),llvm::InstCombinerImpl::FoldShiftByConstant(),getAssignmentInfoImpl(),getBitsNeeded(),llvm::ExpressionFormat::getMatchingString(),getRangeForAffineARHelper(),getStrideAndModOffsetOfGEP(),llvm::ScalarEvolution::getUDivExpr(),isConstantPowerOfTwo(),llvm::ScalarEvolution::isKnownNegative(),llvm::ScalarEvolution::isKnownNonNegative(),llvm::ConstantInt::isNegative(),isNonEqualPointersWithRecursiveGEP(),isNonZeroRecurrence(),performMulCombine(),llvm::APIntOps::RoundingSDiv(),sadd_sat(),sdiv(),sext(),sfloordiv_ov(),shouldTransformMulToShiftsAddsSubs(),llvm::ConstantRange::signedAddMayOverflow(),llvm::ConstantRange::signedSubMayOverflow(),llvm::TargetLowering::SimplifySetCC(),smul_sat(),llvm::APIntOps::SolveQuadraticEquationWrap(),srem(),sshl_sat(),ssub_sat(),llvm::RISCVTargetLowering::targetShrinkDemandedConstant(),toString(),toString(),truncSSat(), andumul_ov().
| inline |
Determine if thisAPIntValue is non-negative (>= 0)
This tests the high bit of theAPInt to determine if it is unset.
Definition at line334 of fileAPInt.h.
Referenced byllvm::TargetLowering::buildSDIVPow2WithCMov(),combineTruncToVnclip(),llvm::KnownBits::computeForAddSub(),llvm::SelectionDAG::computeKnownBits(),computePointerICmp(),computeShlNSW(),detectUSatPattern(),llvm::ConstantRange::isAllNonNegative(),llvm::isKnownInversion(),llvm::ConstantRange::multiply(),performMulCombine(),sadd_ov(),llvm::ConstantRange::signedAddMayOverflow(),llvm::ConstantRange::signedSubMayOverflow(),simplifyICmpWithBinOp(),simplifyIntrinsic(),llvm::TargetLowering::SimplifySetCC(),llvm::ConstantRange::srem(),sshl_ov(),llvm::ConstantRange::sshl_sat(),ssub_ov(),trySimplifyICmpWithAdds(),llvm::InstCombinerImpl::visitCallInst(), andllvm::InstCombinerImpl::visitGetElementPtrInst().
| inline |
Determine if thisAPIntValue is non-positive (<= 0).
Definition at line361 of fileAPInt.h.
Referenced byprocessAbsIntrinsic(), andtrySimplifyICmpWithAdds().
| inline |
Determine if this is a value of 1.
This checks to see if the value of thisAPInt is one.
Definition at line389 of fileAPInt.h.
ReferencesBitWidth.
Referenced byllvm::TargetLowering::BuildSDIV(),llvm::TargetLowering::BuildUDIV(),llvm::CombinerHelper::buildUDivUsingMul(),combineSelectOfTwoConstants(),llvm::TargetLowering::expandDIVREMByConstant(),llvm::InstCombinerImpl::foldICmpAndShift(),llvm::InstCombinerImpl::foldICmpDivConstant(),foldICmpShlLHSC(),llvm::SelectionDAG::isBoolConstant(),llvm::TargetLowering::isConstTrueVal(),llvm::ConstantInt::isOne(),isSelect01(),llvm::SDPatternMatch::m_True(),multiplicativeInverse(),performVSelectCombine(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),simplifyGEPInst(), andllvm::TargetLowering::SimplifySetCC().
| inline |
Check if thisAPInt's value is a power of two greater than zero.
Definition at line440 of fileAPInt.h.
Referencesassert(),BitWidth, andllvm::isPowerOf2_64().
Referenced byllvm::PPCTargetLowering::BuildSDIVPow2(),combineAnd(),combineSelectOfTwoConstants(),combineSetCC(),llvm::SelectionDAG::computeKnownBits(),llvm::decomposeBitTestICmp(),llvm::InstCombinerImpl::foldAddWithConstant(),foldAndOrOfSETCC(),llvm::InstCombinerImpl::foldICmpAddConstant(),llvm::InstCombinerImpl::foldICmpBinOpEqualityWithConstant(),foldICmpShlLHSC(),llvm::InstCombinerImpl::foldICmpShrConstant(),llvm::InstCombinerImpl::foldICmpShrConstConst(),llvm::InstCombinerImpl::foldICmpUsingKnownBits(),foldICmpWithTruncSignExtendedVal(),llvm::InstCombinerImpl::foldICmpXorShiftConst(),foldSelectICmpAnd(),foldSignedTruncationCheck(),llvm::SystemZTTIImpl::getArithmeticInstrCost(),getBitsNeeded(),llvm::ConstantExpr::getExactLogBase2(),getMaskedICmpType(),instCombineSVESDIV(),isAllocSiteRemovable(),isConstantPowerOfTwo(),llvm::isKnownToBeAPowerOfTwo(),isPowerOf2Constant(),isSaturatingMinMax(),LowerVSETCC(),optimizeBranch(),performMulCombine(),performSubsToAndsCombine(),processUGT_ADDCST_ADD(),shouldTransformMulToShiftsAddsSubs(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),simplifyDiv(),llvm::TargetLowering::SimplifySetCC(),useInversedSetcc(),llvm::InstCombinerImpl::visitAdd(), andllvm::InstCombinerImpl::visitAnd().
Determine if two APInts have the same value, after zero-extending one of them (if needed!) to ensure that the bit-widths match.
Definition at line553 of fileAPInt.h.
ReferencesgetBitWidth(), andzext().
Referenced byllvm::SDPatternMatch::SpecificInt_match::match(),llvm::PatternMatch::specific_intval< AllowPoison >::match(), andllvm::VPlanPatternMatch::specific_intval< BitWidth >::match().
| inline |
Return true if thisAPInt value contains a non-empty sequence of ones with the remainder zero.
Definition at line510 of fileAPInt.h.
ReferencesBitWidth, andllvm::isShiftedMask_64().
Return true if thisAPInt value contains a non-empty sequence of ones with the remainder zero.
If true,MaskIdx
will specify the index of the lowest set bit andMaskLen
is updated to specify the length of the mask, else neither are updated.
Definition at line522 of fileAPInt.h.
ReferencesBitWidth, andllvm::isShiftedMask_64().
| inline |
Determine if sign bit of thisAPInt is clear.
This tests the high bit of thisAPInt to determine if it is clear.
Definition at line348 of fileAPInt.h.
Referenced byllvm::KnownBits::getSignedMaxValue(), andllvm::KnownBits::getSignedMinValue().
| inline |
Determine if sign bit of thisAPInt is set.
This tests the high bit of thisAPInt to determine if it is set.
Definition at line341 of fileAPInt.h.
ReferencesBitWidth.
Referenced bycombineSetCC(),llvm::APFixedPoint::compare(),llvm::ScalarEvolution::getAddExpr(),llvm::KnownBits::isNegative(),llvm::KnownBits::isNonNegative(),llvm::KnownBits::isSignUnknown(),llvm::KnownBits::isStrictlyPositive(),simplifyShift(), andtoSigned().
Check if thisAPInt has an N-bits signed integer value.
Definition at line435 of fileAPInt.h.
ReferencesN.
Referenced byAreMulWideOperandsDemotable(),combineSubOfBoolean(),computeFlagsForAddressComputation(),INITIALIZE_PASS(),llvm::NVPTXTargetLowering::isLegalAddressingMode(),llvm::RISCVTargetLowering::isMulAddWithConstProfitable(),llvm::LoongArchDAGToDAGISel::selectVSplatImm(),llvm::RISCVTargetLowering::targetShrinkDemandedConstant(),truncSSat(), anduseInversedSetcc().
| inline |
Check if theAPInt's value is returned by getSignMask.
Definition at line466 of fileAPInt.h.
Referenced byfoldAddToAshr(),llvm::InstCombinerImpl::foldAddWithConstant(),llvm::InstCombinerImpl::foldICmpAndConstConst(),llvm::InstCombinerImpl::foldICmpXorConstant(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(), andllvm::InstCombinerImpl::visitXor().
| inline |
Determine if thisAPInt just has one word to store value.
Definition at line322 of fileAPInt.h.
ReferencesBitWidth.
Referenced byextractBits(),extractBitsAsZExtValue(),llvm::hash_value(),insertBits(),operator*(),operator*=(),operator++(),operator+=(),operator--(),operator-=(),Profile(),roundToDouble(),sqrt(),llvm::SystemZVectorConstantInfo::SystemZVectorConstantInfo(),toString(),udiv(), andurem().
| inline |
Determine if thisAPIntValue is positive.
This tests if the value of thisAPInt is positive (> 0). Note that 0 is not a positive value.
Definition at line356 of fileAPInt.h.
ReferencesisZero().
Referenced byllvm::ConstantRange::abs(),llvm::TargetLowering::BuildSDIV(),ComputeNumSignBitsImpl(),llvm::InstCombinerImpl::foldICmpDivConstant(),llvm::ConstantRange::isAllNegative(),llvm::ConstantRange::isAllPositive(),llvm::ScalarEvolution::isKnownNonPositive(),llvm::ScalarEvolution::isKnownPositive(),isNonEqualPointersWithRecursiveGEP(),simplifyAndOfICmpsWithAdd(), andsimplifyOrOfICmpsWithAdd().
This operation checks that all bits set in thisAPInt are also set in RHS.
Definition at line1257 of fileAPInt.h.
Referencesassert(),BitWidth, andRHS.
Referenced bybitTrackingDCE(),llvm::SelectionDAGISel::CheckAndMask(),llvm::SelectionDAGISel::CheckOrMask(),eliminateDeadSwitchCases(),foldLogOpOfMaskedICmps(),foldSignedTruncationCheck(),getMaskedICmpType(),llvm::SelectionDAG::getSplatSourceVector(),llvm::X86TTIImpl::instCombineIntrinsic(),LowerMUL(),performORCombine(),llvm::LoongArchDAGToDAGISel::selectShiftMask(),llvm::RISCVDAGToDAGISel::selectShiftMask(),simplifyAndInst(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::ARMTargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),llvm::X86TTIImpl::simplifyDemandedVectorEltsIntrinsic(),simplifyICmpWithBinOp(),llvm::InstCombinerImpl::SimplifyMultipleUseDemandedBits(),llvm::X86TargetLowering::SimplifyMultipleUseDemandedBitsForTargetNode(),llvm::TargetLowering::SimplifySetCC(),llvm::KnownBits::srem(),llvm::RISCVTargetLowering::targetShrinkDemandedConstant(),llvm::X86TargetLowering::targetShrinkDemandedConstant(), andllvm::InstCombinerImpl::visitSub().
| inline |
Determine if this value is zero, i.e. all bits are clear.
Definition at line380 of fileAPInt.h.
ReferencesBitWidth.
Referenced byllvm::KnownBits::abs(),canonicalizeGEPOfConstGEPI8(),llvm::slpvectorizer::BoUpSLP::canVectorizeLoads(),canWidenShuffleElements(),llvm::GEPOperator::collectOffset(),combineBlendOfPermutes(),llvm::PPCInstrInfo::combineRLWINM(),combineSetCCMOVMSK(),combineX86ShufflesRecursively(),llvm::InstCombinerImpl::commonIDivTransforms(),computeKnownBitsForHorizontalOperation(),computeKnownBitsFromOperator(),computeKnownFPClass(),createAndInstr(),llvm::ConstantRange::cttz(),llvm::APFixedPoint::div(),EltsFromConsecutiveLoads(),llvm::exprDiv(),foldAndOrOfICmpEqConstantAndICmp(),foldAndOrOfSETCC(),foldBinOpIntoSelectIfProfitable(),foldCttzCtlz(),llvm::InstCombinerImpl::foldICmpAddConstant(),llvm::InstCombinerImpl::foldICmpAndConstant(),llvm::InstCombinerImpl::foldICmpAndConstConst(),llvm::InstCombinerImpl::foldICmpAndShift(),llvm::InstCombinerImpl::foldICmpBinOp(),llvm::InstCombinerImpl::foldICmpDivConstant(),llvm::InstCombinerImpl::foldICmpMulConstant(),llvm::InstCombinerImpl::foldICmpShlConstConst(),foldICmpShlLHSC(),llvm::InstCombinerImpl::foldICmpShrConstConst(),llvm::InstCombinerImpl::foldICmpSRemConstant(),llvm::InstCombinerImpl::foldICmpWithZero(),foldLogOpOfMaskedICmps_NotAllZeros_BMask_Mixed(),foldNoWrapAdd(),foldSelectICmpAnd(),llvm::InstCombinerImpl::FoldShiftByConstant(),foldSignedTruncationCheck(),GEPToVectorIndex(),llvm::SignedDivisionByConstantInfo::get(),llvm::UnsignedDivisionByConstantInfo::get(),getFauxShuffleMask(),getKnownBitsFromAndXorOr(),llvm::X86TTIImpl::getScalarizationOverhead(),llvm::getShuffleDemandedElts(),incDecVectorConstant(),isAligned(),llvm::SelectionDAG::isBoolConstant(),llvm::BuildVectorSDNode::isConstantSequence(),llvm::ISD::isConstantSplatVectorAllZeros(),llvm::SelectionDAG::isGuaranteedNotToBeUndefOrPoison(),llvm::ShuffleVectorInst::isInsertSubvectorMask(),llvm::SelectionDAG::isKnownNeverZero(),isKnownNonZeroFromOperator(),isMultiple(),llvm::KnownBits::isNonZero(),isNonZeroRecurrence(),isSelect01(),llvm::SelectionDAG::isSplatValue(),llvm::KnownBits::isStrictlyPositive(),isTargetShuffleEquivalent(),llvm::KnownBits::isUnknown(),llvm::ConstantRange::isWrappedSet(),llvm::ConstantInt::isZero(),LowerBuildVectorv16i8(),LowerVSETCC(),llvm::SDPatternMatch::m_False(),matchMinMax(),llvm::LegalizerHelper::narrowScalarShiftByConstant(),nearestLogBase2(),parseJumpTable(),llvm::APIntOps::RoundingSDiv(),llvm::APIntOps::RoundingUDiv(),llvm::ConstantRange::sdiv(),llvm::KnownBits::sdiv(),llvm::TargetLowering::ShrinkDemandedConstant(),llvm::InstCombinerImpl::SimplifyAddWithRemainder(),llvm::InstCombinerImpl::SimplifyDemandedBits(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TTIImpl::simplifyDemandedUseBitsIntrinsic(),llvm::InstCombinerImpl::SimplifyDemandedVectorElts(),simplifyGEPInst(),simplifyIntrinsic(),simplifyIRemMulShl(),llvm::TargetLowering::SimplifyMultipleUseDemandedBits(),llvm::TargetLowering::SimplifySetCC(),simplifyX86immShift(),sinkAndCmp0Expression(),llvm::APIntOps::SolveQuadraticEquationWrap(),llvm::ConstantRange::srem(),toString(),llvm::ConstantRange::udiv(),llvm::KnownBits::udiv(), andllvm::InstCombinerImpl::visitMul().
| inline |
Definition at line1739 of fileAPInt.h.
Referenced byllvm::SelectionDAG::computeKnownBits(),ComputeNumSignBitsImpl(),llvm::InstCombinerImpl::foldAddWithConstant(),foldICmpShlLHSC(),llvm::InstCombinerImpl::foldICmpShrConstConst(),foldSelectICmpAnd(),foldSelectICmpAndBinOp(),getBitsNeeded(),llvm::ConstantExpr::getExactLogBase2(),instCombineSVESDIV(),isEXTMask(),LowerVSETCC(),nearestLogBase2(),optimizeBranch(),llvm::ARMTargetLowering::PerformCMOVCombine(),llvm::ARMTargetLowering::PerformCMOVToBFICombine(),performMulCombine(),shouldTransformMulToShiftsAddsSubs(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::TargetLowering::SimplifySetCC(),llvm::InstCombinerImpl::visitAShr(), andllvm::InstCombinerImpl::visitLShr().
Logical right-shift function.
Logical right-shift thisAPInt by shiftAmt.
Definition at line851 of fileAPInt.h.
Referenced byllvm::DwarfExpression::addConstantFP(),areUsedBitsDense(),combineShiftRightLogical(),computeKnownBitsFromOperator(),llvm::ConstantFoldBinaryInstruction(),llvm::ConstantFoldBinOp(),llvm::TargetLowering::CTTZTableLookup(),llvm::InstCombinerImpl::foldICmpAndShift(),llvm::InstCombinerImpl::foldICmpShrConstant(),llvm::InstCombinerImpl::foldICmpShrConstConst(),foldICmpWithTruncSignExtendedVal(),FoldValue(),getDemandedSrcElements(),getHiBits(),getHopForBuildVector(),llvm::APFixedPoint::getMax(),llvm::BlockFrequencyInfoImplBase::getProfileCountFromFreq(),llvm::X86TTIImpl::instCombineIntrinsic(),llvm::SelectionDAG::isKnownNeverZero(),isNonZeroShift(),llvm::SystemZVectorConstantInfo::isVectorConstantLegal(),lowerMSABinaryBitImmIntr(),LowerShift(),llvm::ConstantRange::lshr(),llvm::CombinerHelper::matchCombineUnmergeConstant(),llvm::LegalizerHelper::narrowScalar(),rotl(),rotr(),setLimitsForBinOp(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::InstCombinerImpl::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),llvm::X86TTIImpl::simplifyDemandedVectorEltsIntrinsic(),llvm::TargetLowering::SimplifySetCC(),llvm::InstCombinerImpl::simplifyShrShlDemandedBits(),llvm::SystemZVectorConstantInfo::SystemZVectorConstantInfo(),umul_ov(),llvm::Interpreter::visitLShr(),llvm::InstCombinerImpl::visitLShr(),llvm::InstCombinerImpl::visitSwitchInst(), andllvm::InstCombinerImpl::visitXor().
Logical right-shift thisAPInt by ShiftAmt in place.
Logical right-shift thisAPInt by shiftAmt.
Logical right-shift function.
Definition at line1073 of fileAPInt.cpp.
ReferencesgetLimitedValue(), andlshrInPlace().
| inline |
Logical right-shift thisAPInt by ShiftAmt in place.
Definition at line858 of fileAPInt.h.
Referencesassert(), andBitWidth.
Referenced byBuildExactUDIV(),llvm::CombinerHelper::buildUDivUsingMul(),checkSignTestSetCCCombine(),combineVectorShiftImm(),llvm::SelectionDAG::computeKnownBits(),llvm::X86TargetLowering::computeKnownBitsForTargetNode(),computeKnownBitsFromCmp(),emitGlobalConstantLargeInt(),llvm::TargetLowering::expandDIVREMByConstant(),getDemandedSrcElements(),getUsefulBitsFromBitfieldMoveOpd(),llvm::KnownBits::lshr(),lshrInPlace(),PerformSHLSimplify(),reverseBits(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),llvm::TargetLowering::SimplifySetCC(),simplifyX86extrq(), andtoString().
APInt APInt::multiplicativeInverse | ( | ) | const |
Definition at line1248 of fileAPInt.cpp.
Referencesassert(), andisOne().
Referenced byBinomialCoefficient(),BuildExactSDIV(),BuildExactUDIV(),llvm::CombinerHelper::buildSDivUsingMul(),llvm::CombinerHelper::buildUDivUsingMul(),llvm::TargetLowering::expandDIVREMByConstant(), andSolveLinEquationWithOverflow().
unsigned APInt::nearestLogBase2 | ( | ) | const |
NOTE: When we have a BitWidth of 1, we define:
log2(0) = UINT32_MAX log2(1) = 0
to get around any mathematical concerns resulting from referencing 2 in a space where 2 does no exist.
Definition at line1146 of fileAPInt.cpp.
ReferencesisZero(), andlogBase2().
| inline |
| inline |
Negate thisAPInt in place.
Definition at line1450 of fileAPInt.h.
Referenced byllvm::InstCombinerImpl::foldICmpDivConstant(),llvm::SignedDivisionByConstantInfo::get(),llvm::LegalizerHelper::getDynStackAllocTargetPtr(),instCombineSVESDIV(),sdivrem(), andtoString().
| inline |
| inline |
| inline |
Multiplication operator.
Multiplies thisAPInt by RHS and returns the result.
Definition at line235 of fileAPInt.cpp.
ReferencesAPInt(),assert(),getBitWidth(),getMemory(),getNumWords(),isSingleWord(),RHS, andtcMultiply().
Definition at line270 of fileAPInt.cpp.
ReferencesgetNumWords(),isSingleWord(),RHS, andtcMultiplyPart().
APInt & APInt::operator++ | ( | ) |
Prefix increment operator.
Prefix increment operator. Increments theAPInt by one.
Definition at line178 of fileAPInt.cpp.
ReferencesgetNumWords(),isSingleWord(), andtcIncrement().
| inline |
Addition assignment operator.
Adds the RHSAPInt to thisAPInt.
Adds RHS to *this and assigns the result to *this.
Definition at line198 of fileAPInt.cpp.
Referencesassert(),getNumWords(),isSingleWord(),RHS, andtcAdd().
Definition at line207 of fileAPInt.cpp.
ReferencesgetNumWords(),isSingleWord(),RHS, andtcAddPart().
APInt & APInt::operator-- | ( | ) |
Prefix decrement operator.
Prefix decrement operator. Decrements theAPInt by one.
Definition at line187 of fileAPInt.cpp.
ReferencesgetNumWords(),isSingleWord(), andtcDecrement().
| inline |
Subtraction assignment operator.
Subtracts the RHSAPInt from thisAPInt.
Subtracts RHS from *this and assigns the result to *this.
Definition at line218 of fileAPInt.cpp.
Referencesassert(),getNumWords(),isSingleWord(),RHS, andtcSubtract().
Definition at line227 of fileAPInt.cpp.
ReferencesgetNumWords(),isSingleWord(),RHS, andtcSubtractPart().
Left-shift assignment function.
Left-shift thisAPInt by shiftAmt.
Shifts *this left by shiftAmt and assigns the result to *this.
Left-shift function.
Definition at line1085 of fileAPInt.cpp.
ReferencesgetLimitedValue().
Left-shift assignment function.
Shifts *this left by shiftAmt and assigns the result to *this.
Definition at line785 of fileAPInt.h.
Referencesassert(),BitWidth, andclearUnusedBits().
Assignment operator.
The RHS value is assigned to *this. If the significant bits in RHS exceed the bit width, the excess bits are truncated. If the bit width is larger than 64, the value is zero filled in the unspecified high order bits.
Definition at line658 of fileAPInt.h.
ReferencesclearUnusedBits(), andRHS.
Array-indexing support.
Definition at line1043 of fileAPInt.h.
Referencesassert(), andgetBitWidth().
Bitwise XOR assignment operator.
Performs a bitwise XOR operation on thisAPInt and RHS. RHS is logically zero-extended or truncated to match the bit-width of the LHS.
Definition at line747 of fileAPInt.h.
ReferencesclearUnusedBits(), andRHS.
Bitwise OR assignment operator.
Performs a bitwise OR operation on thisAPInt and RHS. RHS is logically zero-extended or truncated to match the bit-width of the LHS.
Definition at line718 of fileAPInt.h.
ReferencesclearUnusedBits(), andRHS.
| inline |
Count the number of bits set.
This function is anAPInt version of std::popcount. It counts the number of 1 bits in theAPInt value.
Definition at line1649 of fileAPInt.h.
Referencesllvm::popcount().
Referenced byllvm::KnownBits::abs(),collectBitParts(),combineShuffleOfSplatVal(),llvm::X86TargetLowering::computeKnownBitsForTargetNode(),llvm::KnownBits::countMaxPopulation(),llvm::KnownBits::countMinPopulation(),EltsFromConsecutiveLoads(),llvm::SelectionDAG::FoldConstantArithmetic(),foldSwitchToSelect(),llvm::X86TTIImpl::getMemoryOpCost(),llvm::X86TTIImpl::getReplicationShuffleCost(),llvm::AArch64TTIImpl::getScalarizationOverhead(),llvm::X86TTIImpl::getScalarizationOverhead(),llvm::KnownBits::isConstant(),LowerCTPOP(),ParseBFI(),llvm::ARMTargetLowering::PerformCMOVToBFICombine(),simplifyAMDGCNMemoryIntrinsicDemanded(),llvm::InstCombinerImpl::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyMultipleUseDemandedBitsForTargetNode(),tryBitfieldInsertOpFromOr(), andtryBitfieldInsertOpFromOrAndImm().
void APInt::print | ( | raw_ostream & | OS, |
bool | isSigned | ||
) | const |
Definition at line2281 of fileAPInt.cpp.
ReferencesisSigned(),OS, andtoString().
void APInt::Profile | ( | FoldingSetNodeID & | id | ) | const |
Used to insertAPInt objects, or objects that containAPInt objects, into FoldingSets.
This method 'profiles' anAPInt for use withFoldingSet.
Definition at line156 of fileAPInt.cpp.
ReferencesgetNumWords(), andisSingleWord().
Referenced byllvm::Attribute::get(),llvm::APSInt::Profile(), andllvm::AttributeImpl::Profile().
| inline |
relative arithmetic shift left
Definition at line895 of fileAPInt.h.
Referenced byllvm::APFixedPoint::mul().
| inline |
| inline |
relative logical shift left
Definition at line885 of fileAPInt.h.
Referenced byllvm::APFixedPoint::mul().
| inline |
APInt APInt::reverseBits | ( | ) | const |
Definition at line741 of fileAPInt.cpp.
ReferencesAPInt(), andlshrInPlace().
Referenced bycomputeKnownBitsFromOperator(),computeKnownFPClass(),determineLiveOperandBitsAddCarry(),foldBitwiseLogicWithIntrinsics(),llvm::SelectionDAG::FoldConstantArithmetic(),isKnownNonZeroFromOperator(),llvm::KnownBits::reverseBits(), andllvm::TargetLowering::SimplifyDemandedBits().
Rotate left by rotateAmt.
Definition at line1111 of fileAPInt.cpp.
ReferencesrotateModulo(), androtl().
Rotate left by rotateAmt.
Definition at line1115 of fileAPInt.cpp.
ReferencesLLVM_UNLIKELY,lshr(), andshl().
Referenced byllvm::PPCInstrInfo::combineRLWINM(),FoldValue(),isSplat(), androtl().
Rotate right by rotateAmt.
Definition at line1124 of fileAPInt.cpp.
ReferencesrotateModulo(), androtr().
Rotate right by rotateAmt.
Definition at line1128 of fileAPInt.cpp.
Referenced byFoldValue(),llvm::RISCVLegalizerInfo::legalizeCustom(),rotr(),selectI64ImmDirect(), andselectI64ImmDirectPrefix().
| inline |
Converts this unsignedAPInt to a double value.
Definition at line1690 of fileAPInt.h.
ReferencesroundToDouble().
Referenced byroundToDouble().
double APInt::roundToDouble | ( | bool | isSigned | ) | const |
Converts thisAPInt to a double value.
This function converts thisAPInt to a double.
Sign Exponent Fraction Bias |
---|
1[63] 11[62-52] 52[51-00] 1023 |
Definition at line853 of fileAPInt.cpp.
ReferencesAPINT_BITS_PER_WORD,assert(),getActiveBits(),I,isNeg(),isSigned(),isSingleWord(),pVal,sext(), andllvm::SignExtend64().
Referenced byllvm::ExecutionEngine::getConstantValue(), andllvm::APIntOps::RoundAPIntToDouble().
Definition at line1902 of fileAPInt.cpp.
ReferencesisNonNegative(), andRHS.
Referenced byllvm::APFixedPoint::add(),addWithOverflow(),llvm::checkedAdd(),llvm::exprAdd(),maintainNoSignedWrap(),llvm::detail::SlowDynamicAPInt::operator+(),optimizeIncrementingWhile(),sadd_sat(),llvm::simplifyLoopAfterUnroll(),llvm::InstCombinerImpl::visitCallInst(), andllvm::InstCombinerImpl::visitOr().
Definition at line2000 of fileAPInt.cpp.
ReferencesgetSignedMaxValue(),getSignedMinValue(),isNegative(),RHS, andsadd_ov().
Referenced byllvm::APFixedPoint::add(),FoldValue(), andllvm::ConstantRange::sadd_sat().
Signed division function forAPInt.
Signed divide thisAPInt byAPInt RHS.
The result is rounded towards zero.
Definition at line1618 of fileAPInt.cpp.
ReferencesisNegative(),RHS, andudiv().
Referenced byllvm::ProfileSummaryBuilder::computeDetailedSummary(),llvm::ConstantFoldBinaryInstruction(),llvm::ConstantFoldBinOp(),findGCD(),llvm::InstCombinerImpl::foldICmpDivConstant(),FoldValue(),getExactSDiv(),isSimpleVIDSequence(),llvm::ConstantRange::sdiv(),llvm::KnownBits::sdiv(),sdiv_ov(),setLimitsForBinOp(),smul_ov(), andllvm::Interpreter::visitBinaryOperator().
APInt APInt::sdiv | ( | int64_t | RHS | ) | const |
Definition at line1629 of fileAPInt.cpp.
ReferencesisNegative(),RHS, andudiv().
Definition at line1928 of fileAPInt.cpp.
ReferencesisMinSignedValue(),RHS, andsdiv().
Referenced byllvm::exprDiv(),llvm::detail::SlowDynamicAPInt::operator/(), andsfloordiv_ov().
Definition at line1864 of fileAPInt.cpp.
ReferencesLHS,negate(),RHS, andudivrem().
Referenced byceilingOfQuotient(),llvm::APFixedPoint::div(),findGCD(),floorOfQuotient(),isMultiple(),performMulCombine(),llvm::APIntOps::RoundingSDiv(),llvm::APIntOps::SolveQuadraticEquationWrap(),llvm::SCEVDivision::visitConstant(),llvm::InstCombinerImpl::visitGetElementPtrInst(), andllvm::InstCombinerImpl::visitMul().
| inline |
Set every bit to 1.
Definition at line1319 of fileAPInt.h.
ReferencesclearUnusedBits().
Referenced byllvm::KnownBits::ashr(),llvm::slpvectorizer::BoUpSLP::canVectorizeLoads(),computeKnownBits(),llvm::SelectionDAG::computeKnownBits(),llvm::X86TargetLowering::computeKnownBitsForTargetNode(),computeKnownBitsFromOperator(),llvm::computeKnownBitsFromRangeMetadata(),llvm::GISelKnownBits::computeKnownBitsImpl(),getExtractedDemandedElts(),llvm::KnownBits::lshr(),llvm::KnownBits::setAllOnes(),llvm::KnownBits::setAllZero(),llvm::KnownBits::shl(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(), andllvm::ConstantRange::truncate().
| inline |
Set the given bit to 1 whose position is given as "bitPosition".
Definition at line1330 of fileAPInt.h.
Referencesassert(), andBitWidth.
Referenced byllvm::KnownBits::abs(),llvm::KnownBits::blsi(),combineAnd(),combineAndnp(),combineOr(),combineShuffleOfSplatVal(),combineVectorPack(),combineX86ShuffleChain(),combineX86ShufflesConstants(),combineX86ShufflesRecursively(),llvm::SelectionDAG::computeKnownBits(),llvm::RISCVTargetLowering::computeKnownBitsForTargetNode(),computeKnownBitsFromOperator(),llvm::SelectionDAG::computeVectorKnownZeroElements(),computeZeroableShuffleElements(),divComputeLowBit(),EltsFromConsecutiveLoads(),llvm::TargetLowering::expandIS_FPCLASS(),llvm::extractConstantMask(),findDemandedEltsBySingleUser(),getDemandedSrcElements(),llvm::APFixedPoint::getEpsilon(),getExtractedDemandedElts(),llvm::getHorizDemandedEltsForFirstOperand(),llvm::TargetTransformInfoImplCRTPBase< T >::getInstructionCost(),llvm::BasicTTIImplBase< T >::getInterleavedMemoryOpCost(),llvm::X86TTIImpl::getInterleavedMemoryOpCostAVX512(),getKnownBitsFromAndXorOr(),getKnownUndefForVectorBinop(),getOneBitSet(),getPackDemandedElts(),llvm::getShuffleDemandedElts(),getSignedMinValue(),getTargetConstantBitsFromNode(),getTargetShuffleAndZeroables(),llvm::mca::initializeUsedResources(),isCompletePermute(),llvm::ShuffleVectorInst::isInsertSubvectorMask(),llvm::SelectionDAG::isSplatValue(),isTargetShuffleEquivalent(),lowerShuffleAsLanePermuteAndPermute(),matchBinaryShuffle(),llvm::KnownBits::mul(),PerformReduceShuffleCombine(),resolveZeroablesFromTargetShuffle(),llvm::APIntOps::ScaleBitMask(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::InstCombinerImpl::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),llvm::X86TTIImpl::simplifyDemandedVectorEltsIntrinsic(),llvm::TargetLowering::SimplifyMultipleUseDemandedBits(),llvm::InstCombinerImpl::visitExtractElementInst(), andllvm::InstCombinerImpl::visitICmpInst().
Set the bits from loBit (inclusive) to hiBit (exclusive) to 1.
This function handles case whenloBit
<=hiBit
.
Definition at line1367 of fileAPInt.h.
Referencesassert(), andBitWidth.
Referenced byllvm::KnownBits::abs(),llvm::slpvectorizer::BoUpSLP::canVectorizeLoads(),llvm::KnownBits::computeForAddSub(),llvm::LanaiTargetLowering::computeKnownBitsForTargetNode(),llvm::extractConstantMask(),getBitsSet(),getTargetConstantBitsFromNode(),llvm::BuildVectorSDNode::isConstantSplat(),matchBinaryShuffle(),llvm::APIntOps::ScaleBitMask(), andllvm::TargetLowering::SimplifyDemandedVectorElts().
| inline |
Set the top bits starting from loBit.
Definition at line1386 of fileAPInt.h.
ReferencesBitWidth.
Referenced byllvm::KnownBits::blsi(),llvm::KnownBits::blsmsk(),llvm::SelectionDAG::computeKnownBits(),llvm::SITargetLowering::computeKnownBitsForTargetInstr(),llvm::RISCVTargetLowering::computeKnownBitsForTargetNode(),llvm::AMDGPUTargetLowering::computeKnownBitsForTargetNode(),llvm::SITargetLowering::computeKnownBitsForTargetNode(),llvm::SystemZTargetLowering::computeKnownBitsForTargetNode(),llvm::X86TargetLowering::computeKnownBitsForTargetNode(),computeKnownBitsFromOperator(),llvm::GISelKnownBits::computeKnownBitsImpl(),getBitsSetFrom(),isTruncateOf(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TTIImpl::simplifyDemandedUseBitsIntrinsic(),llvm::RISCVTargetLowering::targetShrinkDemandedConstant(), andllvm::KnownBits::zext().
Set the bits from loBit (inclusive) to hiBit (exclusive) to 1.
This function handles "wrap" case whenloBit
>=hiBit
, and calls setBits whenloBit
<hiBit
. ForloBit
==hiBit
wrap case, set every bit to 1.
Definition at line1354 of fileAPInt.h.
Referencesassert(), andBitWidth.
Referenced bygetBitsSetWithWrap().
Set a given bit to a given value.
Definition at line1343 of fileAPInt.h.
Referenced byllvm::mca::RegisterFile::addRegisterWrite(),flipBit(),insertBits(),llvm::TargetLowering::SimplifyDemandedVectorElts(), andllvm::KnownBits::smin().
| inline |
Set the top hiBits bits.
Definition at line1392 of fileAPInt.h.
ReferencesBitWidth.
Referenced byllvm::KnownBits::computeForAddSub(),llvm::SelectionDAG::computeKnownBits(),llvm::SITargetLowering::computeKnownBitsForFrameIndex(),llvm::SITargetLowering::computeKnownBitsForTargetInstr(),llvm::AMDGPUTargetLowering::computeKnownBitsForTargetNode(),llvm::X86TargetLowering::computeKnownBitsForTargetNode(),computeKnownBitsFromCmp(),computeKnownBitsFromOperator(),getHighBitsSet(),knownBitsForWorkitemID(),llvm::KnownBits::lshr(),llvm::KnownBits::mul(),llvm::KnownBits::sdiv(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),llvm::X86TTIImpl::simplifyDemandedVectorEltsIntrinsic(),llvm::KnownBits::srem(),llvm::KnownBits::udiv(), andllvm::KnownBits::urem().
| inline |
Set the bottom loBits bits.
Definition at line1389 of fileAPInt.h.
Referenced byllvm::KnownBits::abs(),llvm::KnownBits::blsmsk(),computeKnownBits(),llvm::SelectionDAG::computeKnownBits(),llvm::GISelKnownBits::computeKnownBitsForAlignment(),llvm::TargetLowering::computeKnownBitsForFrameIndex(),llvm::RISCVTargetLowering::computeKnownBitsForTargetNode(),llvm::AMDGPUTargetLowering::computeKnownBitsForTargetNode(),llvm::X86TargetLowering::computeKnownBitsForTargetNode(),llvm::computeKnownBitsFromContext(),computeKnownBitsFromOperator(),llvm::GISelKnownBits::computeKnownBitsImpl(),divComputeLowBit(),getLowBitsSet(),llvm::KnownBits::shl(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(), andllvm::InstCombinerImpl::simplifyShrShlDemandedBits().
| inline |
Set the sign bit to 1.
Definition at line1340 of fileAPInt.h.
ReferencesBitWidth.
Referenced byllvm::KnownBits::abs(),llvm::KnownBits::computeForAddSub(),computeForSatAddSub(),llvm::KnownBits::getSignedMinValue(),LowerFMINIMUM_FMAXIMUM(),llvm::KnownBits::makeNegative(),llvm::KnownBits::makeNonNegative(),llvm::KnownBits::shl(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(), andsimplifyShift().
Sign extend to a new width.
This operation sign extends theAPInt to a new width. If the high order bit is set, the fill on the left will be done with 1 bits, otherwise zero. It is an error to specify a width that is less than the current width.
Definition at line959 of fileAPInt.cpp.
ReferencesAPInt(),APINT_BITS_PER_WORD,APINT_WORD_SIZE,assert(),getMemory(),getNumWords(),getRawData(),isNegative(), andllvm::SignExtend64().
Referenced bycombineTruncToVnclip(),combineVPMADD(),llvm::FunctionLoweringInfo::ComputePHILiveOutRegInfo(),detectSSatPattern(),detectSSatSPattern(),llvm::APFixedPoint::div(),llvm::BinaryOperation::eval(),llvm::TargetLowering::expandFP_TO_INT_SAT(),llvm::InstCombinerImpl::foldAddWithConstant(),foldNoWrapAdd(),llvm::ExecutionEngine::getConstantValue(),llvm::SelectionDAG::getNode(),isSaturatingMinMax(),lowerFCOPYSIGN(),llvm::APFixedPoint::mul(),llvm::APIntOps::mulhs(),llvm::ConstantRange::multiply(),narrowSDivOrSRem(),llvm::detail::SlowDynamicAPInt::operator!=(),llvm::detail::SlowDynamicAPInt::operator%(),llvm::detail::SlowDynamicAPInt::operator-(),llvm::detail::SlowDynamicAPInt::operator<(),llvm::detail::SlowDynamicAPInt::operator<=(),llvm::detail::SlowDynamicAPInt::operator==(),llvm::detail::SlowDynamicAPInt::operator>(),llvm::detail::SlowDynamicAPInt::operator>=(),llvm::RISCVTargetLowering::PerformDAGCombine(),performSETCCCombine(),printExtend(),roundToDouble(),selectI64ImmDirectPrefix(),llvm::KnownBits::sext(),sextOrTrunc(),llvm::APFixedPoint::shl(),llvm::ConstantRange::signExtend(),simplifyX86pack(),SolveQuadraticAddRecRange(),llvm::SCEVDivision::visitConstant(), andllvm::LegalizerHelper::widenScalar().
Sign extend or truncate to width.
Make thisAPInt have the bit width given bywidth
. The value is sign extended, truncated, or left alone to make it that width.
Definition at line1015 of fileAPInt.cpp.
Referenced byllvm::detail::PtrUseVisitorBase::adjustOffsetForGEP(),computeKnownBitsFromOperator(),llvm::DIExpression::constantFold(),llvm::ConstantFoldBinOp(),llvm::SelectionDAG::FoldConstantArithmetic(),llvm::SelectionDAG::getConstant(),llvm::TargetTransformInfoImplCRTPBase< T >::getGEPCost(),llvm::AArch64TTIImpl::getIntImmCost(),llvm::X86TTIImpl::getIntImmCost(),llvm::RISCVMatInt::getIntMatCost(),llvm::getPointersDiff(),hasNearbyPairedStore(),llvm::CombinerHelper::matchCombineConstPtrAddToI2P(), andsimplifyRelativeLoad().
Signed integer floor division operation.
Rounds towards negative infinity, i.e. 5 / -2 = -3. Iff minimum value divided by -1 set Overflow to true.
Definition at line1993 of fileAPInt.cpp.
ReferencesisNegative(),RHS, andsdiv_ov().
Signed greater or equal comparison.
Regards both *this and RHS as signed quantities and compares them for validity of the greater-or-equal relationship.
Definition at line1237 of fileAPInt.h.
ReferencesRHS.
Referenced bycomputeKnownFPClass(),llvm::InstCombinerImpl::foldICmpOrConstant(),foldNoWrapAdd(),FoldValue(),llvm::ConstantRange::icmp(),isNonEqualPointersWithRecursiveGEP(),llvm::ConstantRangeList::isOrderedRanges(),llvm::detail::SlowDynamicAPInt::operator>=(),performMulCombine(),llvm::ConstantRangeList::subtract(), andTryMULWIDECombine().
| inline |
Signed greater than comparison.
Regards both *this and RHS as signed quantities and compares them for the validity of the greater-than relationship.
Definition at line1201 of fileAPInt.h.
ReferencesRHS.
Referenced bycanUseSExt(),llvm::APFixedPoint::compare(),llvm::InstCombinerImpl::foldICmpBinOpEqualityWithConstant(),llvm::InstCombinerImpl::foldICmpOrConstant(),llvm::InstCombinerImpl::foldICmpShrConstConst(),llvm::BasicTTIImplBase< T >::getEstimatedNumberOfCaseClusters(),llvm::ConstantRange::icmp(),llvm::ConstantRange::isSignWrappedSet(),llvm::ConstantRange::isUpperSignWrapped(),matchClamp(),llvm::detail::SlowDynamicAPInt::operator>(),llvm::ConstantRange::signedAddMayOverflow(),llvm::ConstantRange::signedSubMayOverflow(),llvm::APIntOps::SolveQuadraticEquationWrap(), andswitchToLookupTable().
| inline |
Left-shift function.
Left-shift thisAPInt by shiftAmt.
Definition at line873 of fileAPInt.h.
Referenced byllvm::APFixedPoint::compare(),llvm::SelectionDAG::computeKnownBits(),computeKnownBitsFromOperator(),llvm::GISelKnownBits::computeKnownBitsImpl(),llvm::SelectionDAG::ComputeNumSignBits(),computeShlNSWWithNegLHS(),llvm::ConstantFoldBinaryInstruction(),convertShiftLeftToScale(),llvm::TargetLowering::CTTZTableLookup(),llvm::APFixedPoint::div(),llvm::TargetLowering::expandIS_FPCLASS(),llvm::InstCombinerImpl::foldICmpAndShift(),llvm::InstCombinerImpl::foldICmpShlConstConst(),foldICmpWithTruncSignExtendedVal(),foldSignedTruncationCheck(),llvm::SelectionDAG::isKnownNeverZero(),isNonZeroShift(),llvm::SelectionDAG::isSplatValue(),llvm::LegalizerHelper::lowerISFPCLASS(),LowerShift(),llvm::CombinerHelper::matchShlOfVScale(),rotl(),rotr(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),simplifyX86insertq(),sqrt(),llvm::InstCombinerImpl::visitLShr(),llvm::Interpreter::visitShl(),llvm::InstCombinerImpl::visitShl(), andllvm::InstCombinerImpl::visitXor().
| inline |
Converts this signedAPInt to a double value.
Definition at line1693 of fileAPInt.h.
Referenced byllvm::ExecutionEngine::getConstantValue(),llvm::APIntOps::RoundSignedAPIntToDouble(), andllvm::APIntOps::RoundSignedAPIntToFloat().
Signed less or equal comparison.
Regards both *this and RHS as signed quantities and compares them for validity of the less-or-equal relationship.
Definition at line1166 of fileAPInt.h.
ReferencesRHS.
Referenced byllvm::SelectionDAG::computeKnownBits(),llvm::SelectionDAG::ComputeNumSignBits(),FoldValue(),llvm::ConstantRange::icmp(),llvm::ConstantRangeList::insert(),isNonEqualPointersWithRecursiveGEP(),isSignedMinMaxClamp(),isSignedMinMaxIntrinsicClamp(),isTruePredicate(),llvm::detail::SlowDynamicAPInt::operator<=(),performMulCombine(), andllvm::ConstantRangeList::subtract().
Signed less than comparison.
Regards both *this and RHS as signed quantities and compares them for validity of the less-than relationship.
Definition at line1130 of fileAPInt.h.
ReferencesRHS.
Referenced byllvm::SwitchCG::SwitchLowering::buildJumpTable(),canUseSExt(),llvm::APFixedPoint::compare(),llvm::exprMax(),findGCD(),foldLoadsRecursive(),getBoundsCheckCond(),llvm::BasicTTIImplBase< T >::getEstimatedNumberOfCaseClusters(),llvm::MDNode::getMostGenericRange(),llvm::ConstantRange::icmp(),llvm::ConstantRangeList::insert(),llvm::ConstantRangeList::intersectWith(),matchClamp(),MinOptional(),llvm::detail::SlowDynamicAPInt::operator<(),llvm::ConstantRange::signedAddMayOverflow(),llvm::ConstantRange::signedSubMayOverflow(),llvm::ConstantRangeList::subtract(),switchToLookupTable(),TryMULWIDECombine(),trySimplifyICmpWithAdds(), andllvm::ConstantRangeList::unionWith().
| inline |
Definition at line1934 of fileAPInt.cpp.
ReferencesisMinSignedValue(),RHS, andsdiv().
Referenced byllvm::checkedMul(),llvm::exprMul(),maintainNoSignedWrap(),llvm::APFixedPoint::mul(),multiplyOverflows(),MulWillOverflow(),llvm::detail::SlowDynamicAPInt::operator*(),llvm::ConstantRange::smul_fast(), andsmul_sat().
Definition at line2038 of fileAPInt.cpp.
ReferencesgetSignedMaxValue(),getSignedMinValue(),isNegative(),RHS, andsmul_ov().
Referenced byllvm::ConstantRange::smul_sat().
APInt APInt::sqrt | ( | ) | const |
Function for signed remainder operation.
Signed remainder operation onAPInt.
Note that this is a true remainder operation and not a modulo operation because the sign follows the sign of the dividend which is *this.
Definition at line1710 of fileAPInt.cpp.
ReferencesisNegative(),RHS, andurem().
Referenced byllvm::ConstantFoldBinaryInstruction(),llvm::ConstantFoldBinOp(),findGCD(),FoldValue(),getExactSDiv(),getStrideAndModOffsetOfGEP(),isRemainderZero(),isSimpleVIDSequence(),llvm::detail::SlowDynamicAPInt::operator%(),simplifyRelativeLoad(), andllvm::Interpreter::visitBinaryOperator().
int64_t APInt::srem | ( | int64_t | RHS | ) | const |
Definition at line1721 of fileAPInt.cpp.
ReferencesisNegative(),RHS, andurem().
Definition at line1962 of fileAPInt.cpp.
ReferencesgetBitWidth(),getLimitedValue(), andsshl_ov().
Referenced bycomputeShlNSWWithNegLHS(),computeShlNSWWithNNegLHS(),sshl_ov(), andsshl_sat().
Definition at line1966 of fileAPInt.cpp.
ReferencesAPInt(),countl_one(),countl_zero(),getBitWidth(), andisNonNegative().
Definition at line2060 of fileAPInt.cpp.
ReferencesgetBitWidth(),RHS, andsshl_sat().
Referenced byFoldValue(),sshl_sat(), andllvm::ConstantRange::sshl_sat().
Definition at line2064 of fileAPInt.cpp.
ReferencesgetSignedMaxValue(),getSignedMinValue(),isNegative(),RHS, andsshl_ov().
Definition at line1915 of fileAPInt.cpp.
ReferencesisNonNegative(), andRHS.
Referenced byllvm::checkedSub(),llvm::exprSub(),maintainNoSignedWrap(),moveAddAfterMinMax(),llvm::detail::SlowDynamicAPInt::operator-(),ssub_sat(),llvm::APFixedPoint::sub(),subWithOverflow(),switchToLookupTable(), andllvm::InstCombinerImpl::visitOr().
Definition at line2019 of fileAPInt.cpp.
ReferencesgetSignedMaxValue(),getSignedMinValue(),isNegative(),RHS, andssub_ov().
Referenced byFoldValue(),llvm::ConstantRange::ssub_sat(), andllvm::APFixedPoint::sub().
| static |
DST += RHS + CARRY where CARRY is zero or one. Returns the carry flag.
Definition at line2416 of fileAPInt.cpp.
Referencesassert().
Referenced byoperator+=().
| static |
DST += RHS. Returns the carry flag.
This function adds a single "word" integer, src, to the multiple "word" integer array, dst[].
dst[] is modified to reflect the addition and 1 is returned if there is a carry out, otherwise 0 is returned.
Definition at line2438 of fileAPInt.cpp.
Referenced byoperator+=().
Assign one bignum to another.
Definition at line2322 of fileAPInt.cpp.
Referenced byllvm::detail::IEEEFloat::convert(),llvm::detail::IEEEFloat::convertFromSignExtendedInteger(),llvm::detail::IEEEFloat::makeNaN(),llvm::powerOf5(),tcDivide(), andtcExtract().
Clear the given bit of a bignum. Zero-based.
Clears the given bit of a bignum.
Definition at line2347 of fileAPInt.cpp.
Referenced byllvm::detail::IEEEFloat::makeNaN().
Comparison (unsigned) of two bignums.
Definition at line2725 of fileAPInt.cpp.
Referenced byllvm::detail::IEEEFloat::compareAbsoluteValue(), andtcDivide().
Decrement a bignum in-place. Return the borrow flag.
Definition at line1892 of fileAPInt.h.
Referenced byllvm::detail::IEEEFloat::next(), andoperator--().
| static |
If RHS is zero LHS and REMAINDER are left unchanged, return one.
Otherwise set LHS to LHS / RHS with the fractional part discarded, set REMAINDER to the remainder, return zero. i.e.
OLD_LHS = RHS * LHS + REMAINDER
SCRATCH is a bignum of the same size as the operands and result for use by the routine; its contents need not be initialized and are destroyed. LHS, REMAINDER and SCRATCH must be distinct.
Definition at line2630 of fileAPInt.cpp.
ReferencesAPINT_BITS_PER_WORD,assert(),tcAssign(),tcCompare(),tcMSB(),tcSet(),tcShiftLeft(),tcShiftRight(), andtcSubtract().
| static |
Copy the bit vector of width srcBITS from SRC, starting at bit srcLSB, to DST, of dstCOUNT parts, such that the bit srcLSB becomes the least significant bit of DST.
All high bits above srcBITS in DST are zero-filled.
All high bits above srcBITS in DST are zero-filled. */
Definition at line2386 of fileAPInt.cpp.
ReferencesAPINT_BITS_PER_WORD,assert(),lowBitMask(),tcAssign(), andtcShiftRight().
Extract the given bit of a bignum; returns 0 or 1. Zero-based.
Extract the given bit of a bignum; returns 0 or 1.
Definition at line2337 of fileAPInt.cpp.
Referenced byllvm::detail::IEEEFloat::convertFromSignExtendedInteger(),llvm::detail::IEEEFloat::convertFromZeroExtendedInteger(),llvm::detail::IEEEFloat::isDenormal(),llvm::detail::IEEEFloat::isSignaling(), andllvm::lostFractionThroughTruncation().
| static |
DST = LHS * RHS, where DST has width the sum of the widths of the operands.
No overflow occurs. DST must be disjoint from both operands.
Definition at line2605 of fileAPInt.cpp.
Referencesassert(),tcFullMultiply(), andtcMultiplyPart().
Referenced byllvm::powerOf5(), andtcFullMultiply().
Increment a bignum in-place. Return the carry flag.
Definition at line1887 of fileAPInt.h.
Referenced byoperator++(), andtcNegate().
Returns true if a bignum is zero, false otherwise.
Definition at line2328 of fileAPInt.cpp.
Referenced byllvm::detail::IEEEFloat::makeNaN().
Returns the bit number of the least or most significant set bit of a number.
Returns the bit number of the least significant set bit of a number.
If the input number has no bits set -1U is returned.
If the input number has no bits set UINT_MAX is returned.
Definition at line2353 of fileAPInt.cpp.
ReferencesAPINT_BITS_PER_WORD, andllvm::countr_zero().
Referenced byllvm::lostFractionThroughTruncation().
Returns the bit number of the most significant set bit of a number.
If the input number has no bits set UINT_MAX is returned.
Definition at line2366 of fileAPInt.cpp.
ReferencesAPINT_BITS_PER_WORD, andllvm::Log2_64().
Referenced bytcDivide().
DST = LHS * RHS, where DST has the same width as the operands and is filled with the least significant parts of the result.
Returns one if overflow occurred, otherwise zero. DST must be disjoint from both operands.
Definition at line2587 of fileAPInt.cpp.
Referencesassert(), andtcMultiplyPart().
Referenced byoperator*().
| static |
DST += SRC * MULTIPLIER + PART if add is true DST = SRC * MULTIPLIER + PART if add is false.
DST += SRC * MULTIPLIER + CARRY if add is true DST = SRC * MULTIPLIER + CARRY if add is false Requires 0 <= DSTPARTS <= SRCPARTS + 1.
Requires 0 <= DSTPARTS <= SRCPARTS + 1. If DST overlaps SRC they must start at the same point, i.e. DST == SRC.
If DSTPARTS == SRC_PARTS + 1 no overflow occurs and zero is returned. Otherwise DST is filled with the least significant DSTPARTS parts of the result, and if all of the omitted higher parts were zero return zero, otherwise overflow occurred and return one.
If DST overlaps SRC they must start at the same point, i.e. DST == SRC. If DSTPARTS == SRCPARTS + 1 no overflow occurs and zero is returned. Otherwise DST is filled with the least significant DSTPARTS parts of the result, and if all of the omitted higher parts were zero return zero, otherwise overflow occurred and return one.
Definition at line2504 of fileAPInt.cpp.
ReferencesAPINT_BITS_PER_WORD,assert(),highHalf(), andlowHalf().
Referenced byoperator*=(),tcFullMultiply(), andtcMultiply().
Negate a bignum in-place.
Definition at line2490 of fileAPInt.cpp.
ReferencestcComplement(), andtcIncrement().
Referenced byllvm::detail::IEEEFloat::convertFromSignExtendedInteger().
Sets the least significant part of a bignum to the input value, and zeroes out higher parts.
Definition at line2314 of fileAPInt.cpp.
Referencesassert().
Referenced byllvm::detail::IEEEFloat::convert(),llvm::detail::IEEEFloat::makeInf(),llvm::detail::IEEEFloat::makeNaN(),llvm::detail::IEEEFloat::makeSmallest(),llvm::detail::IEEEFloat::makeZero(),llvm::detail::IEEEFloat::next(), andtcDivide().
Set the given bit of a bignum. Zero-based.
Set the given bit of a bignum.
Definition at line2342 of fileAPInt.cpp.
Referenced byllvm::detail::IEEEFloat::convert(),llvm::detail::IEEEFloat::makeNaN(),llvm::detail::IEEEFloat::makeQuiet(),llvm::detail::IEEEFloat::makeSmallestNormalized(), andllvm::detail::IEEEFloat::next().
Shift a bignum left Count bits.
Shift a bignum left Count bits in-place.
Shifted in bits are zero. There are no restrictions on Count.
Definition at line2672 of fileAPInt.cpp.
ReferencesAPINT_BITS_PER_WORD, andAPINT_WORD_SIZE.
Referenced byllvm::detail::IEEEFloat::convert(),llvm::detail::IEEEFloat::convertToInteger(), andtcDivide().
Shift a bignum right Count bits.
Shift a bignum right Count bits in-place.
Shifted in bits are zero. There are no restrictions on Count.
Definition at line2699 of fileAPInt.cpp.
ReferencesAPINT_BITS_PER_WORD, andAPINT_WORD_SIZE.
Referenced byllvm::shiftRight(),tcDivide(), andtcExtract().
| static |
DST -= RHS + CARRY where CARRY is zero or one. Returns the carry flag.
DST -= RHS + C where C is zero or one. Returns the carry flag.
Definition at line2451 of fileAPInt.cpp.
Referencesassert().
Referenced byoperator-=(), andtcDivide().
| static |
DST -= RHS. Returns the carry flag.
This function subtracts a single "word" (64-bit word), src, from the multi-word integer array, dst[], propagating the borrowed 1 value until no further borrowing is needed or it runs out of "words" in dst.
The result is 1 if "borrowing" exhausted the digits in dst, or 0 if dst was not exhausted. In other words, if src > dst then this function returns 1, otherwise 0.
Definition at line2476 of fileAPInt.cpp.
Referenced byoperator-=().
void APInt::toString | ( | SmallVectorImpl<char > & | Str, |
unsigned | Radix, | ||
bool | Signed, | ||
bool | formatAsCLiteral =false , | ||
bool | UpperCase =true , | ||
bool | InsertSeparators =false | ||
) | const |
Converts anAPInt to a string and append it to Str.
Str is commonly aSmallString. If Radix > 10, UpperCase determine the case of letter digits.
Definition at line2138 of fileAPInt.cpp.
Referencesassert(),getBoolValue(),getRawData(),getSExtValue(),getZExtValue(),I,isNegative(),isSingleWord(),isZero(),llvm_unreachable,lshrInPlace(),N,negate(),Signed, andudivrem().
Referenced byllvm::ExpressionFormat::getMatchingString(), andprint().
| inline |
Considers theAPInt to be signed and converts it into a string in the radix given.
The radix can be 2, 8, 10, 16, or 36.
Definition at line1675 of fileAPInt.h.
ReferencestoString().
Referenced bydump().
| inline |
Considers theAPInt to be unsigned and converts it into a string in the radix given.
The radix can be 2, 8, 10 16, or 36.
Definition at line1669 of fileAPInt.h.
ReferencestoString().
Referenced bydump().
Truncate to new width.
Truncate theAPInt to a specified width. It is an error to specify a width that is greater than the current width.
Definition at line910 of fileAPInt.cpp.
ReferencesAPInt(),APINT_BITS_PER_WORD,assert(),getMemory(),getNumWords(), andgetRawData().
Referenced byllvm::APSInt::APSInt(),areUsedBitsDense(),combineVectorPack(),combineX86ShufflesRecursively(),llvm::KnownBits::computeForAddSub(),llvm::TargetLowering::expandDIVREMByConstant(),extractConstantWithoutWrapping(),llvm::SelectionDAG::FoldConstantArithmetic(),llvm::InstCombinerImpl::foldICmpShlConstant(),foldNoWrapAdd(),llvm::ExecutionEngine::getConstantValue(),getDemandedSrcElements(),llvm::SelectionDAG::getNode(),llvm::GCNTTIImpl::instCombineIntrinsic(),llvm::BuildVectorSDNode::isConstantSequence(),llvm::ISD::isConstantSplatVector(),llvm::TargetLowering::isConstTrueVal(),isSaturatingMinMax(),llvm::SelectionDAG::isSplatValue(),llvm::SystemZVectorConstantInfo::isVectorConstantLegal(),lowerMSABinaryBitImmIntr(),llvm::CombinerHelper::matchCastOfInteger(),llvm::CombinerHelper::matchCombineUnmergeConstant(),llvm::LegalizerHelper::narrowScalar(),llvm::RISCVTargetLowering::PerformDAGCombine(),performSETCCCombine(),processUMulZExtIdiom(),rebuildExtCst(),sextOrTrunc(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::TargetLowering::SimplifySetCC(),llvm::SystemZVectorConstantInfo::SystemZVectorConstantInfo(),llvm::X86TargetLowering::targetShrinkDemandedConstant(),llvm::KnownBits::trunc(),llvm::ConstantRange::truncate(),truncSSat(),truncUSat(),llvm::InstCombinerImpl::visitAnd(),llvm::InstCombinerImpl::visitICmpInst(),llvm::InstCombinerImpl::visitSwitchInst(), andzextOrTrunc().
Truncate to new width with signed saturation.
If thisAPInt, treated as signed integer, can be losslessly truncated to the new bitwidth, then return truncatedAPInt. Else, return either signed min value if theAPInt was negative, or signed max value.
Definition at line947 of fileAPInt.cpp.
Referencesassert(),getSignedMaxValue(),getSignedMinValue(),isNegative(),isSignedIntN(), andtrunc().
Referenced bycombineVectorPack().
| inline |
Get sign extended value if possible.
This method attempts to return the value of thisAPInt as a sign extended int64_t. The bitwidth must be <= 64 or the value must fit within an int64_t. Otherwise no value is returned.
Definition at line1554 of fileAPInt.h.
Referenced byllvm::getExpressionForConstant(), andsimplifySwitchOfCmpIntrinsic().
| inline |
Get zero extended value if possible.
This method attempts to return the value of thisAPInt as a zero extended uint64_t. The bitwidth must be <= 64 or the value must fit within a uint64_t. Otherwise no value is returned.
Definition at line1532 of fileAPInt.h.
Referenced bymayLoopAccessLocation().
Definition at line2010 of fileAPInt.cpp.
ReferencesgetMaxValue(),RHS, anduadd_ov().
Referenced byllvm::APFixedPoint::add(),FoldValue(),llvm::ConstantRange::uadd_sat(), andllvm::InstCombinerImpl::visitCallInst().
Unsigned division operation.
Perform an unsigned divide operation on thisAPInt by RHS. Both this and RHS are treated as unsigned quantities for purposes of this division.
Definition at line1547 of fileAPInt.cpp.
ReferencesAPInt(),assert(),getActiveBits(),getNumWords(),isSingleWord(),pVal,RHS, andult().
Referenced bycalculateGEPOffset(),llvm::InstCombinerImpl::commonIDivTransforms(),llvm::ConstantFoldBinaryInstruction(),llvm::ConstantFoldBinOp(),llvm::APFixedPoint::div(),llvm::InstCombinerImpl::foldICmpDivConstant(),llvm::InstCombinerImpl::foldICmpUDivConstant(),FoldValue(),foldVecExtTruncToExtElt(),getRangeForAffineARHelper(),optimizeSection(),llvm::scaleProfData(),sdiv(),setLimitsForBinOp(),llvm::APIntOps::SolveQuadraticEquationWrap(),sqrt(),llvm::ConstantRange::udiv(),llvm::KnownBits::udiv(), andllvm::Interpreter::visitBinaryOperator().
Definition at line1585 of fileAPInt.cpp.
ReferencesAPInt(),assert(),getActiveBits(),getNumWords(),isSingleWord(),pVal,RHS, andult().
Dual division/remainder interface.
Sometimes it is convenient to divide twoAPInt values and obtain both the quotient and remainder. This function does both operations in the same computation making it a little more efficient. The pair of input arguments may overlap with the pair of output arguments. It is safe to call udivrem(X, Y, X, Y), for example.
Definition at line1732 of fileAPInt.cpp.
ReferencesAPInt(),APINT_WORD_SIZE,assert(),llvm::BitWidth,getNumWords(),LHS,pVal, andRHS.
Referenced byextractShiftForRotate(),foldICmpShlLHSC(),GEPToVectorIndex(),llvm::SignedDivisionByConstantInfo::get(),llvm::UnsignedDivisionByConstantInfo::get(),isMultiple(),llvm::APIntOps::RoundingUDiv(),sdivrem(),toString(), andllvm::InstCombinerImpl::visitGetElementPtrInst().
Definition at line1803 of fileAPInt.cpp.
ReferencesAPInt(),APINT_WORD_SIZE,assert(),llvm::BitWidth,getNumWords(),LHS,pVal, andRHS.
Unsigned greater or equal comparison.
Regards both *this and RHS as unsigned quantities and compares them for validity of the greater-or-equal relationship.
Definition at line1221 of fileAPInt.h.
ReferencesRHS.
Referenced byllvm::SelectionDAG::canCreateUndefOrPoison(),canTryToConstantAddTwoShiftAmounts(),collectBitParts(),combineAnd(),combineExtractWithShuffle(),combineShiftOfShiftedLogic(),combineTruncToVnclip(),llvm::X86TargetLowering::ComputeNumSignBitsForTargetNode(),ComputeNumSignBitsImpl(),llvm::InstCombinerImpl::convertOrOfShiftsToFunnelShift(),detectUSatPattern(),Expand64BitShift(),llvm::TargetLowering::expandDIVREMByConstant(),llvm::InstCombinerImpl::foldICmpBinOp(),llvm::InstCombinerImpl::foldICmpShlConstant(),llvm::InstCombinerImpl::foldICmpShrConstant(),llvm::InstCombinerImpl::foldICmpSRemConstant(),llvm::InstCombinerImpl::FoldShiftByConstant(),FoldValue(),foldVecExtTruncToExtElt(),llvm::SignedDivisionByConstantInfo::get(),llvm::UnsignedDivisionByConstantInfo::get(),llvm::SelectionDAG::getValidShiftAmountRange(),getVariantMatchScore(),llvm::ConstantRange::icmp(),isDereferenceableAndAlignedPointer(),isNonZeroShift(),isPoisonShift(),LowerShiftByScalarImmediate(),matchAndOrChain(),llvm::CombinerHelper::matchCombineTruncOfShift(),PerformSHLSimplify(),llvm::X86TargetLowering::preferedOpcodeForCmpEqPiecesOfOperand(),simplifyAndCommutative(),simplifyLShrInst(),simplifyShift(),llvm::InstCombinerImpl::simplifyShrShlDemandedBits(),simplifyX86immShift(),simplifyX86varShift(),splitGlobal(),llvm::ConstantInt::uge(),llvm::ConstantRange::unionWith(),llvm::InstCombinerImpl::visitICmpInst(), andllvm::InstCombinerImpl::visitLShr().
Unsigned greater than comparison.
Regards both *this and RHS as unsigned quantities and compares them for the validity of the greater-than relationship.
Definition at line1182 of fileAPInt.h.
ReferencesRHS.
Referenced byllvm::SelectionDAG::canCreateUndefOrPoison(),canEvaluateShiftedShift(),llvm::APFixedPoint::compare(),llvm::InstCombinerImpl::convertOrOfShiftsToFunnelShift(),extractShiftForRotate(),foldICmpShlLHSC(),foldICmpWithTruncSignExtendedVal(),llvm::SelectionDAG::getValidShiftAmountRange(),llvm::ConstantRange::icmp(),llvm::isDereferenceableAndAlignedInLoop(),llvm::ConstantRange::isSizeLargerThan(),llvm::ConstantRange::isUpperWrapped(),llvm::ConstantRange::isWrappedSet(),matchClamp(),llvm::CombinerHelper::matchCombineTruncOfShift(),llvm::LegalizerHelper::narrowScalarShiftByConstant(),llvm::ConstantRange::shl(),simplifySetCCWithCTPOP(),llvm::ConstantRange::srem(),llvm::ConstantRange::unionWith(),llvm::ConstantRange::unsignedAddMayOverflow(),usub_ov(), andllvm::InstCombinerImpl::visitLShr().
Unsigned less or equal comparison.
Regards both *this and RHS as unsigned quantities and compares them for validity of the less-or-equal relationship.
Definition at line1150 of fileAPInt.h.
ReferencesRHS.
Referenced byllvm::SCEVAAResult::alias(),combineArithReduction(),llvm::InstCombinerImpl::commonIDivTransforms(),llvm::ConstantRange::contains(),llvm::InstCombinerImpl::convertOrOfShiftsToFunnelShift(),llvm::TargetLowering::expandDIVREMByConstant(),llvm::InstCombinerImpl::foldICmpAndConstConst(),llvm::InstCombinerImpl::foldICmpBinOp(),foldShiftIntoShiftInAnotherHandOfAndInICmp(),FoldValue(),llvm::ScalarEvolution::getAddExpr(),llvm::ConstantRange::icmp(),llvm::ConstantRange::intersectWith(),isTruePredicate(),matchIntPart(),llvm::AMDGPUTargetLowering::performTruncateCombine(),processAnd(),llvm::ConstantRange::shl(),simplifyICmpWithBinOpOnLHS(),sqrt(),llvm::ConstantRange::unionWith(), andllvm::InstCombinerImpl::visitGetElementPtrInst().
Unsigned less than comparison.
Regards both *this and RHS as unsigned quantities and compares them for the validity of the less-than relationship.
Definition at line1111 of fileAPInt.h.
ReferencesRHS.
Referenced bycanEvaluateShiftedShift(),canEvaluateTruncated(),cheapToScalarize(),combineCMov(),combineCMP(),combineExtractWithShuffle(),combineShiftRightArithmetic(),llvm::InstCombinerImpl::commonIDivTransforms(),llvm::APFixedPoint::compare(),CompareSCEVComplexity(),llvm::ARMTargetLowering::computeKnownBitsForTargetNode(),computeKnownBitsFromShiftOperator(),llvm::SelectionDAG::computeOverflowForUnsignedAdd(),computePointerICmp(),llvm::InstCombinerImpl::convertOrOfShiftsToFunnelShift(),findDemandedEltsBySingleUser(),foldICmpWithTruncSignExtendedVal(),foldShiftIntoShiftInAnotherHandOfAndInICmp(),llvm::SignedDivisionByConstantInfo::get(),llvm::UnsignedDivisionByConstantInfo::get(),llvm::omp::getBestVariantMatchForContext(),getRangeForAffineARHelper(),llvm::SelectionDAG::getShiftAmountConstant(),llvm::SelectionDAG::getValidShiftAmountRange(),llvm::ConstantRange::icmp(),llvm::ConstantRange::intersectWith(),llvm::SelectionDAG::isKnownNeverZero(),matchClamp(),llvm::X86TargetLowering::preferedOpcodeForCmpEqPiecesOfOperand(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),simplifyIRemMulShl(),llvm::InstCombinerImpl::SimplifyMultipleUseDemandedBits(),simplifyX86immShift(),simplifyX86varShift(),sqrt(),llvm::ConstantRange::truncate(),uadd_ov(),udiv(),umul_ov(),llvm::ConstantRange::unionWith(),llvm::ConstantRange::unsignedSubMayOverflow(),urem(),llvm::InstCombinerImpl::visitAnd(),llvm::InstCombinerImpl::visitAShr(),llvm::InstCombinerImpl::visitLShr(), andllvm::InstCombinerImpl::visitShl().
Definition at line1945 of fileAPInt.cpp.
Referencescountl_zero(),isNegative(),lshr(),RHS, andult().
Referenced byllvm::checkedMulUnsigned(),llvm::SelectionDAG::computeKnownBits(),llvm::ScalarEvolution::getUDivExpr(),llvm::APFixedPoint::mul(),llvm::KnownBits::mul(),multiplyOverflows(),MulWillOverflow(),umul_sat(), andllvm::ConstantRange::unsignedMulMayOverflow().
Definition at line2051 of fileAPInt.cpp.
ReferencesgetMaxValue(),RHS, andumul_ov().
Referenced byllvm::ConstantRange::umul_sat().
Unsigned remainder operation.
Perform an unsigned remainder operation on thisAPInt with RHS being the divisor. Both this and RHS are treated as unsigned quantities for purposes of this operation.
Definition at line1640 of fileAPInt.cpp.
ReferencesAPInt(),assert(),getActiveBits(),getNumWords(),isSingleWord(),RHS, andult().
Referenced byllvm::CombinerHelper::applyFunnelShiftConstantModulo(),combineExtractWithShuffle(),computeKnownBitsFromOperator(),llvm::ConstantFoldBinaryInstruction(),llvm::ConstantFoldBinOp(),llvm::TargetLowering::expandDIVREMByConstant(),FoldValue(),foldVecExtTruncToExtElt(),llvm::ScalarEvolution::getUDivExpr(),llvm::isDereferenceableAndAlignedInLoop(),isLoadCombineCandidateImpl(),isNonZeroModBitWidthOrUndef(),LowerFunnelShift(),LowerRotate(),rotateModulo(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),simplifyIntrinsic(),srem(),llvm::ScalarEvolution::verify(), andllvm::Interpreter::visitBinaryOperator().
Definition at line1678 of fileAPInt.cpp.
Referencesassert(),getActiveBits(),getNumWords(),getZExtValue(),isSingleWord(),RHS, andult().
Definition at line1979 of fileAPInt.cpp.
ReferencesgetBitWidth(),getLimitedValue(), andushl_ov().
Referenced bycomputeShlNUW(),ushl_ov(),ushl_sat(), andllvm::InstCombinerImpl::visitUDiv().
Definition at line1983 of fileAPInt.cpp.
ReferencesAPInt(),countl_zero(), andgetBitWidth().
Definition at line2074 of fileAPInt.cpp.
ReferencesgetBitWidth(),RHS, andushl_sat().
Referenced byFoldValue(),ushl_sat(), andllvm::ConstantRange::ushl_sat().
Definition at line2078 of fileAPInt.cpp.
ReferencesgetMaxValue(),RHS, andushl_ov().
Definition at line1922 of fileAPInt.cpp.
Referenced bymoveAddAfterMinMax(),llvm::APFixedPoint::sub(),subWithOverflow(),usub_sat(), andllvm::InstCombinerImpl::visitOr().
Definition at line2029 of fileAPInt.cpp.
ReferencesAPInt(),RHS, andusub_ov().
Referenced byFoldValue(),llvm::APFixedPoint::sub(), andllvm::ConstantRange::usub_sat().
Zero extend to a new width.
This operation zero extends theAPInt to a new width. The high order bits are filled with 0 bits. It is an error to specify a width that is less than the current width.
Definition at line986 of fileAPInt.cpp.
ReferencesAPInt(),APINT_BITS_PER_WORD,APINT_WORD_SIZE,assert(),getMemory(),getNumWords(), andgetRawData().
Referenced byllvm::KnownBits::anyext(),llvm::ConstantRange::castOp(),combineVPMADD(),combineX86ShufflesRecursively(),llvm::SelectionDAG::computeKnownBits(),llvm::GISelKnownBits::computeKnownBitsImpl(),llvm::SelectionDAG::ComputeNumSignBits(),llvm::FunctionLoweringInfo::ComputePHILiveOutRegInfo(),ConstantBuildVector(),detectSSatPattern(),detectSSatUPattern(),detectUSatUPattern(),llvm::APFixedPoint::div(),llvm::TargetLowering::expandFP_TO_INT_SAT(),extractConstantWithoutWrapping(),llvm::InstCombinerImpl::foldICmpAndConstConst(),llvm::InstCombinerImpl::foldICmpEquality(),foldSignedTruncationCheck(),llvm::SCEVExpander::generateOverflowCheck(),llvm::getAllocSize(),llvm::ExecutionEngine::getConstantValue(),llvm::SelectionDAG::getNode(),llvm::X86TTIImpl::getReplicationShuffleCost(),llvm::X86TTIImpl::getScalarizationOverhead(),isObjectSizeLessThanOrEq(),isSameValue(),llvm::SelectionDAG::isSplatValue(),llvm::RISCVLegalizerInfo::legalizeCustom(),llvm::APFixedPoint::mul(),llvm::APIntOps::mulhu(),llvm::ConstantRange::multiply(),performANDCombine(),llvm::PPCTargetLowering::PerformDAGCombine(),PerformUMinFpToSatCombine(),printExtend(),processUMulZExtIdiom(),rotateModulo(),llvm::APFixedPoint::shl(),llvm::ConstantRange::signExtend(),llvm::TargetLowering::SimplifyDemandedBits(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::X86TTIImpl::simplifyDemandedVectorEltsIntrinsic(),SolveLinEquationWithOverflow(),toSigned(),llvm::APFixedPoint::toString(),llvm::LegalizationArtifactCombiner::tryCombineZExt(),tryToMergePartialOverlappingStores(),llvm::InstCombinerImpl::visitAnd(),llvm::LegalizerHelper::widenScalar(),llvm::ConstantRange::zeroExtend(),llvm::KnownBits::zext(), andzextOrTrunc().
Zero extend or truncate to width.
Make thisAPInt have the bit width given bywidth
. The value is zero extended, truncated, or left alone to make it that width.
Definition at line1007 of fileAPInt.cpp.
Referenced byllvm::computeKnownBitsFromRangeMetadata(),llvm::X86TargetLowering::ComputeNumSignBitsForTargetNode(),llvm::DIExpression::constantFold(),llvm::Interpreter::exitCalled(),extractShiftForRotate(),llvm::SelectionDAG::FoldConstantArithmetic(),llvm::SelectionDAG::getConstant(),llvm::ExecutionEngine::getConstantValue(),getFauxShuffleMask(),getPreferredVectorIndex(),llvm::ScalarEvolution::getSmallConstantTripMultiple(),llvm::X86TTIImpl::instCombineIntrinsic(),isBitfieldDstMask(),llvm::isKnownToBeAPowerOfTwo(),llvm::CombinerHelper::matchCombineConstPtrAddToI2P(),resolveBuildVector(),llvm::simplifyBinaryIntrinsic(),llvm::X86TargetLowering::SimplifyDemandedBitsForTargetNode(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::X86TTIImpl::simplifyDemandedUseBitsIntrinsic(),llvm::TargetLowering::SimplifyDemandedVectorElts(),llvm::InstCombinerImpl::SimplifyDemandedVectorElts(),llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(),simplifyX86extrq(),simplifyX86immShift(),simplifyX86insertq(),SkipExtensionForVMULL(),llvm::APFixedPoint::toString(), andtryLowerToSLI().
| friend |
| staticconstexpr |
Bits in a word.
Definition at line86 of fileAPInt.h.
Referenced bybyteSwap(),extractBits(),extractBitsAsZExtValue(),llvm::detail::IEEEFloat::getExactLog2Abs(),highHalf(),insertBits(),lowBitMask(),lowHalf(),nextAPIntBitWidth(),roundToDouble(),sext(),tcDivide(),tcExtract(),tcLSB(),tcMSB(),tcMultiplyPart(),llvm::detail::tcSetLeastSignificantBits(),tcShiftLeft(),tcShiftRight(),trunc(), andzext().
Byte size of a word.
Definition at line83 of fileAPInt.h.
Referenced byinsertBits(),sext(),tcShiftLeft(),tcShiftRight(),udivrem(), andzext().
uint64_t* llvm::APInt::pVal |
Used to store the >64 bits integer value.
Definition at line1911 of fileAPInt.h.
Referenced byllvm::hash_value(),roundToDouble(),udiv(), andudivrem().
uint64_t llvm::APInt::VAL |
Used to store the <= 64 bits integer value.
Definition at line1910 of fileAPInt.h.
Referenced byAPInt(),concat(),llvm::hash_value(), andinsertBits().
Definition at line94 of fileAPInt.h.
Referenced byinsertBits().