From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1251) id 7FE4C385EC54; Wed, 16 Mar 2022 09:26:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7FE4C385EC54 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Roger Sayle To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-7664] Some minor HONOR_NANS improvements to match.pd X-Act-Checkin: gcc X-Git-Author: Roger Sayle X-Git-Refname: refs/heads/master X-Git-Oldrev: ab46fc7c3bf01337ea4554f08f4f6b0be8173557 X-Git-Newrev: 7690bee9f36ee02b7ad0b8a7e7a3e08357890dc0 Message-Id: <20220316092623.7FE4C385EC54@sourceware.org> Date: Wed, 16 Mar 2022 09:26:23 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Mar 2022 09:26:23 -0000 https://gcc.gnu.org/g:7690bee9f36ee02b7ad0b8a7e7a3e08357890dc0 commit r12-7664-g7690bee9f36ee02b7ad0b8a7e7a3e08357890dc0 Author: Roger Sayle Date: Wed Mar 16 09:25:34 2022 +0000 Some minor HONOR_NANS improvements to match.pd Tweak the constant folding of X CMP X in when X can't be a NaN. 2022-03-16 Roger Sayle gcc/ChangeLog * match.pd (X CMP X -> true): Test tree_expr_maybe_nan_p instead of HONOR_NANS. (X LTGT X -> false): Enable if X is not tree_expr_maybe_nan_p, as this can't trap/signal. Diff: --- gcc/match.pd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index 7d619f4c932..6d691d302b3 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -4743,7 +4743,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (simplify (cmp @0 @0) (if (! FLOAT_TYPE_P (TREE_TYPE (@0)) - || ! HONOR_NANS (@0)) + || ! tree_expr_maybe_nan_p (@0)) { constant_boolean_node (true, type); } (if (cmp != EQ_EXPR /* With -ftrapping-math conversion to EQ loses an exception. */ @@ -4755,7 +4755,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (cmp @0 @0) (if (cmp != NE_EXPR || ! FLOAT_TYPE_P (TREE_TYPE (@0)) - || ! HONOR_NANS (@0)) + || ! tree_expr_maybe_nan_p (@0)) { constant_boolean_node (false, type); }))) (for cmp (unle unge uneq) (simplify @@ -4767,7 +4767,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (unordered @0 @0))) (simplify (ltgt @0 @0) - (if (!flag_trapping_math) + (if (!flag_trapping_math || !tree_expr_maybe_nan_p (@0)) { constant_boolean_node (false, type); })) /* x == ~x -> false */