public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tnfchris at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/106594] [13 Regression] sign-extensions no longer merged into addressing mode
Date: Fri, 12 Aug 2022 12:44:25 +0000	[thread overview]
Message-ID: <bug-106594-4-9hIAxd9Xoc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106594-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> I believe this was some match.pd simplification - why does this affect the
> addressing mode?  Is the IVOPTs result different or does it differ later?

The results in IVOpts don't change aside from the changes mentioned above.  It
looks like this was previously being matched in RTL through combine.

Before we had

(insn 25 24 26 4 (set (reg:DI 118)
        (sign_extend:DI (reg:SI 117))) "/app/example.c":12:35 109
{*extendsidi2_aarch64}
     (expr_list:REG_DEAD (reg:SI 117)
        (nil)))
(insn 26 25 27 4 (set (reg:SI 119 [ constellation_64qam[_6] ])
        (mem/u:SI (plus:DI (mult:DI (reg:DI 118)
                    (const_int 4 [0x4]))
                (reg/f:DI 120)) [1 constellation_64qam[_6]+0 S4 A32]))
"/app/example.c":12:14 52 {*movsi_aarch64}

Trying 25 -> 26:
   25: r118:DI=sign_extend(r117:SI)
      REG_DEAD r117:SI
   26: r119:SI=[r118:DI*0x4+r120:DI]
      REG_DEAD r118:DI
      REG_EQUAL [r118:DI*0x4+`constellation_64qam']
Successfully matched this instruction:
(set (reg:SI 119 [ constellation_64qamD.3590[_6] ])
    (mem/u:SI (plus:DI (mult:DI (sign_extend:DI (reg:SI 117))
                (const_int 4 [0x4]))
            (reg/f:DI 120)) [1 constellation_64qamD.3590[_6]+0 S4 A32]))
allowing combination of insns 25 and 26
original costs 4 + 16 = 20
replacement cost 16
deferring deletion of insn with uid = 25.
modifying insn i3    26: r119:SI=[sign_extend(r117:SI)*0x4+r120:DI]
      REG_DEAD r117:SI
deferring rescan insn with uid = 26.

now, instead we have


(insn 24 23 25 4 (set (reg:DI 116)
        (sign_extend:DI (reg:SI 115))) "/app/example.c":12:35 126
{*extendsidi2_aarch64}
     (expr_list:REG_DEAD (reg:SI 115)
        (nil)))
(insn 25 24 26 4 (set (reg:SI 117 [ constellation_64qam[_5] ])
        (mem/u:SI (plus:DI (mult:DI (reg:DI 116)
                    (const_int 4 [0x4]))
                (reg/f:DI 118)) [1 constellation_64qam[_5]+0 S4 A32]))
"/app/example.c":12:14 52 {*movsi_aarch64}

Trying 24 -> 25:
   24: r116:DI=sign_extend(r115:SI)
      REG_DEAD r115:SI
   25: r117:SI=[r116:DI*0x4+r118:DI]
      REG_DEAD r116:DI
      REG_EQUAL [r116:DI*0x4+`constellation_64qam']
Failed to match this instruction:
(set (reg:SI 117 [ constellation_64qamD.3641[_5] ])
    (mem/u:SI (plus:DI (and:DI (mult:DI (subreg:DI (reg:SI 115) 0)
                    (const_int 4 [0x4]))
                (const_int 252 [0xfc]))
            (reg/f:DI 118)) [1 constellation_64qamD.3641[_5]+0 S4 A32]))


where the sign extend has suddenly turned into an and.

I don't know why though, the two input RTLs look identical to me.

  parent reply	other threads:[~2022-08-12 12:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-12 11:23 [Bug tree-optimization/106594] New: " tnfchris at gcc dot gnu.org
2022-08-12 12:04 ` [Bug tree-optimization/106594] " rguenth at gcc dot gnu.org
2022-08-12 12:44 ` tnfchris at gcc dot gnu.org [this message]
2022-08-12 14:01 ` roger at nextmovesoftware dot com
2022-08-12 14:48 ` tnfchris at gcc dot gnu.org
2022-08-12 17:01 ` roger at nextmovesoftware dot com
2022-08-13 11:34 ` [Bug rtl-optimization/106594] " roger at nextmovesoftware dot com
2022-08-14 12:07 ` tnfchris at gcc dot gnu.org
2022-08-17  1:05 ` hp at gcc dot gnu.org
2022-10-19  7:11 ` rguenth at gcc dot gnu.org
2022-10-19  7:52 ` roger at nextmovesoftware dot com
2023-01-17  4:06 ` roger at nextmovesoftware dot com
2023-02-27 10:00 ` tnfchris at gcc dot gnu.org
2023-02-27 10:03 ` ktkachov at gcc dot gnu.org
2023-03-04 22:26 ` segher at gcc dot gnu.org
2023-03-05  8:06 ` roger at nextmovesoftware dot com
2023-03-05 12:00 ` roger at nextmovesoftware dot com
2023-03-05 15:23 ` segher at gcc dot gnu.org
2023-03-05 19:23 ` tnfchris at gcc dot gnu.org
2023-03-06  7:51 ` rguenth at gcc dot gnu.org
2023-03-06 10:38 ` rsandifo at gcc dot gnu.org
2023-03-06 11:07 ` jakub at gcc dot gnu.org
2023-03-07 11:32 ` roger at nextmovesoftware dot com
2023-03-13  9:30 ` roger at nextmovesoftware dot com
2023-04-17 11:41 ` jakub at gcc dot gnu.org
2023-04-17 12:58 ` jakub at gcc dot gnu.org
2023-04-26  6:56 ` [Bug rtl-optimization/106594] [13/14 " rguenth at gcc dot gnu.org
2023-07-27  9:23 ` rguenth at gcc dot gnu.org
2023-10-30 16:19 ` segher at gcc dot gnu.org
2024-05-21  9:12 ` [Bug rtl-optimization/106594] [13/14/15 " 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-106594-4-9hIAxd9Xoc@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).