public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/112305] [11/12/13/14 Regression] Wrong code at -O1/2/3/s on x86_64-pc-linux-gnu
Date: Tue, 31 Oct 2023 09:10:20 +0000	[thread overview]
Message-ID: <bug-112305-4-KZh9QpnQNK@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112305-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
final value replacement introduces

   <bb 5> [local count: 118111600]:
-  # e_14 = PHI <e_10(4)>
-  # d_23 = PHI <d_11(4)>
+  _7 = e_20 + 4;
+  _12 = e_20 <= 19;
+  _25 = (unsigned int) e_20;
+  _26 = 19 - _25;
+  _27 = _26 / 4;
+  _28 = (int) _27;
+  _29 = _28 * 4;
+  _30 = _12 ? _29 : 0;
+  e_14 = _7 + _30;
+  _31 = e_20 <= 19;
+  _32 = (unsigned int) e_20;
+  _33 = 19 - _32;
+  _34 = _33 / 4;
+  _35 = _34 * 4294967293;
+  _36 = _31 ? _35 : 0;
+  _37 = d_19 + _36;
+  d_23 = _37 + 4294967293;

which is e_20 + 4 + (e_20 <= 19 ? 4 * (int)((19 - (unsigned int) e_20) / 4): 0)
and ((e_20 <= 19 ? ((19 - (unsigned int) e_20) / 4) * 4294967293 : 0) + d_19) +
4294967293

I think there's another bug noting that final value replacement with
COND_EXPRs should eventually materialize control-flow.

I have a patch to do more rewriting to unsigned instead.

  parent reply	other threads:[~2023-10-31  9:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31  6:51 [Bug middle-end/112305] New: [13/14 " jwzeng at nuaa dot edu.cn
2023-10-31  7:00 ` [Bug middle-end/112305] " pinskia at gcc dot gnu.org
2023-10-31  7:02 ` pinskia at gcc dot gnu.org
2023-10-31  7:07 ` [Bug middle-end/112305] [11/12/13/14 " pinskia at gcc dot gnu.org
2023-10-31  7:08 ` pinskia at gcc dot gnu.org
2023-10-31  9:10 ` rguenth at gcc dot gnu.org [this message]
2023-10-31 12:10 ` cvs-commit at gcc dot gnu.org
2023-10-31 12:18 ` [Bug middle-end/112305] [11/12/13 " rguenth at gcc dot gnu.org
2024-05-21  9:18 ` 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-112305-4-KZh9QpnQNK@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).