glibc/sysdeps/unix/sysv/linux/powerpc/powerpc64
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
..
970 powerpc: Re-work the Implies structure 2010-06-30 09:57:38 -07:00
a2 powerpc: PPCA2/A2 optimized memcpy function 2010-10-24 21:47:33 -04:00
cell powerpc: Re-work the Implies structure 2010-06-30 09:57:38 -07:00
fpu Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Implies Revert "Use ieee754/dbl-64/wordsize-64 on powerpc64" 2013-01-10 10:44:05 +01:00
Versions Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
____longjmp_chk.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
brk.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
c++-types.data powerpc: Consolidate nptl/ subdirectories under linux/.... 2014-06-23 09:40:01 -07:00
clone.S Remove cached PID/TID in clone 2016-11-24 19:38:51 -02:00
configure Rename localedir to complocaledir (bug 14259). 2015-11-27 10:22:38 -05:00
configure.ac Use %ifdef in sysdeps/unix/sysv/linux/powerpc/powerpc64/shlib-versions. 2014-09-12 12:25:36 +00:00
dl-cache.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fcntl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
getcontext.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
kernel_stat.h Allow [f]statfs64 to alias [f]statfs 2016-11-22 09:59:12 -08:00
ld-le.abilist ld.so: Remove __libc_memalign 2016-11-30 16:23:58 +01:00
ld.abilist ld.so: Remove __libc_memalign 2016-11-30 16:23:58 +01:00
ldsodefs.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
libBrokenLocale-le.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libBrokenLocale.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libanl-le.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
libc-le.abilist New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
libc.abilist New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
libcrypt-le.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-le.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-le.abilist Add roundeven, roundevenf, roundevenl. 2016-12-21 01:48:27 +00:00
libm.abilist Add roundeven, roundevenf, roundevenl. 2016-12-21 01:48:27 +00:00
libnsl-le.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libnsl.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libpthread-le.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-le.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-le.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-le.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-le.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
localplt.data ld.so: Remove __libc_memalign 2016-11-30 16:23:58 +01:00
makecontext.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
setcontext.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
shlib-versions Remove shlib-versions entries redundant with DEFAULT entries. 2014-09-26 17:34:22 +00:00
swapcontext.S powerpc: Add missing insn in swapcontext [BZ #20004] 2016-05-03 10:45:51 -05:00
sysdep-cancel.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
sysdep.h Consolidate pwrite/pwrite64 implementations 2016-04-11 10:08:01 -03:00
timer_create.c PowerPC: Move powerpc64 timer_*.c out of nptl/ 2014-05-26 11:41:46 -05:00
timer_delete.c PowerPC: Move powerpc64 timer_*.c out of nptl/ 2014-05-26 11:41:46 -05:00
timer_getoverr.c PowerPC: Move powerpc64 timer_*.c out of nptl/ 2014-05-26 11:41:46 -05:00
timer_gettime.c PowerPC: Move powerpc64 timer_*.c out of nptl/ 2014-05-26 11:41:46 -05:00
timer_settime.c PowerPC: Move powerpc64 timer_*.c out of nptl/ 2014-05-26 11:41:46 -05:00
ucontext_i.sym PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes 2013-12-04 07:41:39 -06:00
umount.c * sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c: Include x86_64 2006-02-28 19:07:44 +00:00
vfork.S Remove cached PID/TID in clone 2016-11-24 19:38:51 -02:00