onent: c
Assignee: unassigned at gcc dot gnu.org
Reporter: fredericopissarra at gmail dot com
Target Milestone: ---
GCC 7.3 and 8.2 (from Ubuntu 18.04 and MinGW-w64) seems to generate wrong code
for sqrtf() -- and sqrt() -- for multiple platforms (tested under x86-64 and
ARM A
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90106
--- Comment #2 from Frederico Lamberti Pissarra ---
(In reply to Andrew Pinski from comment #1)
> It is <0 when sqrt is called and it is due setting errno. Not a bug.
Hu... interesting. But why the inefficient code?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90106
--- Comment #4 from Frederico Lamberti Pissarra ---
My suggestion is to do a simple jmp after .L8 label and test the condition
before sqrtss (or fsqrt, or sqrtsd...):
f:
pxor %xmm2,%xmm2
ucomiss %xmm0,%xmm2
ja .L8
sqrtss %xmm0,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90106
--- Comment #5 from Frederico Lamberti Pissarra ---
CLANG 6 creates a similar code:
f:
xorps %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb .L8 # more intutive test...
sqrtss
ret
.L8:
jmp sqrtf@PLT