glibc/sysdeps
Joseph Myers b1c347e2cd Move fenv.h override inline functions to generic math_private.h.
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-01 20:54:44 +00:00
..
aarch64 aarch64: fix static pie enabled libc when main is in a shared library 2018-01-12 18:10:03 +00:00
alpha Update Alpha libm-test-ulps 2018-01-27 13:31:38 +01:00
arm Update ARM libm-test-ulps. 2018-01-02 18:37:06 +00:00
generic Move fenv.h override inline functions to generic math_private.h. 2018-02-01 20:54:44 +00:00
gnu LIBC_SLIBDIR_RTLDDIR: substitute arguments in single quotes 2018-01-25 17:20:28 +01:00
hppa Update hppa libm-test-ulps 2018-01-27 13:32:36 +01:00
i386 Revert Intel CET changes to __jmp_buf_tag (Bug 22743) 2018-01-25 23:43:46 -08:00
ia64 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ieee754 Fix -Os log1p, log1pf build (bug 21314). 2018-02-01 20:40:48 +00:00
init_array sysdeps/init_array: Add PREINIT_FUNCTION to crti.S 2018-01-29 10:22:26 -08:00
m68k Move some fenv.h override macros to generic math_private.h. 2018-02-01 20:52:59 +00:00
mach hurd: include generic's hp-timing.h instead of copying it 2018-01-30 01:17:51 +01:00
microblaze Move some fenv.h override macros to generic math_private.h. 2018-02-01 20:52:59 +00:00
mips Update MIPS libm-test-ulps. 2018-01-02 21:55:15 +00:00
nios2 Move some fenv.h override macros to generic math_private.h. 2018-02-01 20:52:59 +00:00
nptl Revert Intel CET changes to __jmp_buf_tag (Bug 22743) 2018-01-25 23:43:46 -08:00
posix Reject invalid definitions of _POSIX_CHOWN_RESTRICTED, _POSIX_NO_TRUNC, _POSIX_VDISABLE 2018-01-29 22:21:21 +01:00
powerpc powerpc: Fix syscalls during early process initialization [BZ #22685] 2018-01-19 09:50:09 -02:00
pthread allocalim.h: use __glibc_likely instead of __builtin_expect 2018-01-30 21:42:21 +01:00
riscv RISC-V: Build Infastructure 2018-01-29 10:43:15 -08:00
s390 Fix s390 linknamespace fallout of bug 22702 patch. 2018-01-12 00:12:57 +00:00
sh Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sparc Update sparc ULPs. 2018-01-26 08:23:01 -08:00
tile Move fenv.h override inline functions to generic math_private.h. 2018-02-01 20:54:44 +00:00
unix RISC-V: Add ipc_priv.h 2018-01-29 10:43:15 -08:00
wordsize-32 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wordsize-64 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
x86 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
x86_64 Revert Intel CET changes to __jmp_buf_tag (Bug 22743) 2018-01-25 23:43:46 -08:00