LLVM 22.0.0git
llvm::APFloat Class Reference

#include "llvm/ADT/APFloat.h"

Inheritance diagram for llvm::APFloat:
[legend]

Public Member Functions

 APFloat (const fltSemantics &Semantics)
LLVM_ABI APFloat (const fltSemantics &Semantics, StringRef S)
 APFloat (const fltSemantics &Semantics, integerPart I)
template<typename T, typename = std::enable_if_t<std::is_floating_point<T>::value>>
 APFloat (const fltSemantics &Semantics, T V)=delete
 APFloat (const fltSemantics &Semantics, uninitializedTag)
 APFloat (const fltSemantics &Semantics, const APInt &I)
 APFloat (double d)
 APFloat (float f)
 APFloat (const APFloat &RHS)=default
 APFloat (APFloat &&RHS)=default
 ~APFloat ()=default
bool needsCleanup () const
LLVM_ABI void Profile (FoldingSetNodeID &NID) const
 Used to insert APFloat objects, or objects that contain APFloat objects, into FoldingSets.
opStatus add (const APFloat &RHS, roundingMode RM)
opStatus subtract (const APFloat &RHS, roundingMode RM)
opStatus multiply (const APFloat &RHS, roundingMode RM)
opStatus divide (const APFloat &RHS, roundingMode RM)
opStatus remainder (const APFloat &RHS)
opStatus mod (const APFloat &RHS)
opStatus fusedMultiplyAdd (const APFloat &Multiplicand, const APFloat &Addend, roundingMode RM)
opStatus roundToIntegral (roundingMode RM)
opStatus next (bool nextDown)
APFloat operator- () const
 Negate an APFloat.
APFloat operator+ (const APFloat &RHS) const
 Add two APFloats, rounding ties to the nearest even.
APFloat operator- (const APFloat &RHS) const
 Subtract two APFloats, rounding ties to the nearest even.
APFloat operator* (const APFloat &RHS) const
 Multiply two APFloats, rounding ties to the nearest even.
APFloat operator/ (const APFloat &RHS) const
 Divide the first APFloat by the second, rounding ties to the nearest even.
void changeSign ()
void clearSign ()
void copySign (const APFloat &RHS)
APFloat makeQuiet () const
 Assuming this is an IEEE-754 NaN value, quiet its signaling bit.
