[libgfortran, patch] C99 floating-point macros: isinf, isnan, ...
FX
fxcoudert@gmail.com
Thu Sep 9 10:31:00 GMT 2010
Dear all,
The attached patch removes the configure checks and hackish libgfortran.h definitions for C99 floating-point classification macros: isinf, isnan, isfinite, isnormal and signbit. Instead, I define all of them using the GCC built-ins (__builtin_isinf, etc.).
In addition to smaller code and easier maintainance, this has the advantage that the GCC built-ins are truly type-generic, while the system headers do not handle non-C floating-point types such as __float128. As a consequence, this fixes the __float128 issue observed by Jerry at [2].
According to the thread at [1], this is safe and has been use in the C++ standard library since GCC 4.4.0 without problem. I have checked on i386 and x86_64 that it leads to similar or superior code being generated (sometimes avoiding a function call, depending on OS headers and optimization flags).
Bootstrapped and regtested on x86_64-linux, OK to commit?
FX
[1] http://gcc.gnu.org/ml/gcc/2010-09/msg00106.html
[2] http://gcc.gnu.org/ml/fortran/2010-09/msg00147.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lib_builtins.ChangeLog
Type: application/octet-stream
Size: 563 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100909/8b4e6e9f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lib_builtins.diff
Type: application/octet-stream
Size: 7466 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100909/8b4e6e9f/attachment-0001.obj>
More information about the Fortran
mailing list