This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: [PATCH][AArch64] Add inlines for signbit
- From: "Wilco Dijkstra" <wdijkstr at arm dot com>
- To: "'Joseph Myers'" <joseph at codesourcery dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Mon, 27 Apr 2015 11:47:09 +0100
- Subject: RE: [PATCH][AArch64] Add inlines for signbit
- Authentication-results: sourceware.org; auth=none
- References: <000001d07775$77c71880$67554980$ at com> <alpine dot DEB dot 2 dot 10 dot 1504241724020 dot 30193 at digraph dot polyomino dot org dot uk>
> 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