glibc/sysdeps/ieee754/ldbl-128
Joseph Myers eb3c12c784 Add setpayload, setpayloadf, setpayloadl.
TS 18661-1 defines functions for manipulating the payloads of NaNs.
This patch implements the setpayload functions for glibc; these set a
number (pointed to by a function argument) to a quiet NaN with the
given payload, or to +0 if the given payload is not valid.  The
implementations are structured to allow the substance of the
implementation to be shared with the setpayloadsig functions when
those are added.

The semantics in the TS are not entirely clear in the case where the
payload passed to the function is zero (see discussion on the WG14
reflector last month).  This patch implements what seems the most
sensible interpretation, that -0 is never valid to give as the
payload, but +0 is valid in the case where the kind of NaN being
generated has its high mantissa bit set so payload 0 is actually
possible in such a NaN.

Tested for x86_64, x86, mips64 and powerpc.

	* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(setpayload): New declaration.
	* math/Versions (setpayload): New libm symbol at version
	GLIBC_2.25.
	(setpayloadf): Likewise.
	(setpayloadl): Likewise.
	* math/Makefile (libm-calls): Add s_setpayloadF.
	* math/libm-test.inc (struct test_Ffp_b1_data): Rename to struct
	test_Ff_b1_data.
	(RUN_TEST_Ff_b1): New macro.
	(RUN_TEST_LOOP_Ff_b1): Likewise.
	(canonicalize_test_data): Update type.
	(setpayload_test_data): New array.
	(setpayload_test): New function.
	(main): Call setpayload_test.
	* manual/arith.texi (FP Bit Twiddling): Document setpayload,
	setpayloadf and setpayloadl.
	* manual/libm-err-tab.pl: Update comment on interfaces without
	ulps tabulated.
	* sysdeps/ieee754/dbl-64/s_setpayload.c: New file.
	* sysdeps/ieee754/dbl-64/s_setpayload_main.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c:
	Likewise.
	* sysdeps/ieee754/flt-32/s_setpayloadf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_setpayloadf_main.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_setpayloadl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_setpayloadl_main.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_setpayloadl_main.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_setpayloadl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_setpayloadl_main.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/nldbl-setpayload.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
	setpayload.
	(CFLAGS-nldbl-setpayload.c): New variable.
	* 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-11-19 00:16:28 +00:00
..
e_acoshl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_acosl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_asinl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_atan2l.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_atanhl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_coshl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_exp10l.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_expl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_fmodl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
e_gammal_r.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_hypotl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_ilogbl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
e_j0l.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_j1l.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_jnl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_lgammal_r.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_log2l.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_log10l.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_logl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_powl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_rem_pio2l.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_remainderl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
e_sinhl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
gamma_productl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
ieee754.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
k_cosl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
k_sincosl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
k_sinl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
k_tanl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
ldbl2mpn.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
lgamma_negl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
lgamma_productl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
Makefile * sysdeps/ieee754/ldbl-128/Makefile: New file. 2007-03-14 17:36:18 +00:00
math_ldbl.h ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
mpn2ldbl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
printf_fphex.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_asinhl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_atanl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_cbrtl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_ceill.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_copysignl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_cosl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_erfl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_expm1l.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_fabsl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_finitel.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_floorl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_fma.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fmal.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_fpclassifyl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_frexpl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_getpayloadl.c Add getpayload, getpayloadf, getpayloadl. 2016-10-19 01:49:09 +00:00
s_isinfl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_isnanl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_issignalingl.c Define HIGH_ORDER_BIT_IS_SET_FOR_SNAN to 0 or 1. 2016-10-17 22:48:51 +00:00
s_llrintl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_llroundl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_log1pl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_logbl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_lrintl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_lroundl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_modfl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_nearbyintl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_nextafterl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_nexttoward.c Make nextafter, nexttoward set errno (bug 6799). 2015-11-02 18:54:19 +00:00
s_nexttowardf.c Make nextafter, nexttoward set errno (bug 6799). 2015-11-02 18:54:19 +00:00
s_nextupl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_remquol.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_rintl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_roundl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_scalblnl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_scalbnl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_setpayloadl_main.c Add setpayload, setpayloadf, setpayloadl. 2016-11-19 00:16:28 +00:00
s_setpayloadl.c Add setpayload, setpayloadf, setpayloadl. 2016-11-19 00:16:28 +00:00
s_signbitl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_sincosl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_sinl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_tanhl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_tanl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
s_totalorderl.c Define HIGH_ORDER_BIT_IS_SET_FOR_SNAN to 0 or 1. 2016-10-17 22:48:51 +00:00
s_totalordermagl.c Define HIGH_ORDER_BIT_IS_SET_FOR_SNAN to 0 or 1. 2016-10-17 22:48:51 +00:00
s_truncl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
strtod_nan_ldouble.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strtold_l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
t_expl.h ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
t_sincosl.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00
w_expl.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
x2y2m1l.c ldbl-128: Use L(x) macro for long double constants 2016-09-13 15:33:59 -05:00