From: liuhongt Date: Mon, 8 Nov 2021 01:32:17 +0000 (+0800) Subject: Add !HONOR_SNANS to simplifcation: (trunc)copysign((extend)a, (extend)b) to copysign... X-Git-Tag: basepoints/gcc-13~3328 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1f7ead09cd41d32e2feffff902eb32e587c36e7;p=thirdparty%2Fgcc.git 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 --git a/gcc/match.pd b/gcc/match.pd index 869b26d16a0c..71cf6f9df0ac 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))