public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4985] Add !HONOR_SNANS to simplifcation: (trunc)copysign((extend)a, (extend)b) to copysign (a, b).
@ 2021-11-08  1:38 hongtao Liu
  0 siblings, 0 replies; only message in thread
From: hongtao Liu @ 2021-11-08  1:38 UTC (permalink / raw)
  To: gcc-cvs

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))


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-08  1:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08  1:38 [gcc r12-4985] Add !HONOR_SNANS to simplifcation: (trunc)copysign((extend)a, (extend)b) to copysign (a, b) hongtao Liu

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).