public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "palmer at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/108826] Inefficient address generation on POWER and RISC-V
Date: Thu, 16 Feb 2023 18:21:10 +0000	[thread overview]
Message-ID: <bug-108826-4-nqr3FJvyzv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108826-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from palmer at gcc dot gnu.org ---
We've run into a handful of things that look like this before, I'm not sure if
it's a backend issue or something more general.  There's two patterns here that
are frequently bad on RISC-V: "unsigned int" array indices and unsigned int
shifting.  I think they might both boil down to some problems we have tracking
the high parts of registers around ABI boundaries.

FWIW, the smallest bad code I can get is

    unsigned int func(unsigned int ui) {
        return (ui >> 6 & 5) << 2;
    }

    func:
        srliw   a0,a0,6
        slliw   a0,a0,2
        andi    a0,a0,20
        ret

which is particularly awkward as enough is going right to try and move that
andi, but we still end up with the double shifts.

  parent reply	other threads:[~2023-02-16 18:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 17:53 [Bug rtl-optimization/108826] New: " tkoenig at gcc dot gnu.org
2023-02-16 17:56 ` [Bug rtl-optimization/108826] " pinskia at gcc dot gnu.org
2023-02-16 18:00 ` pinskia at gcc dot gnu.org
2023-02-16 18:00 ` pinskia at gcc dot gnu.org
2023-02-16 18:09 ` pinskia at gcc dot gnu.org
2023-02-16 18:21 ` palmer at gcc dot gnu.org [this message]
2023-02-16 18:25 ` pinskia at gcc dot gnu.org
2023-09-28 19:55 ` pinskia 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-108826-4-nqr3FJvyzv@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).