From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2119) id 142DA3858D1E; Mon, 19 Jun 2023 17:53:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 142DA3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687197201; bh=b6GL7mHhN6515XfI7h8UdkderhMv/jxT1hyhBQQmf5s=; h=From:To:Subject:Date:From; b=V0zmk+13e1wzno7uKi4npbYLTtYu/vg98/5bQpP+NGwe6NhjW0f1J04FarPl8hbi5 fZbdrHhGcGxwVIACcQsengwE5f77IH3AiI/lWVX+BSTj/CwXEsci7U5lVa9IsqWxjl PFMPEHvw0OEZtbxpQySSzCk10IvKhr6w1oeEs5KQ= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jeff Law To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1952] Do not allow "x + 0.0" to "x" optimization with -fsignaling-nans X-Act-Checkin: gcc X-Git-Author: Toru Kisuki X-Git-Refname: refs/heads/master X-Git-Oldrev: 7b34cacc5735385e7e2855d7c0a6fad60ef4a99b X-Git-Newrev: 827b2a279fc6ad5bb76e4d2c2eb3432955b5e11c Message-Id: <20230619175321.142DA3858D1E@sourceware.org> Date: Mon, 19 Jun 2023 17:53:21 +0000 (GMT) List-Id: https://gcc.gnu.org/g:827b2a279fc6ad5bb76e4d2c2eb3432955b5e11c commit r14-1952-g827b2a279fc6ad5bb76e4d2c2eb3432955b5e11c Author: Toru Kisuki Date: Mon Jun 19 11:51:09 2023 -0600 Do not allow "x + 0.0" to "x" optimization with -fsignaling-nans gcc/ PR rtl-optimization/110305 * simplify-rtx.cc (simplify_context::simplify_binary_operation_1): Handle HONOR_SNANS for x + 0.0. Diff: --- gcc/simplify-rtx.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc index 9c68d360672..1b581447de6 100644 --- a/gcc/simplify-rtx.cc +++ b/gcc/simplify-rtx.cc @@ -2831,7 +2831,8 @@ simplify_context::simplify_binary_operation_1 (rtx_code code, when x is NaN, infinite, or finite and nonzero. They aren't when x is -0 and the rounding mode is not towards -infinity, since (-0) + 0 is then 0. */ - if (!HONOR_SIGNED_ZEROS (mode) && trueop1 == CONST0_RTX (mode)) + if (!HONOR_SIGNED_ZEROS (mode) && !HONOR_SNANS (mode) + && trueop1 == CONST0_RTX (mode)) return op0; /* ((-a) + b) -> (b - a) and similarly for (a + (-b)). These