public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pacoarjonilla at yahoo dot es" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/93328] missed optimization opportunity in deserialization code Date: Fri, 20 Mar 2020 02:42:35 +0000 [thread overview] Message-ID: <bug-93328-4-n9rti9KWk9@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-93328-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93328 Paco Arjonilla <pacoarjonilla at yahoo dot es> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pacoarjonilla at yahoo dot es --- Comment #2 from Paco Arjonilla <pacoarjonilla at yahoo dot es> --- Using shifts and bitwise does not optimize either in GCC master, but it does optimize in CLang. Take this code: #include <cstdint> using type = std::uint32_t; type foo(type v){ type r = (v << 24) & 0xFF000000; r += (v << 8) & 0x00FF0000; r += (v >> 8) & 0x0000FF00; r += (v >> 24) & 0x000000FF; return r; } CLang assembler output: ( optimize with -O2 ) mov eax, edi bswap eax ret GCC master assembler output: ( optimize with -O2 ) mov eax, edi mov edx, edi shr eax, 24 sal edx, 24 add edx, eax mov eax, edi shr edi, 8 sal eax, 8 and edi, 65280 and eax, 16711680 add eax, edx add eax, edi ret
next parent reply other threads:[~2020-03-20 2:42 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-93328-4@http.gcc.gnu.org/bugzilla/> 2020-03-20 2:42 ` pacoarjonilla at yahoo dot es [this message] 2020-03-23 5:35 ` pacoarjonilla at yahoo dot es 2020-03-30 15:46 ` boris_oncev at hotmail dot com 2020-03-30 15:48 ` boris_oncev at hotmail 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-93328-4-n9rti9KWk9@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: linkBe 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).