Lines Matching refs:BitWidth

106 APInt::APInt(unsigned numBits, ArrayRef<uint64_t> bigVal) : BitWidth(numBits) {
111 : BitWidth(numBits) {
116 : BitWidth(numbits) {
123 BitWidth = NewBitWidth;
131 // Update BitWidth.
132 BitWidth = NewBitWidth;
156 ID.AddInteger(BitWidth);
198 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
218 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
235 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
237 return APInt(BitWidth, U.VAL * RHS.U.VAL);
283 assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison");
291 assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison");
293 int64_t lhsSext = SignExtend64(U.VAL, BitWidth);
294 int64_t rhsSext = SignExtend64(RHS.U.VAL, BitWidth);
364 assert(bitPosition < BitWidth && "Out of the bit-width range!");
370 assert((subBitWidth + bitPosition) <= BitWidth && "Illegal bit insertion");
377 if (subBitWidth == BitWidth) {
454 assert(bitPosition < BitWidth && (numBits + bitPosition) <= BitWidth &&
491 assert(bitPosition < BitWidth && (numBits + bitPosition) <= BitWidth &&
588 return hash_combine(Arg.BitWidth, Arg.U.VAL);
591 Arg.BitWidth,
609 return this->lshr(BitWidth - numBits);
614 APInt Result(getLowBitsSet(BitWidth, numBits));
642 unsigned Mod = BitWidth % APINT_BITS_PER_WORD;
648 unsigned highWordBits = BitWidth % APINT_BITS_PER_WORD;
678 return std::min(Count, BitWidth);
688 assert(Count <= BitWidth);
716 assert(BitWidth >= 16 && BitWidth % 8 == 0 && "Cannot byteswap!");
717 if (BitWidth == 16)
718 return APInt(BitWidth, llvm::byteswap<uint16_t>(U.VAL));
719 if (BitWidth == 32)
720 return APInt(BitWidth, llvm::byteswap<uint32_t>(U.VAL));
721 if (BitWidth <= 64) {
723 Tmp1 >>= (64 - BitWidth);
724 return APInt(BitWidth, Tmp1);
730 if (Result.BitWidth != BitWidth) {
731 Result.lshrInPlace(Result.BitWidth - BitWidth);
732 Result.BitWidth = BitWidth;
738 switch (BitWidth) {
740 return APInt(BitWidth, llvm::reverseBits<uint64_t>(U.VAL));
742 return APInt(BitWidth, llvm::reverseBits<uint32_t>(U.VAL));
744 return APInt(BitWidth, llvm::reverseBits<uint16_t>(U.VAL));
746 return APInt(BitWidth, llvm::reverseBits<uint8_t>(U.VAL));
754 APInt Reversed(BitWidth, 0);
755 unsigned S = BitWidth;
855 int64_t sext = SignExtend64(getWord(0), BitWidth);
862 bool isNeg = isSigned ? (*this)[BitWidth-1] : false;
907 assert(width <= BitWidth && "Invalid APInt Truncate request");
912 if (width == BitWidth)
932 assert(width <= BitWidth && "Invalid APInt Truncate request");
943 assert(width <= BitWidth && "Invalid APInt Truncate request");
955 assert(Width >= BitWidth && "Invalid APInt SignExtend request");
958 return APInt(Width, SignExtend64(U.VAL, BitWidth));
960 if (Width == BitWidth)
971 ((BitWidth - 1) % APINT_BITS_PER_WORD) + 1);
982 assert(width >= BitWidth && "Invalid APInt ZeroExtend request");
987 if (width == BitWidth)
1003 if (BitWidth < width)
1005 if (BitWidth > width)
1011 if (BitWidth < width)
1013 if (BitWidth > width)
1021 ashrInPlace((unsigned)shiftAmt.getLimitedValue(BitWidth));
1042 U.pVal[getNumWords() - 1], ((BitWidth - 1) % APINT_BITS_PER_WORD) + 1);
1070 lshrInPlace((unsigned)shiftAmt.getLimitedValue(BitWidth));
1082 // It's undefined behavior in C to shift by BitWidth or greater.
1083 *this <<= (unsigned)shiftAmt.getLimitedValue(BitWidth);
1093 static unsigned rotateModulo(unsigned BitWidth, const APInt &rotateAmt) {
1094 if (LLVM_UNLIKELY(BitWidth == 0))
1098 if (rotBitWidth < BitWidth) {
1101 rot = rotateAmt.zext(BitWidth);
1103 rot = rot.urem(APInt(rot.getBitWidth(), BitWidth));
1104 return rot.getLimitedValue(BitWidth);
1108 return rotl(rotateModulo(BitWidth, rotateAmt));
1112 if (LLVM_UNLIKELY(BitWidth == 0))
1114 rotateAmt %= BitWidth;
1117 return shl(rotateAmt) | lshr(BitWidth - rotateAmt);
1121 return rotr(rotateModulo(BitWidth, rotateAmt));
1125 if (BitWidth == 0)
1127 rotateAmt %= BitWidth;
1130 return lshr(rotateAmt) | shl(BitWidth - rotateAmt);
1135 /// NOTE: When we have a BitWidth of 1, we define:
1146 if (BitWidth == 1)
1186 return APInt(BitWidth, results[ (isSingleWord() ? U.VAL : U.pVal[0]) ]);
1194 return APInt(BitWidth,
1204 unsigned nbits = BitWidth, i = 4;
1205 APInt testy(BitWidth, 16);
1206 APInt x_old(BitWidth, 1);
1207 APInt x_new(BitWidth, 0);
1208 APInt two(BitWidth, 2);
1243 /// \returns the multiplicative inverse of an odd APInt modulo 2^BitWidth.
1544 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
1549 return APInt(BitWidth, U.VAL / RHS.U.VAL);
1561 return APInt(BitWidth, 0);
1567 return APInt(BitWidth, 0);
1570 return APInt(BitWidth, 1);
1573 return APInt(BitWidth, this->U.pVal[0] / RHS.U.pVal[0]);
1576 APInt Quotient(BitWidth, 0); // to hold result.
1586 return APInt(BitWidth, U.VAL / RHS);
1594 return APInt(BitWidth, 0);
1600 return APInt(BitWidth, 0);
1603 return APInt(BitWidth, 1);
1606 return APInt(BitWidth, this->U.pVal[0] / RHS);
1609 APInt Quotient(BitWidth, 0); // to hold result.
1637 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
1640 return APInt(BitWidth, U.VAL % RHS.U.VAL);
1654 return APInt(BitWidth, 0);
1657 return APInt(BitWidth, 0);
1663 return APInt(BitWidth, 0);
1666 return APInt(BitWidth, U.pVal[0] % RHS.U.pVal[0]);
1669 APInt Remainder(BitWidth, 0);
1730 assert(LHS.BitWidth == RHS.BitWidth && "Bit widths must be the same");
1731 unsigned BitWidth = LHS.BitWidth;
1738 Quotient = APInt(BitWidth, QuotVal);
1739 Remainder = APInt(BitWidth, RemVal);
1751 Quotient = APInt(BitWidth, 0); // 0 / Y ===> 0
1752 Remainder = APInt(BitWidth, 0); // 0 % Y ===> 0
1758 Remainder = APInt(BitWidth, 0); // X % 1 ===> 0
1763 Quotient = APInt(BitWidth, 0); // X / Y ===> 0, iff X < Y
1768 Quotient = APInt(BitWidth, 1); // X / X ===> 1
1769 Remainder = APInt(BitWidth, 0); // X % X ===> 0;
1777 Quotient.reallocate(BitWidth);
1778 Remainder.reallocate(BitWidth);
1794 (getNumWords(BitWidth) - lhsWords) * APINT_WORD_SIZE);
1796 (getNumWords(BitWidth) - rhsWords) * APINT_WORD_SIZE);
1802 unsigned BitWidth = LHS.BitWidth;
1808 Quotient = APInt(BitWidth, QuotVal);
1817 Quotient = APInt(BitWidth, 0); // 0 / Y ===> 0
1830 Quotient = APInt(BitWidth, 0); // X / Y ===> 0, iff X < Y
1835 Quotient = APInt(BitWidth, 1); // X / X ===> 1
1843 Quotient.reallocate(BitWidth);
1857 (getNumWords(BitWidth) - lhsWords) * APINT_WORD_SIZE);
1942 if (countl_zero() + RHS.countl_zero() + 2 <= BitWidth) {
1965 return APInt(BitWidth, 0);
1982 return APInt(BitWidth, 0);
2002 return isNegative() ? APInt::getSignedMinValue(BitWidth)
2003 : APInt::getSignedMaxValue(BitWidth);
2012 return APInt::getMaxValue(BitWidth);
2021 return isNegative() ? APInt::getSignedMinValue(BitWidth)
2022 : APInt::getSignedMaxValue(BitWidth);
2031 return APInt(BitWidth, 0);
2043 return ResIsNegative ? APInt::getSignedMinValue(BitWidth)
2044 : APInt::getSignedMaxValue(BitWidth);
2053 return APInt::getMaxValue(BitWidth);
2066 return isNegative() ? APInt::getSignedMinValue(BitWidth)
2067 : APInt::getSignedMaxValue(BitWidth);
2080 return APInt::getMaxValue(BitWidth);
2272 dbgs() << "APInt(" << BitWidth << "b, "
2827 // and R = 2^BitWidth.