public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "wilson at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/95632] Redundant zero extension
Date: Tue, 16 Jun 2020 00:01:44 +0000	[thread overview]
Message-ID: <bug-95632-4-gAy2OuNz2F@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95632-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Jim Wilson <wilson at gcc dot gnu.org> ---
It isn't possible to have patterns that match only in combine.  If we add a
pattern to accept (xor (reg) (large constant)) then it could match in any
optimization pass, and could prevent us from optimizing away redundant lui
instructions.

There is a representation issue here with constants.  If we split them early,
then optimizing redundant lui is easy.  If we split them late, then optimizing
redundant lui is hard.  There are also other optimizations that may be easy or
hard depending on whether constants are split early or late.  Currently, we
always split constants early, and changing that will have a major impact on the
code optimization, which may be good or bad, but more likely will be good for
some programs and bad for others.  I'd rather not change this as it will be a
major project to deal with the problems caused by the change.

Hence my suggestion at RTL generation time to split xor with constants
differently.  I have a proof of concept patch for that, but it needs a lot of
cleanup to be useful, and a lot of testing to verify that it improves code more
often than it harms code.

As for ree, splitters after register allocation traditionally check
reload_completed which is a global variable set near the end of the last
register allocation pass.  The split2 pass happens between reload and ree. 
Maybe moving ree before split2 would help RISC-V, but might hurt other targets.
 Or might help for some programs and hurt for others.

  parent reply	other threads:[~2020-06-16  0:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11  4:06 [Bug target/95632] New: " bina2374 at gmail dot com
2020-06-12  4:25 ` [Bug target/95632] " wilson at gcc dot gnu.org
2020-06-15  9:49 ` bina2374 at gmail dot com
2020-06-16  0:01 ` wilson at gcc dot gnu.org [this message]
2020-06-16  0:02 ` wilson at gcc dot gnu.org
2020-06-16  7:15 ` ubizjak at gmail dot com
2020-06-16  7:21 ` ubizjak at gmail dot com
2021-05-30 22:26 ` pinskia at gcc dot gnu.org
2022-12-27 23:31 ` cvs-commit at gcc dot gnu.org
2022-12-27 23:32 ` law 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-95632-4-gAy2OuNz2F@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).