public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/62054] New: fabsf uses constant pool and andps (x86-64) - use pabsd instead?
@ 2014-08-07 18:55 spatel at rotateright dot com
2014-08-07 19:18 ` [Bug target/62054] " glisse at gcc dot gnu.org
2014-08-07 19:23 ` spatel at rotateright dot com
0 siblings, 2 replies; 3+ messages in thread
From: spatel at rotateright dot com @ 2014-08-07 18:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62054
Bug ID: 62054
Summary: fabsf uses constant pool and andps (x86-64) - use
pabsd instead?
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 fabs.c
#include <math.h>
float foo(float a) {
return fabsf(a);
}
$ gcc49 -O1 fabs.c -S -o -
.text
.globl _foo
_foo:
LFB19:
movss LC0(%rip), %xmm1
andps %xmm1, %xmm0
ret
LFE19:
.literal16
.align 4
LC0:
.long 2147483647
.long 0
.long 0
.long 0
----------------------------------------------------
I think we can save 16-bytes of constant pool data and a load instruction by
generating:
pabsd %xmm0, %xmm0
If this was part of a larger floating point chain of ops and depending on CPU,
there may be some speed penalty for intermingling integer and FP ops on data in
an xmm reg, but the size savings should outweigh that?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/62054] fabsf uses constant pool and andps (x86-64) - use pabsd instead?
2014-08-07 18:55 [Bug target/62054] New: fabsf uses constant pool and andps (x86-64) - use pabsd instead? spatel at rotateright dot com
@ 2014-08-07 19:18 ` glisse at gcc dot gnu.org
2014-08-07 19:23 ` spatel at rotateright dot com
1 sibling, 0 replies; 3+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-08-07 19:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62054
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
Did you try it? It doesn't compute the same thing at all...
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/62054] fabsf uses constant pool and andps (x86-64) - use pabsd instead?
2014-08-07 18:55 [Bug target/62054] New: fabsf uses constant pool and andps (x86-64) - use pabsd instead? spatel at rotateright dot com
2014-08-07 19:18 ` [Bug target/62054] " glisse at gcc dot gnu.org
@ 2014-08-07 19:23 ` spatel at rotateright dot com
1 sibling, 0 replies; 3+ messages in thread
From: spatel at rotateright dot com @ 2014-08-07 19:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62054
--- Comment #3 from Sanjay Patel <spatel at rotateright dot com> ---
I think there's still an optimization possible here regarding the constant pool
data - see bug 62055. Hopefully, I didn't mess that one up. :)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-07 19:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-07 18:55 [Bug target/62054] New: fabsf uses constant pool and andps (x86-64) - use pabsd instead? spatel at rotateright dot com
2014-08-07 19:18 ` [Bug target/62054] " glisse at gcc dot gnu.org
2014-08-07 19:23 ` spatel at rotateright dot com
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).