public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/91690] Slow IEEE intrinsics
       [not found] <bug-91690-4@http.gcc.gnu.org/bugzilla/>
@ 2021-12-29 14:48 ` fxcoudert at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: fxcoudert at gcc dot gnu.org @ 2021-12-29 14:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91690

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu.org

--- Comment #8 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
I think things are a little more complicated that they appear. The function
IEEE_IS_NAN, in itself, is not the problem: it is not slow, and does not
store/restore the floating-point state. If you take the demo program, and
replace the call to the contained function IS_NAN_IEEE directly by the
IEEE_IS_NAN function, you will actually see that it is faster (50% faster) than
the bit-checking function.

The problem is in the contained function IS_NAN_IEEE. By my reading of the
Fortran standard, that function is required to save its floating-point state on
entry, and restore it on exit. This is regardless of what happens inside the
function, and this is what is slowing things done.

Of course, we can still consider this a "missed optimisation": the compiler
could in theory determine that absolutely no floating-point operation is being
done, and optimise away the save/restore calls. But it is a tricky thing to do,
and would have no value for "real" functions, that actually perform
floating-point operations.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-29 14:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-91690-4@http.gcc.gnu.org/bugzilla/>
2021-12-29 14:48 ` [Bug fortran/91690] Slow IEEE intrinsics fxcoudert at gcc dot gnu.org

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).