|
LLVM 24.0.0git
|
#include "llvm/ADT/APFloat.h"
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 bool | isValidArbitraryFPFormat (StringRef Format) |
| Returns true if the given string is a valid arbitrary floating-point format interpretation for llvm.convert.to.arbitrary.fp and llvm.convert.from.arbitrary.fp intrinsics. | |
| static LLVM_ABI unsigned | getArbitraryFPFormatSizeInBits (StringRef Format) |
| Returns the size in bits of a valid arbitrary floating-point format string, or 0 if the string is not a valid format. | |
| static LLVM_ABI const fltSemantics * | getArbitraryFPSemantics (StringRef Format) |
| Returns the fltSemantics for a given arbitrary FP format string, or nullptr if invalid. | |
| static LLVM_ABI const llvm::fltSemantics & | EnumToSemantics (Semantics S) |
| static LLVM_ABI Semantics | SemanticsToEnum (const llvm::fltSemantics &Sem) |
| static constexpr const fltSemantics & | IEEEhalf () |
| static constexpr const fltSemantics & | BFloat () |
| static constexpr const fltSemantics & | IEEEsingle () |
| static constexpr const fltSemantics & | IEEEdouble () |
| static constexpr const fltSemantics & | IEEEquad () |
| static constexpr const fltSemantics & | x87DoubleExtended () |
| static constexpr const fltSemantics & | PPCDoubleDouble () |
| static constexpr const fltSemantics & | PPCDoubleDoubleLegacy () |
| static constexpr const fltSemantics & | Float8E5M2 () |
| static constexpr const fltSemantics & | Float8E5M2FNUZ () |
| static constexpr const fltSemantics & | Float8E4M3 () |
| static constexpr const fltSemantics & | Float8E4M3FN () |
| static constexpr const fltSemantics & | Float8E4M3FNUZ () |
| static constexpr const fltSemantics & | Float8E4M3B11FNUZ () |
| static constexpr const fltSemantics & | Float8E3M4 () |
| static constexpr const fltSemantics & | FloatTF32 () |
| static constexpr const fltSemantics & | Float8E8M0FNU () |
| static constexpr const fltSemantics & | Float8E5M3FNU () |
| static constexpr const fltSemantics & | Float6E3M2FN () |
| static constexpr const fltSemantics & | Float6E2M3FN () |
| static constexpr const fltSemantics & | Float4E2M1FN () |
| static constexpr const fltSemantics & | Bogus () |
| A Pseudo fltsemantic used to construct APFloats that cannot conflict with anything real. | |
| static LLVM_ABI bool | isRepresentableBy (const fltSemantics &A, const fltSemantics &B) |
| static LLVM_ABI bool | isLosslesslyConvertibleTo (const fltSemantics &From, const fltSemantics &To, bool IgnoreNaNs=false) |
Returns whether converting a value from From to To is known to preserve all information. | |
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) |
|
inline |
| llvm::APFloat::APFloat | ( | const fltSemantics & | Semantics, |
| StringRef | S ) |
Definition at line 6025 of file APFloat.cpp.
References assert(), llvm::consumeError(), convertFromString(), and llvm::APFloatBase::rmNearestTiesToEven.
|
inline |
|
delete |
|
inline |
Definition at line 1201 of file APFloat.h.
References llvm::APFloatBase::uninitialized.
|
inline |
|
inlineexplicit |
Definition at line 1204 of file APFloat.h.
References llvm::APFloatBase::IEEEdouble().
|
inlineexplicit |
Definition at line 1205 of file APFloat.h.
References llvm::APFloatBase::IEEEsingle().
|
default |
|
inline |
Definition at line 1318 of file APFloat.h.
References assert(), getSemantics(), llvm_unreachable, and RHS.
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::detail::DoubleAPFloat::multiply(), llvm::detail::DoubleAPFloat::roundToIntegral(), and llvm::ubi::InstExecutor::visitFAdd().
|
inline |
Definition at line 1508 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::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(), insertSpirvDecorations(), llvm::GCNTTIImpl::instCombineIntrinsic(), llvm::AMDGPUTargetLowering::isInt64ImmLegal(), llvm::LegalizerHelper::lowerISFPCLASS(), 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().
Definition at line 1581 of file APFloat.h.
References getSemantics(), llvm_unreachable, and RHS.
Referenced by fmed3AMDGCN(), llvm::ConstantFPRange::getSingleElement(), isExactlyValue(), isInv2Pi(), isInv2Pi(), toStringRoundTrip(), and toStringShortest().
|
inline |
Definition at line 1434 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and changeSign().
Referenced by changeSign(), clearSign(), copySign(), llvm::PPCInstrInfo::finalizeInsInstrs(), llvm::SelectionDAG::getIdentityElement(), llvm::TargetLowering::getNegatedExpression(), getOne(), llvm::SelectionDAG::isIdentityElement(), llvm::SPIRVCombinerHelper::matchSelectToFaceForward(), and llvm::X86TargetLowering::X86TargetLowering().
| FPClassTest llvm::APFloat::classify | ( | ) | const |
Return the FPClassTest which will return true for the value.
Definition at line 6032 of file APFloat.cpp.
References assert(), llvm::fcNegInf, llvm::fcNegNormal, llvm::fcNegSubnormal, llvm::fcNegZero, llvm::fcPosInf, llvm::fcPosNormal, llvm::fcPosSubnormal, llvm::fcPosZero, llvm::fcQNan, llvm::fcSNan, isDenormal(), isInfinity(), isNaN(), isNegative(), isNormal(), isSignaling(), and isZero().
Referenced by llvm::GenericFloatingPointPredicateUtils< SSAContext >::fcmpImpliesClass(), and llvm::InstCombinerImpl::foldICmpBitCast().
|
inline |
Definition at line 1435 of file APFloat.h.
References changeSign(), and isNegative().
Referenced by LowerFCOPYSIGN(), llvm::InstCombinerImpl::visitCallInst(), and llvm::InstCombinerImpl::visitFCmpInst().
Definition at line 1559 of file APFloat.h.
References assert(), getSemantics(), llvm_unreachable, and RHS.
Referenced by operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), and llvm::tryFoldFCmp().
Definition at line 1571 of file APFloat.h.
References assert(), getSemantics(), llvm_unreachable, and RHS.
Referenced by llvm::KnownFPClass::fmul().
| APFloat::opStatus llvm::APFloat::convert | ( | const fltSemantics & | ToSemantics, |
| roundingMode | RM, | ||
| bool * | losesInfo ) |
Definition at line 6103 of file APFloat.cpp.
References llvm::APFloatBase::APFloat, assert(), llvm::fltSemantics::bitcastToAPInt, getSemantics(), llvm_unreachable, and llvm::APFloatBase::opOK.
Referenced by llvm::MachineIRBuilder::buildFConstant(), canLosslesslyConvertToFPType(), canSafelyConvertTo16Bit(), llvm::ConstantFPRange::cast(), llvm::checkConvertToNonDenormSingle(), llvm::ConstantFoldCastInstruction(), convertToDouble(), llvm::APFixedPoint::convertToFloat(), convertToFloat(), llvm::convertToNonDenormSingle(), emitDebugValueComment(), llvm::SelectionDAG::FoldConstantArithmetic(), foldFCmpFpTrunc(), llvm::ConstantFP::get(), llvm::SelectionDAG::getConstantFP(), llvm::APFixedPoint::getFromFloatValue(), llvm::RISCVLoadFPImm::getLoadFPImm(), llvm::GCNTTIImpl::instCombineIntrinsic(), isExactlyValue(), llvm::ConstantFP::isExactlyValue(), isFPExtFromF16OrConst(), llvm::APFloatBase::isLosslesslyConvertibleTo(), llvm::ConstantFP::isValueValidForType(), llvm::ConstantFPSDNode::isValueValidForType(), LLVMConstRealGetDouble(), LowerFROUND(), llvm::ARMAsmPrinter::lowerOperand(), matchFPExtFromF16(), llvm::NVPTXFloatMCExpr::printImpl(), llvm::shortestDigitCount(), strictFPExtFromF16(), llvm::InstCombinerImpl::visitFCmpInst(), llvm::ubi::InstExecutor::visitFPConvInst(), and llvm::X86TargetLowering::X86TargetLowering().
|
inline |
Definition at line 1484 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and convertFromAPInt().
Referenced by llvm::ConstantFoldCastInstruction(), llvm::ConstantFoldIntToFloat(), convertFromAPInt(), llvm::APFixedPoint::convertToFloat(), llvm::TargetLowering::expandFP_TO_INT_SAT(), llvm::TargetLowering::expandFP_TO_UINT(), llvm::SelectionDAG::FoldConstantArithmetic(), foldFPToIntToFP(), llvm::LegalizerHelper::lowerFPTOINT_SAT(), llvm::LegalizerHelper::lowerFPTOUI(), lowerFTRUNC_FCEIL_FFLOOR_FROUND(), lowerVectorFTRUNC_FCEIL_FFLOOR_FROUND(), lowerVectorStrictFTRUNC_FCEIL_FFLOOR_FROUND(), and llvm::ubi::InstExecutor::visitIntToFPInst().
| Expected< APFloat::opStatus > llvm::APFloat::convertFromString | ( | StringRef | Str, |
| roundingMode | RM ) |
Fill this APFloat with the result of a string conversion.
The following strings are accepted for conversion purposes:
If the input string is none of these forms, then an error is returned.
If a floating-point exception occurs during conversion, then no error is returned, and the exception is indicated via opStatus.
Definition at line 6012 of file APFloat.cpp.
References APFLOAT_DISPATCH_ON_SEMANTICS, and convertFromString().
Referenced by APFloat(), convertFromString(), llvm::detail::DoubleAPFloat::convertFromString(), and toStringRoundTrip().
| double llvm::APFloat::convertToDouble | ( | ) | const |
Converts this APFloat to host double value.
Definition at line 6336 of file APFloat.cpp.
References assert(), convert(), llvm::detail::IEEEFloat::convertToDouble(), getSemantics(), llvm::APFloatBase::isRepresentableBy(), llvm::APFloatBase::opInexact, and llvm::APFloatBase::rmNearestTiesToEven.
Referenced by emitDebugValueComment(), llvm::ExecutionEngine::getConstantValue(), LLVMConstRealGetDouble(), and llvm::ARMAsmPrinter::lowerOperand().
| float llvm::APFloat::convertToFloat | ( | ) | const |
Converts this APFloat to host float value.
Definition at line 6364 of file APFloat.cpp.
References assert(), convert(), llvm::detail::IEEEFloat::convertToFloat(), getSemantics(), llvm::APFloatBase::isRepresentableBy(), llvm::APFloatBase::opInexact, and llvm::APFloatBase::rmNearestTiesToEven.
Referenced by llvm::ExecutionEngine::getConstantValue(), llvm::FPMathOperator::getFPAccuracy(), and llvm::SPIRVMCInstLower::lower().
|
inline |
Definition at line 1606 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and convertToHexString().
Referenced by convertToHexString(), and llvm::detail::DoubleAPFloat::convertToHexString().
| APFloat::opStatus llvm::APFloat::convertToInteger | ( | APSInt & | Result, |
| roundingMode | RM, | ||
| bool * | IsExact ) const |
Definition at line 6324 of file APFloat.cpp.
References convertToInteger(), llvm::APInt::getBitWidth(), llvm::APInt::getNumWords(), and llvm::APSInt::isSigned().
|
inline |
Definition at line 1469 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and convertToInteger().
Referenced by llvm::ubi::InstExecutor::callIntrinsic(), llvm::CheckFixedPointOperandConstant(), convertToInteger(), convertToInteger(), ConvertToSInt(), foldFPtoI(), foldFPToIntToFP(), llvm::BuildVectorSDNode::getConstantFPSplatPow2ToLog2Int(), getExactInteger(), llvm::MCSchedModel::getResourceBufferSize(), isMinMaxCmpSelectEliminable(), PerformVMulVCTPCombine(), llvm::shortestDigitCount(), and llvm::ubi::InstExecutor::visitFPToIntInst().
Definition at line 1439 of file APFloat.h.
References changeSign(), isNegative(), and RHS.
Referenced by llvm::ubi::InstExecutor::callIntrinsic().
|
inline |
Definition at line 1345 of file APFloat.h.
References assert(), getSemantics(), llvm_unreachable, and RHS.
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::detail::DoubleAPFloat::divide(), and llvm::ubi::InstExecutor::visitFDiv().
| LLVM_DUMP_METHOD void llvm::APFloat::dump | ( | ) | const |
Definition at line 6314 of file APFloat.cpp.
References llvm::dbgs(), LLVM_DUMP_METHOD, and print().
|
inline |
Definition at line 1372 of file APFloat.h.
References assert(), getSemantics(), and llvm_unreachable.
Referenced by llvm::ubi::InstExecutor::callIntrinsic(), llvm::detail::DoubleAPFloat::fusedMultiplyAdd(), llvm::CombinerHelper::matchConstantFoldFMA(), and llvm::detail::DoubleAPFloat::multiply().
|
static |
Returns a float which is bitcasted from an all one value int.
| Semantics | - type float semantics |
Definition at line 6129 of file APFloat.cpp.
References llvm::APFloatBase::APFloat, and llvm::APInt::getAllOnes().
Referenced by llvm::Constant::getAllOnesValue().
|
inline |
Definition at line 1623 of file APFloat.h.
Referenced by isInfinity(), isNaN(), and isZero().
If this value is normal and has an exact, normal, multiplicative inverse, store it in inv and return true.
Definition at line 6045 of file APFloat.cpp.
References assert(), getExactLog2Abs(), getOne(), getSemantics(), isDenormal(), isFiniteNonZero(), isNegative(), llvm::APFloatBase::rmTowardZero, and scalbn.
Referenced by llvm::CheckFixedPointOperandConstant(), and PerformVMulVCTPCombine().
|
inline |
Definition at line 1694 of file APFloat.h.
References getExactLog2Abs(), and isNegative().
Referenced by isPowerOf2().
|
inline |
Definition at line 1687 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and getExactLog2Abs().
Referenced by computeKnownExponentRangeFromContext(), getExactInverse(), getExactLog2(), getExactLog2Abs(), llvm::detail::DoubleAPFloat::getExactLog2Abs(), and isNegPowerOf2().
|
inlinestatic |
Factory for Positive and Negative Infinity.
| Negative | True iff the number should be negative. |
Definition at line 1235 of file APFloat.h.
References llvm::APFloatBase::uninitialized.
Referenced by llvm::ConstantFPRange::add(), canonicalizeRange(), llvm::ConstantFPRange::div(), llvm::TargetLowering::expandCONVERT_TO_ARBITRARY_FP(), llvm::TargetLowering::expandIS_FPCLASS(), llvm::TargetLowering::expandMODF(), llvm::InstCombinerImpl::foldICmpAndConstConst(), foldLogOpOfMaskedICmps_NotAllZeros_BMask_Mixed(), llvm::SelectionDAG::getIdentityElement(), llvm::ConstantFP::getInfinity(), llvm::AMDGPUTargetLowering::getIsFinite(), llvm::ConstantFPRange::getNaNOnly(), llvm::ConstantFPRange::getNonNaN(), llvm::harrisonUlp(), llvm::SelectionDAG::isIdentityElement(), llvm::AMDGPULegalizerInfo::legalizeFExp(), llvm::AMDGPULegalizerInfo::legalizeFEXPF64(), llvm::AMDGPULegalizerInfo::legalizeFFREXP(), llvm::AMDGPULegalizerInfo::legalizeFlogCommon(), llvm::AMDGPUTargetLowering::lowerFEXP(), llvm::LegalizerHelper::lowerFMODF(), llvm::LegalizerHelper::lowerISFPCLASS(), llvm::ConstantFPRange::makeAllowedFCmpRegion(), llvm::fuzzerop::makeConstantsWithType(), makeGreaterThan(), makeLessThan(), llvm::ConstantFPRange::mul(), and llvm::KnownFPClass::toKnownBits().
|
inlinestatic |
Returns the largest finite number in the given semantics.
| Negative | - True iff the number should be negative |
Definition at line 1275 of file APFloat.h.
References llvm::APFloatBase::uninitialized.
Referenced by computeKnownFPClass(), llvm::TargetLowering::expandIS_FPCLASS(), llvm::InstCombinerImpl::foldFCmpIntToFPConst(), llvm::ConstantFPRange::getFinite(), llvm::SelectionDAG::getIdentityElement(), llvm::getReductionIdentity(), llvm::SelectionDAG::isIdentityElement(), ldexpSaturatingAddIsSafe(), llvm::AMDGPULegalizerInfo::legalizeRsqClampIntrinsic(), llvm::LegalizerHelper::lowerISFPCLASS(), llvm::ConstantFPRange::makeAllowedFCmpRegion(), llvm::fuzzerop::makeConstantsWithType(), removeInf(), SameSignRange::SameSignRange(), and toStringShortest().
|
inlinestatic |
Factory for NaN values.
| 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 1246 of file APFloat.h.
References getQNaN(), and uint64_t.
Referenced by llvm::TargetLowering::expandFMINIMUM_FMAXIMUM(), llvm::SelectionDAG::foldConstantFPMath(), getIdentityValueForAtomicOp(), llvm::ConstantFP::getNaN(), llvm::LegalizerHelper::lowerFMinimumMaximum(), and llvm::fuzzerop::makeConstantsWithType().
|
inline |
If the value is a NaN value, return an integer containing the payload of this value.
This payload will include the quiet bit as part of the returned integer.
Definition at line 1642 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, assert(), getNaNPayload(), and isNaN().
Referenced by getNaNPayload(), and writeAPFloatInternal().
|
inlinestatic |
Factory for Positive and Negative One.
| Negative | True iff the number should be negative. |
Definition at line 1225 of file APFloat.h.
References changeSign().
Referenced by llvm::AMDGPU::evaluateRcp(), llvm::KnownFPClass::fmul(), foldFCmpFAbsFSubIntToFP(), llvm::InstCombinerImpl::foldICmpInstWithConstant(), getExactInverse(), getOneFP(), llvm::harrisonUlp(), llvm::isMathLibCallNoop(), llvm::detail::DoubleAPFloat::roundToIntegral(), llvm::InstCombinerImpl::SimplifyDemandedUseFPClass(), and llvm::InstCombinerImpl::visitCallInst().
|
inlinestatic |
Factory for QNaN values.
Definition at line 1257 of file APFloat.h.
References llvm::APFloatBase::uninitialized.
Referenced by llvm::SelectionDAG::getIdentityElement(), getNaN(), llvm::ConstantFP::getQNaN(), llvm::harrisonUlp(), llvm::GCNTTIImpl::instCombineIntrinsic(), llvm::SelectionDAG::isIdentityElement(), llvm::AMDGPULegalizerInfo::legalizeFPow(), llvm::AMDGPUTargetLowering::lowerFPOW(), and toString().
|
inline |
Definition at line 1624 of file APFloat.h.
Referenced by add(), llvm::ConstantFPRange::add(), bitwiseIsEqual(), llvm::MachineIRBuilder::buildFConstant(), compare(), compareAbsoluteValue(), llvm::ConstantFPRange::contains(), convert(), convertToDouble(), convertToFloat(), divide(), llvm::AMDGPU::evaluateRcp(), flushDenormalConstant(), llvm::KnownFPClass::fmul(), foldFPtoI(), fusedMultiplyAdd(), getExactInverse(), llvm::getFConstantVRegValWithLookThrough(), llvm::RISCVLoadFPImm::getLoadFPImm(), hash_value, ilogb, isExactlyValue(), isRepresentableAsExactInteger(), llvm::ConstantFP::isValueValidForType(), mod(), multiply(), printConstant(), remainder(), llvm::shortestDigitCount(), subtract(), llvm::SystemZVectorConstantInfo::SystemZVectorConstantInfo(), toStringRoundTrip(), toStringShortest(), and writeAPFloatInternal().
|
inlinestatic |
Returns the smallest (by magnitude) finite number in the given semantics.
Might be denormalized, which implies a relative loss of precision.
| Negative | - True iff the number should be negative |
Definition at line 1285 of file APFloat.h.
References llvm::APFloatBase::uninitialized.
Referenced by llvm::ConstantFPRange::div(), llvm::harrisonUlp(), llvm::APFloatBase::isLosslesslyConvertibleTo(), ldexpSaturatingAddIsSafe(), and llvm::fuzzerop::makeConstantsWithType().
|
inlinestatic |
Returns the smallest (by magnitude) normalized finite number in the given semantics.
| Negative | - True iff the number should be negative |
Definition at line 1295 of file APFloat.h.
References llvm::APFloatBase::uninitialized.
Referenced by emitRsqIEEE1ULP(), llvm::TargetLowering::expandIS_FPCLASS(), llvm::AMDGPULegalizerInfo::getScaledLogInput(), llvm::AMDGPUTargetLowering::getScaledLogInput(), llvm::TargetLowering::getSqrtInputTest(), and llvm::InstCombinerImpl::visitFCmpInst().
|
inlinestatic |
Factory for SNaN values.
Definition at line 1265 of file APFloat.h.
References llvm::APFloatBase::uninitialized.
Referenced by llvm::ConstantFP::getSNaN().
|
inlinestatic |
Factory for Positive and Negative Zero.
| Negative | True iff the number should be negative. |
Definition at line 1216 of file APFloat.h.
References llvm::APFloatBase::uninitialized.
Referenced by llvm::ConstantFPRange::abs(), llvm::ConstantFPRange::div(), llvm::AMDGPU::evaluateRcp(), extendZeroIfEqual(), llvm::detail::fastTwoSum(), fixFuncEntryCount(), flush(), flushDenormalConstant(), llvm::ConstantFPRange::flushDenormals(), llvm::generateReadImageInst(), getIdentityValueForAtomicOp(), llvm::Constant::getNullValue(), llvm::ubi::AnyValue::getNullValue(), llvm::ConstantFP::getZero(), getZeroFP(), llvm::GCNTTIImpl::instCombineIntrinsic(), llvm::fuzzerop::makeConstantsWithType(), printConstant(), splitPosNeg(), llvm::pdb::Variant::toAPFloat(), and llvm::X86TargetLowering::X86TargetLowering().
|
inlinestatic |
Returns true if the given semantics has actual significand.
| Sem | - type float semantics |
Definition at line 1310 of file APFloat.h.
References llvm::APFloatBase::Float8E8M0FNU().
Referenced by llvm::detail::IEEEFloat::convert(), llvm::detail::IEEEFloat::isLargest(), and llvm::detail::IEEEFloat::next().
|
inline |
Definition at line 1617 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and isDenormal().
Referenced by llvm::checkConvertToNonDenormSingle(), classify(), llvm::convertToNonDenormSingle(), llvm::AMDGPU::evaluateRcp(), flushDenormalConstantFP(), llvm::FlushFPConstant(), getExactInverse(), isDenormal(), and isNormal().
|
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 1599 of file APFloat.h.
References bitwiseIsEqual(), convert(), getSemantics(), llvm::APFloatBase::rmNearestTiesToEven, and V.
|
inline |
Definition at line 1621 of file APFloat.h.
References isInfinity(), and isNaN().
Referenced by llvm::SelectionDAG::getNode(), isFiniteNonZero(), and matchFastFloatClamp().
|
inline |
Definition at line 1626 of file APFloat.h.
References isFinite(), and isZero().
Referenced by getExactInverse(), isNormal(), and toStringShortest().
|
inline |
Definition at line 1613 of file APFloat.h.
References llvm::APFloatBase::fcInfinity, and getCategory().
Referenced by classify(), foldFCmpFpTrunc(), llvm::GCNTTIImpl::instCombineIntrinsic(), isFinite(), llvm::SelectionDAG::isIdentityElement(), llvm::isMathLibCallNoop(), isNegInfinity(), isPosInfinity(), ldexpSaturatingAddIsSafe(), llvm::detail::DoubleAPFloat::next(), OptimizeConstMinMax(), and writeAPFloatInternal().
|
inline |
Definition at line 1633 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and isInteger().
Referenced by foldFPtoI(), isInteger(), and llvm::isKnownIntegral().
|
inline |
Definition at line 1632 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and isLargest().
Referenced by llvm::SelectionDAG::isIdentityElement(), isLargest(), and OptimizeConstMinMax().
|
inline |
Definition at line 1712 of file APFloat.h.
References isNegPowerOf2(), and LLVM_READONLY.
|
inline |
Definition at line 1614 of file APFloat.h.
References llvm::APFloatBase::fcNaN, and getCategory().
Referenced by llvm::ConstantFPRange::cast(), classify(), llvm::ConstantFPRange::contains(), foldFCmpFpTrunc(), getNaNPayload(), llvm::GCNTTIImpl::instCombineIntrinsic(), isFinite(), llvm::isMathLibCallNoop(), OptimizeConstMinMax(), and writeAPFloatInternal().
|
inline |
Definition at line 1616 of file APFloat.h.
Referenced by classify(), clearSign(), copySign(), llvm::AMDGPU::evaluateRcp(), llvm::GenericFloatingPointPredicateUtils< SSAContext >::fcmpImpliesClass(), flushDenormalConstant(), llvm::detail::frexp(), getExactInverse(), getExactLog2(), llvm::RISCVLoadFPImm::getLoadFPImm(), llvm::MCSchedModel::getResourceBufferSize(), llvm::SelectionDAG::isIdentityElement(), isNegInfinity(), isNegPowerOf2(), isNegZero(), isPosInfinity(), isPosZero(), OptimizeConstMinMax(), llvm::detail::DoubleAPFloat::roundToIntegral(), llvm::InstCombinerImpl::visitCallInst(), and writeAPFloatInternal().
|
inline |
Definition at line 1630 of file APFloat.h.
References isInfinity(), and isNegative().
|
inline |
Definition at line 1704 of file APFloat.h.
References getExactLog2Abs(), isNegative(), and N.
Referenced by isMinusOne().
|
inline |
Definition at line 1628 of file APFloat.h.
References isNegative(), and isZero().
Referenced by llvm::RISCVDAGToDAGISel::Select(), llvm::RISCVDAGToDAGISel::selectScalarFPAsInt(), and llvm::SelectionDAG::simplifyFPBinop().
|
inline |
|
inline |
Definition at line 1620 of file APFloat.h.
References isDenormal(), and isFiniteNonZero().
Referenced by classify(), and llvm::KnownFPClass::fmul().
|
inline |
Definition at line 1709 of file APFloat.h.
References isPowerOf2(), and LLVM_READONLY.
Referenced by llvm::SelectionDAG::simplifyFPBinop().
|
inline |
Definition at line 1629 of file APFloat.h.
References isInfinity(), and isNegative().
Referenced by llvm::GCNTTIImpl::instCombineIntrinsic().
|
inline |
Definition at line 1627 of file APFloat.h.
References isNegative(), and isZero().
Referenced by llvm::SPIRVGlobalRegistry::createConstFP(), llvm::RISCVDAGToDAGISel::Select(), llvm::RISCVDAGToDAGISel::selectScalarFPAsInt(), and llvm::SelectionDAG::simplifyFPBinop().
|
inline |
|
inline |
Definition at line 1618 of file APFloat.h.
Referenced by classify(), llvm::ConstantFPRange::contains(), llvm::GCNTTIImpl::instCombineIntrinsic(), OptimizeConstMinMax(), and writeAPFloatInternal().
|
inline |
Definition at line 1631 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and isSmallest().
Referenced by isSmallest().
|
inline |
Definition at line 1635 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and isSmallestNormalized().
Referenced by llvm::GenericFloatingPointPredicateUtils< SSAContext >::fcmpImpliesClass(), llvm::RISCVLoadFPImm::getLoadFPImm(), and isSmallestNormalized().
|
inline |
Definition at line 1612 of file APFloat.h.
References llvm::APFloatBase::fcZero, and getCategory().
Referenced by classify(), llvm::detail::frexp(), llvm::MCSchedModel::getResourceBufferSize(), isFiniteNonZero(), llvm::isMathLibCallNoop(), isNegZero(), isNonZero(), isPosZero(), ldexpSaturatingAddIsSafe(), llvm::detail::DoubleAPFloat::next(), llvm::RISCVDAGToDAGISel::Select(), llvm::SelectionDAG::simplifyFPBinop(), and llvm::InstCombinerImpl::visitFCmpInst().
|
inlinenodiscard |
Assuming this is an IEEE-754 NaN value, quiet its signaling bit.
This preserves the sign and payload bits.
Definition at line 1453 of file APFloat.h.
Referenced by llvm::GCNTTIImpl::instCombineIntrinsic(), and OptimizeConstMinMax().
Definition at line 1363 of file APFloat.h.
References assert(), getSemantics(), llvm_unreachable, and RHS.
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::detail::DoubleAPFloat::mod(), and llvm::ubi::InstExecutor::visitFRem().
|
inline |
Definition at line 1336 of file APFloat.h.
References assert(), getSemantics(), llvm_unreachable, and RHS.
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::APFixedPoint::convertToFloat(), llvm::MCSchedModel::getResourceBufferSize(), and llvm::ubi::InstExecutor::visitFMul().
|
inline |
Definition at line 1211 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and needsCleanup().
Referenced by needsCleanup().
Definition at line 1391 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and next().
Referenced by foldFCmpFpTrunc(), llvm::detail::frexp(), LowerFROUND(), next(), and llvm::detail::DoubleAPFloat::next().
Definition at line 1537 of file APFloat.h.
References llvm::APFloatBase::cmpEqual, compare(), and RHS.
Multiply two APFloats, rounding ties to the nearest even.
No error checking.
Definition at line 1420 of file APFloat.h.
References RHS, and llvm::APFloatBase::rmNearestTiesToEven.
Add two APFloats, rounding ties to the nearest even.
No error checking.
Definition at line 1404 of file APFloat.h.
References RHS, and llvm::APFloatBase::rmNearestTiesToEven.
|
inline |
Subtract two APFloats, rounding ties to the nearest even.
No error checking.
Definition at line 1412 of file APFloat.h.
References RHS, and llvm::APFloatBase::rmNearestTiesToEven.
Divide the first APFloat by the second, rounding ties to the nearest even.
No error checking.
Definition at line 1428 of file APFloat.h.
References RHS, and llvm::APFloatBase::rmNearestTiesToEven.
Definition at line 1539 of file APFloat.h.
References llvm::APFloatBase::cmpLessThan, compare(), and RHS.
Definition at line 1547 of file APFloat.h.
References llvm::APFloatBase::cmpEqual, llvm::APFloatBase::cmpLessThan, compare(), and RHS.
Definition at line 1535 of file APFloat.h.
References llvm::APFloatBase::cmpEqual, compare(), and RHS.
Definition at line 1543 of file APFloat.h.
References llvm::APFloatBase::cmpGreaterThan, compare(), and RHS.
Definition at line 1552 of file APFloat.h.
References llvm::APFloatBase::cmpEqual, llvm::APFloatBase::cmpGreaterThan, compare(), and RHS.
| void llvm::APFloat::print | ( | raw_ostream & | OS | ) | const |
| void llvm::APFloat::Profile | ( | FoldingSetNodeID & | NID | ) | const |
Used to insert APFloat objects, or objects that contain APFloat objects, into FoldingSets.
Definition at line 6320 of file APFloat.cpp.
References llvm::FoldingSetNodeID::Add(), and bitcastToAPInt().
Definition at line 1354 of file APFloat.h.
References assert(), getSemantics(), llvm_unreachable, and RHS.
Referenced by llvm::detail::DoubleAPFloat::remainder().
|
inline |
Definition at line 1385 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and roundToIntegral().
Referenced by llvm::InstCombinerImpl::foldFCmpIntToFPConst(), roundToIntegral(), and llvm::detail::DoubleAPFloat::roundToIntegral().
|
inline |
Definition at line 1327 of file APFloat.h.
References assert(), getSemantics(), llvm_unreachable, and RHS.
Referenced by llvm::ConstantFoldBinaryInstruction(), and llvm::ubi::InstExecutor::visitFSub().
|
inline |
Definition at line 1653 of file APFloat.h.
References APFLOAT_DISPATCH_ON_SEMANTICS, and toString().
Referenced by emitGlobalConstantFP(), print(), printConstant(), toString(), llvm::detail::DoubleAPFloat::toString(), toStringRoundTrip(), toStringShortest(), and writeAPFloatInternal().
| bool llvm::APFloat::toStringRoundTrip | ( | SmallVectorImpl< char > & | Str, |
| unsigned | FormatPrecision = 0, | ||
| unsigned | FormatMaxPadding = 3, | ||
| bool | TruncateZero = true ) const |
Format the value as toString does and return true if the string parses back bitwise equal.
Non-finite spellings ("+Inf", "NaN") parse back here but may not fit a caller's grammar.
Definition at line 6133 of file APFloat.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), bitwiseIsEqual(), llvm::consumeError(), convertFromString(), llvm::SmallVectorTemplateCommon< T, typename >::end(), getSemantics(), llvm::APFloatBase::rmNearestTiesToEven, and toString().
Referenced by toStringShortest().
| void llvm::APFloat::toStringShortest | ( | SmallVectorImpl< char > & | Str, |
| unsigned | FormatMaxPadding = 3, | ||
| bool | TruncateZero = true ) const |
Like toString, but picks the smallest FormatPrecision whose output parses back bitwise equal: "3.14", not "3.1400000000000001".
An integer in fixed notation keeps its digits: "100", not "1.0E+2".
Definition at line 6272 of file APFloat.cpp.
References llvm::abs(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), bitwiseIsEqual(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::StringRef::find_first_of(), getLargest(), getSemantics(), isFiniteNonZero(), llvm::StringRef::npos, llvm::APFloatBase::semanticsHasInf(), llvm::APFloatBase::semanticsHasNaN(), llvm::shortestDigitCount(), llvm::SmallVectorTemplateCommon< T, typename >::size(), toString(), and toStringRoundTrip().
|
friend |
References X.
See friend declarations above.
These additional declarations are required in order to compile LLVM with IBM xlC compiler.
Definition at line 6017 of file APFloat.cpp.
References getSemantics(), llvm::detail::hash_value(), and llvm_unreachable.
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 1740 of file APFloat.h.
References getSemantics(), llvm::ilogb(), and llvm_unreachable.
|
friend |
References X.
Referenced by getExactInverse().
| friend llvm::APFloat::DoubleAPFloat |
| friend llvm::APFloat::IEEEFloat |