|
LLVM 22.0.0git
|
#include "llvm/Support/KnownFPClass.h"
Public Types | |
| enum class | MinMaxKind { minimum , maximum , minimumnum , maximumnum , minnum , maxnum } |
Public Member Functions | |
| KnownFPClass (FPClassTest Known=fcAllFlags, std::optional< bool > Sign={}) | |
| KnownFPClass (const APFloat &C) | |
| bool | operator== (KnownFPClass Other) const |
| bool | isKnownNever (FPClassTest Mask) const |
| Return true if it's known this can never be one of the mask entries. | |
| bool | isKnownAlways (FPClassTest Mask) const |
| bool | isUnknown () const |
| bool | isKnownNeverNaN () const |
| Return true if it's known this can never be a nan. | |
| bool | isKnownAlwaysNaN () const |
| Return true if it's known this must always be a nan. | |
| bool | isKnownNeverInfinity () const |
| Return true if it's known this can never be an infinity. | |
| bool | isKnownNeverInfOrNaN () const |
| Return true if it's known this can never be an infinity or nan. | |
| bool | isKnownNeverPosInfinity () const |
| Return true if it's known this can never be +infinity. | |
| bool | isKnownNeverNegInfinity () const |
| Return true if it's known this can never be -infinity. | |
| bool | isKnownNeverSubnormal () const |
| Return true if it's known this can never be a subnormal. | |
| bool | isKnownNeverPosSubnormal () const |
| Return true if it's known this can never be a positive subnormal. | |
| bool | isKnownNeverNegSubnormal () const |
| Return true if it's known this can never be a negative subnormal. | |
| bool | isKnownNeverZero () const |
| Return true if it's known this can never be a zero. | |
| bool | isKnownNeverPosZero () const |
| Return true if it's known this can never be a literal positive zero. | |
| bool | isKnownNeverNegZero () const |
| Return true if it's known this can never be a negative zero. | |
| LLVM_ABI bool | isKnownNeverLogicalZero (DenormalMode Mode) const |
| Return true if it's known this can never be interpreted as a zero. | |
| LLVM_ABI bool | isKnownNeverLogicalNegZero (DenormalMode Mode) const |
| Return true if it's known this can never be interpreted as a negative zero. | |
| LLVM_ABI bool | isKnownNeverLogicalPosZero (DenormalMode Mode) const |
| Return true if it's known this can never be interpreted as a positive zero. | |
| bool | cannotBeOrderedLessThanZero () const |
| Return true if we can prove that the analyzed floating-point value is either NaN or never less than -0.0. | |
| bool | cannotBeOrderedGreaterThanZero () const |
| Return true if we can prove that the analyzed floating-point value is either NaN or never greater than -0.0. | |
| bool | cannotBeOrderedGreaterEqZero (DenormalMode Mode) const |
| Return true if it's know this can never be a negative value or a logical 0. | |
| KnownFPClass | intersectWith (const KnownFPClass &RHS) |
| KnownFPClass & | operator|= (const KnownFPClass &RHS) |
| void | knownNot (FPClassTest RuleOut) |
| void | fneg () |
| void | fabs () |
| bool | signBitIsZeroOrNaN () const |
| Return true if the sign bit must be 0, ignoring the sign of nans. | |
| void | signBitMustBeZero () |
| Assume the sign bit is zero. | |
| void | signBitMustBeOne () |
| Assume the sign bit is one. | |
| void | copysign (const KnownFPClass &Sign) |
| void | propagateNaN (const KnownFPClass &Src, bool PreserveSign=false) |
| LLVM_ABI void | propagateDenormal (const KnownFPClass &Src, DenormalMode Mode) |
| Propagate knowledge from a source value that could be a denormal or zero. | |
| LLVM_ABI void | propagateCanonicalizingSrc (const KnownFPClass &Src, DenormalMode Mode) |
Report known classes if Src is evaluated through a potentially canonicalizing operation. | |
| void | resetAll () |
Static Public Member Functions | |
| static LLVM_ABI KnownFPClass | minMaxLike (const KnownFPClass &LHS, const KnownFPClass &RHS, MinMaxKind Kind, DenormalMode DenormMode=DenormalMode::getDynamic()) |
| static LLVM_ABI KnownFPClass | canonicalize (const KnownFPClass &Src, DenormalMode DenormMode=DenormalMode::getDynamic()) |
| Apply the canonicalize intrinsic to this value. | |
| static LLVM_ABI KnownFPClass | fmul (const KnownFPClass &LHS, const KnownFPClass &RHS, DenormalMode Mode=DenormalMode::getDynamic()) |
| Report known values for fmul. | |
| static KnownFPClass | square (const KnownFPClass &Src, DenormalMode Mode=DenormalMode::getDynamic()) |
| static LLVM_ABI KnownFPClass | exp (const KnownFPClass &Src) |
| Report known values for exp, exp2 and exp10. | |
| static LLVM_ABI KnownFPClass | log (const KnownFPClass &Src, DenormalMode Mode=DenormalMode::getDynamic()) |
| Propagate known class for log/log2/log10. | |
Public Attributes | |
| FPClassTest | KnownFPClasses = fcAllFlags |
| Floating-point classes the value could be one of. | |
| std::optional< bool > | SignBit |
| std::nullopt if the sign bit is unknown, true if the sign bit is definitely set or false if the sign bit is definitely unset. | |
Static Public Attributes | |
| static constexpr FPClassTest | OrderedLessThanZeroMask |
| static constexpr FPClassTest | OrderedGreaterThanZeroMask |
Definition at line 24 of file KnownFPClass.h.
|
strong |
| Enumerator | |
|---|---|
| minimum | |
| maximum | |
| minimumnum | |
| maximumnum | |
| minnum | |
| maxnum | |
Definition at line 185 of file KnownFPClass.h.
|
inline |
Definition at line 32 of file KnownFPClass.h.
References llvm::fcAllFlags.
Referenced by canonicalize(), copysign(), exp(), fmul(), intersectWith(), log(), minMaxLike(), operator==(), operator|=(), propagateCanonicalizingSrc(), propagateDenormal(), propagateNaN(), resetAll(), and square().
Definition at line 20 of file KnownFPClass.cpp.
References llvm::CallingConv::C, KnownFPClasses, and SignBit.
|
inline |
Return true if it's know this can never be a negative value or a logical 0.
NaN --> true
x >= -0 --> false nsub --> true if mode is ieee, false otherwise. x < -0 --> true
Definition at line 135 of file KnownFPClass.h.
References llvm::fcPositive, isKnownNever(), isKnownNeverLogicalNegZero(), and Mode.
Referenced by llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
inline |
Return true if we can prove that the analyzed floating-point value is either NaN or never greater than -0.0.
NaN --> true +0 --> true -0 --> true x > +0 --> false x < -0 --> true
Definition at line 124 of file KnownFPClass.h.
References isKnownNever(), and OrderedGreaterThanZeroMask.
Referenced by computeKnownFPClass(), exp(), and minMaxLike().
|
inline |
Return true if we can prove that the analyzed floating-point value is either NaN or never less than -0.0.
NaN --> true +0 --> true -0 --> true
x > +0 --> true x < -0 --> false
Definition at line 113 of file KnownFPClass.h.
References isKnownNever(), and OrderedLessThanZeroMask.
Referenced by llvm::cannotBeOrderedLessThanZero(), computeKnownFPClass(), computeKnownFPClassForFPTrunc(), exp(), log(), minMaxLike(), and simplifyFCmpInst().
|
static |
Apply the canonicalize intrinsic to this value.
This is essentially a stronger form of propagateCanonicalizingSrc.
Definition at line 186 of file KnownFPClass.cpp.
References llvm::fcNan, llvm::fcNegSubnormal, llvm::fcNegZero, llvm::fcPosSubnormal, llvm::fcPosZero, llvm::fcQNan, llvm::fcSNan, llvm::fcSubnormal, llvm::fcZero, llvm::DenormalMode::getIEEE(), llvm::DenormalMode::getPreserveSign(), llvm::DenormalMode::IEEE, llvm::DenormalMode::Input, llvm::DenormalMode::inputsAreZero(), isKnownNever(), isKnownNeverNaN(), KnownFPClass(), KnownFPClasses, knownNot(), llvm::DenormalMode::Output, llvm::DenormalMode::outputsAreZero(), and llvm::DenormalMode::PositiveZero.
Referenced by computeKnownFPClass(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
inline |
Definition at line 237 of file KnownFPClass.h.
References llvm::fcInf, llvm::fcNan, llvm::fcNegative, llvm::fcNormal, llvm::fcPositive, llvm::fcSubnormal, llvm::fcZero, isKnownNever(), KnownFPClass(), KnownFPClasses, and SignBit.
Referenced by computeKnownFPClass(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
static |
Report known values for exp, exp2 and exp10.
Definition at line 289 of file KnownFPClass.cpp.
References cannotBeOrderedGreaterThanZero(), cannotBeOrderedLessThanZero(), llvm::fcNegative, llvm::fcPosInf, llvm::fcPosSubnormal, llvm::fcPosZero, KnownFPClass(), knownNot(), and propagateNaN().
Referenced by computeKnownFPClass(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
inline |
Definition at line 168 of file KnownFPClass.h.
References llvm::fcNegInf, llvm::fcNegNormal, llvm::fcNegSubnormal, llvm::fcNegZero, llvm::fcPosInf, llvm::fcPosNormal, llvm::fcPosSubnormal, llvm::fcPosZero, KnownFPClasses, and signBitMustBeZero().
Referenced by computeKnownFPClass(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
static |
Report known values for fmul.
Definition at line 236 of file KnownFPClass.cpp.
References llvm::fcInf, llvm::fcNan, llvm::fcNegative, llvm::fcNormal, llvm::fcPositive, llvm::fcSubnormal, llvm::fcZero, isKnownAlways(), isKnownNever(), isKnownNeverInfinity(), isKnownNeverLogicalZero(), isKnownNeverNaN(), KnownFPClass(), knownNot(), SignBit, signBitMustBeOne(), and signBitMustBeZero().
Referenced by computeKnownFPClass(), llvm::InstCombinerImpl::SimplifyDemandedUseFPClass(), and square().
|
inline |
Definition at line 162 of file KnownFPClass.h.
References llvm::fneg(), KnownFPClasses, and SignBit.
Referenced by computeKnownFPClass(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
inline |
Definition at line 139 of file KnownFPClass.h.
References KnownFPClass(), KnownFPClasses, RHS, and SignBit.
Referenced by computeKnownFPClass(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
inline |
Definition at line 45 of file KnownFPClass.h.
References isKnownNever().
Referenced by fmul(), isKnownAlwaysNaN(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
inline |
Return true if it's known this must always be a nan.
Definition at line 53 of file KnownFPClass.h.
References llvm::fcNan, and isKnownAlways().
Referenced by simplifyFCmpInst().
|
inline |
Return true if it's known this can never be one of the mask entries.
Definition at line 41 of file KnownFPClass.h.
References llvm::fcNone, and KnownFPClasses.
Referenced by cannotBeOrderedGreaterEqZero(), cannotBeOrderedGreaterThanZero(), cannotBeOrderedLessThanZero(), canonicalize(), computeKnownFPClass(), copysign(), fmul(), foldFPtoI(), isKnownAlways(), isKnownNeverInfinity(), isKnownNeverInfOrNaN(), isKnownNeverNaN(), isKnownNeverNegInfinity(), isKnownNeverNegSubnormal(), isKnownNeverNegZero(), isKnownNeverPosInfinity(), isKnownNeverPosSubnormal(), isKnownNeverPosZero(), isKnownNeverSubnormal(), isKnownNeverZero(), knownNot(), signBitIsZeroOrNaN(), llvm::InstCombinerImpl::SimplifyDemandedUseFPClass(), and simplifyFMAFMul().
|
inline |
Return true if it's known this can never be an infinity.
Definition at line 56 of file KnownFPClass.h.
References llvm::fcInf, and isKnownNever().
Referenced by computeKnownFPClass(), fmul(), llvm::isKnownNeverInfinity(), and llvm::isKnownNeverInfOrNaN().
|
inline |
Return true if it's known this can never be an infinity or nan.
Definition at line 59 of file KnownFPClass.h.
References llvm::fcInf, llvm::fcNan, and isKnownNever().
Referenced by llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
| bool KnownFPClass::isKnownNeverLogicalNegZero | ( | DenormalMode | Mode | ) | const |
Return true if it's known this can never be interpreted as a negative zero.
Definition at line 39 of file KnownFPClass.cpp.
References inputDenormalIsIEEEOrPosZero(), isKnownNeverNegSubnormal(), and isKnownNeverNegZero().
Referenced by cannotBeOrderedGreaterEqZero(), and computeKnownFPClass().
| bool KnownFPClass::isKnownNeverLogicalPosZero | ( | DenormalMode | Mode | ) | const |
Return true if it's known this can never be interpreted as a positive zero.
Definition at line 44 of file KnownFPClass.cpp.
References llvm::DenormalMode::IEEE, isKnownNeverPosSubnormal(), isKnownNeverPosZero(), isKnownNeverSubnormal(), llvm_unreachable, llvm::DenormalMode::PositiveZero, and llvm::DenormalMode::PreserveSign.
Referenced by computeKnownFPClass().
| bool KnownFPClass::isKnownNeverLogicalZero | ( | DenormalMode | Mode | ) | const |
Return true if it's known this can never be interpreted as a zero.
This extends isKnownNeverZero to cover the case where the assumed floating-point mode for the function interprets denormals as zero.
Definition at line 34 of file KnownFPClass.cpp.
References inputDenormalIsIEEE(), isKnownNeverSubnormal(), and isKnownNeverZero().
Referenced by computeKnownFPClass(), fmul(), and log().
|
inline |
Return true if it's known this can never be a nan.
Definition at line 50 of file KnownFPClass.h.
References llvm::fcNan, and isKnownNever().
Referenced by canonicalize(), computeKnownFPClass(), fmul(), llvm::isKnownNeverInfOrNaN(), llvm::isKnownNeverNaN(), log(), minMaxLike(), llvm::InstCombinerImpl::SimplifyDemandedUseFPClass(), and simplifyFCmpInst().
|
inline |
Return true if it's known this can never be -infinity.
Definition at line 65 of file KnownFPClass.h.
References llvm::fcNegInf, and isKnownNever().
Referenced by computeKnownFPClass().
|
inline |
Return true if it's known this can never be a negative subnormal.
Definition at line 74 of file KnownFPClass.h.
References llvm::fcNegSubnormal, and isKnownNever().
Referenced by computeKnownFPClass(), and isKnownNeverLogicalNegZero().
|
inline |
Return true if it's known this can never be a negative zero.
This means a literal -0 and does not include denormal inputs implicitly treated as -0.
Definition at line 85 of file KnownFPClass.h.
References llvm::fcNegZero, and isKnownNever().
Referenced by llvm::cannotBeNegativeZero(), isKnownNeverLogicalNegZero(), and minMaxLike().
|
inline |
Return true if it's known this can never be +infinity.
Definition at line 62 of file KnownFPClass.h.
References llvm::fcPosInf, and isKnownNever().
Referenced by computeKnownFPClass(), and log().
|
inline |
Return true if it's known this can never be a positive subnormal.
Definition at line 71 of file KnownFPClass.h.
References llvm::fcPosSubnormal, and isKnownNever().
Referenced by computeKnownFPClass(), and isKnownNeverLogicalPosZero().
|
inline |
Return true if it's known this can never be a literal positive zero.
Definition at line 81 of file KnownFPClass.h.
References llvm::fcPosZero, and isKnownNever().
Referenced by isKnownNeverLogicalPosZero(), and minMaxLike().
|
inline |
Return true if it's known this can never be a subnormal.
Definition at line 68 of file KnownFPClass.h.
References llvm::fcSubnormal, and isKnownNever().
Referenced by isKnownNeverLogicalPosZero(), isKnownNeverLogicalZero(), minMaxLike(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
inline |
Return true if it's known this can never be a zero.
This means a literal [+-]0, and does not include denormal inputs implicitly treated as [+-]0.
Definition at line 78 of file KnownFPClass.h.
References llvm::fcZero, and isKnownNever().
Referenced by isKnownNeverLogicalZero(), and llvm::LegalizerHelper::lowerFMinimumMaximum().
|
inline |
Definition at line 47 of file KnownFPClass.h.
References llvm::fcAllFlags, KnownFPClasses, and SignBit.
Referenced by computeKnownFPClass().
|
inline |
Definition at line 152 of file KnownFPClass.h.
References llvm::fcNan, llvm::fcNegative, llvm::fcPositive, isKnownNever(), KnownFPClasses, and SignBit.
Referenced by canonicalize(), computeKnownFPClass(), computeKnownFPClassForFPTrunc(), computeKnownFPClassFromCond(), exp(), fmul(), log(), minMaxLike(), propagateNaN(), llvm::InstCombinerImpl::SimplifyDemandedUseFPClass(), and square().
|
static |
Propagate known class for log/log2/log10.
Definition at line 316 of file KnownFPClass.cpp.
References cannotBeOrderedLessThanZero(), llvm::fcNan, llvm::fcNegInf, llvm::fcNegZero, llvm::fcPosInf, isKnownNeverLogicalZero(), isKnownNeverNaN(), isKnownNeverPosInfinity(), KnownFPClass(), and knownNot().
Referenced by computeKnownFPClass(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
static |
Definition at line 94 of file KnownFPClass.cpp.
References cannotBeOrderedGreaterThanZero(), cannotBeOrderedLessThanZero(), llvm::fcNan, llvm::fcNone, llvm::fcZero, llvm::DenormalMode::getIEEE(), isKnownNeverNaN(), isKnownNeverNegZero(), isKnownNeverPosZero(), isKnownNeverSubnormal(), KnownFPClass(), KnownFPClasses, knownNot(), llvm_unreachable, maximum, maximumnum, maxnum, minimum, minimumnum, minnum, OrderedGreaterThanZeroMask, OrderedLessThanZeroMask, SignBit, signBitMustBeOne(), and signBitMustBeZero().
Referenced by computeKnownFPClass(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
inline |
Definition at line 36 of file KnownFPClass.h.
References KnownFPClass(), KnownFPClasses, llvm::Other, and SignBit.
|
inline |
Definition at line 144 of file KnownFPClass.h.
References KnownFPClass(), KnownFPClasses, RHS, and SignBit.
| void KnownFPClass::propagateCanonicalizingSrc | ( | const KnownFPClass & | Src, |
| DenormalMode | Mode ) |
Report known classes if Src is evaluated through a potentially canonicalizing operation.
We can assume signaling nans will not be introduced, but cannot assume a denormal will be flushed under FTZ/DAZ.
This assumes a copy-like operation and will replace any currently known information.
Definition at line 310 of file KnownFPClass.cpp.
References KnownFPClass(), propagateDenormal(), and propagateNaN().
Referenced by computeKnownFPClass().
| void KnownFPClass::propagateDenormal | ( | const KnownFPClass & | Src, |
| DenormalMode | Mode ) |
Propagate knowledge from a source value that could be a denormal or zero.
We have to be conservative since output flushing is not guaranteed, so known-never-zero may not hold.
This assumes a copy-like operation and will replace any currently known information.
Definition at line 67 of file KnownFPClass.cpp.
References llvm::DenormalMode::Dynamic, llvm::fcNegZero, llvm::fcPosZero, llvm::DenormalMode::getIEEE(), llvm::DenormalMode::getPositiveZero(), KnownFPClass(), KnownFPClasses, and llvm::DenormalMode::PositiveZero.
Referenced by propagateCanonicalizingSrc().
|
inline |
Definition at line 262 of file KnownFPClass.h.
References llvm::fcNan, llvm::fcSNan, KnownFPClass(), knownNot(), and SignBit.
Referenced by computeKnownFPClass(), computeKnownFPClassForFPTrunc(), exp(), and propagateCanonicalizingSrc().
|
inline |
Definition at line 292 of file KnownFPClass.h.
References KnownFPClass().
Referenced by computeKnownFPClass(), and llvm::TargetLowering::computeKnownFPClassForTargetInstr().
|
inline |
Return true if the sign bit must be 0, ignoring the sign of nans.
Definition at line 223 of file KnownFPClass.h.
References llvm::fcNegative, and isKnownNever().
|
inline |
Assume the sign bit is one.
Definition at line 232 of file KnownFPClass.h.
References llvm::fcNan, llvm::fcNegative, KnownFPClasses, and SignBit.
Referenced by computeKnownFPClass(), computeKnownFPClassFromCond(), fmul(), and minMaxLike().
|
inline |
Assume the sign bit is zero.
Definition at line 226 of file KnownFPClass.h.
References llvm::fcNan, llvm::fcPositive, KnownFPClasses, and SignBit.
Referenced by computeKnownFPClass(), computeKnownFPClassFromCond(), fabs(), fmul(), and minMaxLike().
|
inlinestatic |
Definition at line 210 of file KnownFPClass.h.
References llvm::fcNegative, fmul(), llvm::DenormalMode::getDynamic(), KnownFPClass(), knownNot(), and Mode.
Referenced by computeKnownFPClass(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
| FPClassTest llvm::KnownFPClass::KnownFPClasses = fcAllFlags |
Floating-point classes the value could be one of.
Definition at line 26 of file KnownFPClass.h.
Referenced by canonicalize(), computeKnownFPClass(), copysign(), fabs(), fneg(), intersectWith(), isKnownNever(), isUnknown(), KnownFPClass(), knownNot(), minMaxLike(), operator==(), operator|=(), propagateDenormal(), signBitMustBeOne(), signBitMustBeZero(), llvm::InstCombinerImpl::SimplifyDemandedFPClass(), llvm::InstCombinerImpl::SimplifyDemandedUseFPClass(), and llvm::InstCombinerImpl::SimplifyMultipleUseDemandedFPClass().
|
staticconstexpr |
Definition at line 102 of file KnownFPClass.h.
Referenced by cannotBeOrderedGreaterThanZero(), computeKnownFPClass(), and minMaxLike().
|
staticconstexpr |
Definition at line 100 of file KnownFPClass.h.
Referenced by llvm::cannotBeOrderedLessThanZero(), cannotBeOrderedLessThanZero(), computeKnownFPClass(), computeKnownFPClassForFPTrunc(), minMaxLike(), and simplifyFCmpInst().
| std::optional<bool> llvm::KnownFPClass::SignBit |
std::nullopt if the sign bit is unknown, true if the sign bit is definitely set or false if the sign bit is definitely unset.
Definition at line 30 of file KnownFPClass.h.
Referenced by computeKnownFPClass(), llvm::computeKnownFPSignBit(), copysign(), fmul(), fneg(), intersectWith(), isUnknown(), KnownFPClass(), knownNot(), minMaxLike(), operator==(), operator|=(), propagateNaN(), signBitMustBeOne(), signBitMustBeZero(), and simplifyFMAFMul().