public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: hongtao Liu <liuhongt@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-4985] Add !HONOR_SNANS to simplifcation: (trunc)copysign((extend)a, (extend)b) to copysign (a, b).
Date: Mon,  8 Nov 2021 01:38:46 +0000 (GMT)	[thread overview]
Message-ID: <20211108013846.4BA513858401@sourceware.org> (raw)

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

commit r12-4985-ga1f7ead09cd41d32e2feffff902eb32e587c36e7
Author: liuhongt <hongtao.liu@intel.com>
Date:   Mon Nov 8 09:32:17 2021 +0800

    Add !HONOR_SNANS to simplifcation: (trunc)copysign((extend)a, (extend)b) to copysign (a, b).
    
    > Note that this is not safe with -fsignaling-nans, so needs to be disabled
    > for that option (if there isn't already logic somewhere with that effect),
    > because the extend will convert a signaling NaN to quiet (raising
    > "invalid"), but copysign won't, so this transformation could result in a
    > signaling NaN being wrongly returned when the original code would never
    > have returned a signaling NaN.
    >
    > --
    > Joseph S. Myers
    > joseph@codesourcery.com
    
    gcc/ChangeLog
    
            PR target/102464
            * match.pd (Simplifcation (trunc)copysign((extend)a, (extend)b)
            to .COPYSIGN (a, b)): Add !HONOR_SNANS.

Diff:
---
 gcc/match.pd | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/match.pd b/gcc/match.pd
index 869b26d16a0..71cf6f9df0a 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -6210,6 +6210,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
  (simplify
   (convert (copysigns (convert@2 @0) (convert @1)))
    (if (optimize
+       && !HONOR_SNANS (@2)
        && types_match (type, TREE_TYPE (@0))
        && types_match (type, TREE_TYPE (@1))
        && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (@2))


                 reply	other threads:[~2021-11-08  1:38 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=20211108013846.4BA513858401@sourceware.org \
    --to=liuhongt@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).