public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gabravier at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/94837] New: Failure to optimize out spurious movbe into bswap Date: Wed, 29 Apr 2020 01:11:54 +0000 [thread overview] Message-ID: <bug-94837-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94837 Bug ID: 94837 Summary: Failure to optimize out spurious movbe into bswap Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- float swapFloat(float x) { union { float f; uint32_t u32; } swapper; swapper.f = x; swapper.u32 = __builtin_bswap32(swapper.u32); return swapper.f; } For this function, on x86-64 with `-O3 -mmovbe`, LLVM outputs this : swapFloat(float): # @swapFloat(float) movd eax, xmm0 bswap eax movd xmm0, eax ret GCC instead outputs this : swapFloat(float): movd DWORD PTR [rsp-4], xmm0 movbe eax, DWORD PTR [rsp-4] movd xmm0, eax ret It seems highly likely to me that a spill to memory is much slower than a direct `bswap`.
next reply other threads:[~2020-04-29 1:11 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-29 1:11 gabravier at gmail dot com [this message] 2020-04-29 1:48 ` [Bug rtl-optimization/94837] " pinskia at gcc dot gnu.org 2020-04-29 8:26 ` gabravier at gmail dot com 2020-04-29 8:46 ` gabravier at gmail dot com 2020-04-29 9:49 ` ubizjak at gmail dot com 2020-04-29 9:54 ` ubizjak at gmail 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-94837-4@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).