Lines Matching +full:full +full:- +full:scale
1 //===- APFixedPoint.cpp - Fixed point constant handling ---------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
24 OS << "scale=" << getScale() << ", "; in print()
35 int RelativeUpscale = getLsbWeight() - DstSema.getLsbWeight(); in convert()
45 std::min(DstSema.getIntegralBits() - DstSema.getLsbWeight(), in convert()
81 unsigned CommonWidth = CommonMsb - CommonLsb + 1; in compare()
86 ThisVal = ThisVal.shl(getLsbWeight() - CommonLsb); in compare()
87 OtherVal = OtherVal.shl(Other.getLsbWeight() - CommonLsb); in compare()
93 return -1; in compare()
98 return -1; in compare()
101 return -1; in compare()
105 return -1; in compare()
113 return -1; in compare()
164 int CommonMSb = std::max(getMsbWeight() - hasSignOrPaddingBit(), in getCommonSemantics()
165 Other.getMsbWeight() - Other.hasSignOrPaddingBit()); in getCommonSemantics()
166 unsigned CommonWidth = CommonMSb - CommonLsb + 1; in getCommonSemantics()
244 // Widen the LHS and RHS so we can perform a full multiplication. in mul()
254 // Perform the full multiplication and downscale to get the same scale. in mul()
268 assert(!Overflowed && "Full multiplication cannot overflow!"); in mul()
301 // Widen the LHS and RHS so we can perform a full division. in div()
305 CommonFXSema.getWidth() * 2 + std::max(-CommonFXSema.getMsbWeight(), 0); in div()
315 // perform the full division. in div()
317 ThisVal = ThisVal.shl(-CommonFXSema.getLsbWeight()); in div()
327 Result = Result - 1; in div()
403 Val = -Val; in toString()
405 Str.push_back('-'); in toString()
408 int Scale = -getLsbWeight(); in toString() local
409 APSInt IntPart = (OrigWidth > Scale) ? (Val >> Scale) : APSInt::get(0); in toString()
412 unsigned Width = std::max(OrigWidth, Scale) + 4; in toString()
413 APInt FractPart = Val.zextOrTrunc(Scale).zext(Width); in toString()
414 APInt FractPartMask = APInt::getAllOnes(Scale).zext(Width); in toString()
421 .lshr(Scale) in toString()
439 return APFixedPoint(-Val, Sema); in negate()
447 return Val.isMinSignedValue() ? getMax(Sema) : APFixedPoint(-Val, Sema); in negate()
500 // Make sure that we are operating in a type that works with this fixed-point in convertToFloat()
516 // Scale down the integer value in the float to match the correct scaling in convertToFloat()
557 // Make sure that we are operating in a type that works with this fixed-point in getFromFloatValue()
569 // Scale up the float so that the 'fractional' part of the mantissa ends up in in getFromFloatValue()
573 APFloat ScaleFactor(std::pow(2, -DstFXSema.getLsbWeight())); in getFromFloatValue()
582 // Round the integral value and scale back. This makes the in getFromFloatValue()
585 // representable range of the fixed-point semantic even though no overflow in getFromFloatValue()
593 // is outside the range representable by the fixed-point value. in getFromFloatValue()