This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [PATCH] Implement __abs?f2 functions in soft-fp
- From: Roger Sayle <roger at eyesopen dot com>
- To: Roland McGrath <roland at redhat dot com>
- Cc: <libc-alpha at sources dot redhat dot com>
- Date: Fri, 1 Nov 2002 19:11:22 -0700 (MST)
- Subject: Re: [PATCH] Implement __abs?f2 functions in soft-fp
Hi Roland,
> If you are going to make gcc emit new calls, why not just have it call
> fabs/fabsf/fabsl directly? Those are ISO C99 symbols, are they not?
Very true. However, without support for __abs?f2 in soft-fp, glibc's
implementation of fabs/fabsf/fabsl is probably the same inefficient
compare against zero, and conditional negation sequence that GCC emits
inline.
Once there's an efficient __abs?f2, it can be used both by the library
fabs routines, and also inlined by the compiler. This also avoids the
potential problem of GCC converting "(x < 0)? -x : x" into a call to
"fabs" with -ffree-standing, i.e. without an ISO C library available.
I'll will freely admit that GCC is lacking in that it currently
doesn't have a cost model to allow it to realize that calling "fabs"
could be just as cheap (or perhaps cheaper) than using cmp/bnz/neg
when the latter would involve a libcall anyway. My __abs?f2 patch
just works around this failing to both gcc's and glibc's benefit.
Roger
--