diff options
author | Joseph Myers <joseph@codesourcery.com> | 2016-11-19 00:16:28 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2016-11-19 00:16:28 +0000 |
commit | eb3c12c78420ce51778ab36ab1d4b37dcdaf7bd0 (patch) | |
tree | aa868e51ca299bf499cac8a74ba99b5b3cfeccc3 /sysdeps | |
parent | e92bd6e362470aa0a79cfb19a512944f0761184b (diff) | |
download | glibc-eb3c12c78420ce51778ab36ab1d4b37dcdaf7bd0.zip glibc-eb3c12c78420ce51778ab36ab1d4b37dcdaf7bd0.tar.gz glibc-eb3c12c78420ce51778ab36ab1d4b37dcdaf7bd0.tar.bz2 |
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.
Diffstat (limited to 'sysdeps')
40 files changed, 499 insertions, 1 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_setpayload.c b/sysdeps/ieee754/dbl-64/s_setpayload.c new file mode 100644 index 0000000..5ab70de --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_setpayload.c @@ -0,0 +1,6 @@ +#define SIG 0 +#define FUNC setpayload +#include <s_setpayload_main.c> +#ifdef NO_LONG_DOUBLE +weak_alias (setpayload, setpayloadl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_setpayload_main.c b/sysdeps/ieee754/dbl-64/s_setpayload_main.c new file mode 100644 index 0000000..d7a3609 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_setpayload_main.c @@ -0,0 +1,69 @@ +/* Set NaN payload. dbl-64 version. + Copyright (C) 2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <math_private.h> +#include <nan-high-order-bit.h> +#include <stdint.h> + +#define SET_HIGH_BIT (HIGH_ORDER_BIT_IS_SET_FOR_SNAN ? SIG : !SIG) +#define BIAS 0x3ff +#define PAYLOAD_DIG 51 +#define EXPLICIT_MANT_DIG 52 + +int +FUNC (double *x, double payload) +{ + uint32_t hx, lx; + EXTRACT_WORDS (hx, lx, payload); + int exponent = hx >> (EXPLICIT_MANT_DIG - 32); + /* Test if argument is (a) negative or too large; (b) too small, + except for 0 when allowed; (c) not an integer. */ + if (exponent >= BIAS + PAYLOAD_DIG + || (exponent < BIAS && !(SET_HIGH_BIT && hx == 0 && lx == 0))) + { + INSERT_WORDS (*x, 0, 0); + return 1; + } + int shift = BIAS + EXPLICIT_MANT_DIG - exponent; + if (shift < 32 + ? (lx & ((1U << shift) - 1)) != 0 + : (lx != 0 || (hx & ((1U << (shift - 32)) - 1)) != 0)) + { + INSERT_WORDS (*x, 0, 0); + return 1; + } + if (exponent != 0) + { + hx &= (1U << (EXPLICIT_MANT_DIG - 32)) - 1; + hx |= 1U << (EXPLICIT_MANT_DIG - 32); + if (shift >= 32) + { + lx = hx >> (shift - 32); + hx = 0; + } + else if (shift != 0) + { + lx = (lx >> shift) | (hx << (32 - shift)); + hx >>= shift; + } + } + hx |= 0x7ff00000 | (SET_HIGH_BIT ? 0x80000 : 0); + INSERT_WORDS (*x, hx, lx); + return 0; +} diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c new file mode 100644 index 0000000..6915792 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c @@ -0,0 +1,53 @@ +/* Set NaN payload. dbl-64/wordsize-64 version. + Copyright (C) 2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <math_private.h> +#include <nan-high-order-bit.h> +#include <stdint.h> + +#define SET_HIGH_BIT (HIGH_ORDER_BIT_IS_SET_FOR_SNAN ? SIG : !SIG) +#define BIAS 0x3ff +#define PAYLOAD_DIG 51 +#define EXPLICIT_MANT_DIG 52 + +int +FUNC (double *x, double payload) +{ + uint64_t ix; + EXTRACT_WORDS64 (ix, payload); + int exponent = ix >> EXPLICIT_MANT_DIG; + /* Test if argument is (a) negative or too large; (b) too small, + except for 0 when allowed; (c) not an integer. */ + if (exponent >= BIAS + PAYLOAD_DIG + || (exponent < BIAS && !(SET_HIGH_BIT && ix == 0)) + || (ix & ((1ULL << (BIAS + EXPLICIT_MANT_DIG - exponent)) - 1)) != 0) + { + INSERT_WORDS64 (*x, 0); + return 1; + } + if (ix != 0) + { + ix &= (1ULL << EXPLICIT_MANT_DIG) - 1; + ix |= 1ULL << EXPLICIT_MANT_DIG; + ix >>= BIAS + EXPLICIT_MANT_DIG - exponent; + } + ix |= 0x7ff0000000000000ULL | (SET_HIGH_BIT ? 0x8000000000000ULL : 0); + INSERT_WORDS64 (*x, ix); + return 0; +} diff --git a/sysdeps/ieee754/flt-32/s_setpayloadf.c b/sysdeps/ieee754/flt-32/s_setpayloadf.c new file mode 100644 index 0000000..86dfda9 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_setpayloadf.c @@ -0,0 +1,3 @@ +#define SIG 0 +#define FUNC setpayloadf +#include <s_setpayloadf_main.c> diff --git a/sysdeps/ieee754/flt-32/s_setpayloadf_main.c b/sysdeps/ieee754/flt-32/s_setpayloadf_main.c new file mode 100644 index 0000000..cd40294 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_setpayloadf_main.c @@ -0,0 +1,53 @@ +/* Set NaN payload. flt-32 version. + Copyright (C) 2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <math_private.h> +#include <nan-high-order-bit.h> +#include <stdint.h> + +#define SET_HIGH_BIT (HIGH_ORDER_BIT_IS_SET_FOR_SNAN ? SIG : !SIG) +#define BIAS 0x7f +#define PAYLOAD_DIG 22 +#define EXPLICIT_MANT_DIG 23 + +int +FUNC (float *x, float payload) +{ + uint32_t ix; + GET_FLOAT_WORD (ix, payload); + int exponent = ix >> EXPLICIT_MANT_DIG; + /* Test if argument is (a) negative or too large; (b) too small, + except for 0 when allowed; (c) not an integer. */ + if (exponent >= BIAS + PAYLOAD_DIG + || (exponent < BIAS && !(SET_HIGH_BIT && ix == 0)) + || (ix & ((1U << (BIAS + EXPLICIT_MANT_DIG - exponent)) - 1)) != 0) + { + SET_FLOAT_WORD (*x, 0); + return 1; + } + if (ix != 0) + { + ix &= (1U << EXPLICIT_MANT_DIG) - 1; + ix |= 1U << EXPLICIT_MANT_DIG; + ix >>= BIAS + EXPLICIT_MANT_DIG - exponent; + } + ix |= 0x7f800000 | (SET_HIGH_BIT ? 0x400000 : 0); + SET_FLOAT_WORD (*x, ix); + return 0; +} diff --git a/sysdeps/ieee754/ldbl-128/s_setpayloadl.c b/sysdeps/ieee754/ldbl-128/s_setpayloadl.c new file mode 100644 index 0000000..1aba33e --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_setpayloadl.c @@ -0,0 +1,3 @@ +#define SIG 0 +#define FUNC setpayloadl +#include <s_setpayloadl_main.c> diff --git a/sysdeps/ieee754/ldbl-128/s_setpayloadl_main.c b/sysdeps/ieee754/ldbl-128/s_setpayloadl_main.c new file mode 100644 index 0000000..5f54811 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_setpayloadl_main.c @@ -0,0 +1,69 @@ +/* Set NaN payload. ldbl-128 version. + Copyright (C) 2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <math_private.h> +#include <nan-high-order-bit.h> +#include <stdint.h> + +#define SET_HIGH_BIT (HIGH_ORDER_BIT_IS_SET_FOR_SNAN ? SIG : !SIG) +#define BIAS 0x3fff +#define PAYLOAD_DIG 111 +#define EXPLICIT_MANT_DIG 112 + +int +FUNC (long double *x, long double payload) +{ + uint64_t hx, lx; + GET_LDOUBLE_WORDS64 (hx, lx, payload); + int exponent = hx >> (EXPLICIT_MANT_DIG - 64); + /* Test if argument is (a) negative or too large; (b) too small, + except for 0 when allowed; (c) not an integer. */ + if (exponent >= BIAS + PAYLOAD_DIG + || (exponent < BIAS && !(SET_HIGH_BIT && hx == 0 && lx == 0))) + { + SET_LDOUBLE_WORDS64 (*x, 0, 0); + return 1; + } + int shift = BIAS + EXPLICIT_MANT_DIG - exponent; + if (shift < 64 + ? (lx & ((1ULL << shift) - 1)) != 0 + : (lx != 0 || (hx & ((1ULL << (shift - 64)) - 1)) != 0)) + { + SET_LDOUBLE_WORDS64 (*x, 0, 0); + return 1; + } + if (exponent != 0) + { + hx &= (1ULL << (EXPLICIT_MANT_DIG - 64)) - 1; + hx |= 1ULL << (EXPLICIT_MANT_DIG - 64); + if (shift >= 64) + { + lx = hx >> (shift - 64); + hx = 0; + } + else if (shift != 0) + { + lx = (lx >> shift) | (hx << (64 - shift)); + hx >>= shift; + } + } + hx |= 0x7fff000000000000ULL | (SET_HIGH_BIT ? 0x800000000000ULL : 0); + SET_LDOUBLE_WORDS64 (*x, hx, lx); + return 0; +} diff --git a/sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c b/sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c new file mode 100644 index 0000000..1aba33e --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c @@ -0,0 +1,3 @@ +#define SIG 0 +#define FUNC setpayloadl +#include <s_setpayloadl_main.c> diff --git a/sysdeps/ieee754/ldbl-128ibm/s_setpayloadl_main.c b/sysdeps/ieee754/ldbl-128ibm/s_setpayloadl_main.c new file mode 100644 index 0000000..278306f --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm/s_setpayloadl_main.c @@ -0,0 +1,60 @@ +/* Set NaN payload. ldbl-128ibm version. + Copyright (C) 2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <math_private.h> +#include <nan-high-order-bit.h> +#include <stdint.h> + +#define SET_HIGH_BIT (HIGH_ORDER_BIT_IS_SET_FOR_SNAN ? SIG : !SIG) +#define BIAS 0x3ff +#define PAYLOAD_DIG 51 +#define EXPLICIT_MANT_DIG 52 + +int +FUNC (long double *x, long double payload) +{ + double hi, lo; + uint64_t hx, lx; + + ldbl_unpack (payload, &hi, &lo); + EXTRACT_WORDS64 (hx, hi); + EXTRACT_WORDS64 (lx, lo); + int exponent = hx >> EXPLICIT_MANT_DIG; + /* Test if argument is (a) negative or too large; (b) too small, + except for 0 when allowed; (c) not an integer. All valid + arguments have the low part zero. */ + if ((lx & 0x7fffffffffffffffULL) != 0 + || exponent >= BIAS + PAYLOAD_DIG + || (exponent < BIAS && !(SET_HIGH_BIT && hx == 0)) + || (hx & ((1ULL << (BIAS + EXPLICIT_MANT_DIG - exponent)) - 1)) != 0) + { + *x = 0.0L; + return 1; + } + if (hx != 0) + { + hx &= (1ULL << EXPLICIT_MANT_DIG) - 1; + hx |= 1ULL << EXPLICIT_MANT_DIG; + hx >>= BIAS + EXPLICIT_MANT_DIG - exponent; + } + hx |= 0x7ff0000000000000ULL | (SET_HIGH_BIT ? 0x8000000000000ULL : 0); + INSERT_WORDS64 (hi, hx); + *x = ldbl_pack (hi, 0.0); + return 0; +} diff --git a/sysdeps/ieee754/ldbl-96/s_setpayloadl.c b/sysdeps/ieee754/ldbl-96/s_setpayloadl.c new file mode 100644 index 0000000..1aba33e --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_setpayloadl.c @@ -0,0 +1,3 @@ +#define SIG 0 +#define FUNC setpayloadl +#include <s_setpayloadl_main.c> diff --git a/sysdeps/ieee754/ldbl-96/s_setpayloadl_main.c b/sysdeps/ieee754/ldbl-96/s_setpayloadl_main.c new file mode 100644 index 0000000..9af967b --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_setpayloadl_main.c @@ -0,0 +1,68 @@ +/* Set NaN payload. ldbl-96 version. + Copyright (C) 2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <math_private.h> +#include <nan-high-order-bit.h> +#include <stdint.h> + +#define SET_HIGH_BIT (HIGH_ORDER_BIT_IS_SET_FOR_SNAN ? SIG : !SIG) +#define BIAS 0x3fff +#define PAYLOAD_DIG 62 +#define EXPLICIT_MANT_DIG 63 + +int +FUNC (long double *x, long double payload) +{ + uint32_t hx, lx; + uint16_t exponent; + GET_LDOUBLE_WORDS (exponent, hx, lx, payload); + /* Test if argument is (a) negative or too large; (b) too small, + except for 0 when allowed; (c) not an integer. */ + if (exponent >= BIAS + PAYLOAD_DIG + || (exponent < BIAS && !(SET_HIGH_BIT + && exponent == 0 && hx == 0 && lx == 0))) + { + SET_LDOUBLE_WORDS (*x, 0, 0, 0); + return 1; + } + int shift = BIAS + EXPLICIT_MANT_DIG - exponent; + if (shift < 32 + ? (lx & ((1U << shift) - 1)) != 0 + : (lx != 0 || (hx & ((1U << (shift - 32)) - 1)) != 0)) + { + SET_LDOUBLE_WORDS (*x, 0, 0, 0); + return 1; + } + if (exponent != 0) + { + if (shift >= 32) + { + lx = hx >> (shift - 32); + hx = 0; + } + else if (shift != 0) + { + lx = (lx >> shift) | (hx << (32 - shift)); + hx >>= shift; + } + } + hx |= 0x80000000 | (SET_HIGH_BIT ? 0x40000000 : 0); + SET_LDOUBLE_WORDS (*x, 0x7fff, hx, lx); + return 0; +} diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile index 745fa4c..627ebc8 100644 --- a/sysdeps/ieee754/ldbl-opt/Makefile +++ b/sysdeps/ieee754/ldbl-opt/Makefile @@ -43,7 +43,7 @@ libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \ isoc99_wscanf isoc99_fwscanf isoc99_swscanf \ isoc99_vwscanf isoc99_vfwscanf isoc99_vswscanf \ nextup nextdown totalorder totalordermag getpayload \ - canonicalize + canonicalize setpayload libnldbl-routines = $(libnldbl-calls:%=nldbl-%) libnldbl-inhibit-o = $(object-suffixes) libnldbl-static-only-routines = $(libnldbl-routines) @@ -138,6 +138,7 @@ CFLAGS-nldbl-round.c = -fno-builtin-roundl CFLAGS-nldbl-scalb.c = -fno-builtin-scalbl CFLAGS-nldbl-scalbln.c = -fno-builtin-scalblnl CFLAGS-nldbl-scalbn.c = -fno-builtin-scalbnl +CFLAGS-nldbl-setpayload.c = -fno-builtin-setpayloadl CFLAGS-nldbl-significand.c = -fno-builtin-significandl CFLAGS-nldbl-sin.c = -fno-builtin-sinl CFLAGS-nldbl-sincos.c = -fno-builtin-sincosl diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-setpayload.c b/sysdeps/ieee754/ldbl-opt/nldbl-setpayload.c new file mode 100644 index 0000000..2336b99 --- /dev/null +++ b/sysdeps/ieee754/ldbl-opt/nldbl-setpayload.c @@ -0,0 +1,26 @@ +/* Compatibility routine for IEEE double as long double for setpayload. + Copyright (C) 2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include "nldbl-compat.h" + +int +attribute_hidden +setpayloadl (double *x, double payload) +{ + return setpayload (x, payload); +} diff --git a/sysdeps/nacl/libm.abilist b/sysdeps/nacl/libm.abilist index b0fc19f..f6f45d3 100644 --- a/sysdeps/nacl/libm.abilist +++ b/sysdeps/nacl/libm.abilist @@ -392,6 +392,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/aarch64/libm.abilist b/sysdeps/unix/sysv/linux/aarch64/libm.abilist index 9d5936c..4d94f5b 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libm.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libm.abilist @@ -424,6 +424,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/alpha/libm.abilist b/sysdeps/unix/sysv/linux/alpha/libm.abilist index ce5be3c..0eea474 100644 --- a/sysdeps/unix/sysv/linux/alpha/libm.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libm.abilist @@ -434,6 +434,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/arm/libm.abilist b/sysdeps/unix/sysv/linux/arm/libm.abilist index 675dfa5..26d2b21 100644 --- a/sysdeps/unix/sysv/linux/arm/libm.abilist +++ b/sysdeps/unix/sysv/linux/arm/libm.abilist @@ -81,6 +81,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/hppa/libm.abilist b/sysdeps/unix/sysv/linux/hppa/libm.abilist index 75b71ad..d081d7b 100644 --- a/sysdeps/unix/sysv/linux/hppa/libm.abilist +++ b/sysdeps/unix/sysv/linux/hppa/libm.abilist @@ -393,6 +393,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/i386/libm.abilist b/sysdeps/unix/sysv/linux/i386/libm.abilist index 5db3def..cc8be12 100644 --- a/sysdeps/unix/sysv/linux/i386/libm.abilist +++ b/sysdeps/unix/sysv/linux/i386/libm.abilist @@ -437,6 +437,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/ia64/libm.abilist b/sysdeps/unix/sysv/linux/ia64/libm.abilist index a80c93a..1aa5468 100644 --- a/sysdeps/unix/sysv/linux/ia64/libm.abilist +++ b/sysdeps/unix/sysv/linux/ia64/libm.abilist @@ -366,6 +366,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist index 675dfa5..26d2b21 100644 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist @@ -81,6 +81,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist index c795dbd..6ffebfd 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist @@ -435,6 +435,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/microblaze/libm.abilist b/sysdeps/unix/sysv/linux/microblaze/libm.abilist index cdc8f19..9752f2f 100644 --- a/sysdeps/unix/sysv/linux/microblaze/libm.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/libm.abilist @@ -392,6 +392,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist index a610b03..edde2f2 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist @@ -394,6 +394,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist index dfd888c..67705e8 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist @@ -426,6 +426,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/nios2/libm.abilist b/sysdeps/unix/sysv/linux/nios2/libm.abilist index a6c505d..86f75cb 100644 --- a/sysdeps/unix/sysv/linux/nios2/libm.abilist +++ b/sysdeps/unix/sysv/linux/nios2/libm.abilist @@ -392,6 +392,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist index 9a5f983..6bd32bb 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist @@ -437,6 +437,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist index 24f0127..2ae95e2 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist @@ -436,6 +436,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist index 00c7d22..35fd922 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist @@ -431,6 +431,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist index bfbaa36..d616292 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist @@ -112,6 +112,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist index 6e52936..f331069 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist @@ -424,6 +424,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist index a01c588..e105c77 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist @@ -422,6 +422,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/sh/libm.abilist b/sysdeps/unix/sysv/linux/sh/libm.abilist index 9649784..4c24c90 100644 --- a/sysdeps/unix/sysv/linux/sh/libm.abilist +++ b/sysdeps/unix/sysv/linux/sh/libm.abilist @@ -393,6 +393,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist index ba10933..dbf19bd 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist @@ -427,6 +427,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist index 82245ed..83e8308 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist @@ -425,6 +425,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist index 1d4d6f9..7306e46 100644 --- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist +++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist @@ -393,6 +393,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist index 1d4d6f9..7306e46 100644 --- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist +++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist @@ -393,6 +393,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist b/sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist index 1d4d6f9..7306e46 100644 --- a/sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist +++ b/sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist @@ -393,6 +393,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist index b0bbada..cabd7fe 100644 --- a/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist @@ -426,6 +426,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist index 87f0852..ff64e99 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist @@ -425,6 +425,9 @@ GLIBC_2.25 fetestexceptflag F GLIBC_2.25 getpayload F GLIBC_2.25 getpayloadf F GLIBC_2.25 getpayloadl F +GLIBC_2.25 setpayload F +GLIBC_2.25 setpayloadf F +GLIBC_2.25 setpayloadl F GLIBC_2.25 totalorder F GLIBC_2.25 totalorderf F GLIBC_2.25 totalorderl F |