public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "segher at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/93802] gcc generates a rlwinm/or pair instead of a single rlwimi (powerpc)
Date: Thu, 30 Apr 2020 21:36:16 +0000	[thread overview]
Message-ID: <bug-93802-4-EXWQt7Xk68@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-93802-4@http.gcc.gnu.org/bugzilla/>

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

Segher Boessenkool <segher at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |segher at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-04-30

--- Comment #1 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Confirmed.  Needs -m32.

There are complications from parameter passing.  Making x a global doesn't
improve things: the zero-extend becomes part of the memory access, which
prevents us from optimising it well later.

Adding something like
  x *= 42;
as extra first line doesn't work, either:
Failed to match this instruction:
(set (reg:SI 124)
    (ior:SI (and:SI (reg:SI 123)
            (const_int 65534 [0xfffe]))
        (ashift:SI (reg:SI 123)
            (const_int 16 [0x10]))))

(Note combine has figured out the low bit is always zero,  How helpful ;-) )

But with
  x *= 421;
we get
f:
        mulli 3,3,421    # 6    [c=8 l=4]  mulsi3/1
        rlwimi 3,3,16,0,31-16    # 14   [c=4 l=4]  *rotlsi3_insert_3
        blr              # 22   [c=4 l=4]  simple_return

which is exactly what we wanted.


Both the original case and the "even" case should work better if we had
better known bits tracking (the "even" one could maybe be made to work
already, even, in target code).

       reply	other threads:[~2020-04-30 21:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-93802-4@http.gcc.gnu.org/bugzilla/>
2020-04-30 21:36 ` segher at gcc dot gnu.org [this message]
2024-03-06  2:53 ` guihaoc 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-93802-4-EXWQt7Xk68@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).