LLVM: llvm::APFixedPoint Class Reference (original) (raw)

The APFixedPoint class works similarly to APInt/APSInt in that it is a functional replacement for a scaled integer. More...

#include "[llvm/ADT/APFixedPoint.h](APFixedPoint%5F8h%5Fsource.html)"

Public Member Functions
APFixedPoint (const APInt &Val, const FixedPointSemantics &Sema)
APFixedPoint (uint64_t Val, const FixedPointSemantics &Sema)
APFixedPoint (const FixedPointSemantics &Sema)
APSInt getValue () const
unsigned getWidth () const
unsigned getScale () const
int getLsbWeight () const
int getMsbWeight () const
bool isSaturated () const
bool isSigned () const
bool hasPadding () const
FixedPointSemantics getSemantics () const
bool getBoolValue () const
LLVM_ABI APFixedPoint convert (const FixedPointSemantics &DstSema, bool *Overflow=nullptr) const
LLVM_ABI APFixedPoint add (const APFixedPoint &Other, bool *Overflow=nullptr) const
LLVM_ABI APFixedPoint sub (const APFixedPoint &Other, bool *Overflow=nullptr) const
LLVM_ABI APFixedPoint mul (const APFixedPoint &Other, bool *Overflow=nullptr) const
LLVM_ABI APFixedPoint div (const APFixedPoint &Other, bool *Overflow=nullptr) const
LLVM_ABI APFixedPoint shl (unsigned Amt, bool *Overflow=nullptr) const
APFixedPoint shr (unsigned Amt, bool *Overflow=nullptr) const
LLVM_ABI APFixedPoint negate (bool *Overflow=nullptr) const
Perform a unary negation (-X) on this fixed point type, taking into account saturation if applicable.
APSInt getIntPart () const
Return the integral part of this fixed point number, rounded towards zero.
LLVM_ABI APSInt convertToInt (unsigned DstWidth, bool DstSign, bool *Overflow=nullptr) const
Return the integral part of this fixed point number, rounded towards zero.
LLVM_ABI APFloat convertToFloat (const fltSemantics &FloatSema) const
Convert this fixed point number to a floating point value with the provided semantics.
LLVM_ABI void toString (SmallVectorImpl< char > &Str) const
std::string toString () const
LLVM_ABI void print (raw_ostream &) const
LLVM_DUMP_METHOD void dump () const
LLVM_ABI int compare (const APFixedPoint &Other) const
bool operator== (const APFixedPoint &Other) const
bool operator!= (const APFixedPoint &Other) const
bool operator> (const APFixedPoint &Other) const
bool operator< (const APFixedPoint &Other) const
bool operator>= (const APFixedPoint &Other) const
bool operator<= (const APFixedPoint &Other) const
Static Public Member Functions
static LLVM_ABI APFixedPoint getMax (const FixedPointSemantics &Sema)
static LLVM_ABI APFixedPoint getMin (const FixedPointSemantics &Sema)
static LLVM_ABI APFixedPoint getEpsilon (const FixedPointSemantics &Sema)
static LLVM_ABI const fltSemantics * promoteFloatSemantics (const fltSemantics *S)
Given a floating point semantic, return the next floating point semantic with a larger exponent and larger or equal mantissa.
static LLVM_ABI APFixedPoint getFromIntValue (const APSInt &Value, const FixedPointSemantics &DstFXSema, bool *Overflow=nullptr)
Create an APFixedPoint with a value equal to that of the provided integer, and in the same semantics as the provided target semantics.
static LLVM_ABI APFixedPoint getFromFloatValue (const APFloat &Value, const FixedPointSemantics &DstFXSema, bool *Overflow=nullptr)
Create an APFixedPoint with a value equal to that of the provided floating point value, in the provided target semantics.

The APFixedPoint class works similarly to APInt/APSInt in that it is a functional replacement for a scaled integer.

It supports a wide range of semantics including the one used by fixed point types proposed in ISO/IEC JTC1 SC22 WG14 N1169. The class carries the value and semantics of a fixed point, and provides different operations that would normally be performed on fixed point types.

Definition at line 163 of file APFixedPoint.h.

Definition at line 165 of file APFixedPoint.h.

References assert(), and isSigned().

Referenced by add(), APFixedPoint(), APFixedPoint(), compare(), convert(), div(), getEpsilon(), getFromFloatValue(), getFromIntValue(), getMax(), getMin(), mul(), negate(), operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), shl(), shr(), and sub().