LLVM_ABI opStatus convert (const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
opStatus convertToInteger (MutableArrayRef< integerPart > Input, unsigned int Width, bool IsSigned, roundingMode RM, bool *IsExact) const
LLVM_ABI opStatus convertToInteger (APSInt &Result, roundingMode RM, bool *IsExact) const
opStatus convertFromAPInt (const APInt &Input, bool IsSigned, roundingMode RM)
LLVM_ABI Expected< opStatusconvertFromString (StringRef, roundingMode)
APInt bitcastToAPInt () const
LLVM_ABI double convertToDouble () const
 Converts this APFloat to host double value.
LLVM_ABI float convertToFloat () const
 Converts this APFloat to host float value.
bool operator== (const APFloat &RHS) const
bool operator!= (const APFloat &RHS) const
bool operator< (const APFloat &RHS) const
bool operator> (const APFloat &RHS) const
bool operator<= (const APFloat &RHS) const
bool operator>= (const APFloat &RHS) const
cmpResult compare (const APFloat &RHS) const
bool bitwiseIsEqual (const APFloat &RHS) const
bool isExactlyValue (double V) const
 We don't rely on operator== working on double values, as it returns true for things that are clearly not equal, like -0.0 and 0.0.
unsigned int convertToHexString (char *DST, unsigned int HexDigits, bool UpperCase, roundingMode RM) const
bool isZero () const
bool isInfinity () const
bool isNaN () const
bool isNegative () const
bool isDenormal () const
bool isSignaling () const
bool isNormal () const
bool isFinite () const
fltCategory getCategory () const
const fltSemanticsgetSemantics () const
bool isNonZero () const
bool isFiniteNonZero () const
bool isPosZero () const
bool isNegZero () const
bool isPosInfinity () const
bool isNegInfinity () const
bool isSmallest () const
bool isLargest () const
bool isInteger () const
bool isSmallestNormalized () const
LLVM_ABI FPClassTest classify () const
 Return the FPClassTest which will return true for the value.
APFloatoperator= (const APFloat &RHS)=default
APFloatoperator= (APFloat &&RHS)=default
void toString (SmallVectorImpl< char > &Str, unsigned FormatPrecision=0, unsigned FormatMaxPadding=3, bool TruncateZero=true) const
LLVM_ABI void print (raw_ostream &) const
LLVM_DUMP_METHOD void dump () const
bool getExactInverse (APFloat *Inv) const
 If this value is normal and has an exact, normal, multiplicative inverse, store it in inv and return true.
LLVM_READONLY int getExactLog2Abs () const
LLVM_READONLY int getExactLog2 () const

Static Public Member Functions

static APFloat getZero (const fltSemantics &Sem, bool Negative=false)
 Factory for Positive and Negative Zero.
static APFloat getOne (const fltSemantics &Sem, bool Negative=false)
 Factory for Positive and Negative One.
static APFloat getInf (const fltSemantics &Sem, bool Negative=false)
 Factory for Positive and Negative Infinity.
static APFloat getNaN (const fltSemantics &Sem, bool Negative=false, uint64_t payload=0)
 Factory for NaN values.
static APFloat getQNaN (const fltSemantics &Sem, bool Negative=false, const APInt *payload=nullptr)
 Factory for QNaN values.
static APFloat getSNaN (const fltSemantics &Sem, bool Negative=false, const APInt *payload=nullptr)
 Factory for SNaN values.
static APFloat getLargest (const fltSemantics &Sem, bool Negative=false)
 Returns the largest finite number in the given semantics.
static APFloat getSmallest (const fltSemantics &Sem, bool Negative=false)
 Returns the smallest (by magnitude) finite number in the given semantics.
static APFloat getSmallestNormalized (const fltSemantics &Sem, bool Negative=false)
 Returns the smallest (by magnitude) normalized finite number in the given semantics.
static LLVM_ABI APFloat getAllOnesValue (const fltSemantics &Semantics)
 Returns a float which is bitcasted from an all one value int.
static bool hasSignificand (const fltSemantics &Sem)
 Returns true if the given semantics has actual significand.
static APFloat copySign (APFloat Value, const APFloat &Sign)
 A static helper to produce a copy of an APFloat value with its sign copied from some other APFloat.
Static Public Member Functions inherited from llvm::APFloatBase
static LLVM_ABI unsigned int semanticsPrecision (const fltSemantics &)
static LLVM_ABI ExponentType semanticsMinExponent (const fltSemantics &)
static LLVM_ABI ExponentType semanticsMaxExponent (const fltSemantics &)
static LLVM_ABI unsigned int semanticsSizeInBits (const fltSemantics &)
static LLVM_ABI unsigned int semanticsIntSizeInBits (const fltSemantics &, bool)
static LLVM_ABI bool semanticsHasZero (const fltSemantics &)
static LLVM_ABI bool semanticsHasSignedRepr (const fltSemantics &)
static LLVM_ABI bool semanticsHasInf (const fltSemantics &)
static LLVM_ABI bool semanticsHasNaN (const fltSemantics &)
static LLVM_ABI bool isIEEELikeFP (const fltSemantics &)
static LLVM_ABI bool hasSignBitInMSB (const fltSemantics &)
static LLVM_ABI bool isRepresentableAsNormalIn (const fltSemantics &Src, const fltSemantics &Dst)
static LLVM_ABI unsigned getSizeInBits (const fltSemantics &Sem)
 Returns the size of the floating point number (in bits) in the given semantics.
static LLVM_ABI const llvm::fltSemanticsEnumToSemantics (Semantics S)
static LLVM_ABI Semantics SemanticsToEnum (const llvm::fltSemantics &Sem)
static LLVM_ABI const fltSemanticsIEEEhalf () LLVM_READNONE
static LLVM_ABI const fltSemanticsBFloat () LLVM_READNONE
static LLVM_ABI const fltSemanticsIEEEsingle () LLVM_READNONE
static LLVM_ABI const fltSemanticsIEEEdouble () LLVM_READNONE
static LLVM_ABI const fltSemanticsIEEEquad () LLVM_READNONE
static LLVM_ABI const fltSemanticsPPCDoubleDouble () LLVM_READNONE
static LLVM_ABI const fltSemanticsPPCDoubleDoubleLegacy () LLVM_READNONE
static LLVM_ABI const fltSemanticsFloat8E5M2 () LLVM_READNONE
static LLVM_ABI const fltSemanticsFloat8E5M2FNUZ () LLVM_READNONE
static LLVM_ABI const fltSemanticsFloat8E4M3 () LLVM_READNONE
static LLVM_ABI const fltSemanticsFloat8E4M3FN () LLVM_READNONE
static LLVM_ABI const fltSemanticsFloat8E4M3FNUZ () LLVM_READNONE
static LLVM_ABI const fltSemanticsFloat8E4M3B11FNUZ () LLVM_READNONE
static LLVM_ABI const fltSemanticsFloat8E3M4 () LLVM_READNONE
static LLVM_ABI const fltSemanticsFloatTF32 () LLVM_READNONE
static LLVM_ABI const fltSemanticsFloat8E8M0FNU () LLVM_READNONE
static LLVM_ABI const fltSemanticsFloat6E3M2FN () LLVM_READNONE
static LLVM_ABI const fltSemanticsFloat6E2M3FN () LLVM_READNONE
static LLVM_ABI const fltSemanticsFloat4E2M1FN () LLVM_READNONE
static LLVM_ABI const fltSemanticsx87DoubleExtended () LLVM_READNONE
static LLVM_ABI const fltSemanticsBogus () LLVM_READNONE
 A Pseudo fltsemantic used to construct APFloats that cannot conflict with anything real.
static LLVM_ABI bool isRepresentableBy (const fltSemantics &A, const fltSemantics &B)

Public Attributes

friend IEEEFloat
friend DoubleAPFloat

Friends

LLVM_ABI friend hash_code hash_value (const APFloat &Arg)
 See friend declarations above.
int ilogb (const APFloat &Arg)
 Returns the exponent of the internal representation of the APFloat.
APFloat scalbn (APFloat X, int Exp, roundingMode RM)
APFloat frexp (const APFloat &X, int &Exp, roundingMode RM)

Additional Inherited Members

Public Types inherited from llvm::APFloatBase
enum  cmpResult { cmpLessThan , cmpEqual , cmpGreaterThan , cmpUnordered }
 IEEE-754R 5.11: Floating Point Comparison Relations. More...
enum  opStatus {
  opOK = 0x00 , opInvalidOp = 0x01 , opDivByZero = 0x02 , opOverflow = 0x04 ,
  opUnderflow = 0x08 , opInexact = 0x10
}
 IEEE-754R 7: Default exception handling. More...
enum  fltCategory { fcInfinity , fcNaN , fcNormal , fcZero }
 Category of internally-represented number. More...
enum  uninitializedTag { uninitialized }
 Convenience enum used to construct an uninitialized APFloat. More...
enum  IlogbErrorKinds { IEK_Zero = INT_MIN + 1 , IEK_NaN = INT_MIN , IEK_Inf = INT_MAX }
 Enumeration of ilogb error results. More...
typedef APInt::WordType integerPart
typedef int32_t ExponentType
 A signed type to represent a floating point numbers unbiased exponent.
using roundingMode = llvm::RoundingMode
 IEEE-754R 4.3: Rounding-direction attributes.
enum  Semantics {
  S_IEEEhalf , S_BFloat , S_IEEEsingle , S_IEEEdouble ,
  S_IEEEquad , S_PPCDoubleDouble , S_PPCDoubleDoubleLegacy , S_Float8E5M2 ,
  S_Float8E5M2FNUZ , S_Float8E4M3 , S_Float8E4M3FN , S_Float8E4M3FNUZ ,
  S_Float8E4M3B11FNUZ , S_Float8E3M4 , S_FloatTF32 , S_Float8E8M0FNU ,
  S_Float6E3M2FN , S_Float6E2M3FN , S_Float4E2M1FN , S_x87DoubleExtended ,
  S_MaxSemantics = S_x87DoubleExtended
}
Static Public Attributes inherited from llvm::APFloatBase
static constexpr unsigned integerPartWidth = APInt::APINT_BITS_PER_WORD
static constexpr roundingMode rmNearestTiesToEven
static constexpr roundingMode rmTowardPositive = RoundingMode::TowardPositive
static constexpr roundingMode rmTowardNegative = RoundingMode::TowardNegative
static constexpr roundingMode rmTowardZero = RoundingMode::TowardZero
static constexpr roundingMode rmNearestTiesToAway

Detailed Description

Definition at line 900 of file APFloat.h.

Constructor & Destructor Documentation

◆ APFloat() [1/10]

llvm::APFloat::APFloat ( const fltSemantics & Semantics)
inline

Definition at line 1057 of file APFloat.h.

◆ APFloat() [2/10]

llvm::APFloat::APFloat ( const fltSemantics & Semantics,
StringRef S )

◆ APFloat() [3/10]

llvm::APFloat::APFloat ( const fltSemantics & Semantics,
integerPart I )
inline

Definition at line 1059 of file APFloat.h.

References I.

◆ APFloat() [4/10]

template<typename T, typename = std::enable_if_t<std::is_floating_point<T>::value>>
llvm::APFloat::APFloat ( const fltSemantics & Semantics,
T V )
delete

References T.

◆ APFloat() [5/10]

llvm::APFloat::APFloat ( const fltSemantics & Semantics,
uninitializedTag  )
inline

Definition at line 1064 of file APFloat.h.

References llvm::APFloatBase::uninitialized.

◆ APFloat() [6/10]

llvm::APFloat::APFloat ( const fltSemantics & Semantics,
const APInt & I )
inline

Definition at line 1066 of file APFloat.h.

References I.

◆ APFloat() [7/10]

llvm::APFloat::APFloat ( double d)
inlineexplicit

Definition at line 1067 of file APFloat.h.

References llvm::APFloatBase::IEEEdouble().

◆ APFloat() [8/10]

llvm::APFloat::APFloat ( float f)
inlineexplicit

Definition at line 1068 of file APFloat.h.

References llvm::APFloatBase::IEEEsingle().

◆ APFloat() [9/10]

llvm::APFloat::APFloat ( const APFloat & RHS)
default

References RHS.

◆ APFloat() [10/10]

llvm::APFloat::APFloat ( APFloat && RHS)
default

References RHS.

◆ ~APFloat()

llvm::APFloat::~APFloat ( )
default

Member Function Documentation

◆ add()

◆ bitcastToAPInt()

APInt llvm::APFloat::bitcastToAPInt ( ) const
inline

Definition at line 1353 of file APFloat.h.

References APFLOAT_DISPATCH_ON_SEMANTICS, and bitcastToAPInt().

Referenced by llvm::DwarfExpression::addConstantFP(), llvm::DwarfUnit::addConstantFPValue(), bitcastToAPInt(), llvm::detail::DoubleAPFloat::convertFromString(), convertIntToDoubleImm(), llvm::convertToNonDenormSingle(), llvm::SPIRVGlobalRegistry::createConstFP(), llvm::detail::DoubleAPFloat::divide(), emitGlobalConstantFP(), llvm::TargetLowering::expandIS_FPCLASS(), llvm::InstCombinerImpl::foldICmpAndConstConst(), foldLogOpOfMaskedICmps_NotAllZeros_BMask_Mixed(), llvm::detail::DoubleAPFloat::fusedMultiplyAdd(), llvm::generateSpecConstantInst(), llvm::ExecutionEngine::getConstantValue(), llvm::getExpressionForConstant(), llvm::AArch64_AM::getFP16Imm(), llvm::ARM_AM::getFP16Imm(), llvm::ARM_AM::getFP32FP16Imm(), llvm::AArch64_AM::getFP32Imm(), llvm::ARM_AM::getFP32Imm(), llvm::AArch64_AM::getFP64Imm(), llvm::ARM_AM::getFP64Imm(), llvm::RISCVLoadFPImm::getLoadFPImm(), llvm::HexagonLowerToMC(), llvm::GCNTTIImpl::instCombineIntrinsic(), llvm::AMDGPUTargetLowering::isInt64ImmLegal(), llvm::RISCVLegalizerInfo::legalizeCustom(), llvm::LegalizerHelper::lowerISFPCLASS(), llvm::CombinerHelper::matchCombineUnmergeConstant(), llvm::detail::DoubleAPFloat::mod(), llvm::NVPTXFloatMCExpr::printImpl(), Profile(), llvm::detail::DoubleAPFloat::remainder(), llvm::RISCVDAGToDAGISel::Select(), llvm::RISCVDAGToDAGISel::selectScalarFPAsInt(), llvm::stableHashValue(), llvm::LegalizerHelper::widenScalar(), and WriteAPFloatInternal().

◆ bitwiseIsEqual()

bool llvm::APFloat::bitwiseIsEqual ( const APFloat & RHS) const
inline

◆ changeSign()

◆ classify()

◆ clearSign()

void llvm::APFloat::clearSign ( )
inline

◆ compare()

cmpResult llvm::APFloat::compare ( const APFloat & RHS) const
inline

◆ convert()

◆ convertFromAPInt()

◆ convertFromString()

Expected< APFloat::opStatus > llvm::APFloat::convertFromString ( StringRef Str,
roundingMode RM )

◆ convertToDouble()

double llvm::APFloat::convertToDouble ( ) const

Converts this APFloat to host double value.

Precondition
The APFloat must be built using semantics, that can be represented by the host double type without loss of precision. It can be IEEEdouble and shorter semantics, like IEEEsingle and others.

Definition at line 6115 of file APFloat.cpp.

References assert(), convert(), llvm::detail::IEEEFloat::convertToDouble(), getSemantics(), llvm::APFloatBase::isRepresentableBy(), llvm::APFloatBase::opInexact, llvm::APFloatBase::rmNearestTiesToEven, and llvm::semIEEEdouble.

Referenced by emitDebugValueComment(), LLVMConstRealGetDouble(), llvm::ARMAsmPrinter::lowerOperand(), and WriteAPFloatInternal().

◆ convertToFloat()

float llvm::APFloat::convertToFloat ( ) const

Converts this APFloat to host float value.

Precondition
The APFloat must be built using semantics, that can be represented by the host float type without loss of precision. It can be IEEEquad and shorter semantics, like IEEEdouble and others. Converts this APFloat to host float value.
The APFloat must be built using semantics, that can be represented by the host float type without loss of precision. It can be IEEEsingle and shorter semantics, like IEEEhalf.

Definition at line 6143 of file APFloat.cpp.

References assert(), convert(), llvm::detail::IEEEFloat::convertToFloat(), getSemantics(), llvm::APFloatBase::isRepresentableBy(), llvm::APFloatBase::opInexact, llvm::APFloatBase::rmNearestTiesToEven, and llvm::semIEEEsingle.

Referenced by llvm::FPMathOperator::getFPAccuracy(), insertSpirvDecorations(), and llvm::SPIRVMCInstLower::lower().

◆ convertToHexString()

unsigned int llvm::APFloat::convertToHexString ( char * DST,
unsigned int HexDigits,
bool UpperCase,
roundingMode RM ) const
inline

◆ convertToInteger() [1/2]

APFloat::opStatus llvm::APFloat::convertToInteger ( APSInt & Result,
roundingMode RM,
bool * IsExact ) const

◆ convertToInteger() [2/2]

◆ copySign() [1/2]

APFloat llvm::APFloat::copySign ( APFloat Value,
const APFloat & Sign )
inlinestatic

A static helper to produce a copy of an APFloat value with its sign copied from some other APFloat.

Definition at line 1309 of file APFloat.h.

◆ copySign() [2/2]

void llvm::APFloat::copySign ( const APFloat & RHS)
inline

Definition at line 1302 of file APFloat.h.

References changeSign(), isNegative(), and RHS.

Referenced by llvm::ConstantFoldFPBinOp(), and llvm::SelectionDAG::foldConstantFPMath().

◆ divide()

◆ dump()

LLVM_DUMP_METHOD void llvm::APFloat::dump ( ) const

Definition at line 6093 of file APFloat.cpp.

References llvm::dbgs(), LLVM_DUMP_METHOD, and print().

◆ fusedMultiplyAdd()

◆ getAllOnesValue()

APFloat llvm::APFloat::getAllOnesValue ( const fltSemantics & Semantics)
static

Returns a float which is bitcasted from an all one value int.

Parameters
Semantics- type float semantics

Definition at line 6082 of file APFloat.cpp.

References llvm::APInt::getAllOnes().

Referenced by llvm::Constant::getAllOnesValue(), and lowerShuffleAsBitMask().

◆ getCategory()

fltCategory llvm::APFloat::getCategory ( ) const
inline

Definition at line 1456 of file APFloat.h.

Referenced by isInfinity(), isNaN(), and isZero().

◆ getExactInverse()

bool llvm::APFloat::getExactInverse ( APFloat * Inv) const

If this value is normal and has an exact, normal, multiplicative inverse, store it in inv and return true.

Definition at line 5999 of file APFloat.cpp.

References assert(), getExactLog2Abs(), getOne(), getSemantics(), isDenormal(), isFiniteNonZero(), isNegative(), llvm::APFloatBase::rmTowardZero, and scalbn.

Referenced by checkCVTFixedPointOperandWithFBits(), and PerformVMulVCTPCombine().

◆ getExactLog2()

LLVM_READONLY int llvm::APFloat::getExactLog2 ( ) const
inline

Definition at line 1504 of file APFloat.h.

References getExactLog2Abs(), and isNegative().

◆ getExactLog2Abs()

LLVM_READONLY int llvm::APFloat::getExactLog2Abs ( ) const
inline

◆ getInf()

◆ getLargest()

◆ getNaN()

APFloat llvm::APFloat::getNaN ( const fltSemantics & Sem,
bool Negative = false,
uint64_t payload = 0 )
inlinestatic

Factory for NaN values.

Parameters
Negative- True iff the NaN generated should be negative.
payload- The unspecified fill bits for creating the NaN, 0 by default. The value is truncated as necessary.

Definition at line 1109 of file APFloat.h.

References getQNaN().

Referenced by llvm::TargetLowering::expandFMINIMUM_FMAXIMUM(), llvm::SelectionDAG::foldConstantFPMath(), getIdentityValueForAtomicOp(), llvm::ConstantFP::getNaN(), and llvm::fuzzerop::makeConstantsWithType().

◆ getOne()

APFloat llvm::APFloat::getOne ( const fltSemantics & Sem,
bool Negative = false )
inlinestatic

Factory for Positive and Negative One.

Parameters
NegativeTrue iff the number should be negative.

Definition at line 1088 of file APFloat.h.

References changeSign().

Referenced by getExactInverse(), getOneFP(), llvm::harrisonUlp(), llvm::isMathLibCallNoop(), and llvm::detail::DoubleAPFloat::roundToIntegral().

◆ getQNaN()

APFloat llvm::APFloat::getQNaN ( const fltSemantics & Sem,
bool Negative = false,
const APInt * payload = nullptr )
inlinestatic

◆ getSemantics()

◆ getSmallest()

APFloat llvm::APFloat::getSmallest ( const fltSemantics & Sem,
bool Negative = false )
inlinestatic

Returns the smallest (by magnitude) finite number in the given semantics.

Might be denormalized, which implies a relative loss of precision.

Parameters
Negative- True iff the number should be negative

Definition at line 1148 of file APFloat.h.

References llvm::APFloatBase::uninitialized.

Referenced by llvm::harrisonUlp(), and llvm::fuzzerop::makeConstantsWithType().

◆ getSmallestNormalized()

APFloat llvm::APFloat::getSmallestNormalized ( const fltSemantics & Sem,
bool Negative = false )
inlinestatic

Returns the smallest (by magnitude) normalized finite number in the given semantics.

Parameters
Negative- True iff the number should be negative

Definition at line 1158 of file APFloat.h.

References llvm::APFloatBase::uninitialized.

Referenced by emitRsqIEEE1ULP(), llvm::TargetLowering::expandIS_FPCLASS(), llvm::AMDGPUTargetLowering::getIsLtSmallestNormal(), llvm::AMDGPULegalizerInfo::getScaledLogInput(), llvm::AMDGPUTargetLowering::getScaledLogInput(), llvm::TargetLowering::getSqrtInputTest(), and llvm::InstCombinerImpl::visitFCmpInst().

◆ getSNaN()

APFloat llvm::APFloat::getSNaN ( const fltSemantics & Sem,
bool Negative = false,
const APInt * payload = nullptr )
inlinestatic

Factory for SNaN values.

Definition at line 1128 of file APFloat.h.

References llvm::APFloatBase::uninitialized.

Referenced by llvm::ConstantFP::getSNaN(), and WriteAPFloatInternal().

◆ getZero()

◆ hasSignificand()

bool llvm::APFloat::hasSignificand ( const fltSemantics & Sem)
inlinestatic

Returns true if the given semantics has actual significand.

Parameters
Sem- type float semantics

Definition at line 1173 of file APFloat.h.

References llvm::APFloatBase::Float8E8M0FNU().

Referenced by llvm::detail::IEEEFloat::isLargest(), and llvm::detail::IEEEFloat::next().

◆ isDenormal()

◆ isExactlyValue()

bool llvm::APFloat::isExactlyValue ( double V) const
inline

We don't rely on operator== working on double values, as it returns true for things that are clearly not equal, like -0.0 and 0.0.

As such, this method can be used to do an exact bit-for-bit comparison of two floating point values.

We leave the version with the double argument here because it's just so convenient to write "2.0" and the like. Without this function we'd have to duplicate its logic everywhere it's called.

Definition at line 1432 of file APFloat.h.

References bitwiseIsEqual(), convert(), getSemantics(), and llvm::APFloatBase::rmNearestTiesToEven.

Referenced by llvm::SelectionDAG::simplifyFPBinop().

◆ isFinite()

bool llvm::APFloat::isFinite ( ) const
inline

Definition at line 1454 of file APFloat.h.

References isInfinity(), and isNaN().

Referenced by llvm::SelectionDAG::getNode(), isFiniteNonZero(), and matchFastFloatClamp().

◆ isFiniteNonZero()

bool llvm::APFloat::isFiniteNonZero ( ) const
inline

Definition at line 1459 of file APFloat.h.

References isFinite(), and isZero().

Referenced by getExactInverse(), and isNormal().

◆ isInfinity()

◆ isInteger()

bool llvm::APFloat::isInteger ( ) const
inline

Definition at line 1466 of file APFloat.h.

References APFLOAT_DISPATCH_ON_SEMANTICS, and isInteger().

Referenced by isInteger(), and isKnownIntegral().

◆ isLargest()

bool llvm::APFloat::isLargest ( ) const
inline

Definition at line 1465 of file APFloat.h.

References APFLOAT_DISPATCH_ON_SEMANTICS, and isLargest().

Referenced by isLargest().

◆ isNaN()

◆ isNegative()

◆ isNegInfinity()

bool llvm::APFloat::isNegInfinity ( ) const
inline

Definition at line 1463 of file APFloat.h.

References isInfinity(), and isNegative().

Referenced by llvm::GCNTTIImpl::instCombineIntrinsic().

◆ isNegZero()

bool llvm::APFloat::isNegZero ( ) const
inline

◆ isNonZero()

bool llvm::APFloat::isNonZero ( ) const
inline

Definition at line 1458 of file APFloat.h.

References isZero().

◆ isNormal()

bool llvm::APFloat::isNormal ( ) const
inline

Definition at line 1453 of file APFloat.h.

References isDenormal(), and isFiniteNonZero().

Referenced by classify().

◆ isPosInfinity()

bool llvm::APFloat::isPosInfinity ( ) const
inline

Definition at line 1462 of file APFloat.h.

References isInfinity(), and isNegative().

Referenced by llvm::GCNTTIImpl::instCombineIntrinsic().

◆ isPosZero()

◆ isSignaling()

bool llvm::APFloat::isSignaling ( ) const
inline

◆ isSmallest()

bool llvm::APFloat::isSmallest ( ) const
inline

Definition at line 1464 of file APFloat.h.

References APFLOAT_DISPATCH_ON_SEMANTICS, and isSmallest().

Referenced by isSmallest().

◆ isSmallestNormalized()

◆ isZero()

◆ makeQuiet()

APFloat llvm::APFloat::makeQuiet ( ) const
inline

Assuming this is an IEEE-754 NaN value, quiet its signaling bit.

This preserves the sign and payload bits.

Definition at line 1316 of file APFloat.h.

Referenced by llvm::GCNTTIImpl::instCombineIntrinsic().

◆ mod()

◆ multiply()

◆ needsCleanup()

bool llvm::APFloat::needsCleanup ( ) const
inline

Definition at line 1074 of file APFloat.h.

References APFLOAT_DISPATCH_ON_SEMANTICS, and needsCleanup().

Referenced by needsCleanup().

◆ next()

opStatus llvm::APFloat::next ( bool nextDown)
inline

◆ operator!=()

bool llvm::APFloat::operator!= ( const APFloat & RHS) const
inline

Definition at line 1382 of file APFloat.h.

References llvm::APFloatBase::cmpEqual, compare(), and RHS.

◆ operator*()

APFloat llvm::APFloat::operator* ( const APFloat & RHS) const
inline

Multiply two APFloats, rounding ties to the nearest even.

No error checking.

Definition at line 1283 of file APFloat.h.

References RHS, and llvm::APFloatBase::rmNearestTiesToEven.

◆ operator+()

APFloat llvm::APFloat::operator+ ( const APFloat & RHS) const
inline

Add two APFloats, rounding ties to the nearest even.

No error checking.

Definition at line 1267 of file APFloat.h.

References RHS, and llvm::APFloatBase::rmNearestTiesToEven.

◆ operator-() [1/2]

APFloat llvm::APFloat::operator- ( ) const
inline

Negate an APFloat.

Definition at line 1259 of file APFloat.h.

◆ operator-() [2/2]

APFloat llvm::APFloat::operator- ( const APFloat & RHS) const
inline

Subtract two APFloats, rounding ties to the nearest even.

No error checking.

Definition at line 1275 of file APFloat.h.

References RHS, and llvm::APFloatBase::rmNearestTiesToEven.

◆ operator/()

APFloat llvm::APFloat::operator/ ( const APFloat & RHS) const
inline

Divide the first APFloat by the second, rounding ties to the nearest even.

No error checking.

Definition at line 1291 of file APFloat.h.

References RHS, and llvm::APFloatBase::rmNearestTiesToEven.

◆ operator<()

bool llvm::APFloat::operator< ( const APFloat & RHS) const
inline

Definition at line 1384 of file APFloat.h.

References llvm::APFloatBase::cmpLessThan, compare(), and RHS.

◆ operator<=()

bool llvm::APFloat::operator<= ( const APFloat & RHS) const
inline

◆ operator=() [1/2]

APFloat & llvm::APFloat::operator= ( APFloat && RHS)
default

References RHS.

◆ operator=() [2/2]

APFloat & llvm::APFloat::operator= ( const APFloat & RHS)
default

References RHS.

◆ operator==()

bool llvm::APFloat::operator== ( const APFloat & RHS) const
inline

Definition at line 1380 of file APFloat.h.

References llvm::APFloatBase::cmpEqual, compare(), and RHS.

◆ operator>()

bool llvm::APFloat::operator> ( const APFloat & RHS) const
inline

Definition at line 1388 of file APFloat.h.

References llvm::APFloatBase::cmpGreaterThan, compare(), and RHS.

◆ operator>=()

bool llvm::APFloat::operator>= ( const APFloat & RHS) const
inline

◆ print()

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

Definition at line 6086 of file APFloat.cpp.

References toString().

Referenced by dump().

◆ Profile()

void llvm::APFloat::Profile ( FoldingSetNodeID & NID) const

Used to insert APFloat objects, or objects that contain APFloat objects, into FoldingSets.

Definition at line 6099 of file APFloat.cpp.

References llvm::FoldingSetNodeID::Add(), and bitcastToAPInt().

◆ remainder()

opStatus llvm::APFloat::remainder ( const APFloat & RHS)
inline

Definition at line 1217 of file APFloat.h.

References assert(), getSemantics(), llvm_unreachable, and RHS.

Referenced by llvm::detail::DoubleAPFloat::remainder().

◆ roundToIntegral()

◆ subtract()

◆ toString()

void llvm::APFloat::toString ( SmallVectorImpl< char > & Str,
unsigned FormatPrecision = 0,
unsigned FormatMaxPadding = 3,
bool TruncateZero = true ) const
inline

◆ frexp

APFloat frexp ( const APFloat & X,
int & Exp,
roundingMode RM )
friend

References X.

◆ hash_value

LLVM_ABI friend hash_code hash_value ( const APFloat & Arg)
friend

See friend declarations above.

These additional declarations are required in order to compile LLVM with IBM xlC compiler.

Definition at line 5971 of file APFloat.cpp.

References getSemantics(), hash_value, and llvm_unreachable.

Referenced by hash_value.

◆ ilogb

int ilogb ( const APFloat & Arg)
friend

Returns the exponent of the internal representation of the APFloat.

Because the radix of APFloat is 2, this is equivalent to floor(log2(x)). For special APFloat values, this returns special error codes:

NaN -> IEK_NaN 0 -> IEK_Zero Inf -> IEK_Inf

Definition at line 1534 of file APFloat.h.

References getSemantics(), llvm::ilogb(), and llvm_unreachable.

◆ scalbn

APFloat scalbn ( APFloat X,
int Exp,
roundingMode RM )
friend

References X.

Referenced by getExactInverse().

Member Data Documentation

◆ DoubleAPFloat

Definition at line 1513 of file APFloat.h.

◆ IEEEFloat

Definition at line 1512 of file APFloat.h.


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