Lines Matching refs:BitWidth
92 assert(BitWidth && "Bitwidth too small"); in initFromArray()
109 : BitWidth(numBits) { in APInt()
114 : BitWidth(numBits) { in APInt()
119 : BitWidth(numbits) { in APInt()
120 assert(BitWidth && "Bitwidth too small"); in APInt()
127 BitWidth = NewBitWidth; in reallocate()
136 BitWidth = NewBitWidth; in reallocate()
160 ID.AddInteger(BitWidth); in Profile()
194 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in operator +=()
214 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in operator -=()
231 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in operator *()
233 return APInt(BitWidth, U.VAL * RHS.U.VAL); in operator *()
256 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in operator *=()
276 assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison"); in compare()
284 assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison"); in compareSigned()
286 int64_t lhsSext = SignExtend64(U.VAL, BitWidth); in compareSigned()
287 int64_t rhsSext = SignExtend64(RHS.U.VAL, BitWidth); in compareSigned()
340 assert(bitPosition < BitWidth && "Out of the bit-width range!"); in flipBit()
346 assert(0 < subBitWidth && (subBitWidth + bitPosition) <= BitWidth && in insertBits()
350 if (subBitWidth == BitWidth) { in insertBits()
428 assert(bitPosition < BitWidth && (numBits + bitPosition) <= BitWidth && in extractBits()
466 assert(bitPosition < BitWidth && (numBits + bitPosition) <= BitWidth && in extractBitsAsZExtValue()
546 return hash_combine(Arg.BitWidth, Arg.U.VAL); in hash_value()
549 Arg.BitWidth, in hash_value()
567 return this->lshr(BitWidth - numBits); in getHiBits()
572 APInt Result(getLowBitsSet(BitWidth, numBits)); in getLoBits()
600 unsigned Mod = BitWidth % APINT_BITS_PER_WORD; in countLeadingZerosSlowCase()
606 unsigned highWordBits = BitWidth % APINT_BITS_PER_WORD; in countLeadingOnesSlowCase()
636 return std::min(Count, BitWidth); in countTrailingZerosSlowCase()
646 assert(Count <= BitWidth); in countTrailingOnesSlowCase()
674 assert(BitWidth >= 16 && BitWidth % 8 == 0 && "Cannot byteswap!"); in byteSwap()
675 if (BitWidth == 16) in byteSwap()
676 return APInt(BitWidth, ByteSwap_16(uint16_t(U.VAL))); in byteSwap()
677 if (BitWidth == 32) in byteSwap()
678 return APInt(BitWidth, ByteSwap_32(unsigned(U.VAL))); in byteSwap()
679 if (BitWidth <= 64) { in byteSwap()
681 Tmp1 >>= (64 - BitWidth); in byteSwap()
682 return APInt(BitWidth, Tmp1); in byteSwap()
688 if (Result.BitWidth != BitWidth) { in byteSwap()
689 Result.lshrInPlace(Result.BitWidth - BitWidth); in byteSwap()
690 Result.BitWidth = BitWidth; in byteSwap()
696 switch (BitWidth) { in reverseBits()
698 return APInt(BitWidth, llvm::reverseBits<uint64_t>(U.VAL)); in reverseBits()
700 return APInt(BitWidth, llvm::reverseBits<uint32_t>(U.VAL)); in reverseBits()
702 return APInt(BitWidth, llvm::reverseBits<uint16_t>(U.VAL)); in reverseBits()
704 return APInt(BitWidth, llvm::reverseBits<uint8_t>(U.VAL)); in reverseBits()
710 APInt Reversed(BitWidth, 0); in reverseBits()
711 unsigned S = BitWidth; in reverseBits()
811 int64_t sext = SignExtend64(getWord(0), BitWidth); in roundToDouble()
818 bool isNeg = isSigned ? (*this)[BitWidth-1] : false; in roundToDouble()
863 assert(width < BitWidth && "Invalid APInt Truncate request"); in trunc()
886 assert(width < BitWidth && "Invalid APInt Truncate request"); in truncUSat()
898 assert(width < BitWidth && "Invalid APInt Truncate request"); in truncSSat()
911 assert(Width > BitWidth && "Invalid APInt SignExtend request"); in sext()
914 return APInt(Width, SignExtend64(U.VAL, BitWidth)); in sext()
924 ((BitWidth - 1) % APINT_BITS_PER_WORD) + 1); in sext()
935 assert(width > BitWidth && "Invalid APInt ZeroExtend request"); in zext()
953 if (BitWidth < width) in zextOrTrunc()
955 if (BitWidth > width) in zextOrTrunc()
961 if (BitWidth < width) in sextOrTrunc()
963 if (BitWidth > width) in sextOrTrunc()
969 if (BitWidth > width) in truncOrSelf()
975 if (BitWidth < width) in zextOrSelf()
981 if (BitWidth < width) in sextOrSelf()
989 ashrInPlace((unsigned)shiftAmt.getLimitedValue(BitWidth)); in ashrInPlace()
1010 U.pVal[getNumWords() - 1], ((BitWidth - 1) % APINT_BITS_PER_WORD) + 1); in ashrSlowCase()
1038 lshrInPlace((unsigned)shiftAmt.getLimitedValue(BitWidth)); in lshrInPlace()
1051 *this <<= (unsigned)shiftAmt.getLimitedValue(BitWidth); in operator <<=()
1061 static unsigned rotateModulo(unsigned BitWidth, const APInt &rotateAmt) { in rotateModulo() argument
1064 if (rotBitWidth < BitWidth) { in rotateModulo()
1067 rot = rotateAmt.zext(BitWidth); in rotateModulo()
1069 rot = rot.urem(APInt(rot.getBitWidth(), BitWidth)); in rotateModulo()
1070 return rot.getLimitedValue(BitWidth); in rotateModulo()
1074 return rotl(rotateModulo(BitWidth, rotateAmt)); in rotl()
1078 rotateAmt %= BitWidth; in rotl()
1081 return shl(rotateAmt) | lshr(BitWidth - rotateAmt); in rotl()
1085 return rotr(rotateModulo(BitWidth, rotateAmt)); in rotr()
1089 rotateAmt %= BitWidth; in rotr()
1092 return lshr(rotateAmt) | shl(BitWidth - rotateAmt); in rotr()
1119 return APInt(BitWidth, results[ (isSingleWord() ? U.VAL : U.pVal[0]) ]); in sqrt()
1127 return APInt(BitWidth, in sqrt()
1137 unsigned nbits = BitWidth, i = 4; in sqrt()
1138 APInt testy(BitWidth, 16); in sqrt()
1139 APInt x_old(BitWidth, 1); in sqrt()
1140 APInt x_new(BitWidth, 0); in sqrt()
1141 APInt two(BitWidth, 2); in sqrt()
1195 APInt t[2] = { APInt(BitWidth, 0), APInt(BitWidth, 1) }; in multiplicativeInverse()
1196 APInt q(BitWidth, 0); in multiplicativeInverse()
1213 return APInt(BitWidth, 0); in multiplicativeInverse()
1605 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in udiv()
1610 return APInt(BitWidth, U.VAL / RHS.U.VAL); in udiv()
1622 return APInt(BitWidth, 0); in udiv()
1628 return APInt(BitWidth, 0); in udiv()
1631 return APInt(BitWidth, 1); in udiv()
1634 return APInt(BitWidth, this->U.pVal[0] / RHS.U.pVal[0]); in udiv()
1637 APInt Quotient(BitWidth, 0); // to hold result. in udiv()
1647 return APInt(BitWidth, U.VAL / RHS); in udiv()
1655 return APInt(BitWidth, 0); in udiv()
1661 return APInt(BitWidth, 0); in udiv()
1664 return APInt(BitWidth, 1); in udiv()
1667 return APInt(BitWidth, this->U.pVal[0] / RHS); in udiv()
1670 APInt Quotient(BitWidth, 0); // to hold result. in udiv()
1698 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in urem()
1701 return APInt(BitWidth, U.VAL % RHS.U.VAL); in urem()
1715 return APInt(BitWidth, 0); in urem()
1718 return APInt(BitWidth, 0); in urem()
1724 return APInt(BitWidth, 0); in urem()
1727 return APInt(BitWidth, U.pVal[0] % RHS.U.pVal[0]); in urem()
1730 APInt Remainder(BitWidth, 0); in urem()
1791 assert(LHS.BitWidth == RHS.BitWidth && "Bit widths must be the same"); in udivrem()
1792 unsigned BitWidth = LHS.BitWidth; in udivrem() local
1799 Quotient = APInt(BitWidth, QuotVal); in udivrem()
1800 Remainder = APInt(BitWidth, RemVal); in udivrem()
1812 Quotient = APInt(BitWidth, 0); // 0 / Y ===> 0 in udivrem()
1813 Remainder = APInt(BitWidth, 0); // 0 % Y ===> 0 in udivrem()
1819 Remainder = APInt(BitWidth, 0); // X % 1 ===> 0 in udivrem()
1824 Quotient = APInt(BitWidth, 0); // X / Y ===> 0, iff X < Y in udivrem()
1829 Quotient = APInt(BitWidth, 1); // X / X ===> 1 in udivrem()
1830 Remainder = APInt(BitWidth, 0); // X % X ===> 0; in udivrem()
1838 Quotient.reallocate(BitWidth); in udivrem()
1839 Remainder.reallocate(BitWidth); in udivrem()
1855 (getNumWords(BitWidth) - lhsWords) * APINT_WORD_SIZE); in udivrem()
1857 (getNumWords(BitWidth) - rhsWords) * APINT_WORD_SIZE); in udivrem()
1863 unsigned BitWidth = LHS.BitWidth; in udivrem() local
1869 Quotient = APInt(BitWidth, QuotVal); in udivrem()
1878 Quotient = APInt(BitWidth, 0); // 0 / Y ===> 0 in udivrem()
1891 Quotient = APInt(BitWidth, 0); // X / Y ===> 0, iff X < Y in udivrem()
1896 Quotient = APInt(BitWidth, 1); // X / X ===> 1 in udivrem()
1904 Quotient.reallocate(BitWidth); in udivrem()
1918 (getNumWords(BitWidth) - lhsWords) * APINT_WORD_SIZE); in udivrem()
2002 if (countLeadingZeros() + RHS.countLeadingZeros() + 2 <= BitWidth) { in umul_ov()
2021 return APInt(BitWidth, 0); in sshl_ov()
2034 return APInt(BitWidth, 0); in ushl_ov()
2047 return isNegative() ? APInt::getSignedMinValue(BitWidth) in sadd_sat()
2048 : APInt::getSignedMaxValue(BitWidth); in sadd_sat()
2057 return APInt::getMaxValue(BitWidth); in uadd_sat()
2066 return isNegative() ? APInt::getSignedMinValue(BitWidth) in ssub_sat()
2067 : APInt::getSignedMaxValue(BitWidth); in ssub_sat()
2076 return APInt(BitWidth, 0); in usub_sat()
2088 return ResIsNegative ? APInt::getSignedMinValue(BitWidth) in smul_sat()
2089 : APInt::getSignedMaxValue(BitWidth); in smul_sat()
2098 return APInt::getMaxValue(BitWidth); in umul_sat()
2107 return isNegative() ? APInt::getSignedMinValue(BitWidth) in sshl_sat()
2108 : APInt::getSignedMaxValue(BitWidth); in sshl_sat()
2117 return APInt::getMaxValue(BitWidth); in ushl_sat()
2289 dbgs() << "APInt(" << BitWidth << "b, " in dump()