public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-3500] Convert flag_finite_math_only uses in frange to HONOR_*.
Date: Wed, 26 Oct 2022 06:08:48 +0000 (GMT)	[thread overview]
Message-ID: <20221026060852.053453857434@sourceware.org> (raw)

https://gcc.gnu.org/g:82866f434cfd724b0d976b034445b7816f6c79f9

commit r13-3500-g82866f434cfd724b0d976b034445b7816f6c79f9
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Tue Oct 25 22:22:56 2022 +0200

    Convert flag_finite_math_only uses in frange to HONOR_*.
    
    As mentioned earlier, we should be using HONOR_* on types rather than
    flag_finite_math_only.
    
    gcc/ChangeLog:
    
            * value-range.cc (frange::set): Use HONOR_*.
            (frange::verify_range): Same.
            * value-range.h (frange_val_min): Same.
            (frange_val_max): Same.

Diff:
---
 gcc/value-range.cc |  6 +++---
 gcc/value-range.h  | 12 ++++++------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index d8ee6ec0d0f..77e5a2cc299 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -341,7 +341,7 @@ frange::set (tree type,
 
   // For -ffinite-math-only we can drop ranges outside the
   // representable numbers to min/max for the type.
-  if (flag_finite_math_only)
+  if (!HONOR_INFINITIES (m_type))
     {
       REAL_VALUE_TYPE min_repr = frange_val_min (m_type);
       REAL_VALUE_TYPE max_repr = frange_val_max (m_type);
@@ -712,8 +712,8 @@ frange::supports_type_p (const_tree type) const
 void
 frange::verify_range ()
 {
-  if (flag_finite_math_only)
-    gcc_checking_assert (!maybe_isnan ());
+  if (!undefined_p ())
+    gcc_checking_assert (HONOR_NANS (m_type) || !maybe_isnan ());
   switch (m_kind)
     {
     case VR_UNDEFINED:
diff --git a/gcc/value-range.h b/gcc/value-range.h
index b48542a68aa..c87734dd8cd 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -1201,10 +1201,10 @@ real_min_representable (const_tree type)
 inline REAL_VALUE_TYPE
 frange_val_min (const_tree type)
 {
-  if (flag_finite_math_only)
-    return real_min_representable (type);
-  else
+  if (HONOR_INFINITIES (type))
     return dconstninf;
+  else
+    return real_min_representable (type);
 }
 
 // Return the maximum value for TYPE.
@@ -1212,10 +1212,10 @@ frange_val_min (const_tree type)
 inline REAL_VALUE_TYPE
 frange_val_max (const_tree type)
 {
-  if (flag_finite_math_only)
-    return real_max_representable (type);
-  else
+  if (HONOR_INFINITIES (type))
     return dconstinf;
+  else
+    return real_max_representable (type);
 }
 
 // Return TRUE if R is the minimum value for TYPE.

                 reply	other threads:[~2022-10-26  6:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221026060852.053453857434@sourceware.org \
    --to=aldyh@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).