glibc/sysdeps/unix/sysv/linux/mips/mips32
Joseph Myers 41c67149b9 Add roundeven, roundevenf, roundevenl.
TS 18661-1 defines roundeven functions that round a floating-point
number to the nearest integer, in that floating-point type, with ties
rounding to even (whereas the round functions round ties away from
zero).  As with other such functions, they raise no exceptions apart
from "invalid" for signaling NaNs.  There was a previous user request
for this functionality in glibc in
<https://sourceware.org/ml/libc-help/2015-02/msg00005.html>.

This patch implements these functions for glibc.  The implementations
use integer bit-manipulation (or roundeven on the high and low parts,
in the IBM long double case).  It's possible that there may be faster
approaches on some architectures (in particular, on AArch64 the frintn
instruction should do exactly what's required); I'll leave it to
architecture maintainers or others interested to implement such
architecture-specific versions if desired.  (Where architectures have
instructions to round to nearest integer in the current rounding mode,
implementations saving and restoring the rounding mode - and dealing
with exceptions if those instructions generate "inexact" - are also
possible, though their performance depends on the cost of manipulating
exceptions / rounding mode state.)

Tested for x86_64, x86, mips64 and powerpc.

	* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(roundeven): New declaration.
	* math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (roundeven): New
	macro.
	* math/Versions (roundeven): New libm symbol at version
	GLIBC_2.25.
	(roundevenf): Likewise.
	(roundevenl): Likewise.
	* math/Makefile (libm-calls): Add s_roundevenF.
	* math/libm-test.inc (roundeven_test_data): New array.
	(roundeven_test): New function.
	(main): Call roundeven_test.
	* math/test-tgmath.c (NCALLS): Increase to 134.
	(F(compile_test)): Call roundeven.
	(F(roundeven)): New function.
	* manual/arith.texi (Rounding Functions): Document roundeven,
	roundevenf and roundevenl.
	* manual/libm-err-tab.pl (@all_functions): Add roundeven.
	* include/math.h (roundeven): Use libm_hidden_proto.
	* sysdeps/ieee754/dbl-64/s_roundeven.c: New file.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c: Likewise.
	* sysdeps/ieee754/flt-32/s_roundevenf.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_roundevenl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_roundevenl.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
	roundeven.
	(CFLAGS-nldbl-roundeven.c): New variable.
	* sysdeps/ieee754/ldbl-opt/nldbl-roundeven.c: New file.
	* sysdeps/nacl/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
2016-12-21 01:48:27 +00:00
..
fpu New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
mips16 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nofpu New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
Versions Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
accept4.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
c++-types.data MIPS: Consolidate nptl/ subdirectories under linux/... 2014-06-27 11:41:04 -07:00
fcntl.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
fxstatat.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
ld.abilist ld.so: Remove __libc_memalign 2016-11-30 16:23:58 +01:00
libBrokenLocale.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libanl.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libcidn.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libcrypt.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libdl.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libm.abilist Add roundeven, roundevenf, roundevenl. 2016-12-21 01:48:27 +00:00
libnsl.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libnss_compat.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libnss_db.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libnss_dns.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libnss_files.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libnss_hesiod.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libnss_nis.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libnss_nisplus.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libpthread.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libresolv.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
librt.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libthread_db.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libutil.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
lockf64.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
mmap.c Fix MIPS mmap negative offset handling for consistency (bug 19550). 2016-02-01 18:20:21 +00:00
readahead.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
recvmmsg.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
sendmmsg.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
syscalls.list Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
sysdep.h VDSO support for MIPS 2016-04-12 11:05:13 +01:00