This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH][AArch64] Add inlines for signbit


> Joseph Myers wrote:
> On Wed, 15 Apr 2015, Wilco Dijkstra wrote:
> 
> > Is there a reason this couldn't be done by default in math.h similar to isgreater (unlike
> > __builtin_isinf et al, GCC implements signbit efficiently and correctly).
> 
> It is, however, not type-generic in GCC
> <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36757>, so you'd still need
> to have a macro expansion checking sizeof.

Yes indeed. However the issue is how to deal with the targets that currently
define inlines. Would it be reasonable just to leave them and add a signbit
expansion for GCC >= 3.0 that directly uses the builtins?
(if we define __signbit(f/l) to be __builtin_signbit(f/l), things may go 
wrong as the various mathinlines don't do an undef first).

Eg. in math.h:

#if defined __USE_ISOC99 && __GNUC_PREREQ(2,97)
# undef signbit
# ifdef __NO_LONG_DOUBLE_MATH
#  define signbit(x) \
     (sizeof (x) == sizeof (float) ? __builtin_signbitf (x) : __builtin_signbit (x))
# else
...

Wilco



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]