This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] middle-end: convert builtin finite -> MINUS/ORD
On Tue, 12 Jun 2007, Kaveh R. GHAZI wrote:
> In libgcc2.c, we have:
>
> /* All of these would be present in a full C99 implementation of <math.h>
> and <complex.h>. Our problem is that only a few systems have such full
> implementations. Further, libgcc_s.so isn't currently linked against
> libm.so, and even for systems that do provide full C99, the extra overhead
> of all programs using libgcc having to link against libm. So avoid it.
> */
>
> #define isnan(x) __builtin_expect ((x) != (x), 0)
> #define isfinite(x) __builtin_expect (!isnan((x) - (x)), 1)
> #define isinf(x) __builtin_expect (!isnan(x) & !isfinite(x), 0)
>
>
> So won't these raise exceptions as well?
Yes, but these are only for C99 complex arithmetic operations and C99
G.5.1#5 says those may raise spurious floating-point exceptions. The
built-in functions provided for use in system headers (__builtin_isX for
use in implementing isX) should not do so.
--
Joseph S. Myers
joseph@codesourcery.com