Lines Matching refs:BitWidth

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