public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3196] Add frange::maybe_isnan (bool sign).
@ 2022-10-10 12:50 Aldy Hernandez
0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2022-10-10 12:50 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e23f7dabe6f7ce1d92bfc07d2b62cc7bcdc0caae
commit r13-3196-ge23f7dabe6f7ce1d92bfc07d2b62cc7bcdc0caae
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Mon Oct 10 13:43:16 2022 +0200
Add frange::maybe_isnan (bool sign).
It is useful to know if there's the possiblity of a NAN with a given
sign. This is to complement maybe_isnan(void) which returns TRUE for a
NAN of any sign.
A follow-up patch implementing ABS will make use of this.
gcc/ChangeLog:
* value-range.h (frange::maybe_isnan): New.
Diff:
---
gcc/value-range.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/gcc/value-range.h b/gcc/value-range.h
index 484f911bd90..07a2067898c 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -323,6 +323,7 @@ public:
bool known_isnan () const;
bool known_isinf () const;
bool maybe_isnan () const;
+ bool maybe_isnan (bool sign) const;
bool maybe_isinf () const;
bool signbit_p (bool &signbit) const;
private:
@@ -1295,6 +1296,18 @@ frange::maybe_isnan () const
return m_pos_nan || m_neg_nan;
}
+// Return TRUE if range is possibly a NAN with SIGN.
+
+inline bool
+frange::maybe_isnan (bool sign) const
+{
+ if (undefined_p ())
+ return false;
+ if (sign)
+ return m_neg_nan;
+ return m_pos_nan;
+}
+
// Return TRUE if range is a +NAN or -NAN.
inline bool
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-10 12:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 12:50 [gcc r13-3196] Add frange::maybe_isnan (bool sign) Aldy Hernandez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).