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] Replace ABS macros with fabs


> Joseph Myers wrote:
> On Mon, 27 Apr 2015, Wilco Dijkstra wrote:
> 
> > GLIBC contains many uses of ABS macros which GCC is not able to optimize
> > into fabs due to strict IEEE mode being used. On AArch64 GCC fails to
> > use CSEL so several math functions contain many unnecessary and
> > unpredictable branches. This patch removes the various ABS macros and
> > replaces uses with fabs (or in one case abs) which is more efficient on
> > all targets.
> >
> > OK for commit?
> 
> OK given testing with math/ tests on x86_64 (I think the math/ tests
> provide sufficient evidence that nothing was actually relying on the signs
> of results of those macros for zero arguments where use of fabs changes
> it; I've encountered various cases where including <math.h> in dbl-64
> files nonobviously required such an include to be added to
> sysdeps/x86_64/fpu/multiarch files as well because of some sort of include
> ordering issue, so think an x86_64 build test is a good idea for any patch
> like this that adds <math.h> includes to dbl-64 files).

There was indeed an include ordering issue in sysdeps/x86_64/fpu/multiarch/e_log.c
which included math_private.h before math.h, which is an easy fix.

Unfortunately it is not possible to build GLIBC unless you have the latest Linux
kernel installed (there seem to be some odd dependencies on kernel headers and
explicit kernel revision checks), so I can't build/test anything on x64 despite 
using latest GCC/binutils.

So either someone else needs to give it a spin or I'll check in what I've got now.

Wilco



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