APFixedPoint() [2/3]

APFixedPoint() [3/3]

add()

compare()

Definition at line 83 of file APFixedPoint.cpp.

References APFixedPoint(), llvm::APSInt::extOrTrunc(), getLsbWeight(), getMsbWeight(), getValue(), llvm::APInt::isSignBitSet(), llvm::APSInt::isSigned(), llvm::Other, llvm::APInt::sgt(), llvm::APInt::shl(), llvm::APInt::slt(), llvm::APInt::ugt(), and llvm::APInt::ult().

Referenced by operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

convert()

Definition at line 42 of file APFixedPoint.cpp.

References APFixedPoint(), llvm::APSInt::extend(), llvm::APSInt::extOrTrunc(), llvm::APInt::getBitsSetFrom(), llvm::APInt::getBitWidth(), llvm::FixedPointSemantics::getIntegralBits(), getLsbWeight(), llvm::FixedPointSemantics::getLsbWeight(), llvm::FixedPointSemantics::getWidth(), llvm::APSInt::isNegative(), llvm::FixedPointSemantics::isSaturated(), llvm::APSInt::isSigned(), llvm::FixedPointSemantics::isSigned(), llvm::Masked, llvm::APSInt::relativeShl(), and llvm::APSInt::setIsSigned().

Referenced by add(), div(), mul(), and sub().

convertToFloat()

convertToInt()

div()

Definition at line 303 of file APFixedPoint.cpp.

References APFixedPoint(), convert(), llvm::APSInt::extOrTrunc(), getMax(), getMin(), getValue(), llvm::APSInt::isNegative(), llvm::APInt::isZero(), llvm::Other, llvm::APInt::sdivrem(), llvm::APInt::sext(), llvm::APInt::shl(), llvm::APInt::udiv(), and llvm::APInt::zext().

dump()

getBoolValue()

bool llvm::APFixedPoint::getBoolValue ( ) const inline

getEpsilon()

getFromFloatValue()

Create an APFixedPoint with a value equal to that of the provided floating point value, in the provided target semantics.

If the value is not able to fit in the specified fixed point semantics and the overflow parameter is specified, it is set to true. For NaN, the Overflow flag is always set. For +inf and -inf, if the semantic is saturating, the value saturates. Otherwise, the Overflow flag is set.

Definition at line 555 of file APFixedPoint.cpp.

References APFixedPoint(), llvm::APFloat::convert(), convertToFloat(), llvm::FixedPointSemantics::fitsInFloatSemantics(), llvm::FixedPointSemantics::getLsbWeight(), getMax(), getMin(), getValue(), llvm::FixedPointSemantics::getWidth(), llvm::FixedPointSemantics::isSaturated(), llvm::FixedPointSemantics::isSigned(), promoteFloatSemantics(), and llvm::APFloatBase::rmTowardZero.

getFromIntValue()

getIntPart()

APSInt llvm::APFixedPoint::getIntPart ( ) const inline

getLsbWeight()

int llvm::APFixedPoint::getLsbWeight ( ) const inline

getMax()

getMin()

getMsbWeight()

int llvm::APFixedPoint::getMsbWeight ( ) const inline

getScale()

unsigned llvm::APFixedPoint::getScale ( ) const inline

getSemantics()

getValue()

APSInt llvm::APFixedPoint::getValue ( ) const inline

getWidth()

unsigned llvm::APFixedPoint::getWidth ( ) const inline

hasPadding()

bool llvm::APFixedPoint::hasPadding ( ) const inline

isSaturated()

bool llvm::APFixedPoint::isSaturated ( ) const inline

isSigned()

bool llvm::APFixedPoint::isSigned ( ) const inline

mul()

Definition at line 245 of file APFixedPoint.cpp.

References APFixedPoint(), assert(), convert(), llvm::APSInt::extOrTrunc(), getMax(), getMin(), getValue(), llvm::Other, llvm::APInt::relativeAShl(), llvm::APInt::relativeLShl(), llvm::APInt::sext(), llvm::APInt::smul_ov(), llvm::APInt::umul_ov(), and llvm::APInt::zext().

negate()

operator!=()

operator<()

operator<=()

operator==()

operator>()

operator>=()

print()

void llvm::APFixedPoint::print ( raw_ostream & OS ) const

promoteFloatSemantics()

shl()

shr()

sub()

toString() [1/2]

std::string llvm::APFixedPoint::toString ( ) const inline

toString() [2/2]


The documentation for this class was generated from the following files: