[Bug target/62054] New: fabsf uses constant pool and andps (x86-64) - use pabsd instead?
spatel at rotateright dot com
gcc-bugzilla@gcc.gnu.org
Thu Aug 7 18:55:00 GMT 2014
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?
More information about the Gcc-bugs
mailing list