I have a questions regarding GCC C99 built-ins: isfinite, isnan, isnormal, 
isinf and signbit.

Currently, libgfortran (which is compiled with -std=c99) has a few configure 
tests and target-specific hacks to provide reasonable versions of the macros 
above: using the ones in <math.h> headers if they are present and seem to work, 
relying on fpclassify for some targets that have it, and otherwise doing stuff 
like:

#define isfinite(x) ((x) - (x) == 0)
#define isnan(x) ((x) != (x))

I'm tempted to remove all this, and have us use 
__builtin_{isfinite,isnormal,isinf,signbit}. In addition, the GCC built-ins are 
really type-generic, while the macros from the system headers don't handle 
unusual fp types such as __float128.

Thus, my question is: Is there any risk in doing so? Are there targets where 
the GCC built-ins perform significantly worse (e.g. being nonfunctional, or 
incapable of handling some of the fp modes) than those from the system headers? 
I don't expect so, but I'd be glad to have someone familiar with the middle-end 
confirm this for me.

Thanks,
FX

Reply via email to