23 if (!
Value.isDenormal())
52 return !Result.isNegative();
54 return Result.isNegative();
62 if (Arg.isSignaling())
73 assert(!Args.empty() && Result.bitwiseIsEqual(Args[0]) &&
74 "Result must start as a copy of Args[0]");
75 if (Args.size() == 2) {
80 return Result.add(Args[1], RM);
82 return Result.subtract(Args[1], RM);
84 return Result.multiply(Args[1], RM);
86 return Result.divide(Args[1], RM);
88 return Result.mod(Args[1]);
90 Result =
minnum(Result, Args[1]);
93 Result =
maxnum(Result, Args[1]);
96 Result =
minimum(Result, Args[1]);
99 Result =
maximum(Result, Args[1]);
108 }
else if (Args.size() == 1) {
123 }
else if (Args.size() == 3 && Opcode ==
FPOp::FMA) {
124 return Result.fusedMultiplyAdd(Args[1], Args[2], RM);
137 assert(!Args.empty() && Args.size() <= 3);
141 for (
unsigned I = 0;
I < Args.size(); ++
I) {
142 assert(&Args[
I].getSemantics() == &Args[0].getSemantics());
148 APFloat Result = FlushedArgs[0];
189 (LHS.isDenormal() || RHS.isDenormal()))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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 ...
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 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 b...
This file provides fallible floating-point folding operations with explicit rounding and denormal mod...
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
This file contains library features backported from future STL versions.
This file defines the SmallVector class.
opStatus
IEEE-754R 7: Default exception handling.
static APFloat getZero(const fltSemantics &Sem, bool Negative=false)
Factory for Positive and Negative Zero.
cmpResult compare(const APFloat &RHS) const
Represent a constant reference to an array (0 or more elements consecutively in memory),...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::optional< FPFoldResult > tryFoldFP(FPOp Opcode, ArrayRef< APFloat > Args, DenormalMode Denorms)
Try to evaluate a floating-point operation with the specified inputs.
LLVM_READONLY APFloat maximum(const APFloat &A, const APFloat &B)
Implements IEEE 754-2019 maximum semantics.
LLVM_READONLY APFloat maxnum(const APFloat &A, const APFloat &B)
Implements IEEE-754 2008 maxNum semantics.
FPOp
The floating-point operations supported by the folding helpers.
LLVM_READONLY APFloat minimumnum(const APFloat &A, const APFloat &B)
Implements IEEE 754-2019 minimumNumber semantics.
LLVM_ABI std::optional< APFloat::cmpResult > tryFoldFCmp(const APFloat &LHS, const APFloat &RHS, DenormalMode Denorms)
Try to compare two floating-point values.
LLVM_READONLY APFloat minnum(const APFloat &A, const APFloat &B)
Implements IEEE-754 2008 minNum semantics.
RoundingMode
Rounding mode.
@ TowardZero
roundTowardZero.
@ NearestTiesToEven
roundTiesToEven.
@ Invalid
Denotes invalid value.
@ Dynamic
Denotes mode unknown at compile time.
@ TowardPositive
roundTowardPositive.
@ NearestTiesToAway
roundTiesToAway.
@ TowardNegative
roundTowardNegative.
constexpr std::optional< remove_cvref_t< std::invoke_result_t< Function, Value > > > transformOptional(Optional &&O, Function &&F)
LLVM_READONLY APFloat minimum(const APFloat &A, const APFloat &B)
Implements IEEE 754-2019 minimum semantics.
LLVM_READONLY APFloat maximumnum(const APFloat &A, const APFloat &B)
Implements IEEE 754-2019 maximumNumber semantics.
LLVM_ABI std::optional< APFloat > getFPValue(std::optional< FPFoldResult > Res)
Return the value of a successful fold, or std::nullopt.
LLVM_ABI std::optional< FPFoldResult > tryFoldFPWithRM(FPOp Opcode, ArrayRef< APFloat > Args, RoundingMode RM, DenormalMode Denorms)
Try to evaluate a floating-point operation with an explicit rounding mode.
Represent subnormal handling kind for floating point instruction inputs and outputs.
DenormalModeKind Input
Denormal treatment kind for floating point instruction inputs in the default floating-point environme...
DenormalModeKind
Represent handled modes for denormal (aka subnormal) modes in the floating point environment.
@ PreserveSign
The sign of a flushed-to-zero number is preserved in the sign of 0.
@ PositiveZero
Denormals are flushed to positive zero.
@ Dynamic
Denormals have unknown treatment.
@ IEEE
IEEE-754 denormal numbers preserved.
constexpr bool isValid() const
DenormalModeKind Output
Denormal flushing mode for floating point instruction results in the default floating point environme...
A unique floating-point result and the IEEE exceptions raised computing it.