diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h index 40131c83a8ef4..e7e32be0ef595 100644 --- a/llvm/include/llvm/ADT/APFloat.h +++ b/llvm/include/llvm/ADT/APFloat.h @@ -309,6 +309,8 @@ struct APFloatBase { static ExponentType semanticsMaxExponent(const fltSemantics &); static unsigned int semanticsSizeInBits(const fltSemantics &); static unsigned int semanticsIntSizeInBits(const fltSemantics&, bool); + static bool semanticsHasZero(const fltSemantics &); + static bool semanticsHasSignedRepr(const fltSemantics &); // Returns true if any number described by \p Src can be precisely represented // by a normal (not subnormal) value in \p Dst. diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 03413f6eb6fe7..25500d29c4e4e 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -367,6 +367,14 @@ unsigned int APFloatBase::semanticsIntSizeInBits(const fltSemantics &semantics, return MinBitWidth; } +bool APFloatBase::semanticsHasZero(const fltSemantics &semantics) { + return semantics.hasZero; +} + +bool APFloatBase::semanticsHasSignedRepr(const fltSemantics &semantics) { + return semantics.hasSignedRepr; +} + bool APFloatBase::isRepresentableAsNormalIn(const fltSemantics &Src, const fltSemantics &Dst) { // Exponent range must be larger.