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] Cleanup __ieee754_sqrt(f)


Joseph Myers wrote:
> On Fri, 15 Sep 2017, Wilco Dijkstra wrote:

> > This patch cleans up the many uses of  __ieee754_sqrt(f) in GLIBC.
> > We can compile all of the math functions with -fno-math-errno which 
>
> I don't think that's appropriate for compiling testcases that test errno 
> setting (even if in fact the use of -fno-builtin means it works for them).  
> That is, unlike -frounding-math which is OK globally, -fno-math-errno 
> should be handled more like the other options that are used for building 
> glibc itself but not tests.

So how can I differentiate between testcases and math functions in the
makefile?

I tried doing "CFLAGS-test-.o += -fmath-errno" but it doesn't always trigger
(there are also tests that don't have the obvious prefix).

So currently I get >99% of math tests building OK, but not all. For example
matherr.c gets built with -fno-math-errno and fails.

> Did you test with build-many-glibcs.py?  I'd expect configurations that 
> don't inline sqrt to get localplt failures from this because of 
> __builtin_sqrt calls resulting in sqrt references (and, in such cases, it 
> would seem optimal for internal calls within glibc to continue to go to 
> __ieee754_sqrt not to the errno-setting wrapper, which might require 
> declaring sqrt with asm ("__ieee754_sqrt") while maybe doing something to 
> avoid this causing problems for the definitions of the wrappers 
> themselves.

I've now added redirect declarations to include/math.h. This is a bit hacky of
course and not strictly needed for correctness, but it preserves existing
behaviour. These redirects can be removed when we merge the wrappers
into the math implementations.

> I'd expect __ieee754_sqrtl to be handled the same way.  __builtin_sqrtf128 
> doesn't exist (except for powerpc64le in GCC 8) so I wouldn't expect using 
> __builtin_sqrt in M_SQRT to work without appropriate overrides for 
> float128.

I'll add those too then. While looking at this, there are also sqrt inlines in a
few math_private.h guarded by !__GNUC_PREREQ (3, 2). I couldn't find
a mention in any docs, what is the current minimum GCC version for using
GLIBC headers? It looks we could get rid of quite a lot of redundant math cruft.

Wilco
    

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