Skip to content

[APFloat] add predicates to fltSemantics for hasZero and hasSignedRepr #111451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions llvm/include/llvm/ADT/APFloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions llvm/lib/Support/APFloat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading