This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fold isnan to UNORDERED_EXPR
- From: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Paolo Bonzini <paolo dot bonzini at polimi dot it>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 28 Jun 2004 15:19:59 +0000 (UTC)
- Subject: Re: [PATCH] Fold isnan to UNORDERED_EXPR
- References: <Pine.LNX.4.44.0406280759340.3981-100000@www.eyesopen.com>
On Mon, 28 Jun 2004, Roger Sayle wrote:
> I think its best to define these builtins using DEF_C99_BUILTIN as regular
> functions, not just as a GCC extension called __builtin_isnan that uses
> varargs. This follows the existing BSD 4.3 definitions of these
> functions, having an isnanf for floats, and an isnanl for long doubles.
> I'd like to think of C99's isgreater and friends as unusual exceptions
> where GCC has to use varargs to emulate a macro. If ever we can avoid
> this idiom, we should.
While formally is* is a C90 reserved namespace, it's still the case that
as the compiler we don't tend to impinge on those namespaces other than
_[_A-Z]. As there are no such functions in C99, I think the best approach
is just to provide __builtin_isnan, which glibc can then use to provide
the isnan macro, just as it uses the other varargs built-in functions.
Likewise __builtin_isfinite, __builtin_isinf, __builtin_isnormal,
__builtin_signbit, for consistency, if these are implemented as built-in
functions that it makes sense for GCC always to expand inline (this won't
work if some cases better expand to out-of-line calls to libm); this saves
messy macros in the headers.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)