From 4a3d39994e07105fb1bd20ed71d166f6ebb21974 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 31 Dec 2014 19:16:34 +0000 Subject: Clean up powerpc fegetround / __fegetround inlines. The natural fix for some linknamespace test failures, where C90 libm functions call C99 functions, is to make fe* into weak aliases for __fe* and call __fe* from within libm as needed. To do this, the __fe* names need to be available for that purpose - that is, they must not be used for something other than aliases of fe*. On powerpc, however, __fegetround is an inline function in fenv_libc.h, with no corresponding fegetround inline function; fegetround has an equivalent macro expansion in bits/fenvinline.h, but that is disabled if __NO_MATH_INLINES (which is defined for building libm). I see no need for that disabling; it's not even clear that __NO_MATH_INLINES should affect , and the results of fegetround are completely defined so there is no semantic effect of that disabling at all outside glibc. The x86 inline feraiseexcept is conditioned on __USE_EXTERN_INLINES not __NO_MATH_INLINES (but that's an inline function rather than a macro). This patch removes the __NO_MATH_INLINES conditional on that fegetround macro, so resulting in it being expanded inline inside glibc. In turn, this means that direct calls to __fegetround from C99 functions in ldbl-128ibm can be changed to calls to fegetround, so that nofpu fenv_libc.h files don't need to define __fegetround at all and, by changing ldbl-128ibm files to use not , non-e500 nofpu no longer needs an fenv_libc.h file. The other macros in fenvinline.h are left conditional on __NO_MATH_INLINES, although since the only case where this should make a difference is one involving undefined behavior (if the argument to the function is not a valid exception macro). The out-of-line definition for fegetround uses __fegetround (the inline function removed by this patch). So this continues to work, the fenvinline.h header is made to define __fegetround, and then to define fegetround to call __fegetround. Tested for powerpc32 (hard float) that installed stripped shared libraries are unchanged by this patch; also tested that powerpc-nofpu build still works. (This patch does not itself fix any bugs; it simply cleans things up in preparation for separate bug fixes.) * sysdeps/powerpc/bits/fenvinline.h (fegetround): Rename macro to __fegetround and redefine to call __fegetround. Remove condition on [!__NO_MATH_INLINES]. * sysdeps/powerpc/fpu/fenv_libc.h (__fegetround): Remove inline function. * sysdeps/powerpc/nofpu/fenv_libc.h: Remove file. * sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h (__fegetround): Remove macro. * sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: Include instead of . (__llrintl): Call fegetround instead of __fegetround. * sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: Include instead of . * sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: Likewise. (__lrintl): Call fegetround instead of __fegetround. * sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: Include instead of . * sysdeps/ieee754/ldbl-128ibm/s_rintl.c: Likewise. (__rintl): Call fegetround instead of __fegetround. --- sysdeps/ieee754/ldbl-128ibm/s_llrintl.c | 4 ++-- sysdeps/ieee754/ldbl-128ibm/s_llroundl.c | 2 +- sysdeps/ieee754/ldbl-128ibm/s_lrintl.c | 4 ++-- sysdeps/ieee754/ldbl-128ibm/s_lroundl.c | 2 +- sysdeps/ieee754/ldbl-128ibm/s_rintl.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sysdeps/ieee754') diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c index 86996bf..3d9dee1 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c @@ -18,7 +18,7 @@ . */ #include -#include +#include #include #include #include @@ -43,7 +43,7 @@ __llrintl (long double x) #endif ) { - save_round = __fegetround (); + save_round = fegetround (); if (__glibc_unlikely ((xh == -(double) (-__LONG_LONG_MAX__ - 1)))) { diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c index dd84074..98e4253 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c @@ -18,7 +18,7 @@ . */ #include -#include +#include #include #include #include diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c index 2b47c52..895a066 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c @@ -18,7 +18,7 @@ . */ #include -#include +#include #include #include #include @@ -49,7 +49,7 @@ __lrintl (long double x) #endif ) { - save_round = __fegetround (); + save_round = fegetround (); #if __LONG_MAX__ == 2147483647 long long llhi = (long long) xh; diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c index 27b72e2..6c3a314 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c @@ -18,7 +18,7 @@ . */ #include -#include +#include #include #include #include diff --git a/sysdeps/ieee754/ldbl-128ibm/s_rintl.c b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c index 20b75dd..f39e6fd 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_rintl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c @@ -21,7 +21,7 @@ when it's coded in C. */ #include -#include +#include #include #include #include @@ -40,7 +40,7 @@ __rintl (long double x) __builtin_inf ()), 1)) { double orig_xh; - int save_round = __fegetround (); + int save_round = fegetround (); /* Long double arithmetic, including the canonicalisation below, only works in round-to-nearest mode. */ -- cgit v1.1