public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "user202729 at protonmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/115576] [14/15 regression] Worse code generated for simple struct conversion since r14-2386-gbdf2737cda53a8
Date: Wed, 26 Jun 2024 07:10:54 +0000	[thread overview]
Message-ID: <bug-115576-4-kUFswnprGH@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115576-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from user202729 <user202729 at protonmail dot com> ---
I think this can be resolved by implementing some code in combine.cc to
replace:

(set:TI (reg:TI 101) (zero_extend:TI (...:DI ...)))
(set:DI (reg:DI ...) (subreg:DI (reg:TI 101) 8))

with

(set:TI (reg:TI 101) (zero_extend:TI (...:DI ...)))
(set:DI (reg:DI ...) (const_int 0))

This certainly is always an improvement, because 0 is simpler than extracting
the subregister.

After that, a few other passes of combine rescanning should be able to constant
fold the 0 forward.

Unfortunately, I don't know how to modify combine.cc or some other files to
handle this pattern. Can anyone give a suggestion? (maybe add a
define_peephole2 in common.md ? )

      parent reply	other threads:[~2024-06-26  7:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-21  7:44 [Bug rtl-optimization/115576] New: [14 regression] Worse code generated for simple struct conversion jzwinck at gmail dot com
2024-06-21  7:49 ` [Bug c++/115576] " pinskia at gcc dot gnu.org
2024-06-21  7:52 ` [Bug c++/115576] [14/15 " rguenth at gcc dot gnu.org
2024-06-21 17:44 ` [Bug target/115576] " pinskia at gcc dot gnu.org
2024-06-25  8:17 ` user202729 at protonmail dot com
2024-06-26  7:10 ` user202729 at protonmail dot com [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-115576-4-kUFswnprGH@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).