about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/s_setpayload.c
Commit message (Collapse)AuthorAgeFilesLines
* Use libm_alias_double for some dbl-64 functions.Joseph Myers2017-09-291-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the move of libm aliases to common macros that can create _FloatN / _FloatNx aliases in future, this patch converts some dbl-64 functions to using libm_alias_double, thereby eliminating the need for some ldbl-opt wrappers. This patch deliberately limits what functions are converted so that it can be verified by comparison of stipped binaries. Specifically, atan and tan are excluded because they first need converting to being weak aliases; fma is omitted as it has additional complications with versions in other directories (removing the ldbl-opt version can e.g. cause the ldbl-128 version to be used instead of dbl-64); and functions that have both dbl-64/wordsize-64 and ldbl-opt versions are excluded because ldbl-opt currently always wraps dbl-64 function versions, so changing those will result in platforms using both ldbl-opt and dbl-64/wordsize-64 (i.e. alpha) starting to use the dbl-64/wordsize-64 versions of those functions (which is good, as an optimization, but still best separated from the present patch to get better validation). Tested for x86_64, and tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/ieee754/dbl-64/s_asinh.c: Include <libm-alias-double.h>. (asinh): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_cbrt.c: Include <libm-alias-double.h>. (cbrt): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_copysign.c: Include <libm-alias-double.h>. (copysign): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_erf.c: Include <libm-alias-double.h>. (erf): Define using libm_alias_double. (erfc): Likewise. * sysdeps/ieee754/dbl-64/s_expm1.c: Include <libm-alias-double.h>. (expm1): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_fabs.c: Include <libm-alias-double.h>. (fabs): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_fromfp.c (fromfp): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_fromfp_main.c: Include <libm-alias-double.h>. * sysdeps/ieee754/dbl-64/s_fromfpx.c (fromfpx): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_getpayload.c: Include <libm-alias-double.h>. (getpayload): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_llrint.c: Include <libm-alias-double.h>. (llrint): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_lrint.c: Include <libm-alias-double.h>. (lrint): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_nextup.c: Include <libm-alias-double.h>. (nextup): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_roundeven.c: Include <libm-alias-double.h>. (roundeven): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_setpayload.c (setpayload): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_setpayload_main.c: Include <libm-alias-double.h>. * sysdeps/ieee754/dbl-64/s_setpayloadsig.c (setpayloadsig): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_sin.c: Include <libm-alias-double.h>. (cos): Define using libm_alias_double. (sin): Likewise. * sysdeps/ieee754/dbl-64/s_sincos.c: Include <libm-alias-double.h>. (sincos): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_tanh.c: Include <libm-alias-double.h>. (tanh): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_totalorder.c: Include <libm-alias-double.h>. (totalorder): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_totalordermag.c: Include <libm-alias-double.h>. (totalordermag): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_ufromfp.c (ufromfp): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_ufromfpx.c (ufromfpx): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c: Include <libm-alias-double.h>. (getpayload): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c: Include <libm-alias-double.h>. (roundeven): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c: Include <libm-alias-double.h>. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c: Include <libm-alias-double.h>. (totalorder): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Include <libm-alias-double.h>. (totalordermag): Define using libm_alias_double. * sysdeps/ieee754/ldbl-opt/s_copysign.c (copysignl): Only define libc compat symbol here. * sysdeps/ieee754/ldbl-opt/s_asinh.c: Remove file. * sysdeps/ieee754/ldbl-opt/s_cbrt.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_erf.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_expm1.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_fabs.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_llrint.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_lrint.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_sin.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_sincos.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_tanh.c: Likewise.
* Make more libm functions into weak aliases.Joseph Myers2017-09-141-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many libm functions define the function as __<func> and then define <func> as a weak alias. This is not at all limited to cases where there is an internal call that has namespace reasons to need to call __<func> instead of <func>. The common macros for creating libm function aliases work on the basis of public function names all being aliases; that is, they define aliases for functions using the above pattern. Thus, where a function just defines the public name <func> directly, changing that to be a weak alias enables a subsequent conversion to the common macros to retain the exact existing symbols (and so be testable by comparison of stripped binaries). This patch converts many existing functions to use the weak alias pattern, as preparation for subsequent conversions to common macros. I do expect that _FloatN/_FloatNx function aliases will end up needing new variants of the common macros that do *not* create the original float / double / long double name of a function - for cases where that name is created specially to give it a particular symbol version, for example - but for functions that can use the most common macros to create all the public names as aliases, it makes sense for them to do so. Regarding the Bessel function wrappers in this patch: only float and double wrappers are changed because the long double wrappers already used the weak alias pattern. Tested for x86_64, and with build-many-glibcs.py. * include/math.h (roundeven): Change hidden_proto call to __roundeven. * math/w_j0_compat.c (j0): Rename to __j0 and define as weak alias. [NO_LONG_DOUBLE] (__j0l): New strong alias. (y0): Rename to __y0 and define as weak alias. [NO_LONG_DOUBLE] (__y0l): New strong alias. * math/w_j0f_compat.c (j0f): Rename to __j0f and define as weak alias. (y0f): Rename to __y0f and define as weak alias. * math/w_j1_compat.c (j1): Rename to __j1 and define as weak alias. [NO_LONG_DOUBLE] (__j1l): New strong alias. (y1): Rename to __y1 and define as weak alias. [NO_LONG_DOUBLE] (__y1l): New strong alias. * math/w_j1f_compat.c (j1f): Rename to __j1f and define as weak alias. (y1f): Rename to __y1f and define as weak alias. * math/w_jn_compat.c (jn): Rename to __jn and define as weak alias. [NO_LONG_DOUBLE] (__jnl): New strong alias. (yn): Rename to __yn and define as weak alias. [NO_LONG_DOUBLE] (__ynl): New strong alias. * math/w_jnf_compat.c (jnf): Rename to __jnf and define as weak alias. (ynf): Rename to __ynf and define as weak alias. * sysdeps/ieee754/dbl-64/s_fromfp.c (FUNC): Define to __fromfp. (fromfp): Define as weak alias. [NO_LONG_DOUBLE] (__fromfpl): New strong alias. * sysdeps/ieee754/dbl-64/s_fromfpx.c (FUNC): Define to __fromfpx. (fromfpx): Define as weak alias. [NO_LONG_DOUBLE] (__fromfpxl): New strong alias. * sysdeps/ieee754/dbl-64/s_getpayload.c (getpayload): Rename to __getpayload and define as weak alias. [NO_LONG_DOUBLE] (__getpayloadl): New strong alias. * sysdeps/ieee754/dbl-64/s_roundeven.c (roundeven): Rename to __roundeven and define as weak alias. [NO_LONG_DOUBLE] (__roundevenl): New strong alias. * sysdeps/ieee754/dbl-64/s_setpayload.c (FUNC): Define to __setpayload. (setpayload): Define as weak alias. [NO_LONG_DOUBLE] (__setpayloadl): New strong alias. * sysdeps/ieee754/dbl-64/s_setpayloadsig.c (FUNC): Define to __setpayloadsig. (setpayloadsig): Define as weak alias. [NO_LONG_DOUBLE] (__setpayloadsigl): New strong alias. * sysdeps/ieee754/dbl-64/s_totalorder.c (totalorder): Rename to __totalorder and define as weak alias. [NO_LONG_DOUBLE] (__totalorderl): New strong alias. * sysdeps/ieee754/dbl-64/s_totalordermag.c (totalordermag): Rename to __totalordermag and define as weak alias. [NO_LONG_DOUBLE] (__totalordermagl): New strong alias. * sysdeps/ieee754/dbl-64/s_ufromfp.c (FUNC): Define to __ufromfp. (ufromfp): Define as weak alias. [NO_LONG_DOUBLE] (__ufromfpl): New strong alias. * sysdeps/ieee754/dbl-64/s_ufromfpx.c (FUNC): Define to __ufromfpx. (ufromfpx): Define as weak alias. [NO_LONG_DOUBLE] (__ufromfpxl): New strong alias. * sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c (getpayload): Rename to __getpayload and define as weak alias. [NO_LONG_DOUBLE] (__getpayloadl): New strong alias. * sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c (roundeven): Rename to __roundeven and define as weak alias. [NO_LONG_DOUBLE] (__roundevenl): New strong alias. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c (totalorder): Rename to __totalorder and define as weak alias. [NO_LONG_DOUBLE] (__totalorderl): New strong alias. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c (totalordermag): Rename to __totalordermag and define as weak alias. [NO_LONG_DOUBLE] (__totalordermagl): New strong alias. * sysdeps/ieee754/float128/float128_private.h (__getpayloadl): New macro. (__roundevenl): Likewise. (__totalorderl): Likewise. (__totalordermagl): Likewise * sysdeps/ieee754/float128/s_fromfpf128.c (FUNC): Define to __fromfpf128. (fromfpf128): Define as weak alias. * sysdeps/ieee754/float128/s_fromfpxf128.c (FUNC): Define to __fromfpxf128. (fromfpxf128): Define as weak alias. * sysdeps/ieee754/float128/s_setpayloadf128.c (FUNC): Define to __setpayloadf128. (setpayloadf128): Define as weak alias. * sysdeps/ieee754/float128/s_setpayloadsigf128.c (FUNC): Define to __setpayloadsigf128. (setpayloadsigf128): Define as weak alias. * sysdeps/ieee754/float128/s_ufromfpf128.c (FUNC): Define to __ufromfpf128. (ufromfpf128): Define as weak alias. * sysdeps/ieee754/float128/s_ufromfpxf128.c (FUNC): Define to __ufromfpxf128. (ufromfpxf128): Define as weak alias. * sysdeps/ieee754/flt-32/s_fromfpf.c (FUNC): Define to __fromfpf. (fromfpf): Define as weak alias. * sysdeps/ieee754/flt-32/s_fromfpxf.c (FUNC): Define to __fromfpxf. (fromfpxf): Define as weak alias. * sysdeps/ieee754/flt-32/s_getpayloadf.c (getpayloadf): Rename to __getpayloadf and define as weak alias. * sysdeps/ieee754/flt-32/s_roundevenf.c (roundevenf): Rename to __roundevenf and define as weak alias. * sysdeps/ieee754/flt-32/s_setpayloadf.c (FUNC): Define to __setpayloadf. (setpayloadf): Define as weak alias. * sysdeps/ieee754/flt-32/s_setpayloadsigf.c (FUNC): Define to __setpayloadsigf. (setpayloadsigf): Define as weak alias. * sysdeps/ieee754/flt-32/s_totalorderf.c (totalorderf): Rename to __totalorderf and define as weak alias. * sysdeps/ieee754/flt-32/s_totalordermagf.c (totalordermagf): Rename to __totalordermagf and define as weak alias. * sysdeps/ieee754/flt-32/s_ufromfpf.c (FUNC): Define to __ufromfpf. (ufromfpf): Define as weak alias. * sysdeps/ieee754/flt-32/s_ufromfpxf.c (FUNC): Define to __ufromfpxf. (ufromfpxf): Define as weak alias. * sysdeps/ieee754/ldbl-128/s_fromfpl.c (FUNC): Define to __fromfpl. (fromfpl): Define as weak alias. * sysdeps/ieee754/ldbl-128/s_fromfpxl.c (FUNC): Define to __fromfpxl. (fromfpxl): Define as weak alias. * sysdeps/ieee754/ldbl-128/s_getpayloadl.c (getpayloadl): Rename to __getpayloadl and define as weak alias. * sysdeps/ieee754/ldbl-128/s_roundevenl.c (roundevenl): Rename to __roundevenl and define as weak alias. * sysdeps/ieee754/ldbl-128/s_setpayloadl.c (FUNC): Define to __setpayloadl. (setpayloadl): Define as weak alias. * sysdeps/ieee754/ldbl-128/s_setpayloadsigl.c (FUNC): Define to __setpayloadsigl. (setpayloadsigl): Define as weak alias. * sysdeps/ieee754/ldbl-128/s_totalorderl.c (totalorderl): Rename to __totalorderl and define as weak alias. * sysdeps/ieee754/ldbl-128/s_totalordermagl.c (totalordermagl): Rename to __totalordermagl and define as weak alias. * sysdeps/ieee754/ldbl-128/s_ufromfpl.c (FUNC): Define to __ufromfpl. (ufromfpl): Define as weak alias. * sysdeps/ieee754/ldbl-128/s_ufromfpxl.c (FUNC): Define to __ufromfpxl. (ufromfpxl): Define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c (FUNC): Define to __fromfpl. (fromfpl): Define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c (FUNC): Define to __fromfpxl. (fromfpxl): Define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_getpayloadl.c (getpayloadl): Rename to __getpayloadl and define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c (roundevenl): Rename to __roundevenl and define as weak alias. Call __roundeven instead of roundeven. * sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c (FUNC): Define to __setpayloadl. (setpayloadl): Define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c (FUNC): Define to __setpayloadsigl. (setpayloadsigl): Define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c (totalorderl): Rename to __totalorderl and define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c (totalordermagl): Rename to __totalordermagl and define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c (FUNC): Define to __ufromfpl. (ufromfpl): Define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c (FUNC): Define to __ufromfpxl. (ufromfpxl): Define as weak alias. * sysdeps/ieee754/ldbl-96/s_fromfpl.c (FUNC): Define to __fromfpl. (fromfpl): Define as weak alias. * sysdeps/ieee754/ldbl-96/s_fromfpxl.c (FUNC): Define to __fromfpxl. (fromfpxl): Define as weak alias. * sysdeps/ieee754/ldbl-96/s_getpayloadl.c (getpayloadl): Rename to __getpayloadl and define as weak alias. * sysdeps/ieee754/ldbl-96/s_roundevenl.c (roundevenl): Rename to __roundevenl and define as weak alias. * sysdeps/ieee754/ldbl-96/s_setpayloadl.c (FUNC): Define to __setpayloadl. (setpayloadl): Define as weak alias. * sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c (FUNC): Define to __setpayloadsigl. (setpayloadsigl): Define as weak alias. * sysdeps/ieee754/ldbl-96/s_totalorderl.c (totalorderl): Rename to __totalorderl and define as weak alias. * sysdeps/ieee754/ldbl-96/s_totalordermagl.c (totalordermagl): Rename to __totalordermagl and define as weak alias. * sysdeps/ieee754/ldbl-96/s_ufromfpl.c (FUNC): Define to __ufromfpl. (ufromfpl): Define as weak alias. * sysdeps/ieee754/ldbl-96/s_ufromfpxl.c (FUNC): Define to __ufromfpxl. (ufromfpxl): Define as weak alias.
* Add setpayload, setpayloadf, setpayloadl.Joseph Myers2016-11-191-0/+6
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.