public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/114009] [11/12/13/14 Regression] Missed optimization: (!a) * a => 0 when a=(a/2)*2
Date: Wed, 21 Feb 2024 00:03:12 +0000	[thread overview]
Message-ID: <bug-114009-4-54ObKsH1Mg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114009-4@http.gcc.gnu.org/bugzilla/>

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-02-21
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

What is happening is:
`(a/2)*2 == 0` gets optimized to `((unsigned)a) + 1 <= 2` and then we don't
handle:
`((unsigned)a) + 1 <= 2 ? (a/2) : 0` which is just 0. as a has the range of
[-1,1] for the truth side and divide that by 2 is always 0.

  parent reply	other threads:[~2024-02-21  0:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 10:16 [Bug tree-optimization/114009] New: " 652023330028 at smail dot nju.edu.cn
2024-02-20 23:50 ` [Bug tree-optimization/114009] " pinskia at gcc dot gnu.org
2024-02-20 23:56 ` [Bug tree-optimization/114009] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2024-02-21  0:03 ` pinskia at gcc dot gnu.org [this message]
2024-02-22 10:21 ` rguenth at gcc dot gnu.org
2024-03-05 13:02 ` jakub at gcc dot gnu.org
2024-03-05 14:14 ` jakub at gcc dot gnu.org
2024-03-05 14:24 ` jakub at gcc dot gnu.org
2024-03-07  7:47 ` cvs-commit at gcc dot gnu.org
2024-03-15  9:45 ` jakub at gcc dot gnu.org

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-114009-4-54ObKsH1Mg@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).