public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "spatel at rotateright dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/62055] New: missed optimization: recognize fnabs (FP negative absolute value) (x86-64) Date: Thu, 07 Aug 2014 19:17:00 -0000 [thread overview] Message-ID: <bug-62055-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62055 Bug ID: 62055 Summary: missed optimization: recognize fnabs (FP negative absolute value) (x86-64) Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: spatel at rotateright dot com $ cat fnabs.c #include <math.h> float foo(float a) { return -fabsf(a); } $ gcc49 -O1 fnabs.c -S -o - .text .globl _foo _foo: LFB19: movss LC0(%rip), %xmm1 andps %xmm1, %xmm0 movss LC1(%rip), %xmm1 xorps %xmm1, %xmm0 ret LFE19: .literal16 .align 4 LC0: .long 2147483647 .long 0 .long 0 .long 0 .align 4 LC1: .long 2147483648 .long 0 .long 0 .long 0 --------------------------------------------------- That's a lot of constant pool data and instructions to turn on a single bit. I think there are 2 steps to improving this. First, recognize that -(fabs(a)) can be transformed into an 'or' op: movss LC0(%rip), %xmm1 orps %xmm1, %xmm0 LC0: .long 2147483648 Second, I don't think we need the extra 0 longs here; movss only loads 4 bytes. This may require understanding that the upper vector elements for the 'orps' are don't cares?
next reply other threads:[~2014-08-07 19:17 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-08-07 19:17 spatel at rotateright dot com [this message] 2014-08-08 8:04 ` [Bug target/62055] " rguenth 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-62055-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).