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 rtl-optimization/114211] [13 Regression] wrong code with -O -fno-tree-coalesce-vars since r13-1907
Date: Fri, 15 Mar 2024 23:29:15 +0000	[thread overview]
Message-ID: <bug-114211-4-DXG2Pmwzvh@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114211-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:df3994a1be3565ad450d552dc94b696748a7807a

commit r13-8447-gdf3994a1be3565ad450d552dc94b696748a7807a
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Mar 5 10:32:38 2024 +0100

    lower-subreg: Fix ROTATE handling [PR114211]

    On the following testcase, we have
    (insn 10 7 11 2 (set (reg/v:TI 106 [ h ])
            (rotate:TI (reg/v:TI 106 [ h ])
                (const_int 64 [0x40]))) "pr114211.c":8:5 1042
{rotl64ti2_doubleword}
         (nil))
    before subreg1 and the pass decides to use
    (reg:DI 127 [ h ]) / (reg:DI 128 [ h+8 ])
    register pair instead of (reg/v:TI 106 [ h ]).
    resolve_operand_for_swap_move_operator implements it by pretending it is
    an assignment from
    (concatn (reg:DI 127 [ h ]) (reg:DI 128 [ h+8 ]))
    to
    (concatn (reg:DI 128 [ h+8 ]) (reg:DI 127 [ h ]))
    The problem is that if the rotate argument is the same as destination or
    if there is even an overlap between the first half of the destination with
    second half of the source we emit incorrect code, because the store to
    (reg:DI 128 [ h+8 ]) overwrites what we need for source of the second
    move.  The following patch detects that case and uses a temporary pseudo
    to hold the original (reg:DI 128 [ h+8 ]) value across the first store.

    2024-03-05  Jakub Jelinek  <jakub@redhat.com>

            PR rtl-optimization/114211
            * lower-subreg.cc (resolve_simple_move): For double-word
            rotates by BITS_PER_WORD if there is overlap between source
            and destination use a temporary.

            * gcc.dg/pr114211.c: New test.

    (cherry picked from commit aed445b0fd0c7ed16124c61e7eb732992426f103)

  parent reply	other threads:[~2024-03-15 23:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-02 19:03 [Bug tree-optimization/114211] New: [13/14 Regression] wrong code with -O -fno-tree-coalesce-vars zsojka at seznam dot cz
2024-03-02 20:59 ` [Bug target/114211] " pinskia at gcc dot gnu.org
2024-03-04 10:08 ` rguenth at gcc dot gnu.org
2024-03-04 15:00 ` [Bug rtl-optimization/114211] " ubizjak at gmail dot com
2024-03-04 18:32 ` [Bug rtl-optimization/114211] [13/14 Regression] wrong code with -O -fno-tree-coalesce-vars since r13-1907 jakub at gcc dot gnu.org
2024-03-04 18:59 ` jakub at gcc dot gnu.org
2024-03-04 19:41 ` jakub at gcc dot gnu.org
2024-03-05  9:33 ` cvs-commit at gcc dot gnu.org
2024-03-05  9:38 ` [Bug rtl-optimization/114211] [13 " jakub at gcc dot gnu.org
2024-03-05 11:35 ` ubizjak at gmail dot com
2024-03-15 23:29 ` cvs-commit at gcc dot gnu.org [this message]
2024-03-18 14:41 ` 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-114211-4-DXG2Pmwzvh@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).