mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
[FPEnv] Use typed accessors in FPOptions
Previously methods `FPOptions::get*` returned unsigned value even if the corresponding property was represented by specific enumeration type. With this change such methods return actual type of the property. It also allows printing value of a property as text rather than integer code. Differential Revision: https://reviews.llvm.org/D87812
This commit is contained in:
parent
c7c58df71f
commit
35714dfbb7
@ -44,6 +44,24 @@ enum class RoundingMode : int8_t {
|
||||
Invalid = -1 ///< Denotes invalid value.
|
||||
};
|
||||
|
||||
/// Returns text representation of the given rounding mode.
|
||||
inline StringRef spell(RoundingMode RM) {
|
||||
switch (RM) {
|
||||
case RoundingMode::TowardZero: return "towardzero";
|
||||
case RoundingMode::NearestTiesToEven: return "tonearest";
|
||||
case RoundingMode::TowardPositive: return "upward";
|
||||
case RoundingMode::TowardNegative: return "downward";
|
||||
case RoundingMode::NearestTiesToAway: return "tonearestaway";
|
||||
case RoundingMode::Dynamic: return "dynamic";
|
||||
default: return "invalid";
|
||||
}
|
||||
}
|
||||
|
||||
inline raw_ostream &operator << (raw_ostream &OS, RoundingMode RM) {
|
||||
OS << spell(RM);
|
||||
return OS;
|
||||
}
|
||||
|
||||
/// Represent subnormal handling kind for floating point instruction inputs and
|
||||
/// outputs.
|
||||
struct DenormalMode {
|
||||
|
Loading…
Reference in New Issue
Block a user