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

The fixed point semantics work similarly to fltSemantics. More...

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

Classes
struct Lsb
Used to differentiate between constructors with Width and Lsb from the default Width and scale. More...
Public Member Functions
FixedPointSemantics (unsigned Width, unsigned Scale, bool IsSigned, bool IsSaturated, bool HasUnsignedPadding)
FixedPointSemantics (unsigned Width, Lsb Weight, bool IsSigned, bool IsSaturated, bool HasUnsignedPadding)
bool isValidLegacySema () const
Check if the Semantic follow the requirements of an older more limited version of this class.
unsigned getWidth () const
unsigned getScale () const
int getLsbWeight () const
int getMsbWeight () const
bool isSigned () const
bool isSaturated () const
bool hasUnsignedPadding () const
void setSaturated (bool Saturated)
bool hasSignOrPaddingBit () const
return true if the first bit doesn't have a strictly positive weight
unsigned getIntegralBits () const
Return the number of integral bits represented by these semantics.
LLVM_ABI FixedPointSemantics getCommonSemantics (const FixedPointSemantics &Other) const
Return the FixedPointSemantics that allows for calculating the full precision semantic that can precisely represent the precision and ranges of both input values.
LLVM_ABI void print (llvm::raw_ostream &OS) const
Print semantics for debug purposes.
LLVM_ABI bool fitsInFloatSemantics (const fltSemantics &FloatSema) const
Returns true if this fixed-point semantic with its value bits interpreted as an integer can fit in the given floating point semantic without overflowing to infinity.
bool operator== (FixedPointSemantics Other) const
bool operator!= (FixedPointSemantics Other) const
LLVM_ABI uint32_t toOpaqueInt () const
Convert the semantics to a 32-bit unsigned integer.

The fixed point semantics work similarly to fltSemantics.

The width specifies the whole bit width of the underlying scaled integer (with padding if any). The scale represents the number of fractional bits in this type. When HasUnsignedPadding is true and this type is unsigned, the first bit in the value this represents is treated as padding.

Definition at line 35 of file APFixedPoint.h.

llvm::FixedPointSemantics::FixedPointSemantics ( unsigned Width, unsigned Scale, bool IsSigned, bool IsSaturated, bool HasUnsignedPadding ) inline

FixedPointSemantics() [2/2]

llvm::FixedPointSemantics::FixedPointSemantics ( unsigned Width, Lsb Weight, bool IsSigned, bool IsSaturated, bool HasUnsignedPadding ) inline

fitsInFloatSemantics()

Returns true if this fixed-point semantic with its value bits interpreted as an integer can fit in the given floating point semantic without overflowing to infinity.

For example, a signed 8-bit fixed-point semantic has a maximum and minimum integer representation of 127 and -128, respectively. If both of these values can be represented (possibly inexactly) in the floating point semantic without overflowing, this returns true.

Definition at line 148 of file APFixedPoint.cpp.

References F, llvm::APFixedPoint::getMax(), llvm::APFixedPoint::getMin(), llvm::APFixedPoint::getValue(), llvm::APSInt::isSigned(), isSigned(), llvm::APFloatBase::opOverflow, and llvm::APFloatBase::rmNearestTiesToAway.

Referenced by llvm::APFixedPoint::getFromFloatValue().

getCommonSemantics()

Return the FixedPointSemantics that allows for calculating the full precision semantic that can precisely represent the precision and ranges of both input values.

This does not compute the resulting semantics for a given binary operation.

Definition at line 171 of file APFixedPoint.cpp.

References FixedPointSemantics(), getLsbWeight(), getMsbWeight(), hasSignOrPaddingBit(), hasUnsignedPadding(), isSaturated(), isSigned(), and llvm::Other.

Referenced by llvm::FixedPointBuilder< IRBuilderTy >::CreateAdd(), llvm::FixedPointBuilder< IRBuilderTy >::CreateDiv(), llvm::FixedPointBuilder< IRBuilderTy >::CreateMul(), and llvm::FixedPointBuilder< IRBuilderTy >::CreateSub().

getFromOpaqueInt()

GetIntegerSemantics()

getIntegralBits()

unsigned llvm::FixedPointSemantics::getIntegralBits ( ) const inline

getLsbWeight()

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

getMsbWeight()

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

getScale()

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

getWidth()

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

hasSignOrPaddingBit()

bool llvm::FixedPointSemantics::hasSignOrPaddingBit ( ) const inline

hasUnsignedPadding()

bool llvm::FixedPointSemantics::hasUnsignedPadding ( ) const inline

isSaturated()

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

isSigned()

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

isValidLegacySema()

bool llvm::FixedPointSemantics::isValidLegacySema ( ) const inline

operator!=()

operator==()

print()

setSaturated()

void llvm::FixedPointSemantics::setSaturated ( bool Saturated) inline

toOpaqueInt()

uint32_t llvm::FixedPointSemantics::toOpaqueInt ( ) const

LsbWeightBitWidth

unsigned llvm::FixedPointSemantics::LsbWeightBitWidth = 13 staticconstexpr

WidthBitWidth

unsigned llvm::FixedPointSemantics::WidthBitWidth = 16 staticconstexpr

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