public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/57009] New: Select best typed instruction for scalar bitwise operations Date: Fri, 19 Apr 2013 19:46:00 -0000 [thread overview] Message-ID: <bug-57009-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57009 Bug #: 57009 Summary: Select best typed instruction for scalar bitwise operations Classification: Unclassified Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: glisse@gcc.gnu.org Target: x86_64-linux-gnu Hello, I purposedly took almost the same title as PR 54716, because this is the same issue, but for scalars. Consider this code: union A { double d; unsigned long long i; }; bool f(double a, double b, double c){ A x, y, z; x.d = a * a; y.d = b * b; z.i = x.i & y.i; return z.d < c; } which compiles to: mulsd %xmm0, %xmm0 mulsd %xmm1, %xmm1 movq %xmm0, %rax movq %xmm1, %rdx andq %rdx, %rax movq %rax, %xmm0 ucomisd %xmm0, %xmm2 seta %al when using andpd would save 3 movq. Note that for vectors, we get nicer code thanks to Jakub's patch: mulpd %xmm1, %xmm1 mulpd %xmm0, %xmm0 andpd %xmm1, %xmm0 cmpltpd %xmm2, %xmm0 It would be nice to extend that code to scalars (including the case where one of the arguments is a constant). I hit this while experimenting for PR 56944.
next reply other threads:[~2013-04-19 19:46 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-04-19 19:46 glisse at gcc dot gnu.org [this message] 2021-12-06 23:52 ` [Bug target/57009] " 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-57009-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).