aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/tile/math_private.h
AgeCommit message (Collapse)AuthorFilesLines
2018-02-01Remove some math_private.h libc_feholdexcept_setround overrides.Joseph Myers1-24/+0
math_private.h headers for configurations lacking support for floating-point exceptions and rounding modes define libc_feholdexcept_setround to override the default version with one that discards its rounding mode argument. Unlike other such libc_fe* macros that I removed, this one is actually used for such configurations (in dbl-64/e_sqrt.c). However, this does not make the macro required. It's only used for such configurations with FE_TONEAREST as the rounding mode (anything needing another mode should not be used when that mode is unavailable), and the default definition just calls __feholdexcept and __fesetround. Since we now have suitable inline do-nothing definitions of __feholdexcept and __fesetround for the cases of no exceptions and rounding modes, we can just rely on those inlines to achieve the same optimization as this macro definition. Thus, this patch removes those macro definitions (and the math_private.h headers containing them, when no longer needed after that removal). Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/m68k/coldfire/fpu/math_private.h: Move to .... * sysdeps/m68k/coldfire/math_private.h: ... here. * sysdeps/m68k/coldfire/nofpu/math_private.h: Remove file. * sysdeps/tile/math_private.h: Likewise. * sysdeps/microblaze/math_private.h (libc_feholdexcept_setround): Remove macro. * sysdeps/nios2/math_private.h (libc_feholdexcept_setround): Likewise.
2018-02-01Remove some math_private.h libc_fe* overrides.Joseph Myers1-3/+0
math_private.h headers for configurations lacking support for floating-point exceptions and rounding modes define various libc_fe* macros to override the default versions with ones that discard any exception or rounding mode arguments. Three of the four macros defined in these headers are no longer needed there: those macros are only used in fma implementations that are not used for such configurations, now all those configurations properly use soft-fp fma implementations instead. (Effectively, those macros were a workaround to allow glibc to build in the absence of a proper fma implementation for this case - now there is such an implementation, there is no need to support building the wrong implementation for those configurations.) Thus, this patch removes the unnecessary macros. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/m68k/coldfire/nofpu/math_private.h (libc_fesetround): Remove macro. (libc_fetestexcept): Likewise. (libc_feupdateenv_test): Likewise. * sysdeps/microblaze/math_private.h (libc_fesetround): Likewise. (libc_fetestexcept): Likewise. (libc_feupdateenv_test): Likewise. * sysdeps/nios2/math_private.h (libc_fesetround): Likewise. (libc_fetestexcept): Likewise. (libc_feupdateenv_test): Likewise. * sysdeps/tile/math_private.h (libc_fesetround): Likewise. (libc_fetestexcept): Likewise. (libc_feupdateenv_test): Likewise.
2018-02-01Move fenv.h override inline functions to generic math_private.h.Joseph Myers1-14/+1
The tile version of math_private.h defines some inline functions for fenv.h functions, to optimize away internal calls to these functions that do nothing given no support for floating-point exceptions and rounding modes. (Some functions may have error cases for invalid arguments, but those aren't applicable to the internal calls from within glibc.) Other configurations lacking support for exceptions and rounding modes lack such inline functions. This patch moves them to the generic math_private.h, appropriately conditioned, so that all such configurations can benefit from the. include/fenv.h is made to check whether there are any non-default rounding modes; that needs to be done there, rather than later, because get-rounding-mode.h defines values for otherwise unsupported FE_* rounding modes. It also gives an error for FE_TONEAREST undefined, a case that already did not work for building the glibc testsuite; the convention has by now been established that all architectures need to provide a version of bits/fenv.h that at least defines FE_TONEAREST. Tested with build-many-glibcs.py. As expected, installed stripped shared libraries are unchanged for tile and for architectures supporting exceptions and rounding modes, but changed for non-tile architectures not supporting exceptions and rounding modes that previously lacked this optimization (e.g. Nios II libm.so is about 1kB smaller). The optimization is not in fact complete (does not cover feholdexcept / __feholdexcept, so a few calls to those remain unnecessarily within libm even after this patch), but that can be dealt with separately. * include/fenv.h [!_ISOMAC && !FE_TONEAREST]: Give #error. [!_ISOMAC] (FE_HAVE_ROUNDING_MODES): New macro. * sysdeps/generic/math_private.h [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (fegetenv): New inline function. [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (__fegetenv): Likewise. [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (fesetenv): Likewise. [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (__fesetenv): Likewise. [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (feupdateenv): Likewise. [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (__feupdateenv): Likewise. [!FE_HAVE_ROUNDING_MODES] (fegetround): Likewise. [!FE_HAVE_ROUNDING_MODES] (__fegetround): Likewise. [!FE_HAVE_ROUNDING_MODES] (fesetround): Likewise. [!FE_HAVE_ROUNDING_MODES] (__fesetround): Likewise. * sysdeps/tile/math_private.h (fegetenv): Remove inline function. (__fegetenv): Likewise. (fesetenv): Likewise. (__fesetenv): Likewise. (feupdateenv): Likewise. (__feupdateenv): Likewise. (fegetround): Likewise. (__fegetround): Likewise. (fesetround): Likewise. (__fesetround): Likewise.
2018-02-01Move some fenv.h override macros to generic math_private.h.Joseph Myers1-4/+0
Various configurations lacking support for floating-point exceptions and rounding modes have a math_private.h that overrides certain functions and macros, internal and external, to avoid references to FE_* constants that are undefined in those configurations. For example, there are unconditional feraiseexcept (FE_INVALID) calls in generic libm code, and these macro definitions duly define feraiseexcept to ignore its argument to avoid an error from FE_INVALID being undefined. In fact it is easy to tell in an architecture-independent way whether this is needed, by testing whether FE_ALL_EXCEPT == 0. Thus, this patch puts such a test, and feraiseexcept and __feraiseexcept macros, in the generic math_private.h, so reducing the duplication between architecture versions of this header. The feclearexcept macro present in several versions of this header, and fetestexcept in the tile version, are not needed; they would have been needed before there were proper soft-fp fma implementations (when generic versions, that depend on FE_TOWARDZERO and FE_INEXACT, were being used for configurations not supporting those features), but aren't needed any more, and so are removed. The tile version of this header has several inline functions for fenv.h functions to optimize calls to them away in such configurations where they do nothing useful, and all these header versions also have definitions of some of the libc_fe* internal macros. I intend to make those generic in subsequent patches. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. * sysdeps/generic/math_private.h [FE_ALL_EXCEPT == 0] (feraiseexcept): New macro. [FE_ALL_EXCEPT == 0] (__feraiseexcept): Likewise. * sysdeps/m68k/coldfire/nofpu/math_private.h (feraiseexcept): Remove macro. (__feraiseexcept): Likewise. (feclearexcept): Likewise. * sysdeps/microblaze/math_private.h (feraiseexcept): Likewise. (__feraiseexcept): Likewise. (feclearexcept): Likewise. * sysdeps/nios2/math_private.h (feraiseexcept): Likewise. (__feraiseexcept): Likewise. (feclearexcept): Likewise. * sysdeps/tile/math_private.h (feraiseexcept): Likewise. (__feraiseexcept): Likewise. (feclearexcept): Likewise. (fetestexcept): Likewise.
2015-11-20Fix math_private.h multiple include guards.Joseph Myers1-1/+2
Various math_private.h headers are guarded by "#ifndef _MATH_PRIVATE_H", but never define the macro. Nothing else defines the macro either (the generic math_private.h that they include defines a different macro, _MATH_PRIVATE_H_), so those guards are ineffective. With the recent inclusion of s_sin.c in s_sincos.c, this breaks the build for MIPS, since the build of s_sincos.c ends up including <math_private.h> twice and the MIPS version defines inline functions such as libc_feholdexcept_mips, without a separate fenv_private.h header with its own guards such as some architectures have. This patch fixes all the problem headers to use architecture-specific guard macro names, and to define those macros in the headers they guard, just as some architectures already do. Tested for x86 (testsuite, and that installed shared libraries are unchanged by the patch), and for mips64 (that it fixes the build). * sysdeps/arm/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!ARM_MATH_PRIVATE_H]. [!ARM_MATH_PRIVATE_H] (ARM_MATH_PRIVATE_H): Define macro. * sysdeps/hppa/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!HPPA_MATH_PRIVATE_H]. [!HPPA_MATH_PRIVATE_H] (HPPA_MATH_PRIVATE_H): Define macro. * sysdeps/i386/fpu/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!I386_MATH_PRIVATE_H]. [!I386_MATH_PRIVATE_H] (I386_MATH_PRIVATE_H): Define macro. * sysdeps/m68k/m680x0/fpu/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!M68K_MATH_PRIVATE_H]. [!M68K_MATH_PRIVATE_H] (M68K_MATH_PRIVATE_H): Define macro. * sysdeps/microblaze/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!MICROBLAZE_MATH_PRIVATE_H]. [!MICROBLAZE_MATH_PRIVATE_H] (MICROBLAZE_MATH_PRIVATE_H): Define macro. * sysdeps/mips/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!MIPS_MATH_PRIVATE_H]. [!MIPS_MATH_PRIVATE_H] (MIPS_MATH_PRIVATE_H): Define macro. * sysdeps/nios2/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!NIO2_MATH_PRIVATE_H]. [!NIO2_MATH_PRIVATE_H] (NIO2_MATH_PRIVATE_H): Define macro. * sysdeps/tile/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!TILE_MATH_PRIVATE_H]. [!TILE_MATH_PRIVATE_H] (TILE_MATH_PRIVATE_H): Define macro.
2015-01-07Fix libm feupdateenv namespace (bug 17748).Joseph Myers1-0/+1
Concluding the fixes for C90 libm functions calling C99 fe* functions, this patch fixes the case of feupdateenv by making it a weak alias for __feupdateenv and making the affected code call __feupdateenv. Tested for x86_64 (testsuite, and that installed stripped shared libraries are unchanged by the patch). Also tested for ARM (soft-float) that the math.h linknamespace tests now pass. [BZ #17748] * include/fenv.h (__feupdateenv): Use libm_hidden_proto. * math/feupdateenv.c (__feupdateenv): Use libm_hidden_def. * sysdeps/aarch64/fpu/feupdateenv.c (feupdateenv): Rename to __feupdateenv and define as weak alias of __feupdateenv. Use libm_hidden_weak. * sysdeps/alpha/fpu/feupdateenv.c (__feupdateenv): Use libm_hidden_def. * sysdeps/arm/feupdateenv.c (feupdateenv): Rename to __feupdateenv and define as weak alias of __feupdateenv. Use libm_hidden_weak. * sysdeps/hppa/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/i386/fpu/feupdateenv.c (__feupdateenv): Use libm_hidden_def. * sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Rename to __feupdateenv and define as weak alias of __feupdateenv. Use libm_hidden_weak. * sysdeps/m68k/fpu/feupdateenv.c (__feupdateenv): Use libm_hidden_def. * sysdeps/mips/fpu/feupdateenv.c (feupdateenv): Rename to __feupdateenv and define as weak alias of __feupdateenv. Use libm_hidden_weak. * sysdeps/powerpc/fpu/feupdateenv.c (__feupdateenv): Use libm_hidden_def. * sysdeps/powerpc/nofpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Rename to __feupdateenv and define as weak alias of __feupdateenv. Use libm_hidden_weak. * sysdeps/sh/sh4/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/sparc/fpu/feupdateenv.c (__feupdateenv): Use libm_hidden_def. * sysdeps/tile/math_private.h (__feupdateenv): New inline function. * sysdeps/x86_64/fpu/feupdateenv.c (__feupdateenv): Use libm_hidden_def. * sysdeps/generic/math_private.h (default_libc_feupdateenv): Call __feupdateenv instead of feupdateenv. (default_libc_feupdateenv_test): Likewise. (libc_feresetround_ctx): Likewise.
2015-01-07Fix libm fesetround namespace (bug 17748).Joseph Myers1-0/+1
Continuing the fixes for C90 libm functions calling C99 fe* functions, this patch fixes the case of fesetround by making it a weak alias of __fesetround and making the affected code call __fesetround. An existing __fesetround function in fenv_libc.h for powerpc is renamed to __fesetround_inline. Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). Also tested for ARM (soft-float) that fesetround failures disappear from the linknamespace test results (feupdateenv remains to be addressed to complete fixing bug 17748). [BZ #17748] * include/fenv.h (__fesetround): Declare. Use libm_hidden_proto. * math/fesetround.c (fesetround): Rename to __fesetround and define as weak alias of __fesetround. Use libm_hidden_weak. * sysdeps/aarch64/fpu/fesetround.c (fesetround): Likewise. * sysdeps/alpha/fpu/fesetround.c (fesetround): Likewise. * sysdeps/arm/fesetround.c (fesetround): Likewise. * sysdeps/hppa/fpu/fesetround.c (fesetround): Likewise. * sysdeps/i386/fpu/fesetround.c (fesetround): Likewise. * sysdeps/ia64/fpu/fesetround.c (fesetround): Likewise. * sysdeps/m68k/fpu/fesetround.c (fesetround): Likewise. * sysdeps/mips/fpu/fesetround.c (fesetround): Likewise. * sysdeps/powerpc/fpu/fenv_libc.h (__fesetround): Rename to __fesetround_inline. * sysdeps/powerpc/fpu/fenv_private.h (libc_fesetround_ppc): Call __fesetround_inline instead of __fesetround. * sysdeps/powerpc/fpu/fesetround.c (fesetround): Rename to __fesetround and define as weak alias of __fesetround. Use libm_hidden_weak. Call __fesetround_inline instead of __fesetround. * sysdeps/powerpc/nofpu/fesetround.c (fesetround): Rename to __fesetround and define as weak alias of __fesetround. Use libm_hidden_weak. * sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c (fesetround): Likewise. * sysdeps/s390/fpu/fesetround.c (fesetround): Likewise. * sysdeps/sh/sh4/fpu/fesetround.c (fesetround): Likewise. * sysdeps/sparc/fpu/fesetround.c (fesetround): Likewise. * sysdeps/tile/math_private.h (__fesetround): New inline function. * sysdeps/x86_64/fpu/fesetround.c (fesetround): Rename to __fesetround and define as weak alias of __fesetround. Use libm_hidden_weak. * sysdeps/generic/math_private.h (default_libc_fesetround): Call __fesetround instead of fesetround. (default_libc_feholdexcept_setround): Likewise. (libc_feholdsetround_ctx): Likewise. (libc_feholdsetround_noex_ctx): Likewise.
2015-01-06Fix libm fesetenv namespace (bug 17748).Joseph Myers1-0/+1
Continuing the fixes for C90 libm functions calling C99 fe* functions, this patch fixes the case of fesetenv by making it a weak alias of __fesetenv and making the affected code (including various copies of feupdateenv which also gets called from C90 functions) call __fesetenv. Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). Also tested for ARM (soft-float) that fesetenv failures disappear from the linknamespace test results (fsetround and feupdateenv remain to be addressed to complete fixing bug 17748). [BZ #17748] * include/fenv.h (__fesetenv): Use libm_hidden_proto. * math/fesetenv.c (__fesetenv): Use libm_hidden_def. * sysdeps/aarch64/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and define as weak alias of __fesetenv. Use libm_hidden_weak. * sysdeps/alpha/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def. * sysdeps/arm/fesetenv.c (fesetenv): Rename to __fesetenv and define as weak alias of __fesetenv. Use libm_hidden_weak. * sysdeps/hppa/fpu/fesetenv.c (fesetenv): Likewise. * sysdeps/i386/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def. * sysdeps/ia64/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and define as weak alias of __fesetenv. Use libm_hidden_weak. * sysdeps/m68k/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def. * sysdeps/mips/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and define as weak alias of __fesetenv. Use libm_hidden_weak. * sysdeps/powerpc/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def. * sysdeps/powerpc/nofpu/fesetenv.c (__fesetenv): Likewise. * sysdeps/powerpc/powerpc32/e500/nofpu/fesetenv.c (__fesetenv): Likewise. * sysdeps/s390/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and define as weak alias of __fesetenv. Use libm_hidden_weak. * sysdeps/sh/sh4/fpu/fesetenv.c (fesetenv): Likewise. * sysdeps/sparc/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def. * sysdeps/tile/math_private.h (__fesetenv): New inline function. * sysdeps/x86_64/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and define as weak alias of __fesetenv. Use libm_hidden_weak. * sysdeps/generic/math_private.h (default_libc_fesetenv): Use __fesetenv instead of fesetenv. (libc_feresetround_noex_ctx): Likewise. * sysdeps/alpha/fpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/hppa/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/i386/fpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/m68k/fpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/mips/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/powerpc/nofpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/sh/sh4/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/sparc/fpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/x86_64/fpu/feupdateenv.c (__feupdateenv): Likewise.
2015-01-02Fix libm fegetround namespace (bug 17748).Joseph Myers1-0/+1
Continuing the fixes for C90 libm functions calling C99 fe* functions, this patch fixes the case of fegetround by making it a weak alias of __fegetround and making the affected code call __fegetround. Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). Also tested for ARM (soft-float) that fegetround failures disappear from the linknamespace test failures (feholdexcept, fesetenv, fesetround and feupdateenv remain to be addressed before bug 17748 is fully fixed, although this patch may suffice to fix the failures in some cases, when the libc_fe* functions are implemented but there is no architecture-specific sqrt implementation in use so there were failures from fegetround used by sqrt but no other such failures). [BZ #17748] * include/fenv.h (__fegetround): Declare. Use libm_hidden_proto. * math/fegetround.c (fegetround): Rename to __fegetround and define as weak alias of __fegetround. Use libm_hidden_weak. * sysdeps/aarch64/fpu/fegetround.c (fegetround): Likewise. * sysdeps/alpha/fpu/fegetround.c (fegetround): Likewise. * sysdeps/arm/fegetround.c (fegetround): Likewise. * sysdeps/hppa/fpu/fegetround.c (fegetround): Likewise. * sysdeps/i386/fpu/fegetround.c (fegetround): Likewise. * sysdeps/ia64/fpu/fegetround.c (fegetround): Likewise. * sysdeps/m68k/fpu/fegetround.c (fegetround): Likewise. * sysdeps/mips/fpu/fegetround.c (fegetround): Likewise. * sysdeps/powerpc/fpu/fegetround.c (fegetround): Likewise. Undefine after rather than before function definition; use parentheses around function name in definition. (__fegetround): Also undefine macro after function definition. * sysdeps/powerpc/nofpu/fegetround.c (fegetround): Rename to __fegetround and define as weak alias of __fegetround. Use libm_hidden_weak. Do not undefine as macro. * sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c (fegetround): Likewise. * sysdeps/s390/fpu/fegetround.c (fegetround): Rename to __fegetround and define as weak alias of __fegetround. Use libm_hidden_weak. * sysdeps/sh/sh4/fpu/fegetround.c (fegetround): Likewise. * sysdeps/sparc/fpu/fegetround.c (fegetround): Likewise. * sysdeps/tile/math_private.h (__fegetround): New inline function. * sysdeps/x86_64/fpu/fegetround.c (fegetround): Rename to __fegetround and define as weak alias of __fegetround. Use libm_hidden_weak. * sysdeps/ieee754/dbl-64/e_sqrt.c (__ieee754_sqrt): Use __fegetround instead of fegetround.
2014-12-31Fix libm fegetenv namespace (bug 17748).Joseph Myers1-0/+1
Some C90 libm functions call fegetenv via libc_feholdsetround* functions in math_private.h. This patch makes them call __fegetenv instead, making fegetenv into a weak alias for __fegetenv as needed. Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). Also tested for ARM (soft-float) that fegetenv failures disappear from the linknamespace test failures (however, similar fixes will also be needed for fegetround, feholdexcept, fesetenv, fesetround and feupdateenv before this set of namespace issues covered by bug 17748 is fully fixed and those linknamespace tests start passing). [BZ #17748] * include/fenv.h (__fegetenv): Use libm_hidden_proto. * math/fegetenv.c (__fegetenv): Use libm_hidden_def. * sysdeps/aarch64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and define as weak alias of __fegetenv. Use libm_hidden_weak. * sysdeps/alpha/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def. * sysdeps/arm/fegetenv.c (fegetenv): Rename to __fegetenv and define as weak alias of __fegetenv. Use libm_hidden_weak. * sysdeps/hppa/fpu/fegetenv.c (fegetenv): Likewise. * sysdeps/i386/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def. * sysdeps/ia64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and define as weak alias of __fegetenv. Use libm_hidden_weak. * sysdeps/m68k/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def. * sysdeps/mips/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and define as weak alias of __fegetenv. Use libm_hidden_weak. * sysdeps/powerpc/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def. * sysdeps/powerpc/nofpu/fegetenv.c (__fegetenv): Likewise. * sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c (__fegetenv): Likewise. * sysdeps/s390/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and define as weak alias of __fegetenv. Use libm_hidden_weak. * sysdeps/sh/sh4/fpu/fegetenv.c (fegetenv): Likewise. * sysdeps/sparc/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def. * sysdeps/tile/math_private.h (__fegetenv): New inline function. * sysdeps/x86_64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and define as weak alias of __fegetenv. Use libm_hidden_weak. * sysdeps/generic/math_private.h (libc_feholdsetround_ctx): Use __fegetenv instead of fegetenv. (libc_feholdsetround_noex_ctx): Likewise.
2014-12-30Fix libm feraiseexcept namespace (bug 17723).Joseph Myers1-0/+1
Various C90 and UNIX98 libm functions call feraiseexcept, which is not in those standards. This causes linknamespace test failures - except on x86 / x86_64, where feraiseexcept is inline (for the relevant constant arguments) in bits/fenv.h. This patch fixes this by making those functions call __feraiseexcept instead. All changes are applied to all architectures rather than considering the possibility that some might not be needed in some cases (e.g. x86) as it seems most maintainable to keep architectures consistent. Where __feraiseexcept does not exist, it is added, with feraiseexcept made a weak alias; where it is a strong alias, it is made weak. libm_hidden_def / libm_hidden_proto are used with __feraiseexcept (this might in some cases improve code generation for existing calls to __feraiseexcept in some code on some architectures). Where there are dummy feraiseexcept macros (on architectures without floating-point exceptions support, to avoid compile errors from references to undefined FE_* macros), corresponding dummy __feraiseexcept macros are added. And on x86, to ensure __feraiseexcept calls still get inlined, the inline function in bits/fenv.h is refactored so that most of it can be reused in an inline __feraiseexcept in a separate include/bits/fenv.h. Calls are changed in C90/UNIX98 functions, but generally not in functions missing from those standards. They are also changed in libc_fe* functions (on the basis that those might be used in any libm function), and in feupdateenv (on the same basis - may be used, via default libc_*, in any libm function - of course feupdateenv will need changing to __feupdateenv in a subsequent patch to make that fully namespace-clean). No __feraiseexcept is added corresponding to the feraiseexcept in powerpc bits/fenvinline.h, because that macro definition is conditional on !defined __NO_MATH_INLINES, and glibc libm is built with -D__NO_MATH_INLINES, so changing internal calls to use __feraiseexcept should make no difference. Tested for x86_64 (testsuite; the only change in disassembly of installed shared libraries is a slight code reordering in clog10, of no apparent significance). Also tested for MIPS, where (in the configuration tested) it eliminates math.h linknamespace failures for n32 and n64 (some for o32 remain because of other issues). [BZ #17723] * include/fenv.h (__feraiseexcept): Use libm_hidden_proto. * math/fraiseexcpt.c (__feraiseexcept): Use libm_hidden_def. * sysdeps/aarch64/fpu/fraiseexcpt.c (feraiseexcept): Rename to __feraiseexcept and define as weak alias of __feraiseexcept. Use libm_hidden_weak. * sysdeps/arm/fraiseexcpt.c (feraiseexcept): Likewise. * sysdeps/hppa/fpu/fraiseexcpt.c (feraiseexcept): Likewise. * sysdeps/i386/fpu/fraiseexcpt.c (__feraiseexcept): Use libm_hidden_def. * sysdeps/ia64/fpu/fraiseexcpt.c (feraiseexcept): Rename to __feraiseexcept and define as weak alias of __feraiseexcept. Use libm_hidden_weak. * sysdeps/m68k/coldfire/fpu/fraiseexcpt.c (feraiseexcept): Likewise. * sysdeps/microblaze/math_private.h (__feraiseexcept): New macro. * sysdeps/mips/fpu/fraiseexcpt.c (feraiseexcept): Rename to __feraiseexcept and define as weak alias of __feraiseexcept. Use libm_hidden_weak. * sysdeps/powerpc/fpu/fraiseexcpt.c (__feraiseexcept): Use libm_hidden_def. * sysdeps/powerpc/nofpu/fraiseexcpt.c (__feraiseexcept): Likewise. * sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcpt.c (__feraiseexcept): Likewise. * sysdeps/s390/fpu/fraiseexcpt.c (feraiseexcept): Rename to __feraiseexcept and define as weak alias of __feraiseexcept. Use libm_hidden_weak. * sysdeps/sh/sh4/fpu/fraiseexcpt.c (feraiseexcept): Likewise. * sysdeps/sparc/fpu/fraiseexcpt.c (__feraiseexcept): Use libm_hidden_def. * sysdeps/tile/math_private.h (__feraiseexcept): New macro. * sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S (__feraiseexcept): Use libm_hidden_def. * sysdeps/x86_64/fpu/fraiseexcpt.c (__feraiseexcept): Use libm_hidden_def. (feraiseexcept): Define as weak not strong alias. Use libm_hidden_weak. * sysdeps/x86/fpu/bits/fenv.h (__feraiseexcept_invalid_divbyzero): New inline function. Factored out of ... (feraiseexcept): ... here. Use __feraiseexcept_invalid_divbyzero. * sysdeps/x86/fpu/include/bits/fenv.h: New file. * math/e_scalb.c (invalid_fn): Call __feraiseexcept instead of feraiseexcept. * math/w_acos.c (__acos): Likewise. * math/w_asin.c (__asin): Likewise. * math/w_ilogb.c (__ilogb): Likewise. * math/w_j0.c (y0): Likewise. * math/w_j1.c (y1): Likewise. * math/w_jn.c (yn): Likewise. * math/w_log.c (__log): Likewise. * math/w_log10.c (__log10): Likewise. * sysdeps/aarch64/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/aarch64/fpu/math_private.h (libc_feupdateenv_test_aarch64): Likewise. * sysdeps/alpha/fpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/arm/fenv_private.h (libc_feupdateenv_test_vfp): Likewise. * sysdeps/arm/feupdateenv.c (feupdateenv): Likewise. * sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/m68k/fpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/mips/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Likewise. * sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/sh/sh4/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/sparc/fpu/feupdateenv.c (__feupdateenv): Likewise.
2014-12-29tile: prefer inlines to macros in math_private.h.Chris Metcalf1-4/+6
2014-12-26tile: add no-op fe*() routines for libc internal useChris Metcalf1-0/+4
These avoid having tile generate real calls to the no-op functions, which then causes linknamespace test failures. It might make sense to factor all of these out into a common header that can be shared by tile, microblaze, etc., but for now just fix the test failures.
2014-02-10Move tilegx, tilepro, and linux-generic from ports to libc.Chris Metcalf1-0/+31
I've moved the TILE-Gx and TILEPro ports to the main sysdeps hierarchy, along with the linux-generic ports infrastructure. Beyond the README update, the move was just git mv ports/sysdeps/tile sysdeps/tile git mv ports/sysdeps/unix/sysv/linux/tile \ sysdeps/unix/sysv/linux/tile git mv ports/sysdeps/unix/sysv/linux/generic \ sysdeps/unix/sysv/linux/generic I updated the relevant ChangeLogs along the lines of the ARM move in commit c6bfe5c4d75 and tested the 64-bit tilegx build to confirm that there were no changes in "objdump -dr" output in the shared objects.