|
LLVM 24.0.0git
|
#include "llvm/Support/FPFold.h"#include "llvm/ADT/STLForwardCompat.h"#include "llvm/ADT/SmallVector.h"#include "llvm/Support/ErrorHandling.h"#include <cassert>#include <utility>Go to the source code of this file.
Functions | |
| static APFloat | flush (APFloat Value, DenormalMode::DenormalModeKind Mode) |
| static bool | mayHaveBeenRoundedFromSubnormal (const APFloat &Result, APFloat::opStatus Status, RoundingMode RM) |
| Return true if gradual-underflow rounding may have promoted a result from the subnormal range to the smallest normal value. | |
| static APFloat::opStatus | getSNaNStatus (ArrayRef< APFloat > Args) |
| static APFloat::opStatus | executeFold (FPOp Opcode, APFloat &Result, ArrayRef< APFloat > Args, RoundingMode RM) |
| The internal helper that dispatches to APFloat, and always produces a status and result (so RM must be valid and non-dynamic if used, and input args must already be flushed if necessary). | |
| static std::optional< FPFoldResult > | tryFoldFPOpImpl (FPOp Opcode, ArrayRef< APFloat > Args, RoundingMode RM, DenormalMode Denorms) |
| Internal helper to fold or reject if we cannot give correct results. | |
|
static |
The internal helper that dispatches to APFloat, and always produces a status and result (so RM must be valid and non-dynamic if used, and input args must already be flushed if necessary).
Result must be initialized with a copy of Args[0].
Definition at line 71 of file FPFold.cpp.
References llvm::Add, assert(), llvm::Ceil, llvm::Div, llvm::Floor, llvm::FMA, llvm::FRem, getSNaNStatus(), llvm_unreachable, llvm::Maximum, llvm::maximum(), llvm::MaximumNum, llvm::maximumnum(), llvm::MaxNum, llvm::maxnum(), llvm::Minimum, llvm::minimum(), llvm::MinimumNum, llvm::minimumnum(), llvm::MinNum, llvm::minnum(), llvm::Mul, llvm::NearestTiesToAway, llvm::NearestTiesToEven, llvm::Round, llvm::RoundEven, llvm::Sub, llvm::TowardNegative, llvm::TowardPositive, llvm::TowardZero, and llvm::Trunc.
Referenced by tryFoldFPOpImpl().
|
static |
Definition at line 22 of file FPFold.cpp.
References llvm::APFloat::getZero(), Mode, llvm::DenormalMode::PositiveZero, and llvm::DenormalMode::PreserveSign.
Referenced by llvm::LiveRangeUpdater::add(), llvm::MCLOHDirective::getEmitSize(), llvm::vfs::makeMirroringOutputBackend(), llvm::raw_ostream::SetBufferSize(), llvm::raw_ostream::SetUnbuffered(), llvm::tryFoldFCmp(), tryFoldFPOpImpl(), llvm::circular_raw_ostream::~circular_raw_ostream(), llvm::DomTreeUpdater::~DomTreeUpdater(), and llvm::formatted_raw_ostream::~formatted_raw_ostream().
Definition at line 60 of file FPFold.cpp.
References llvm::APFloatBase::opInvalidOp, and llvm::APFloatBase::opOK.
Referenced by executeFold().
|
static |
Return true if gradual-underflow rounding may have promoted a result from the subnormal range to the smallest normal value.
When output denormals are flushed, folding such a result as an ordinary IEEE operation is unsafe: an FTZ operation may produce zero before gradual-underflow rounding can perform that promotion.
Definition at line 38 of file FPFold.cpp.
References llvm::Dynamic, llvm_unreachable, llvm::NearestTiesToAway, llvm::NearestTiesToEven, llvm::APFloatBase::opInexact, llvm::TowardNegative, llvm::TowardPositive, and llvm::TowardZero.
Referenced by tryFoldFPOpImpl().
|
static |
Internal helper to fold or reject if we cannot give correct results.
If RM is necessary for the operation, it must be valid and non-dynamic. Dynamic denormal modes reject the fold if subnormal inputs are present or if the output is subnormal and may need flushing.
Definition at line 133 of file FPFold.cpp.
References assert(), llvm::DenormalMode::Dynamic, executeFold(), flush(), I, llvm::DenormalMode::IEEE, llvm::DenormalMode::Input, llvm::DenormalMode::isValid(), mayHaveBeenRoundedFromSubnormal(), llvm::DenormalMode::Output, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by llvm::tryFoldFP(), and llvm::tryFoldFPWithRM().