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-2761] [PR106967] Set known NANs to undefined for flag_finite_math_only.
Date: Wed, 21 Sep 2022 11:33:57 +0000 (GMT)	[thread overview]
Message-ID: <20220921113357.79CD738582AA@sourceware.org> (raw)

https://gcc.gnu.org/g:dc829c7613ddf562d1aecaf22eda965e87108ac8

commit r13-2761-gdc829c7613ddf562d1aecaf22eda965e87108ac8
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Wed Sep 21 11:18:48 2022 +0200

    [PR106967] Set known NANs to undefined for flag_finite_math_only.
    
    Explicit NANs in the IL can be treated as undefined for
    flag_finite_math_only.  This causes all the right things to happen wrt
    threading, folding, etc.  It also saves us special casing throughout.
    
            PR tree-optimization/106967
    
    gcc/ChangeLog:
    
            * value-range.cc (frange::set): Set known NANs to undefined for
            flag_finite_math_only.

Diff:
---
 gcc/value-range.cc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 505eb9211a7..7e8028eced2 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -313,8 +313,13 @@ frange::set (tree min, tree max, value_range_kind kind)
       gcc_checking_assert (real_identical (TREE_REAL_CST_PTR (min),
 					   TREE_REAL_CST_PTR (max)));
       tree type = TREE_TYPE (min);
-      bool sign = real_isneg (TREE_REAL_CST_PTR (min));
-      set_nan (type, sign);
+      if (HONOR_NANS (type))
+	{
+	  bool sign = real_isneg (TREE_REAL_CST_PTR (min));
+	  set_nan (type, sign);
+	}
+      else
+	set_undefined ();
       return;
     }

                 reply	other threads:[~2022-09-21 11:33 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=20220921113357.79CD738582AA@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).