public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ktkachov at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/99520] Failure to detect bswap pattern
Date: Wed, 10 Mar 2021 16:19:44 +0000	[thread overview]
Message-ID: <bug-99520-4-wbfKA5WN23@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99520-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from ktkachov at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #3)
> Consider e.g.
> unsigned foo (unsigned x)
> {
>   return (x<<24) + ((x<<8)&0xff0000) + ((x>>8)&0xff00) + (x>>24) +
> (((x&0xff00)<<16)>>8);
> }
> as example that should not be optimized into __builtin_bswap32 (but should
> be with | instead of +).

interesting. That said, clang does do a better job than GCC on that too:
foo(unsigned int):                                // @foo(unsigned int)
        lsl     w9, w0, #8
        rev     w8, w0
        and     w9, w9, #0xff0000
        add     w0, w9, w8
        ret

  parent reply	other threads:[~2021-03-10 16:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 15:54 [Bug middle-end/99520] New: " ktkachov at gcc dot gnu.org
2021-03-10 16:03 ` [Bug middle-end/99520] " jakub at gcc dot gnu.org
2021-03-10 16:13 ` jakub at gcc dot gnu.org
2021-03-10 16:17 ` jakub at gcc dot gnu.org
2021-03-10 16:19 ` ktkachov at gcc dot gnu.org [this message]
2021-03-10 16:28 ` jakub at gcc dot gnu.org
2021-03-10 17:43 ` ktkachov at gcc dot gnu.org
2021-03-11  8:10 ` [Bug tree-optimization/99520] " rguenth at gcc dot gnu.org
2021-11-21 14:46 ` pinskia at gcc dot gnu.org
2021-11-25 20:28 ` roger at nextmovesoftware dot com

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-99520-4-wbfKA5WN23@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).