This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: [PATCH] Replace ABS macros with fabs
- From: "Wilco Dijkstra" <wdijkstr at arm dot com>
- To: "'Joseph Myers'" <joseph at codesourcery dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Wed, 29 Apr 2015 14:00:33 +0100
- Subject: RE: [PATCH] Replace ABS macros with fabs
- Authentication-results: sourceware.org; auth=none
- References: <000301d080d5$ba014860$2e03d920$ at com> <alpine dot DEB dot 2 dot 10 dot 1504282159160 dot 10303 at digraph dot polyomino dot org dot uk>
> 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