[Bug target/56944] New: Better isfinite in some cases?
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Apr 13 09:24:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56944
Bug #: 56944
Summary: Better isfinite in some cases?
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,
for isfinite, gcc typically generates this sequence:
movsd .LC0(%rip), %xmm1
andpd %xmm1, %xmm0
movsd .LC1(%rip), %xmm1
ucomisd %xmm0, %xmm1
setae %al
With -fno-trapping-math, I tried this shorter sequence instead, which should be
valid:
subsd %xmm0, %xmm0
ucomisd %xmm0, %xmm0
setnp %al
Depending on the tests, it seemed to be either the same speed or 15% faster,
whether the argument is normal, infinite or nan. For a denormal argument, it is
15% slower (but then both codes take 100 times as long as the normal case). The
results might also be different on a more recent processor.
I don't know if we want to try and generate this code when -fno-trapping-math
is present.
(related to PR 30652)
More information about the Gcc-bugs
mailing list