public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/96392] Optimize x+0.0 if x is an integer
Date: Wed, 09 Feb 2022 14:24:02 +0000	[thread overview]
Message-ID: <bug-96392-4-a4lQrobH5f@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96392-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96392

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>:

https://gcc.gnu.org/g:2d3c477599b02b06e338acd5f5098ee7a3fe6176

commit r12-7130-g2d3c477599b02b06e338acd5f5098ee7a3fe6176
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Wed Feb 9 14:21:08 2022 +0000

    [PATCH] PR tree-optimization/104420: Fix checks for constant folding X*0.0

    This patch resolves PR tree-optimization/104420, which is a P1 regression
    where, as observed by Jakub Jelinek, the conditions for constant folding
    x*0.0 are incorrect (following my patch for PR tree-optimization/96392).
    The multiplication x*0.0 may yield a negative zero result, -0.0, if X is
    negative (not just if x may be negative zero).  Hence (without -ffast-math)
    (int)x*0.0 can't be optimized to 0.0, but (unsigned)x*0.0 can be constant
    folded.  This adds a bunch of test cases to confirm the desired behaviour,
    and removes an incorrect test from gcc.dg/pr96392.c which checked for the
    wrong behaviour.

    2022-02-09  Roger Sayle  <roger@nextmovesoftware.com>

    gcc/ChangeLog
            PR tree-optimization/104420
            * match.pd (mult @0 real_zerop): Tweak conditions for constant
            folding X*0.0 (or X*-0.0) to HONOR_SIGNED_ZEROS when appropriate.

    gcc/testsuite/ChangeLog
            PR tree-optimization/104420
            * gcc.dg/pr104420-1.c: New test case.
            * gcc.dg/pr104420-2.c: New test case.
            * gcc.dg/pr104420-3.c: New test case.
            * gcc.dg/pr104420-4.c: New test case.
            * gcc.dg/pr96392.c: Remove incorrect test.

      parent reply	other threads:[~2022-02-09 14:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30 19:08 [Bug tree-optimization/96392] New: " hugo_musso_gualandi at hotmail dot com
2020-07-30 20:34 ` [Bug tree-optimization/96392] " glisse at gcc dot gnu.org
2021-06-11 16:18 ` cvs-commit at gcc dot gnu.org
2021-06-11 16:43 ` cvs-commit at gcc dot gnu.org
2021-07-10  8:37 ` roger at nextmovesoftware dot com
2022-02-09 14:24 ` cvs-commit at gcc dot gnu.org [this message]

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=bug-96392-4-a4lQrobH5f@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).