about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-opt
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix ldbl-opt/s_clog10l.c libm_alias_ldouble_other usage.Joseph Myers2017-10-131-3/+3
| | | | | | | | | | | | | | | | | | | | | Testing with changes to enable _Float128 function aliases shows that the libm_alias_ldouble_other usage in ldbl-opt/s_clog10l.c does not in fact work, because __clog10l is defined with long_double_symbol rather than as a normal C alias. This patch fixes this by renaming the __clog10l__internal alias (not strictly necessary, but avoids a hack with "__clog10l_interna" / "__clog10l__interna" as first argument to libm_alias_ldouble_other) and using the renamed alias when calling libm_alias_ldouble_other. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanges by the patch. Also tested in conjunction with patches to enable _Float128 function aliases. * sysdeps/ieee754/ldbl-opt/s_clog10l.c (__clog10l__internal): Rename to __clog10_internal_l. (__clog10_internal_l): Define aliases using libm_alias_ldouble_other instead of using libm_alias_ldouble_other with __clog10.
* Use generic alias macros in ldbl-opt.Joseph Myers2017-10-114-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes ldbl-opt code to use generic libm alias macros in preparation for getting _FloatN / _FloatNx aliases where appropriate. Four functions are affected, that undefine and redefine alias macros before including the implementations they wrap in such a way that _FloatN / _FloatNx aliases would not appear. s_clog10l.c undefines and redefined declare_mgen_alias, so just needs a libm_alias_ldouble_other call added. w_exp10l_compat.c undefines and redefines weak_alias, but in fact does not need to do so, since math/w_exp10l_compat.c uses libm_alias_ldouble and does not use weak_alias other than through that, so the undefines and redefines of weak_alias are removed. w_lgamma_compatl.c and w_remainderl_compat.c are made to use libm_alias_ldouble_other in conjunction with restoring the original definition of weak_alias so this is effective. Tested with build-many-glibcs.py. Installed stripped shared libraries are unchanged by this patch. * sysdeps/ieee754/ldbl-opt/s_clog10l.c: Use libm_alias_ldouble_other. * sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c (weak_alias): Do not undefine and redefine. [LIBM_SVID_COMPAT && !LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)] (exp10l): Do not define here. * sysdeps/ieee754/ldbl-opt/w_lgamma_compatl.c [BUILD_LGAMMA] (weak_alias): Undefine and redefine. [BUILD_LGAMMA]: Use libm_alias_ldouble_other. * sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c [LIBM_SVID_COMPAT] (weak_alias): Undefine and redefine here. [LIBM_SVID_COMPAT]: Use libm_alias_ldouble_other.
* Add libm_alias_*_other_r macros.Joseph Myers2017-10-102-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some libm functions are unable to use the generic alias macros such as libm_alias_double because they have special symbol versioning requirements for the main float, double or long double public names. To facilitate adding _FloatN / _FloatNx function aliases in future, it's still desirable to have generic macros those functions can use as far as possible. This patch adds macros such as libm_alias_double_other, which only define names for _FloatN / _FloatNx aliases, not for float / double / long double. As present, all these new macros do nothing, but they are called in the appropriate places in macros such as libm_alias_double. This patch also arranges for lgamma implementations, and the recently added optimized float function implementations, to use the new macros to make them ready for addition of _FloatN / _FloatNx aliases. Tested for x86_64, and tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. * sysdeps/generic/libm-alias-double.h (libm_alias_double_other_r): New macro. (libm_alias_double_other): Likewise. (libm_alias_double_r): Use libm_alias_double_other_r. * sysdeps/generic/libm-alias-float.h (libm_alias_float_other_r): New macro. (libm_alias_float_other): Likewise. (libm_alias_float_r): Use libm_alias_float_other_r. * sysdeps/generic/libm-alias-float128.h (libm_alias_float128_other_r): New macro. (libm_alias_float128_other): Likewise. (libm_alias_float128_r): Use libm_alias_float128_other_r. * sysdeps/generic/libm-alias-ldouble.h (libm_alias_ldouble_other_r): New macro. (libm_alias_ldouble_other): Likewise. (libm_alias_ldouble_r): Use libm_alias_ldouble_other_r. * sysdeps/ieee754/ldbl-opt/libm-alias-double.h (libm_alias_double_other_r): New macro. (libm_alias_double_other): Likewise. (libm_alias_double_r): Use libm_alias_double_other_r. * sysdeps/ieee754/ldbl-opt/libm-alias-ldouble.h (libm_alias_ldouble_other_r): New macro. (libm_alias_ldouble_other): Likewise. (libm_alias_ldouble_r): Use libm_alias_ldouble_other_r. * math/w_lgamma_main.c: Include <libm-alias-double.h>. [!USE_AS_COMPAT]: Use libm_alias_double_other. * math/w_lgammaf_main.c: Include <libm-alias-float.h>. [!USE_AS_COMPAT]: Use libm_alias_float_other. * math/w_lgammal_main.c: Include <libm-alias-ldouble.h>. [!USE_AS_COMPAT]: Use libm_alias_ldouble_other. * math/w_exp2f.c: Use libm_alias_float_other. * math/w_expf.c: Likewise. * math/w_log2f.c: Likewise. * math/w_logf.c: Likewise. * math/w_powf.c: Likewise. * sysdeps/ieee754/flt-32/e_exp2f.c: Include <libm-alias-float.h>. [!__exp2f]: Use libm_alias_float_other. * sysdeps/ieee754/flt-32/e_expf.c: Include <libm-alias-float.h>. [!__expf]: Use libm_alias_float_other. * sysdeps/ieee754/flt-32/e_log2f.c: Include <libm-alias-float.h>. [!__log2f]: Use libm_alias_float_other. * sysdeps/ieee754/flt-32/e_logf.c: Include <libm-alias-float.h>. [!__logf]: Use libm_alias_float_other. * sysdeps/ieee754/flt-32/e_powf.c: Include <libm-alias-float.h>. [!__powf]: Use libm_alias_float_other.
* Use generic macros for lgamma_r function aliases.Joseph Myers2017-10-092-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the use of generic macros for defining libm function aliases, in preparation for adding more _FloatN / _FloatNx function names, this patch makes the lgamma_r functions use such macros. declare_mgen_alias_r becomes a standard macro in math-type-macros.h instead of being locally defined in w_lgamma_r_templace.c. This in turn must be defined by each math-type-macros-<type>.h. Rather than providing an unused default in math-type-macros.h, that header is made to give an error if math-type-macros-<type>.h failed to define declare_mgen_alias or declare_mgen_alias_r. The compat lgamma_r wrappers are updated similarly. The ldbl-opt versions are removed as no longer needed. Tested for x86_64, and with build-many-glibcs.py. Installed stripped shared libraries are unchanged except for powerpc64le (where the usual issue applies that an ldbl-opt long double function previously used long_double_symbol unconditionally and now the symbol versions on powerpc64le mean weak_alias is used instead, resulting in the same symbol versions in the final shared library but still enough difference in the input objects for that library not to be byte-identical). * sysdeps/generic/math-type-macros.h [!declare_mgen_alias]: Give error. Remove default definition of declare_mgen_alias. [!declare_mgen_alias_r]: Likewise. * sysdeps/generic/math-type-macros-double.h [!declare_mgen_alias_r] (declare_mgen_alias_r): New macro. * sysdeps/generic/math-type-macros-float.h [!declare_mgen_alias_r] (declare_mgen_alias_r): Likewise. * sysdeps/generic/math-type-macros-float128.h [!declare_mgen_alias_r] (declare_mgen_alias_r): Likewise. * sysdeps/generic/math-type-macros-ldouble.h [!declare_mgen_alias_r] (declare_mgen_alias_r): Likewise. * math/w_lgamma_r_template.c (declare_mgen_alias_r_x): Remove macro. (declare_mgen_alias_r_s): Likewise. (declare_mgen_alias_r): Likewise. * math/w_lgamma_r_compat.c: Include <libm-alias-double.h>. (lgamma_r): Define using libm_alias_double_r. * math/w_lgammaf_r_compat.c: Include <libm-alias-float.h>. (lgammaf_r): Define using libm_alias_float_r. * math/w_lgammal_r_compat.c: Include <libm-alias-ldouble.h>. (lgammal_r): Define using libm_alias_ldouble_r. * sysdeps/ieee754/ldbl-opt/w_lgamma_r_compat.c: Remove file. * sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c: Likewise.
* Remove ldbl-opt w_scalbln.c.Joseph Myers2017-10-091-5/+0
| | | | | | | | | | | The ldbl-opt version of w_scalbln.c is not in fact needed; it handles compat symbol versions for libc, but this file isn't built for libc, only for libm. This patch removes this file. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. * sysdeps/ieee754/ldbl-opt/w_scalbln.c: Remove file.
* Use libm_alias_double for dbl-64 fma.Joseph Myers2017-10-041-5/+0
| | | | | | | | | | | | | | | | | | | This patch makes dbl-64 fma use libm_alias_double. The ldbl-opt version is removed. The sparc32 version no longer needs to handle compat symbols, while alpha needs a new wrapper to avoid getting the ldbl-128 version (where ldbl-opt is earlier in the list of sysdeps directories, so previously fma came from there). 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_fma.c: Include <libm-alias-double.h>. (fma): Define using libm_alias_double. * sysdeps/ieee754/ldbl-opt/s_fma.c: Remove file. * sysdeps/sparc/sparc32/fpu/s_fma.c: Do not include <math_ldbl_opt.h>. (fmal): Do not define as compat symbol here. * sysdeps/alpha/fpu/s_fma.c: New file.
* Use libm_alias_double for dbl-64 modf.Joseph Myers2017-10-031-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes dbl-64 modf use libm_alias_double. Both the dbl-64 and dbl-64/wordsize-64 versions are changed, and the ldbl-opt version is changed to define the libc compat symbol only. Because of multiarch wrappers, the changed implementations are made not to define aliases at all if __modf is defined as a macro, as with other functions, so avoiding duplicate compat symbols while allowing those wrappers to be simplified. Tested for x86_64, and verified with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/ieee754/dbl-64/s_modf.c: Include <libm-alias-double.h>. (modf): Define using libm_alias_double, only if [!__modf]. * sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c: Include <libm-alias-double.h>. (modf): Define using libm_alias_double, only if [!__modf]. * sysdeps/ieee754/ldbl-opt/s_modf.c (modfl): Only define libc compat symbol here. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-ppc32.c (weak_alias): Do not undefine and redefine. (strong_alias): Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-ppc64.c (weak_alias): Likewise. (strong_alias): Likewise.
* Use libm_alias_double for dbl-64 logb.Joseph Myers2017-10-031-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes dbl-64 logb use libm_alias_double. Both the dbl-64 and dbl-64/wordsize-64 versions are changed, and the ldbl-opt version is removed. Because of multiarch wrappers, the changed implementations are made not to define aliases at all if __logb is defined as a macro, as with other functions, so avoiding duplicate compat symbols while allowing those wrappers to be simplified. Tested for x86_64, and verified with build-many-glibcs.py that installed stripped shared libraries are unchanged (except on alpha where changes from using the wordsize-64 version are expected). * sysdeps/ieee754/dbl-64/s_logb.c: Include <libm-alias-double.h>. (logb): Define using libm_alias_double, only if [!__logb]. * sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c: Include <libm-alias-double.h>. (logb): Define using libm_alias_double, only if [!__logb]. * sysdeps/ieee754/ldbl-opt/s_logb.c: Remove file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-ppc32.c (weak_alias): Do not undefine and redefine. (strong_alias): Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c (weak_alias): Likewise. (strong_alias): Likewise.
* Use libm_alias_double for dbl-64 frexp.Joseph Myers2017-10-031-5/+1
| | | | | | | | | | | | | | | | | | This patch makes dbl-64 frexp use libm_alias_double. Both the dbl-64 and dbl-64/wordsize-64 versions are changed; the ldbl-opt version is made to define only the libc frexpl compat symbol, now the generic code handles the libm compat symbol automatically. Tested for x86_64, and verified with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. * sysdeps/ieee754/dbl-64/s_frexp.c: Include <libm-alias-double.h>. (frexp): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c: Include <libm-alias-double.h>. (frexp): Define using libm_alias_double. * sysdeps/ieee754/ldbl-opt/s_frexp.c (frexpl): Only define libc compat symbol here.
* Use libm_alias_double for more dbl-64 functions.Joseph Myers2017-10-039-45/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes more dbl-64 functions use libm_alias_double to define function aliases. Specifically, it makes the change for functions with dbl-64/wordsize-64 versions, changing both the dbl-64 and dbl-64/wordsize-64 versions and removing the ldbl-opt wrappers. Functions are excluded from this patch if there are complications because of versions of those functions also present in libc, or architecture-specific wrappers round these files. Tested for x86_64, and with build-many-glibcs.py. Installed stripped shared libraries are unchanged except for alpha (where increased use of dbl-64/wordsize-64 files, where previously ldbl-opt files that wrapped dbl-64 files were used, was expected to result in different, better code). * sysdeps/ieee754/dbl-64/s_ceil.c: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_floor.c: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_llround.c: Include <libm-alias-double.h>. (llround): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_lround.c: Include <libm-alias-double.h>. (lround): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_nearbyint.c: Include <libm-alias-double.h>. (nearbyint): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_remquo.c: Include <libm-alias-double.h>. (remquo): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_rint.c: Include <libm-alias-double.h>. (rint): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_round.c: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_trunc.c: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c: Include <libm-alias-double.h>. (llround): Define using libm_alias_double. [_LP64] (lround): Likewise. * sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Include <libm-alias-double.h>. [!_LP64] (lround): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c: Include <libm-alias-double.h>. (nearbyint): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c: Include <libm-alias-double.h>. (remquo): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c: Include <libm-alias-double.h>. (rint): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_round.c: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/ieee754/ldbl-opt/s_ceil.c: Remove file. * sysdeps/ieee754/ldbl-opt/s_floor.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_llround.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_lround.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_nearbyint.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_remquo.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_rint.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_round.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_trunc.c: Likewise.
* Use libm_alias_double for dbl-64 atan, tan.Joseph Myers2017-10-022-10/+0
| | | | | | | | | | | | | | | | | | | This patch makes the dbl-64 atan and tan implementations use libm_alias_double, removing the corresponding ldbl-opt wrappers. Tested for x86_64, and with build-many-glibcs.py. Installed stripped shared libraries are unchanged on non-ldbl-opt platforms. For ldbl-opt configurations, the patch has the effect of causing compat_symbol to define atanl and tanl in terms of __atan and __tan instead of in terms of atan and tan, which is enough to change the installed stripped libm.so. * sysdeps/ieee754/dbl-64/s_atan.c: Include <libm-alias-double.h>. (atan): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_tan.c: Include <libm-alias-double.h>. (tan): Define using libm_alias_double. * sysdeps/ieee754/ldbl-opt/s_atan.c: Remove file. * sysdeps/ieee754/ldbl-opt/s_tan.c: Likewise.
* Use libm_alias_double for some dbl-64 functions.Joseph Myers2017-09-2911-66/+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.
* Fix powerpc64le problem from last ldbl-opt patch.Joseph Myers2017-09-182-0/+16
| | | | | | | | | | | | | | | | | | | | | | This patch fixes a problem on powerpc64le that I missed in initial testing of my last patch to ldbl-opt. In the specific case of powerpc64le, the weak aliases for exp10l and remainderl do not get defined in the generic wrappers because of how those wrappers undefine and redefine weak_alias. This patch restores those aliases in the ldbl-opt code. Tested (compilation only) for powerpc64le with build-many-glibcs.py. * sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c [LIBM_SVID_COMPAT && !LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)] (weak_alias): Undefine and redefine. [LIBM_SVID_COMPAT && !LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)] (exp10l): Define as weak alias. * sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c [LIBM_SVID_COMPAT && !LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)] (weak_alias): Undefine and redefine. [LIBM_SVID_COMPAT && !LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)] (remainderl): Define as weak alias.
* Use libm_alias_ldouble in math/.Joseph Myers2017-09-1822-143/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch converts libm function implementations in math/ from using weak_alias to using libm_alias_ldouble to define public function names, in cases where it would be appropriate to define _Float128 / _Float64x aliases for those functions as well (in cases where either or both of those types exist and have the same ABI as long double). This eliminates many ldbl-opt wrappers round these function implementations. Tested for x86_64, and with build-many-glibcs.py. All installed stripped shared libraries are unchanged except for libm.so on powerpc64le. As noted for a previous patch, powerpc64le's use of ldbl-opt means various long double functions get defined using long_double_symbol which gives them an explicit symbol version in the object files, and this patch results in some such functions using weak_alias instead (because powerpc64le never had a previous version of these functions for long double = double); both produce a valid libm.so with the same public symbols at the same versions, but macros expanding to call weak_alias is cleaner in this case. * math/s_fmal.c: Include <libm-alias-ldouble.h>. (fmal): Define using libm_alias_ldouble. * math/w_acoshl_compat.c: Include <libm-alias-ldouble.h>. (acoshl): Define using libm_alias_ldouble. * math/w_acosl_compat.c: Include <libm-alias-ldouble.h>. (acosl): Define using libm_alias_ldouble. * math/w_asinl_compat.c: Include <libm-alias-ldouble.h>. (asinl): Define using libm_alias_ldouble. * math/w_atan2l_compat.c: Include <libm-alias-ldouble.h>. (atan2l): Define using libm_alias_ldouble. * math/w_atanhl_compat.c: Include <libm-alias-ldouble.h>. (atanhl): Define using libm_alias_ldouble. * math/w_coshl_compat.c: Include <libm-alias-ldouble.h>. (coshl): Define using libm_alias_ldouble. * math/w_exp10l_compat.c: Include <libm-alias-ldouble.h>. (exp10l): Define using libm_alias_ldouble. * math/w_exp2l_compat.c: Include <libm-alias-ldouble.h>. (exp2l): Define using libm_alias_ldouble. * math/w_expl_compat.c: Include <libm-alias-ldouble.h>. (expl): Define using libm_alias_ldouble. * math/w_fmodl_compat.c: Include <libm-alias-ldouble.h>. (fmodl): Define using libm_alias_ldouble. * math/w_hypotl_compat.c: Include <libm-alias-ldouble.h>. (hypotl): Define using libm_alias_ldouble. * math/w_j0l_compat.c: Include <libm-alias-ldouble.h>. (j0l): Define using libm_alias_ldouble. (y0l): Likewise. * math/w_j1l_compat.c: Include <libm-alias-ldouble.h>. (j1l): Define using libm_alias_ldouble. (y1l): Likewise. * math/w_jnl_compat.c: Include <libm-alias-ldouble.h>. (jnl): Define using libm_alias_ldouble. (ynl): Likewise. * math/w_log10l_compat.c: Include <libm-alias-ldouble.h>. (log10l): Define using libm_alias_ldouble. * math/w_log2l_compat.c: Include <libm-alias-ldouble.h>. (log2l): Define using libm_alias_ldouble. * math/w_logl_compat.c: Include <libm-alias-ldouble.h>. (logl): Define using libm_alias_ldouble. * math/w_powl_compat.c: Include <libm-alias-ldouble.h>. (powl): Define using libm_alias_ldouble. * math/w_remainderl_compat.c: Include <libm-alias-ldouble.h>. (remainderl): Define using libm_alias_ldouble. * math/w_sinhl_compat.c: Include <libm-alias-ldouble.h>. (sinhl): Define using libm_alias_ldouble. * math/w_sqrtl_compat.c: Include <libm-alias-ldouble.h>. (sqrtl): Define using libm_alias_ldouble. * math/w_tgammal_compat.c: Include <libm-alias-ldouble.h>. (tgammal): Define using libm_alias_ldouble. * sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c [LIBM_SVID_COMPAT] (exp10l): Do not use long_double_symbol here. * sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c [LIBM_SVID_COMPAT] (remainderl): Likewise. * sysdeps/ieee754/ldbl-opt/s_fmal.c: Remove. * sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_acosl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_asinl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_coshl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_j0l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_j1l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_jnl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log10l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log2l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_logl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_powl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c: Likewise.
* Use libm_alias_double in math/.Joseph Myers2017-09-1522-103/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch converts libm function implementations in math/ from using weak_alias to using libm_alias_double to define public function names, in cases where it would be appropriate to define _Float64 / _Float32x aliases for those functions as well. This eliminates many NO_LONG_DOUBLE conditionals and ldbl-opt wrappers round these function implementations. Tested for x86_64. Also tested with build-many-glibcs.py. Binary differences seen are that the different order in which remainder and drem symbols get defined as a result of this patch (the same source file defines the same aliases, but in a different order of definition) changes the order of symbols in the final libm.so when long double = double, and for ldbl-opt configurations, the compat symbols for Bessel functions were previously defined by e.g. "compat_symbol (libm, j0, j0l, GLIBC_2_0)", which declares j0l as a compat symbol based on j0 and so makes j0l weak because j0 is weak, and are now defined (indirectly via the relevant macros) based on e.g. __j0, so are no longer weak because __j0 isn't weak. * math/s_fma.c: Include <libm-alias-double.h>. (fma): Define using libm_alias_double. * math/s_nextafter.c: Include <libm-alias-double.h>. (nextafter): Define using libm_alias_double. * math/w_acos_compat.c: Include <libm-alias-double.h>. (acos): Define using libm_alias_double. * math/w_acosh_compat.c: Include <libm-alias-double.h>. (aocsh): Define using libm_alias_double. * math/w_asin_compat.c: Include <libm-alias-double.h>. (asin): Define using libm_alias_double. * math/w_atan2_compat.c: Include <libm-alias-double.h>. (atan2): Define using libm_alias_double. * math/w_atanh_compat.c: Include <libm-alias-double.h>. (atanh): Define using libm_alias_double. * math/w_cosh_compat.c: Include <libm-alias-double.h>. (cosh): Define using libm_alias_double. * math/w_exp10_compat.c: Include <libm-alias-double.h>. (exp10): Define using libm_alias_double. * math/w_exp2_compat.c: Include <libm-alias-double.h>. (exp2): Define using libm_alias_double. * math/w_exp_compat.c: Include <libm-alias-double.h>. (exp): Define using libm_alias_double. * math/w_fmod_compat.c: Include <libm-alias-double.h>. (fmod): Define using libm_alias_double. * math/w_hypot_compat.c: Include <libm-alias-double.h>. (hypot): Define using libm_alias_double. * math/w_j0_compat.c: Include <libm-alias-double.h>. (j0): Define using libm_alias_double. (y0): Likewise. * math/w_j1_compat.c: Include <libm-alias-double.h>. (j1): Define using libm_alias_double. (y1): Likewise. * math/w_jn_compat.c: Include <libm-alias-double.h>. (jn): Define using libm_alias_double. (yn): Likewise. * math/w_log10_compat.c: Include <libm-alias-double.h>. (log10): Define using libm_alias_double. * math/w_log2_compat.c: Include <libm-alias-double.h>. (log2): Define using libm_alias_double. * math/w_log_compat.c: Include <libm-alias-double.h>. (log): Define using libm_alias_double. * math/w_pow_compat.c: Include <libm-alias-double.h>. (pow): Define using libm_alias_double. * math/w_remainder_compat.c: Include <libm-alias-double.h>. (remainder): Define using libm_alias_double. * math/w_sinh_compat.c: Include <libm-alias-double.h>. (sinh): Define using libm_alias_double. * math/w_sqrt_compat.c: Include <libm-alias-double.h>. (sqrt): Define using libm_alias_double. * math/w_tgamma_compat.c: Include <libm-alias-double.h>. (tgamma): Define using libm_alias_double. * sysdeps/ieee754/ldbl-opt/s_nextafter.c [LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (nextafterl): Do not define compat symbol here. * sysdeps/ieee754/ldbl-opt/w_exp10_compat.c [LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)] (exp10l): Likewise. * sysdeps/ieee754/ldbl-opt/w_remainder_compat.c [LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (remainderl): Likewise. * sysdeps/ieee754/ldbl-opt/w_acos_compat.c: Remove. * sysdeps/ieee754/ldbl-opt/w_acosh_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_asin_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_atan2_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_atanh_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_cosh_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_exp_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_fmod_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_hypot_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_j0_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_j1_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_jn_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log10_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log2_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_pow_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_sinh_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_sqrt_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_tgamma_compat.c: Likewise.
* Define and use libm_alias_ldouble.Joseph Myers2017-09-132-38/+41
| | | | | | | | | | | | | | | | | | | | | | | | | Continuing the process of setting up common macros for libm function aliases, with a view to using them to define _FloatN / _FloatNx aliases in future, this patch adds a libm_alias_ldouble macro and uses it in the type-generic templates. Since math-type-macros-ldouble.h already did the appropriate thing for each symbol (weak_alias or long_double_symbol), this is just a straightforward rearrangement of code, to make the required logic available in a place that can also be used outside of the type-generic templates in future (in particular, to eliminate various wrappers for functions in ldbl-opt and ldbl-64-128). Tested for x86_64. Also tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/generic/libm-alias-ldouble.h: New file. * sysdeps/ieee754/ldbl-opt/libm-alias-ldouble.h: Likewise. * sysdeps/ieee754/ldbl-opt/math-type-macros-ldouble.h: Remove. * sysdeps/generic/math-type-macros-ldouble.h: Include <libm-alias-ldouble.h>. [!declare_mgen_alias] (declare_mgen_alias): Define to use libm_alias_ldouble.
* Move exp compat wrappers under math/Szabolcs Nagy2017-09-132-1/+8
| | | | | | | | | | | | | | | | Move exp compat wrappers to math/w_exp{,f,l}_compat.c to be consistent with other wrappers. * sysdeps/ieee754/dbl-64/w_exp_compat.c: Move to... * math/w_exp_compat.c: ... here. * sysdeps/ieee754/flt-32/w_expf_compat.c: Move to... * math/w_expf_compat.c: ... here. * sysdeps/ieee754/ldbl-128/w_expl_compat.c: Move to... * math/w_expl_compat.c: ... here. * sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Remove. * sysdeps/ieee754/ldbl-96/w_expl_compat.c: Remove. * sysdeps/ieee754/ldbl-opt/w_exp_compat.c: Use the new path. * sysdeps/ieee754/ldbl-opt/w_expl_compat.c: Likewise.
* Clear up log1p, ldexp, scalbn, scalbln compat handling.Joseph Myers2017-09-137-40/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch cleans up how compat symbols / long double versioning are handled for log1p, ldexp, scalbn and scalbln functions. The general principle is to do as much as possible through the type-generic templates. Previously, when errno-setting wrappers were added the compat long double symbols were left pointing directly to the underlying implementations; they are moved to point to the errno-setting wrappers. For the functions also present in libc, compat symbol handling for the libc copies needs to go in ldbl-opt wrappers, but the type-generic templates can handle it for the libm copies. There is no need for w_scalbln_template.c to disable the creation of an unused internal alias (such code made sense in the context of patches trying to avoid any changes to generated code for ease of comparison, but can be removed in a change that specifically does intend to change details of where symbols point). Tested for x86_64, and with build-many-glibcs.py. * math/w_scalbln_template.c (strong_alias): Do not undefine and redefine. * sysdeps/ieee754/ldbl-opt/s_ldexp.c (declare_mgen_alias): Remove macro. (ldexpl): Only define as compat symbol for libc, not libm. (scalbnl): Define as compat symbol for libc here. * sysdeps/ieee754/ldbl-opt/s_ldexpl.c (declare_mgen_alias): Only define for [IS_IN (libc)]. (__ldexpl_2): Remove alias. (ldexpl): Only define with long_double_symbol if [IS_IN (libc)]. (scalbnl): Likewise. Use __wrap_scalbnl not __ldexpl_2 as base name in long_double_symbol call. * sysdeps/ieee754/ldbl-opt/s_log1p.c: Remove file. * sysdeps/ieee754/ldbl-opt/s_scalbln.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_scalbn.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log1p.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_scalbln.c (declare_mgen_alias): Remove macro. [IS_IN (libc) && LONG_DOUBLE_COMPAT (libc, GLIBC_2_1)] (scalblnl): Define as compat symbol.
* Define and use libm_alias_double.Joseph Myers2017-09-135-18/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the process of setting up common macros for libm function aliases, with a view to using them to define _FloatN / _FloatNx aliases in future, this patch adds a libm_alias_double macro and uses it in the type-generic templates. This macro handles defining aliases for double, and for long double in the NO_LONG_DOUBLE case. It also handles defining compat symbols for long double = double for architectures that changed their long double format. By so doing, it eliminates the need for the M_LIBM_NEED_COMPAT and declare_mgen_libm_compat macros; the single declare_mgen_alias call in each template now suffices to define all required compat symbols. When used for more double functions (not based on type-generic templates), I expect it will eliminate the need for most ldbl-opt wrappers for such functions. A few special cases are needed. __clog10l is a public symbol (for historical reasons) so needs to be given appropriate compat versions for architectures that changed their long double format, but is not defined as an alias using the normal macros since __clog10* are *not* public symbols for _FloatN / _FloatNx types. For scalbn, scalbln and log1p, the changes adding errno setting support for those functions left compat symbols pointing directly to the non-errno-setting implementations. There is no requirement for the compat symbols not to set errno; that just made for the simplest patches at that time. Now, with these common macros, it's natural to redirect the compat symbols to the errno-setting wrappers, which I intend to do in a separate patch. Tested for x86_64, and with build-many-glibcs.py. For ldbl-opt platforms the stripped libm.so binaries are changed (disassembly unchanged) because the details of how the clog10l compat symbol is created mean it ceases to be weak as it was before; for other platforms, stripped libm.so binaries are unchanged. 2017-09-13 Joseph Myers <joseph@codesourcery.com> * sysdeps/generic/libm-alias-double.h: New file. * sysdeps/ieee754/ldbl-opt/libm-alias-double.h: Likewise. * sysdeps/generic/math-type-macros-double.h: Include <libm-alias-double.h>. [declare_mgen_alias] (declare_mgen_alias): Define to use libm_alias_double. * sysdeps/generic/math-type-macros.h [!M_LIBM_NEED_COMPAT] (M_LIBM_NEED_COMPAT): Remove macro. [!M_LIBM_NEED_COMPAT] (declare_mgen_libm_compat): Likewise. * sysdeps/ieee754/ldbl-opt/math-type-macros-double.h: Remove. * math/cabs_template.c [M_LIBM_NEED_COMPAT]: Remove conditional code. * math/carg_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/cimag_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/conj_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/creal_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cacos_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cacosh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_casin_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_casinh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_catan_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_catanh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_ccos_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_ccosh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cexp_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_clog10_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_clog_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cpow_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cproj_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_csin_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_csinh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_csqrt_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_ctan_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_ctanh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_fdim_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_fmax_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_fmin_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_nan_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/w_ilogb_template.c [M_LIBM_NEED_COMPAT]: Likewise. * sysdeps/ieee754/ldbl-opt/s_clog10.c: New file. * sysdeps/ieee754/ldbl-opt/s_ldexp.c (M_LIBM_NEED_COMPAT): Remove macro. (declare_mgen_alias): New macro. * sysdeps/ieee754/ldbl-opt/w_log1p.c: New file. * sysdeps/ieee754/ldbl-opt/w_scalbln.c: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c (M_LIBM_NEED_COMPAT): Remove macro. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c [HAVE_AS_VIS3_SUPPORT]: Include <math_ldbl_opt.h> and <first-versions.h>. [HAVE_AS_VIS3_SUPPORT && LONG_DOUBLE_COMPAT (libm, FIRST_VERSION_libm_fdiml)]: Define fdiml as compat symbol.
* Prefer new libm function wrappers for !LIBM_SVID_COMPAT.Joseph Myers2017-09-0521-3/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The initial obsoletion of SVID libm error handling left the old wrappers and __kernel_standard still being used for new ports and static linking, just with macro definitions of _LIB_VERSION and matherr that meant symbols with those names were never actually used and the code for different error handling variants could be optimized out. This patch cleans things up further by eliminating the __kernel_standard use for new ports and static linking. Now, the old wrappers no longer generate any code in the !LIBM_SVID_COMPAT case, while the new errno-only wrappers that were added for float128 support are now also used for float, double and long double in that case. The changes are generally straightforward. The w_scalb*_compat wrappers continue to be used (scalb is obsolescent in the sense of not being supported for float128, but is present in supported standards - the 2001 edition of POSIX and earlier XSI versions - so remains supported for static linking and new ports, as do the float and long double variants that are existing GNU extensions). Those wrappers would only call __kernel_standard in the _LIB_VERSION == _SVID_ case. Since we would like to be able to compile most of glibc without optimization, relying on a static function whose only use is under an if (0) condition being optimized away to avoid an undefined __kernel_standard reference may not be a good idea. Thus, the relevant code in the scalb wrappers has LIBM_SVID_COMPAT conditionals added to guarantee it's not built at all in the case where __kernel_standard does not exist. Just as i386 has its own w_sqrt_compat.c, so w_sqrt.c is also added. ia64 gets dummy w_*.c to prevent those files being built where they would conflict with the ia64 libm, as with its existing w_*_compat.c. Conditions disabling code for !LIBM_SVID_COMPAT are needed in both the math/ wrappers and in the long double wrappers in ldbl-opt (to avoid them setting up aliases and symbol versions for undefined symbols). I hope that future cleanups to how libm function aliases and symbol versioning are done will eliminate the need for most of the ldbl-opt wrappers. Tested for x86_64 and x86, and with build-many-glibcs.py. * sysdeps/generic/math-type-macros-double.h: Include <math-svid-compat.h>. (__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT. * sysdeps/generic/math-type-macros-float.h: Include <math-svid-compat.h>. (__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT. * sysdeps/generic/math-type-macros-ldouble.h: Include <math-svid-compat.h>. (__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT. * math/lgamma-compat.h (BUILD_LGAMMA): Include LIBM_SVID_COMPAT condition. * math/w_acos_compat.c: Condition contents on [LIBM_SVID_COMPAT]. * math/w_acosf_compat.c: Likewise. * math/w_acosh_compat.c: Likewise. * math/w_acoshf_compat.c: Likewise. * math/w_acoshl_compat.c: Likewise. * math/w_acosl_compat.c: Likewise. * math/w_asin_compat.c: Likewise. * math/w_asinf_compat.c: Likewise. * math/w_asinl_compat.c: Likewise. * math/w_atan2_compat.c: Likewise. * math/w_atan2f_compat.c: Likewise. * math/w_atan2l_compat.c: Likewise. * math/w_atanh_compat.c: Likewise. * math/w_atanhf_compat.c: Likewise. * math/w_atanhl_compat.c: Likewise. * math/w_cosh_compat.c: Likewise. * math/w_coshf_compat.c: Likewise. * math/w_coshl_compat.c: Likewise. * math/w_exp10_compat.c: Likewise. * math/w_exp10f_compat.c: Likewise. * math/w_exp10l_compat.c: Likewise. * math/w_exp2_compat.c: Likewise. * math/w_exp2f_compat.c: Likewise. * math/w_exp2l_compat.c: Likewise. * math/w_fmod_compat.c: Likewise. * math/w_fmodf_compat.c: Likewise. * math/w_fmodl_compat.c: Likewise. * math/w_hypot_compat.c: Likewise. * math/w_hypotf_compat.c: Likewise. * math/w_hypotl_compat.c: Likewise. * math/w_j0_compat.c: Likewise. * math/w_j0f_compat.c: Likewise. * math/w_j0l_compat.c: Likewise. * math/w_j1_compat.c: Likewise. * math/w_j1f_compat.c: Likewise. * math/w_j1l_compat.c: Likewise. * math/w_jn_compat.c: Likewise. * math/w_jnf_compat.c: Likewise. * math/w_jnl_compat.c: Likewise. * math/w_lgamma_r_compat.c: Likewise. * math/w_lgammaf_r_compat.c: Likewise. * math/w_lgammal_r_compat.c: Likewise. * math/w_log10_compat.c: Likewise. * math/w_log10f_compat.c: Likewise. * math/w_log10l_compat.c: Likewise. * math/w_log2_compat.c: Likewise. * math/w_log2f_compat.c: Likewise. * math/w_log2l_compat.c: Likewise. * math/w_log_compat.c: Likewise. * math/w_logf_compat.c: Likewise. * math/w_logl_compat.c: Likewise. * math/w_pow_compat.c: Likewise. * math/w_powf_compat.c: Likewise. * math/w_powl_compat.c: Likewise. * math/w_remainder_compat.c: Likewise. * math/w_remainderf_compat.c: Likewise. * math/w_remainderl_compat.c: Likewise. * math/w_sinh_compat.c: Likewise. * math/w_sinhf_compat.c: Likewise. * math/w_sinhl_compat.c: Likewise. * math/w_sqrt_compat.c: Likewise. * math/w_sqrtf_compat.c: Likewise. * math/w_sqrtl_compat.c: Likewise. * math/w_tgamma_compat.c: Likewise. * math/w_tgammaf_compat.c: Likewise. * math/w_tgammal_compat.c: Likewise. * math/w_scalb_compat.c (sysv_scalb): Condition definition on [LIBM_SVID_COMPAT]. (__scalb): Condition call to sysv_scalb on [LIBM_SVID_COMPAT]. * math/w_scalbf_compat.c (sysv_scalbf): Condition definition on [LIBM_SVID_COMPAT]. (__scalbf): Condition call to sysv_scalbf on [LIBM_SVID_COMPAT]. * math/w_scalbl_compat.c (sysv_scalbl): Condition definition on [LIBM_SVID_COMPAT]. (__scalbl): Condition call to sysv_scalbl on [LIBM_SVID_COMPAT]. * sysdeps/i386/fpu/w_sqrt.c: New file. * sysdeps/ia64/fpu/w_acos.c: Likewise. * sysdeps/ia64/fpu/w_acosf.c: Likewise. * sysdeps/ia64/fpu/w_acosh.c: Likewise. * sysdeps/ia64/fpu/w_acoshf.c: Likewise. * sysdeps/ia64/fpu/w_acoshl.c: Likewise. * sysdeps/ia64/fpu/w_acosl.c: Likewise. * sysdeps/ia64/fpu/w_asin.c: Likewise. * sysdeps/ia64/fpu/w_asinf.c: Likewise. * sysdeps/ia64/fpu/w_asinl.c: Likewise. * sysdeps/ia64/fpu/w_atan2.c: Likewise. * sysdeps/ia64/fpu/w_atan2f.c: Likewise. * sysdeps/ia64/fpu/w_atan2l.c: Likewise. * sysdeps/ia64/fpu/w_atanh.c: Likewise. * sysdeps/ia64/fpu/w_atanhf.c: Likewise. * sysdeps/ia64/fpu/w_atanhl.c: Likewise. * sysdeps/ia64/fpu/w_cosh.c: Likewise. * sysdeps/ia64/fpu/w_coshf.c: Likewise. * sysdeps/ia64/fpu/w_coshl.c: Likewise. * sysdeps/ia64/fpu/w_exp.c: Likewise. * sysdeps/ia64/fpu/w_exp10.c: Likewise. * sysdeps/ia64/fpu/w_exp10f.c: Likewise. * sysdeps/ia64/fpu/w_exp10l.c: Likewise. * sysdeps/ia64/fpu/w_exp2.c: Likewise. * sysdeps/ia64/fpu/w_exp2f.c: Likewise. * sysdeps/ia64/fpu/w_exp2l.c: Likewise. * sysdeps/ia64/fpu/w_expf.c: Likewise. * sysdeps/ia64/fpu/w_expl.c: Likewise. * sysdeps/ia64/fpu/w_fmod.c: Likewise. * sysdeps/ia64/fpu/w_fmodf.c: Likewise. * sysdeps/ia64/fpu/w_fmodl.c: Likewise. * sysdeps/ia64/fpu/w_hypot.c: Likewise. * sysdeps/ia64/fpu/w_hypotf.c: Likewise. * sysdeps/ia64/fpu/w_hypotl.c: Likewise. * sysdeps/ia64/fpu/w_lgamma_r.c: Likewise. * sysdeps/ia64/fpu/w_lgammaf_r.c: Likewise. * sysdeps/ia64/fpu/w_lgammal_r.c: Likewise. * sysdeps/ia64/fpu/w_log.c: Likewise. * sysdeps/ia64/fpu/w_log10.c: Likewise. * sysdeps/ia64/fpu/w_log10f.c: Likewise. * sysdeps/ia64/fpu/w_log10l.c: Likewise. * sysdeps/ia64/fpu/w_log2.c: Likewise. * sysdeps/ia64/fpu/w_log2f.c: Likewise. * sysdeps/ia64/fpu/w_log2l.c: Likewise. * sysdeps/ia64/fpu/w_logf.c: Likewise. * sysdeps/ia64/fpu/w_logl.c: Likewise. * sysdeps/ia64/fpu/w_pow.c: Likewise. * sysdeps/ia64/fpu/w_powf.c: Likewise. * sysdeps/ia64/fpu/w_powl.c: Likewise. * sysdeps/ia64/fpu/w_remainder.c: Likewise. * sysdeps/ia64/fpu/w_remainderf.c: Likewise. * sysdeps/ia64/fpu/w_remainderl.c: Likewise. * sysdeps/ia64/fpu/w_sinh.c: Likewise. * sysdeps/ia64/fpu/w_sinhf.c: Likewise. * sysdeps/ia64/fpu/w_sinhl.c: Likewise. * sysdeps/ia64/fpu/w_sqrt.c: Likewise. * sysdeps/ia64/fpu/w_sqrtf.c: Likewise. * sysdeps/ia64/fpu/w_sqrtl.c: Likewise. * sysdeps/ia64/fpu/w_tgamma.c: Likewise. * sysdeps/ia64/fpu/w_tgammaf.c: Likewise. * sysdeps/ia64/fpu/w_tgammal.c: Likewise. * sysdeps/ieee754/dbl-64/w_exp_compat.c: Condition contents on [LIBM_SVID_COMPAT]. * sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise. * sysdeps/ieee754/k_standard.c: Likewise. * sysdeps/ieee754/k_standardf.c: Likewise. * sysdeps/ieee754/k_standardl.c: Likewise. * sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-64-128/w_expl_compat.c: Condition long_double_symbol call on [LIBM_SVID_COMPAT]. * sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_acosl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_asinl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_coshl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_j0l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_j1l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_jnl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log10l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log2l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_logl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_powl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c: Condition long_double_symbol and compat_symbol calls on [LIBM_SVID_COMPAT].
* Obsolete pow10 functions.Joseph Myers2017-09-014-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch obsoletes the pow10, pow10f and pow10l functions (makes them into compat symbols, not available for new ports or static linking). The exp10 names for these functions are standardized (in TS 18661-4) and were added in the same glibc version (2.1) as pow10 so source code can change to use them without any loss of portability. Since pow10 is deliberately not provided for _Float128, only exp10, this slightly simplifies moving to the new wrapper templates in the !LIBM_SVID_COMPAT case, by avoiding needing to arrange for pow10, pow10f and pow10l to be defined by those templates. Tested for x86_64, and with build-many-glibcs.py. * manual/math.texi (pow10): Do not document. (pow10f): Likewise. (pow10l): Likewise. * math/bits/mathcalls.h [__USE_GNU] (pow10): Do not declare. * math/bits/math-finite.h [__USE_GNU] (pow10): Likewise. * math/libm-test-exp10.inc (pow10_test): Remove. (do_test): Do not call pow10. * math/w_exp10_compat.c (pow10): Make into compat symbol. [NO_LONG_DOUBLE] (pow10l): Likewise. * math/w_exp10f_compat.c (pow10f): Likewise. * math/w_exp10l_compat.c (pow10l): Likewise. * sysdeps/ia64/fpu/e_exp10.S: Include <shlib-compat.h>. (pow10): Make into compat symbol. * sysdeps/ia64/fpu/e_exp10f.S: Include <shlib-compat.h>. (pow10f): Make into compat symbol. * sysdeps/ia64/fpu/e_exp10l.S: Include <shlib-compat.h>. (pow10l): Make into compat symbol. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Remove pow10. (CFLAGS-nldbl-pow10.c): Remove variable.. * sysdeps/ieee754/ldbl-opt/nldbl-pow10.c: Remove file. * sysdeps/ieee754/ldbl-opt/w_exp10_compat.c (pow10l): Condition on [SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)]. * sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c (compat_symbol): Undefine and redefine. (pow10l): Make into compat symbol. * sysdeps/aarch64/libm-test-ulps: Remove pow10 ulps. * sysdeps/alpha/fpu/libm-test-ulps: Likewise. * sysdeps/arm/libm-test-ulps: Likewise. * sysdeps/hppa/fpu/libm-test-ulps: Likewise. * sysdeps/i386/fpu/libm-test-ulps: Likewise. * sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise. * sysdeps/microblaze/libm-test-ulps: Likewise. * sysdeps/mips/mips32/libm-test-ulps: Likewise. * sysdeps/mips/mips64/libm-test-ulps: Likewise. * sysdeps/nios2/libm-test-ulps: Likewise. * sysdeps/powerpc/fpu/libm-test-ulps: Likewise. * sysdeps/powerpc/nofpu/libm-test-ulps: Likewise. * sysdeps/s390/fpu/libm-test-ulps: Likewise. * sysdeps/sh/libm-test-ulps: Likewise. * sysdeps/sparc/fpu/libm-test-ulps: Likewise. * sysdeps/tile/libm-test-ulps: Likewise. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Consistently use uintN_t not u_intN_t in libm.Joseph Myers2017-08-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes libm code to make consistent use of C99 uintN_t types instead of sometimes using those and sometimes using the older nonstandard u_intN_t names. This makes sense as a cleanup in its own right, and also facilitates merges to GCC's libquadmath (which gets the types from stdint.h and so may not have u_intN_t available at all). Tested for x86_64, and with build-many-glibcs.py. * math/s_nextafter.c (__nextafter): Use uintN_t instead of u_intN_t. * math/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/generic/math_private.h (ieee_double_shape_type): Likewise. (ieee_float_shape_type): Likewise. * sysdeps/i386/fpu/s_fpclassifyl.c (__fpclassifyl): Likewise. * sysdeps/i386/fpu/s_isnanl.c (__isnanl): Likewise. * sysdeps/i386/fpu/s_nextafterl.c (__nextafterl): Likewise. * sysdeps/i386/fpu/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/i386/fpu/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/ieee754/dbl-64/e_acosh.c (__ieee754_acosh): Likewise. * sysdeps/ieee754/dbl-64/e_cosh.c (__ieee754_cosh): Likewise. * sysdeps/ieee754/dbl-64/e_fmod.c (__ieee754_fmod): Likewise. * sysdeps/ieee754/dbl-64/e_gamma_r.c (__ieee754_gamma_r): Likewise. * sysdeps/ieee754/dbl-64/e_hypot.c (__ieee754_hypot): Likewise. * sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Likewise. (__ieee754_yn): Likewise. * sysdeps/ieee754/dbl-64/e_log10.c (__ieee754_log10): Likewise. * sysdeps/ieee754/dbl-64/e_log2.c (__ieee754_log2): Likewise. * sysdeps/ieee754/dbl-64/e_rem_pio2.c (__ieee754_rem_pio2): Likewise. * sysdeps/ieee754/dbl-64/e_sinh.c (__ieee754_sinh): Likewise. * sysdeps/ieee754/dbl-64/s_ceil.c (__ceil): Likewise. * sysdeps/ieee754/dbl-64/s_copysign.c (__copysign): Likewise. * sysdeps/ieee754/dbl-64/s_erf.c (__erf): Likewise. (__erfc): Likewise. * sysdeps/ieee754/dbl-64/s_expm1.c (__expm1): Likewise. * sysdeps/ieee754/dbl-64/s_finite.c (FINITE): Likewise. * sysdeps/ieee754/dbl-64/s_floor.c (__floor): Likewise. * sysdeps/ieee754/dbl-64/s_fpclassify.c (__fpclassify): Likewise. * sysdeps/ieee754/dbl-64/s_isnan.c (__isnan): Likewise. * sysdeps/ieee754/dbl-64/s_issignaling.c (__issignaling): Likewise. * sysdeps/ieee754/dbl-64/s_llrint.c (__llrint): Likewise. * sysdeps/ieee754/dbl-64/s_llround.c (__llround): Likewise. * sysdeps/ieee754/dbl-64/s_lrint.c (__lrint): Likewise. * sysdeps/ieee754/dbl-64/s_lround.c (__lround): Likewise. * sysdeps/ieee754/dbl-64/s_modf.c (__modf): Likewise. * sysdeps/ieee754/dbl-64/s_nextup.c (__nextup): Likewise. * sysdeps/ieee754/dbl-64/s_remquo.c (__remquo): Likewise. * sysdeps/ieee754/dbl-64/s_round.c (__round): Likewise. * sysdeps/ieee754/dbl-64/s_trunc.c (__trunc): Likewise. * sysdeps/ieee754/dbl-64/wordsize-64/s_issignaling.c (__issignaling): Likewise. * sysdeps/ieee754/flt-32/e_atan2f.c (__ieee754_atan2f): Likewise. * sysdeps/ieee754/flt-32/e_fmodf.c (__ieee754_fmodf): Likewise. * sysdeps/ieee754/flt-32/e_gammaf_r.c (__ieee754_gammaf_r): Likewise. * sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_ynf): Likewise. * sysdeps/ieee754/flt-32/e_log10f.c (__ieee754_log10f): Likewise. * sysdeps/ieee754/flt-32/e_powf.c (__ieee754_powf): Likewise. * sysdeps/ieee754/flt-32/e_rem_pio2f.c (__ieee754_rem_pio2f): Likewise. * sysdeps/ieee754/flt-32/e_remainderf.c (__ieee754_remainderf): Likewise. * sysdeps/ieee754/flt-32/e_sqrtf.c (__ieee754_sqrtf): Likewise. * sysdeps/ieee754/flt-32/s_ceilf.c (__ceilf): Likewise. * sysdeps/ieee754/flt-32/s_copysignf.c (__copysignf): Likewise. * sysdeps/ieee754/flt-32/s_erff.c (__erff): Likewise. (__erfcf): Likewise. * sysdeps/ieee754/flt-32/s_expm1f.c (__expm1f): Likewise. * sysdeps/ieee754/flt-32/s_finitef.c (FINITEF): Likewise. * sysdeps/ieee754/flt-32/s_floorf.c (__floorf): Likewise. * sysdeps/ieee754/flt-32/s_fpclassifyf.c (__fpclassifyf): Likewise. * sysdeps/ieee754/flt-32/s_isnanf.c (__isnanf): Likewise. * sysdeps/ieee754/flt-32/s_issignalingf.c (__issignalingf): Likewise. * sysdeps/ieee754/flt-32/s_llrintf.c (__llrintf): Likewise. * sysdeps/ieee754/flt-32/s_llroundf.c (__llroundf): Likewise. * sysdeps/ieee754/flt-32/s_lrintf.c (__lrintf): Likewise. * sysdeps/ieee754/flt-32/s_lroundf.c (__lroundf): Likewise. * sysdeps/ieee754/flt-32/s_modff.c (__modff): Likewise. * sysdeps/ieee754/flt-32/s_remquof.c (__remquof): Likewise. * sysdeps/ieee754/flt-32/s_roundf.c (__roundf): Likewise. * sysdeps/ieee754/ldbl-128/e_acoshl.c (__ieee754_acoshl): Likewise. * sysdeps/ieee754/ldbl-128/e_atan2l.c (__ieee754_atan2l): Likewise. * sysdeps/ieee754/ldbl-128/e_atanhl.c (__ieee754_atanhl): Likewise. * sysdeps/ieee754/ldbl-128/e_fmodl.c (__ieee754_fmodl): Likewise. * sysdeps/ieee754/ldbl-128/e_gammal_r.c (__ieee754_gammal_r): Likewise. * sysdeps/ieee754/ldbl-128/e_hypotl.c (__ieee754_hypotl): Likewise. * sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise. (__ieee754_ynl): Likewise. * sysdeps/ieee754/ldbl-128/e_powl.c (__ieee754_powl): Likewise. * sysdeps/ieee754/ldbl-128/e_rem_pio2l.c (__ieee754_rem_pio2l): Likewise. * sysdeps/ieee754/ldbl-128/e_remainderl.c (__ieee754_remainderl): Likewise. * sysdeps/ieee754/ldbl-128/e_sinhl.c (__ieee754_sinhl): Likewise. * sysdeps/ieee754/ldbl-128/k_cosl.c (__kernel_cosl): Likewise. * sysdeps/ieee754/ldbl-128/k_sincosl.c (__kernel_sincosl): Likewise. * sysdeps/ieee754/ldbl-128/k_sinl.c (__kernel_sinl): Likewise. * sysdeps/ieee754/ldbl-128/s_ceill.c (__ceill): Likewise. * sysdeps/ieee754/ldbl-128/s_copysignl.c (__copysignl): Likewise. * sysdeps/ieee754/ldbl-128/s_erfl.c (__erfcl): Likewise. * sysdeps/ieee754/ldbl-128/s_fabsl.c (__fabsl): Likewise. * sysdeps/ieee754/ldbl-128/s_finitel.c (__finitel): Likewise. * sysdeps/ieee754/ldbl-128/s_floorl.c (__floorl): Likewise. * sysdeps/ieee754/ldbl-128/s_fpclassifyl.c (__fpclassifyl): Likewise. * sysdeps/ieee754/ldbl-128/s_frexpl.c (__frexpl): Likewise. * sysdeps/ieee754/ldbl-128/s_isnanl.c (__isnanl): Likewise. * sysdeps/ieee754/ldbl-128/s_issignalingl.c (__issignalingl): Likewise. * sysdeps/ieee754/ldbl-128/s_llrintl.c (__llrintl): Likewise. * sysdeps/ieee754/ldbl-128/s_llroundl.c (__llroundl): Likewise. * sysdeps/ieee754/ldbl-128/s_lrintl.c (__lrintl): Likewise. * sysdeps/ieee754/ldbl-128/s_lroundl.c (__lroundl): Likewise. * sysdeps/ieee754/ldbl-128/s_modfl.c (__modfl): Likewise. * sysdeps/ieee754/ldbl-128/s_nearbyintl.c (__nearbyintl): Likewise. * sysdeps/ieee754/ldbl-128/s_nextafterl.c (__nextafterl): Likewise. * sysdeps/ieee754/ldbl-128/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/ieee754/ldbl-128/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/ieee754/ldbl-128/s_nextupl.c (__nextupl): Likewise. * sysdeps/ieee754/ldbl-128/s_remquol.c (__remquol): Likewise. * sysdeps/ieee754/ldbl-128/s_rintl.c (__rintl): Likewise. * sysdeps/ieee754/ldbl-128/s_roundl.c (__roundl): Likewise. * sysdeps/ieee754/ldbl-128/s_tanhl.c (__tanhl): Likewise. * sysdeps/ieee754/ldbl-128/s_truncl.c (__truncl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_fmodl.c (__ieee754_fmodl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (__ieee754_gammal_r): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_powl.c (__ieee754_powl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c (__ieee754_rem_pio2l): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_remainderl.c (__ieee754_remainderl): Likewise. * sysdeps/ieee754/ldbl-128ibm/k_cosl.c (__kernel_cosl): Likewise. * sysdeps/ieee754/ldbl-128ibm/k_sinl.c (__kernel_sinl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fabsl.c (__fabsl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c (___fpclassifyl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_modfl.c (__modfl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_remquol.c (__remquol): Likewise. * sysdeps/ieee754/ldbl-96/e_acoshl.c (__ieee754_acoshl): Likewise. * sysdeps/ieee754/ldbl-96/e_asinl.c (__ieee754_asinl): Likewise. * sysdeps/ieee754/ldbl-96/e_atanhl.c (__ieee754_atanhl): Likewise. * sysdeps/ieee754/ldbl-96/e_coshl.c (__ieee754_coshl): Likewise. * sysdeps/ieee754/ldbl-96/e_gammal_r.c (__ieee754_gammal_r): Likewise. * sysdeps/ieee754/ldbl-96/e_hypotl.c (__ieee754_hypotl): Likewise. * sysdeps/ieee754/ldbl-96/e_j0l.c (__ieee754_j0l): Likewise. (__ieee754_y0l): Likewise. (pzero): Likewise. (qzero): Likewise. * sysdeps/ieee754/ldbl-96/e_j1l.c (__ieee754_j1l): Likewise. (__ieee754_y1l): Likewise. (pone): Likewise. (qone): Likewise. * sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise. (__ieee754_ynl): Likewise. * sysdeps/ieee754/ldbl-96/e_lgammal_r.c (sin_pi): Likewise. (__ieee754_lgammal_r): Likewise. * sysdeps/ieee754/ldbl-96/e_rem_pio2l.c (__ieee754_rem_pio2l): Likewise. * sysdeps/ieee754/ldbl-96/e_sinhl.c (__ieee754_sinhl): Likewise. * sysdeps/ieee754/ldbl-96/s_copysignl.c (__copysignl): Likewise. * sysdeps/ieee754/ldbl-96/s_erfl.c (__erfl): Likewise. (__erfcl): Likewise. * sysdeps/ieee754/ldbl-96/s_frexpl.c (__frexpl): Likewise. * sysdeps/ieee754/ldbl-96/s_issignalingl.c (__issignalingl): Likewise. * sysdeps/ieee754/ldbl-96/s_llrintl.c (__llrintl): Likewise. * sysdeps/ieee754/ldbl-96/s_llroundl.c (__llroundl): Likewise. * sysdeps/ieee754/ldbl-96/s_lrintl.c (__lrintl): Likewise. * sysdeps/ieee754/ldbl-96/s_lroundl.c (__lroundl): Likewise. * sysdeps/ieee754/ldbl-96/s_modfl.c (__modfl): Likewise. * sysdeps/ieee754/ldbl-96/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/ieee754/ldbl-96/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/ieee754/ldbl-96/s_nextupl.c (__nextupl): Likewise. * sysdeps/ieee754/ldbl-96/s_remquol.c (__remquol): Likewise. * sysdeps/ieee754/ldbl-96/s_roundl.c (__roundl): Likewise. * sysdeps/ieee754/ldbl-96/s_tanhl.c (__tanhl): Likewise. * sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c (__nldbl_nexttowardf): Likewise. * sysdeps/m68k/m680x0/fpu/e_pow.c (s(__ieee754_pow)): Likewise. * sysdeps/m68k/m680x0/fpu/s_fpclassifyl.c (__fpclassifyl): Likewise. * sysdeps/m68k/m680x0/fpu/s_llrint.c (__llrint): Likewise. * sysdeps/m68k/m680x0/fpu/s_llrintf.c (__llrintf): Likewise. * sysdeps/m68k/m680x0/fpu/s_llrintl.c (__llrintl): Likewise. * sysdeps/m68k/m680x0/fpu/s_nextafterl.c (__nextafterl): Likewise. * sysdeps/x86/fpu/powl_helper.c (__powl_helper): Likewise.
* Use locale_t, not __locale_t, throughout glibcZack Weinberg2017-06-204-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <locale.h> is specified to define locale_t in POSIX.1-2008, and so are all of the headers that define functions that take locale_t arguments. Under _GNU_SOURCE, the additional headers that define such functions have also always defined locale_t. Therefore, there is no need to use __locale_t in public function prototypes, nor in any internal code. * ctype/ctype-c99_l.c, ctype/ctype.h, ctype/ctype_l.c * include/monetary.h, include/stdlib.h, include/time.h * include/wchar.h, locale/duplocale.c, locale/freelocale.c * locale/global-locale.c, locale/langinfo.h, locale/locale.h * locale/localeinfo.h, locale/newlocale.c * locale/nl_langinfo_l.c, locale/uselocale.c * localedata/bug-usesetlocale.c, localedata/tst-xlocale2.c * stdio-common/vfscanf.c, stdlib/monetary.h, stdlib/stdlib.h * stdlib/strfmon_l.c, stdlib/strtod_l.c, stdlib/strtof_l.c * stdlib/strtol.c, stdlib/strtol_l.c, stdlib/strtold_l.c * stdlib/strtoll_l.c, stdlib/strtoul_l.c, stdlib/strtoull_l.c * string/strcasecmp.c, string/strcoll_l.c, string/string.h * string/strings.h, string/strncase.c, string/strxfrm_l.c * sysdeps/ieee754/float128/strtof128_l.c * sysdeps/ieee754/float128/wcstof128.c * sysdeps/ieee754/float128/wcstof128_l.c * sysdeps/ieee754/ldbl-128ibm/strtold_l.c * sysdeps/ieee754/ldbl-64-128/strtold_l.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.c * sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c * sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c * sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c * sysdeps/powerpc/powerpc32/power7/strcasecmp.S * sysdeps/powerpc/powerpc64/power7/strcasecmp.S * sysdeps/x86_64/strcasecmp_l-nonascii.c * sysdeps/x86_64/strncase_l-nonascii.c, time/strftime_l.c * time/strptime_l.c, time/time.h, wcsmbs/mbsrtowcs_l.c * wcsmbs/wchar.h, wcsmbs/wcscasecmp.c, wcsmbs/wcsncase.c * wcsmbs/wcstod.c, wcsmbs/wcstod_l.c, wcsmbs/wcstof.c * wcsmbs/wcstof_l.c, wcsmbs/wcstol_l.c, wcsmbs/wcstold.c * wcsmbs/wcstold_l.c, wcsmbs/wcstoll_l.c, wcsmbs/wcstoul_l.c * wcsmbs/wcstoull_l.c, wctype/iswctype_l.c * wctype/towctrans_l.c, wctype/wcfuncs_l.c * wctype/wctrans_l.c, wctype/wctype.h, wctype/wctype_l.c: Change all uses of __locale_t to locale_t.
* Also create and use ldbl-compat-choose.h.Joseph Myers2017-05-196-26/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes the glibc build generate an additional header ldbl-compat-choose.h that defines LONG_DOUBLE_COMPAT_CHOOSE_* macros for each libc and libm symbol, which select one or the other of their arguments based on whether the symbol was added before a change to long double != double. The effect of this is that it is then possible to define a macro maybe_long_double_symbol that automatically acts as either long_double_symbol or weak_alias depending on when the symbol being defined was added. This can be used when building long double functions from type-generic templates. Thus, with this patch ldbl-opt no longer needs special long double implementations of each new libm function added using such a template, and the existing such implementations are removed. This is a step towards being able more generally to use common macros to create all the aliases needed for a libm function, so reducing the amount of special-case code needed in ldbl-opt and ldbl-64-128, and facilitating subsequently adding *f32 / *f64 / *f128 / *f32x / *f64x aliases to existing functions (where the set of aliases that a function should have may depend on the architecture in various ways). Tested with build-many-glibcs.py. Except for on powerpc64le-linux-gnu, installed stripped shared libraries are unchanged by the patch. powerpc64le-linux-gnu is the unique configuration which used ldbl-opt from the start rather than adding a new long double choice after originally only having had long double = double. The effect of the patch there is that various cases that previously used long_double_symbol unconditionally now use weak_alias instead, so .os files contain e.g. a symbol cabsl instead of cabsl@@GLIBC_2.17. The final dynamic symbols and versions in the resulting shared libraries are unchanged (ABI tests pass), as is the disassembly of the shared libraries, but the differences in the .os files still result in different .gnu_hash contents in libm.so; the differences are of no significance and logically using weak_alias is what's most appropriate in those cases. * scripts/versions.awk: Generate ldbl-compat-choose.h. * sysdeps/ieee754/ldbl-opt/math-type-macros-ldouble.h: Include <ldbl-compat-choose.h>. (maybe_long_double_symbol): New macro. [!declare_mgen_alias] (declare_mgen_alias): Use maybe_long_double_symbol. * sysdeps/ieee754/ldbl-opt/s_canonicalizel.c: Remove. * sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_fminmagl.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_nextdownl.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_llogbl.c: Likewise. * Makerules [$(build-shared) = yes && !avoid-generated] (before-compile): Add $(common-objpfx)ldbl-compat-choose.h. [$(build-shared) = yes && !avoid-generated] ($(common-objpfx)ldbl-compat-choose.h): New target.
* Create and use first-versions.h with macros for function symbol versions.Joseph Myers2017-05-191-32/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch arranges for the glibc build to generate a header first-versions.h that defines macros for the earliest symbol version in which each public symbol (GLIBC_[0-9]* symbol version, name only uses C identifier characters) is available. This is used in sysdeps/ieee754/ldbl-opt/math-type-macros-double.h to replace the manually defined LDOUBLE_*_libm_version macros for various functions defined using type-generic templates, the purpose of which is to use in LONG_DOUBLE_COMPAT tests "was this function originally added before glibc supported long double != double on this platform?". As discussed in <https://sourceware.org/ml/libc-alpha/2016-12/msg00246.html>, I expect this to be useful more generally in reducing the amount of special-case code needed in ldbl-opt and ldbl-64-128. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. * scripts/versions.awk: Generate first-versions.h. * sysdeps/ieee754/ldbl-opt/math-type-macros-double.h: Include <first-versions.h>. (LDOUBLE_cabsl_libm_version): Remove macro. (LDOUBLE_cargl_libm_version): Likewise. (LDOUBLE_cimagl_libm_version): Likewise. (LDOUBLE_conjl_libm_version): Likewise. (LDOUBLE_creall_libm_version): Likewise. (LDOUBLE_cacosl_libm_version): Likewise. (LDOUBLE_cacoshl_libm_version): Likewise. (LDOUBLE_ccosl_libm_version): Likewise. (LDOUBLE_ccoshl_libm_version): Likewise. (LDOUBLE_casinl_libm_version): Likewise. (LDOUBLE_csinl_libm_version): Likewise. (LDOUBLE_casinhl_libm_version): Likewise. (LDOUBLE_csinhl_libm_version): Likewise. (LDOUBLE_catanl_libm_version): Likewise. (LDOUBLE_catanhl_libm_version): Likewise. (LDOUBLE_ctanl_libm_version): Likewise. (LDOUBLE_ctanhl_libm_version): Likewise. (LDOUBLE_cexpl_libm_version): Likewise. (LDOUBLE_clogl_libm_version): Likewise. (LDOUBLE_cprojl_libm_version): Likewise. (LDOUBLE_csqrtl_libm_version): Likewise. (LDOUBLE_cpowl_libm_version): Likewise. (LDOUBLE_clog10l_libm_version): Likewise. (LDOUBLE___clog10l_libm_version): Likewise. (LDOUBLE_fdiml_libm_version): Likewise. (LDOUBLE_fmaxl_libm_version): Likewise. (LDOUBLE_fminl_libm_version): Likewise. (LDOUBLE_ilogbl_libm_version): Likewise. (LDOUBLE_nanl_libm_version): Likewise. [!M_LIBM_NEED_COMPAT] (M_LIBM_NEED_COMPAT): Use FIRST_VERSION_libm_* macros. [!declare_mgen_libm_compat] (declare_mgen_libm_compat): Likewise. * Makerules [$(build-shared) = yes && !avoid-generated] (before-compile): Add $(common-objpfx)first-versions.h. [$(build-shared) = yes && !avoid-generated] ($(common-objpfx)first-versions.h): New target. ($(common-objpfx)sysd-versions): Depend on and change to rule for building $(common-objpfx)versions.stmp.
* float128: Add private _Float128 declarations for libm.Paul E. Murphy2017-05-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the necessary bits to the private headers to support building the _Float128 libm functions. A local override for float.h is provided to include the missing *FLT128 macros implied by TS 18661-3 for this type when compiling prior to GCC 7. * include/complex.h (__kernel_casinhf128): New declaration. * include/float.h: New file. * include/math.h (__finitef128): Add a hidden def. (__isinff128): Likewise. (__isnanf128): Likewise. (__fpclassify): Likewise. (__issignalling): Likewise. (__expf128): Likewise. (__expm1f128): Likewise. * sysdeps/generic/fix-fp-int-convert-overflow.h: (FIX_FLT128_LONG_CONVERT_OVERFLOW): New macro. (FIX_FLT128_LLONG_CONVERT_OVERFLOW): Likewise. * sysdeps/generic/math-type-macros-float128.h: New file. * sysdeps/generic/math_private.h: Include bits/floatn.h and math_private_calls.h for _Float128. (__isinff128): New inline implementation used when GCC < 7.0, since in this case __builtin_isinf_sign is broken. (fabsf128): New inline implementation that calls the builtin. (__EXPR_FLT128): New macro. (min_of_type): Optionally include _Float128 types too. * sysdeps/generic/math_private_calls.h (__kernel_sincos): Declare for _Float128. (__kernel_rem_pio2): Likewise. * sysdeps/ieee754/ldbl-opt/s_sin.c: (__DECL_SIMD_sincos_disablef128): New macro.
* Move w_exp to libm-compat-call-autoGabriel F. T. Gomes2017-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the "_compat" suffix to the wrappers of the function exp, which use _LIB_VERSION / matherr / __kernel_standard functionality. Tested for powerpc64le, s390, and x86_64. * math/Makefile (libm-calls): Move w_exp... (libm-compat-calls-auto): Here. * math/w_expl.c: Add suffix "_compat" to filename. * sysdeps/ia64/fpu/w_expl.c: Likewise. * sysdeps/ia64/fpu/w_expf.c: Likewise. * sysdeps/ia64/fpu/w_exp.c: Likewise. * sysdeps/ieee754/dbl-64/w_exp.c: Likewise. * sysdeps/ieee754/flt-32/w_expf.c: Likewise. * sysdeps/ieee754/ldbl-128/w_expl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/w_expl.c: Likewise. * sysdeps/ieee754/ldbl-96/w_expl.c: Likewise. * math/w_expl_compat.c: New file, copied from above. * sysdeps/ia64/fpu/w_exp_compat.c: Likewise. * sysdeps/ia64/fpu/w_expf_compat.c: Likewise. * sysdeps/ia64/fpu/w_expl_compat.c: Likewise. * sysdeps/ieee754/dbl-64/w_exp_compat.c: Likewise. * sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise. * sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-64-128/w_expl.c: Add suffix "_compat" to filename. * sysdeps/ieee754/ldbl-opt/w_exp.c: Likewise. * sysdeps/ieee754/ldbl-64-128/w_expl_compat.c: New file, copied from above and adjusted for the new filenames. * sysdeps/ieee754/ldbl-opt/w_exp_compat.c: Likewise.
* Move w_lgamma_r to libm-compat-calls-autoGabriel F. T. Gomes2017-02-082-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the suffix "_compat" to lgamma_r wrappers and make some adjustments to #includes and Makefiles. This is a step towards deprecation of wrappers that use _LIB_VERSION / matherr / __kernel_standard functionality. Tested for powerpc64le, s390, and x86_64. * math/Makefile (libm-calls): Move w_lgammaF_r... (libm-compat-calls-auto): Here. * math/w_lgamma_r.c: Add suffix "_compat" to filename. * math/w_lgammaf_r.c: Likewise. * math/w_lgammal_r.c: Likewise. * sysdeps/ia64/fpu/w_lgammal_r.c: Likewise. * sysdeps/ia64/fpu/w_lgammaf_r.c: Likewise. * sysdeps/ia64/fpu/w_lgamma_r.c: Likewise. * math/w_lgamma_r_compat.c: New file, copied from above. * math/w_lgammaf_r_compat.c: Likewise. * math/w_lgammal_r_compat.c: Likewise. * sysdeps/ia64/fpu/w_lgamma_r_compat.c: Likewise. * sysdeps/ia64/fpu/w_lgammaf_r_compat.c: Likewise. * sysdeps/ia64/fpu/w_lgammal_r_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_lgamma_r.c: Add suffix "_compat" to filename. * sysdeps/ieee754/ldbl-opt/w_lgammal_r.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_lgamma_r_compat.c: New file copied from above and adjusted for the new filenames. * sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c: Likewise.
* Move wrappers to libm-compat-calls-autoGabriel F. T. Gomes2017-01-0442-42/+42
| | | | | | | | | | This commit moves one step towards the deprecation of wrappers that use _LIB_VERSION / matherr / __kernel_standard functionality, by adding the suffix '_compat' to their filenames and adjusting Makefiles and #includes accordingly. New template wrappers that do not use such functionality will be added by future patches and will be first used by the float128 wrappers.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-0124-24/+24
|
* Add fromfp functions.Joseph Myers2016-12-316-1/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines fromfp functions (fromfp, fromfpx, ufromfp, ufromfpx, and float and long double variants) to convert from floating-point to an integer type with any signedness and any given width up to that of intmax_t, in any of the five IEEE rounding modes (the usual four for binary floating point, plus rounding to nearest with ties rounding away from zero), with control of whether in-range non-integer values should result in the "inexact" exception being raised. This patch implements these functions for glibc. These implementations are (apart from raising exceptions) pure integer implementations; it's entirely possible optimized versions could be devised for some architectures. A common math/fromfp.h header provides various common helper code that can readily be shared between the implementations for different types. For each type, the bulk of the implementation is also shared between the four functions, with wrappers that define UNSIGNED and INEXACT macros appropriately before including the main implementation. As the functions return intmax_t and uintmax_t without math.h being allowed to expose those typedef names, they are declared using __intmax_t and __uintmax_t as obtained from <bits/types.h>. The FP_INT_* rounding direction macros are defined as ascending integers in the order the names are listed in the TS; I see no significant value in allowing architectures to vary the values of them. The libm-test machinery is duly adapted to handle unsigned int arguments, and intmax_t and uintmax_t results. Because each test input is generally tested for four functions, five rounding modes and several different widths, the libm-test.inc additions are very large. Thus, the diffs in the body of this message exclude the libm-test.inc changes, with the full patch being attached gzipped. The bulk of the new tests were generated (expanded from a test input plus rounding results and information about where it lies in the relevant interval between integers, to libm-test tests for all relevant combinations of function, rounding direction and width) by a script that's included in the patch as math/gen-fromfp-tests.py (input data math/gen-fromfp-tests-inputs); as an ad hoc script that's not really expected to be rerun, it's not very polished, but it's at least plausibly useful for adding any further tests for these functions in future. I may split the libm-test tests up by function in future (so both libm-test.inc and auto-libm-test-out are split into separate files, and the tests for each function are also built and run separately), but not for 2.25. For no obvious reason, adding tgmath tests for the new functions resulted in -Wuninitialized errors from test-tgmath.c about the variable i being used uninitialized. Those errors were correct - the variable is read by the frexp version in test-tgmath.c (where real frexp would write through that pointer instead of reading it) - but I don't know why this patch would result in the pre-existing issue being newly detected. The patch initializes the variable to avoid those errors. With these changes, glibc 2.25 should have all the library features from TS 18661-1 other than the functions that round result to narrower type (and constant rounding directions, but I'm considering those mainly a compiler feature not a library one). Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfp): New declaration. [__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfpx): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfp): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfpx): Likewise. * math/tgmath.h (__TGMATH_TERNARY_FIRST_REAL_RET_ONLY): New macro. [__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfp): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfp): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfpx): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfpx): Likewise. * math/math.h: Include <bits/types.h>. [__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_INT_UPWARD): New enum constant and macro. (FP_INT_DOWNWARD): Likewise. (FP_INT_TOWARDZERO): Likewise. (FP_INT_TONEARESTFROMZERO): Likewise. (FP_INT_TONEAREST): Likewise. * math/Versions (fromfp): New libm symbol at version GLIBC_2.25. (fromfpf): Likewise. (fromfpl): Likewise. (ufromfp): Likewise. (ufromfpf): Likewise. (ufromfpl): Likewise. (fromfpx): Likewise. (fromfpxf): Likewise. (fromfpxl): Likewise. (ufromfpx): Likewise. (ufromfpxf): Likewise. (ufromfpxl): Likewise. * math/Makefile (libm-calls): Add s_fromfpF, s_ufromfpF, s_fromfpxF and s_ufromfpxF. * math/gen-fromfp-tests.py: New file. * math/gen-fromfp-tests-inputs: Likewise. * math/libm-test.inc: Include <stdint.h> (check_intmax_t): New function. (check_uintmax_t): Likewise. (struct test_fiu_M_data): New type. (struct test_fiu_U_data): Likewise. (RUN_TEST_fiu_M): New macro. (RUN_TEST_LOOP_fiu_M): Likewise. (RUN_TEST_fiu_U): Likewise. (RUN_TEST_LOOP_fiu_U): Likewise. (fromfp_test_data): New array. (fromfp_test): New function. (fromfpx_test_data): New array. (fromfpx_test): New function. (ufromfp_test_data): New array. (ufromfp_test): New function. (ufromfpx_test_data): New array. (ufromfpx_test): New function. (main): Call fromfp_test, fromfpx_test, ufromfp_test and ufromfpx_test. * math/gen-libm-test.pl (parse_args): Handle u, M and U descriptor characters. * math/test-tgmath-ret.c: Include <stdint.h>. (rm): New variable. (width): Likewise. (CHECK_RET_CONST_TYPE): Take extra arguments and pass them to called function. (CHECK_RET_CONST_FLOAT): Take extra arguments and pass them to CHECK_RET_CONST_TYPE. (CHECK_RET_CONST_DOUBLE): Likewise. (CHECK_RET_CONST_LDOUBLE): Likewise. (CHECK_RET_CONST): Take extra arguments and pass them to calls macros. (fromfp): New CHECK_RET_CONST call. (ufromfp): Likewise. (fromfpx): Likewise. (ufromfpx): Likewise. (do_test): Call check_return_fromfp, check_return_ufromfp, check_return_fromfpx and check_return_ufromfpx. * math/test-tgmath.c: Include <stdint.h> (NCALLS): Increase to 138. (F(compile_test)): Initialize i. Call fromfp functions. (F(fromfp)): New function. (F(fromfpx)): Likewise. (F(ufromfp)): Likewise. (F(ufromfpx)): Likewise. * manual/arith.texi (Rounding Functions): Document FP_INT_UPWARD, FP_INT_DOWNWARD, FP_INT_TOWARDZERO, FP_INT_TONEARESTFROMZERO, FP_INT_TONEAREST, fromfp, fromfpf, fromfpl, ufromfp, ufromfpf, ufromfpl, fromfpx, fromfpxf, fromfpxl, ufromfpx, ufromfpxf and ufromfpxl. * manual/libm-err-tab.pl (@all_functions): Add fromfp, fromfpx, ufromfp and ufromfpx. * math/fromfp.h: New file. * sysdeps/ieee754/dbl-64/s_fromfp.c: Likewise. * sysdeps/ieee754/dbl-64/s_fromfp_main.c: Likewise. * sysdeps/ieee754/dbl-64/s_fromfpx.c: Likewise. * sysdeps/ieee754/dbl-64/s_ufromfp.c: Likewise. * sysdeps/ieee754/dbl-64/s_ufromfpx.c: Likewise. * sysdeps/ieee754/flt-32/s_fromfpf.c: Likewise. * sysdeps/ieee754/flt-32/s_fromfpf_main.c: Likewise. * sysdeps/ieee754/flt-32/s_fromfpxf.c: Likewise. * sysdeps/ieee754/flt-32/s_ufromfpf.c: Likewise. * sysdeps/ieee754/flt-32/s_ufromfpxf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fromfpl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fromfpl_main.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_ufromfpl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_ufromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fromfpl_main.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fromfpl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fromfpl_main.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_ufromfpl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_ufromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fromfp, ufromfp, fromfpx and ufromfpx. (CFLAGS-nldbl-fromfp.c): New variable. (CFLAGS-nldbl-fromfpx.c): Likewise. (CFLAGS-nldbl-ufromfp.c): Likewise. (CFLAGS-nldbl-ufromfpx.c): Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-compat.h: Include <stdint.h>. * sysdeps/ieee754/ldbl-opt/nldbl-fromfp.c: New file. * sysdeps/ieee754/ldbl-opt/nldbl-fromfpx.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-ufromfp.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-ufromfpx.c: Likewise. * 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.
* Add roundeven, roundevenf, roundevenl.Joseph Myers2016-12-212-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add fmaxmag, fminmag functions.Joseph Myers2016-12-205-1/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines fmaxmag and fminmag functions that return the argument with maximum / minimum magnitude (acting like fmax / fmin if the arguments have the same magnitude or either argument is a NaN). These correspond to the IEEE 754-2008 operations maxNumMag and minNumMag. This patch implements these functions for glibc. They are implemented with type-generic templates. Tests are based on those for fmax and fmin. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fmaxmag): New declaration. (fminmag): Likewise. * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fmaxmag): New macro. [__GLIBC_USE (IEC_60559_BFP_EXT)] (fminmag): Likewise. * math/Versions (fmaxmag): New libm symbol at version GLIBC_2.25. (fmaxmagf): Likewise. (fmaxmagl): Likewise. (fminmag): Likewise. (fminmagf): Likewise. (fminmagl): Likewise. * math/Makefile (gen-libm-calls): Add s_fmaxmagF and s_fminmagF. * math/s_fmaxmag_template.c: New file. * math/s_fminmag_template.c: Likewise. * math/libm-test.inc (fmaxmag_test_data): New array. (fmaxmag_test): New function. (fminmag_test_data): New array. (fminmag_test): New function. (main): Call fmaxmag_test and fminmag_test. * math/test-tgmath.c (NCALLS): Increase to 132. (F(compile_test)): Call fmaxmag and fminmag. (F(fminmag)): New function. (F(fmaxmag)): Likewise. * manual/arith.texi (Misc FP Arithmetic): Document fminmag, fminmagf, fminmagl, fmaxmag, fmaxmagf and fmaxmagl. * manual/libm-err-tab.pl (@all_functions): Add fmaxmag and fminmag. * sysdeps/ieee754/ldbl-opt/nldbl-fmaxmag.c: New file. * sysdeps/ieee754/ldbl-opt/nldbl-fminmag.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_fminmagl.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fmaxmag and fminmag. (CFLAGS-nldbl-fmaxmag.c): New variable. (CFLAGS-nldbl-fminmag.c): Likewise. * 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.
* Refactor long double information into bits/long-double.h.Joseph Myers2016-12-141-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Information about whether the ABI of long double is the same as that of double is split between bits/mathdef.h and bits/wordsize.h. When the ABIs are the same, bits/mathdef.h defines __NO_LONG_DOUBLE_MATH. In addition, in the case where the same glibc binary supports both -mlong-double-64 and -mlong-double-128, bits/wordsize.h defines __LONG_DOUBLE_MATH_OPTIONAL, along with __NO_LONG_DOUBLE_MATH if this particular compilation is with -mlong-double-64. As part of the refactoring I proposed in <https://sourceware.org/ml/libc-alpha/2016-11/msg00745.html>, this patch puts all that information in a single header, bits/long-double.h. It is included from sys/cdefs.h alongside the include of bits/wordsize.h, so other headers generally do not need to include bits/long-double.h directly. Previously, various bits/mathdef.h headers and bits/wordsize.h headers had this long double information (including implicitly in some bits/mathdef.h headers through not having the defines present in the default version). After the patch, it's all in six bits/long-double.h headers. Furthermore, most of those new headers are not architecture-specific. Architectures with optional long double all use the ldbl-opt sysdeps directory, either in the order (ldbl-64-128, ldbl-opt, ldbl-128) or (ldbl-128ibm, ldbl-opt). Thus a generic header for the case where long double = double, and headers in ldbl-128, ldbl-96 and ldbl-opt, suffices to cover every architecture except for cases where long double properties vary between different ABIs sharing a set of installed headers; fortunately all the ldbl-opt cases share a single compiler-predefined macro __LONG_DOUBLE_128__ that can be used to tell whether this compilation is -mlong-double-64 or -mlong-double-128. The two cases where a set of headers is shared between ABIs with different long double properties, MIPS (o32 has long double = double, other ABIs use ldbl-128) and SPARC (32-bit has optional long double, 64-bit has required long double), need their own bits/long-double.h headers. As with bits/wordsize.h, multiple-include protection for this header is generally implicit through the include guards on sys/cdefs.h, and multiple inclusion is harmless in any case. There is one subtlety: the header must not define __LONG_DOUBLE_MATH_OPTIONAL if __NO_LONG_DOUBLE_MATH was defined before its inclusion, because doing so breaks how sysdeps/ieee754/ldbl-opt/nldbl-compat.h defines __NO_LONG_DOUBLE_MATH itself before including system headers. Subject to keeping that working, it would be reasonable to move these macros from defined/undefined #ifdef to always-defined 1/0 #if semantics, but this patch does not attempt to do so, just rearranges where the macros are defined. After this patch, the only use of bits/mathdef.h is the alpha one for modifying complex function ABIs for old GCC. Thus, all versions of the header other than the default and alpha versions are removed, as is the include from math.h. Tested for x86_64 and x86. Also did compilation-only testing with build-many-glibcs.py. * bits/long-double.h: New file. * sysdeps/ieee754/ldbl-128/bits/long-double.h: Likewise. * sysdeps/ieee754/ldbl-96/bits/long-double.h: Likewise. * sysdeps/ieee754/ldbl-opt/bits/long-double.h: Likewise. * sysdeps/mips/bits/long-double.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/long-double.h: Likewise. * math/Makefile (headers): Add bits/long-double.h. * misc/sys/cdefs.h: Include <bits/long-double.h>. * stdlib/strtold.c: Include <bits/long-double.h> instead of <bits/wordsize.h>. * bits/mathdef.h [!_COMPLEX_H]: Do not allow inclusion. [!__NO_LONG_DOUBLE_MATH]: Remove conditional code. * math/math.h: Do not include <bits/mathdef.h>. * sysdeps/aarch64/bits/mathdef.h: Remove file. * sysdeps/alpha/bits/mathdef.h [!_COMPLEX_H]: Do not allow inclusion. * sysdeps/ia64/bits/mathdef.h: Remove file. * sysdeps/m68k/m680x0/bits/mathdef.h: Likewise. * sysdeps/mips/bits/mathdef.h: Likewise. * sysdeps/powerpc/bits/mathdef.h: Likewise. * sysdeps/s390/bits/mathdef.h: Likewise. * sysdeps/sparc/bits/mathdef.h: Likewise. * sysdeps/x86/bits/mathdef.h: Likewise. * sysdeps/s390/s390-32/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Remove conditional code. * sysdeps/s390/s390-64/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Likewise.
* Add llogb, llogbf, llogbl.Joseph Myers2016-12-023-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines llogb functions that are like ilogb except that they return long int instead of int. Corresponding FP_LLOGB* macros are defined, whose values are required to have the obvious correspondence to those of the FP_ILOGB* macros. This patch implements these functions and macros for glibc. llogb uses the type-generic infrastructure, with an implementation similar to the wrapper for ilogb but with additional conversion from FP_ILOGB* to FP_LLOGB*; this approach avoids needing to modify or duplicate any of the architecture-specific ilogb implementations. Tests are also based on those for ilogb. Ideally the llogb functions would alias the ilogb ones when long is 32-bit, but such aliasing requires the associated header declarations of the different-type alias to be hidden, typically by defining macros before including the header (see e.g. how sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c defines lround to __hidden_lround before including <math.h>). The infrastructure for type-generic function implementations does not support defining such macros at present (since C code can't define a macro whose name is determined by other macros). So this patch leaves them as separate functions (similar to e.g. scalbln and scalbn being separate in such a case as well), but with the remapping of FP_ILOGB* to FP_LLOGB* conditioned out in the case where it would be the identity map. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (llogb): New declaration. * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (llogb): New macro. * math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (__FP_LONG_MAX): New macro. [__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_LLOGB0): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_LLOGBNAN): Likewise. * math/Versions (llogb): New libm symbol at version GLIBC_2.25. (llogbf): Likewise. (llogbl): Likewise. * math/Makefile (gen-libm-calls): Add w_llogbF. (tests): Add test-fp-llogb-constants. * math/w_llogb_template.c: New file. Based on math/w_ilogb_template.c. * math/libm-test.inc (llogb_test_data): New array. (llogb_test): New function. (main): Call llogb_test. * math/test-fp-llogb-constants.c: New file. Based on math/test-fp-ilogb-constants.c. * math/test-tgmath-ret.c (llogb): New CHECK_RET_CONST call. (do_test): Call check_return_llogb. * math/test-tgmath.c (NCALLS): Increase to 126. (F(compile_test)): Call llogb. (F(llogb)): New function. * manual/math.texi (Exponents and Logarithms): Document llogb, llogbf, llogbl, FP_LLOGB0 and FP_LLOGBNAN. * manual/libm-err-tab.pl (@all_functions): Add llogb. * sysdeps/ieee754/ldbl-opt/nldbl-llogb.c: New file. * sysdeps/ieee754/ldbl-opt/w_llogbl.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add llogb. (CFLAGS-nldbl-llogb.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.
* Make ilogb wrappers type-generic.Joseph Myers2016-11-283-10/+1
| | | | | | | | | | | | | | | | | | | | | This patch converts the ilogb wrappers (which set errno directly rather than doing anything with __kernel_standard) to use the type-generic template machinery. This is intended as preparation for adding llogb. Tested for x86_64 and x86, and tested compile for other architectures with build-many-glibcs.py. * math/w_ilogb_template.c: New file. Based on math/w_ilogb.c. * math/w_ilogb.c: Remove. * math/w_ilogbf.c: Likewise. * math/w_ilogbl.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_ilogb.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_ilogbl.c: Likewise. * math/Makefile (gen-libm-calls): Add w_ilogbF. (libm-calls): Remove w_ilogbF. * sysdeps/ieee754/ldbl-opt/math-type-macros-double.h (LDOUBLE_ilogbl_libm_version): New macro.
* Add setpayloadsig, setpayloadsigf, setpayloadsigl.Joseph Myers2016-11-242-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines functions for manipulating the payloads of NaNs. This patch implements the setpayloadsig functions for glibc; these are like the setpayload functions, but produce a signaling NaN instead of a quiet NaN. The substance of the implementation was included with the setpayload implementation, so the new files here just need to wrap the main files with different defines to build the new functions. Because the functions store a signaling NaN via a pointer and the libm-test macros choose a suitable initial value for the variable in such a case by comparing with the expected value, the relevant macro needs to clear exceptions after FE_INVALID may have been raised by that comparison. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (setpayloadsig): New declaration. * math/Versions (setpayloadsig): New libm symbol at version GLIBC_2.25. (setpayloadsigf): Likewise. (setpayloadsigl): Likewise. * math/Makefile (libm-calls): Add s_setpayloadsigF. * math/libm-test.inc (RUN_TEST_Ff_b1): Call feclearexcept (FE_ALL_EXCEPT) after initializing EXTRA_VAR. (setpayloadsig_test_data): New array. (setpayloadsig_test): New function. (main): Call setpayloadsig_test. * manual/arith.texi (FP Bit Twiddling): Document setpayloadsig, setpayloadsigf and setpayloadsigl. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/dbl-64/s_setpayloadsig.c: New file. * sysdeps/ieee754/flt-32/s_setpayloadsigf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_setpayloadsigl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-setpayloadsig.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add setpayloadsig. (CFLAGS-nldbl-setpayloadsig.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.
* Add setpayload, setpayloadf, setpayloadl.Joseph Myers2016-11-192-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add canonicalize, canonicalizef, canonicalizel.Joseph Myers2016-10-263-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines canonicalize functions to produce a canonical version of a floating-point representation. This patch implements these functions for glibc. As with the iscanonical macro, these functions are oriented to the decimal floating-point case, where some values have both canonical and noncanonical representations. However, the functions have a return value that says whether they succeeded in storing a canonical result; thus, they can fail for the case of an invalid representation (while still not making any particular choice from among multiple equally canonical valid representations of the same value). Since no floating-point formats in glibc actually have noncanonical valid representations, a type-generic implementation of these functions can be used that expects iscanonical to return 0 only for invalid representations. Now that iscanonical is used within libm.so, libm_hidden_proto / libm_hidden_def are added for __iscanonicall. The definition of these functions is intended to correspond to a convertFormat operation to the same floating-point format. Thus, they convert signaling NaNs to quiet NaNs, raising the "invalid" exception. Such a conversion "should" produce "the canonical version of that signaling NaN made quiet". libm-test.inc is made to check NaN payloads for the output of these functions, a new feature (at some point manipulation functions such as fabs and copysign should have tests added that verify payload preservation for them). As however some architectures may not follow the recommended practice of preserving NaN payloads when converting a signaling NaN to quiet, a new math-tests.h macro SNAN_TESTS_PRESERVE_PAYLOAD is added, and defined to 0 for non-NAN2008 MIPS; any other architectures seeing test failures for lack of payload preservation in this case should also define this macro to 0. (If any cases arise where the sign isn't preserved either, those should have a similar macro added.) The ldbl-96 and ldbl-128ibm tests of iscanonical are renamed and adapted to test canonicalizel as well on the same representations. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (canonicalize): New declaration. * math/Versions (canonicalize): New libm symbol at version GLIBC_2.25. (canonicalizef): Likewise. (canonicalizel): Likewise. * math/Makefile (gen-libm-calls): Add s_canonicalizeF. * math/s_canonicalize_template.c: New file. * math/libm-test.inc: Update comment on functions tested and testing of NaN payloads. (TEST_NAN_PAYLOAD): New macro. (NO_TEST_INLINE): Update value. (XFAIL_TEST): Likewise. (ERRNO_UNCHANGED): Likewise. (ERRNO_EDOM): Likewise. (ERRNO_ERANGE): Likewise. (IGNORE_RESULT): Likewise. (NON_FINITE): Likewise. (TEST_SNAN): Likewise. (NO_TEST_MATHVEC): Likewise. (TEST_NAN_PAYLOAD_CANONICALIZE): New macro. (check_float_internal): Check NaN payloads if TEST_NAN_PAYLOAD. (struct test_Ffp_b1_data): New type. (RUN_TEST_Ffp_b1): New macro. (RUN_TEST_LOOP_Ffp_b1): Likewise. (canonicalize_test_data): New array. (canonicalize_test): New function. (main): Call canonicalize_test. * manual/arith.texi (FP Bit Twiddling): Document canonicalize, canonicalizef and canonicalizel. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/ldbl-opt/nldbl-canonicalize.c: New file. * sysdeps/ieee754/ldbl-opt/s_canonicalizel.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add canonicalize. (CFLAGS-nldbl-canonicalize.c): New variable. * sysdeps/ieee754/ldbl-128ibm/test-iscanonical-ldbl-128ibm.c: Move to ... * sysdeps/ieee754/ldbl-128ibm/test-canonical-ldbl-128ibm.c: ... here. (do_test): Also test canonicalizel. * sysdeps/ieee754/ldbl-128ibm/Makefile (tests): Change test-iscanonical-ldbl-128ibm to test-canonical-ldbl-128ibm. * sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h: New file. * sysdeps/ieee754/ldbl-128ibm/s_iscanonicall.c (__iscanonicall): Use libm_hidden_def. * sysdeps/ieee754/ldbl-96/test-iscanonical-ldbl-96.c: Move to ... * sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c: ... here. (do_test): Also test canonicalizel. * sysdeps/ieee754/ldbl-96/Makefile (tests): Change test-iscanonical-ldbl-96 to test-canonical-ldbl-96. * sysdeps/ieee754/ldbl-96/include/bits/iscanonical.h: New file. * sysdeps/ieee754/ldbl-96/s_iscanonicall.c (__iscanonicall): Use libm_hidden_def. * sysdeps/generic/math-tests.h (SNAN_TESTS_PRESERVE_PAYLOAD): New macro. * sysdeps/mips/math-tests.h [__mips_hard_float && !__mips_nan2008] (SNAN_TESTS_PRESERVE_PAYLOAD): Likewise. * 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.
* Add getpayloadl to libnldbl.Joseph Myers2016-10-262-1/+28
| | | | | | | | | | | | This patch adds getpayloadl to libnldbl, missed in my patch that originally implemented getpayload functions. Tested for powerpc. * sysdeps/ieee754/ldbl-opt/nldbl-getpayload.c: New file. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add getpayload. (CFLAGS-nldbl-getpayload.c): New variable.
* Add strfromd, strfromf, and strfroml functionsGabriel F. T. Gomes2016-10-252-0/+9
| | | | | | | ISO/IEC TS 18661-1 adds several functions in the strfrom family to stdlib. This patch adds strfromd, strfromf, and strfroml. This is being done in preparation for the new floating-point type, float128. The added functions convert a floating-point value into a string, with configurable format.
* Add totalordermag, totalordermagf, totalordermagl.Joseph Myers2016-10-152-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In addition to the totalorder functions, TS 18661-1 defines totalordermag functions, which do the same comparison but on the absolute values of the arguments. This patch implements these functions for glibc, including the type-generic macro in <tgmath.h>. In general the implementations are similar to but simpler than those for the totalorder functions. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalordermag): New declaration. * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalordermag): New macro. * math/Versions (totalordermag): New libm symbol at version GLIBC_2.25. (totalordermagf): Likewise. (totalordermagl): Likewise. * math/Makefile (libm-calls): Add s_totalordermagF. * math/libm-test.inc (totalordermag_test_data): New array. (totalordermag_test): New function. (main): Call totalordermag_test. * math/test-tgmath.c (NCALLS): Increase to 125. (F(compile_test)): Call totalordermag. (F(totalordermag)): New function. * manual/arith.texi (FP Comparison Functions): Document totalordermag, totalordermagf and totalordermagl. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/dbl-64/s_totalordermag.c: New file. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Likewise. * sysdeps/ieee754/flt-32/s_totalordermagf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_totalordermagl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_totalordermagl.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-totalordermag.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add totalordermag. (CFLAGS-nldbl-totalordermag.c): New variable. * sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c (do_test): Also test totalordermagl. * sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c (do_test): Likewise. * 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.
* Add totalorder, totalorderf, totalorderl.Joseph Myers2016-10-122-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines totalorder functions implementing the totalOrder comparison operation from IEEE 754-2008. This patch implements these functions for glibc, including the type-generic macro in <tgmath.h>. (The totalordermag functions will be added in a separate patch.) The description of the totalOrder operation is complicated. However, for IEEE interchange binary formats and the preferred quiet NaN convention, what that complicated description means is that you interpret the representation as a sign-magnitude integer (with -0 coming before +0) and do a <= comparison on that interpretation. For finite values and infinities the ordering of the sign-magnitude integers is just the same as the ordering of floating-point values, so this extends that to all representations. (Different representations of the same floating-point value - which includes same quantum in the decimal case - must still be considered equal by this operation, but that issue doesn't arise for IEEE interchange binary formats.) So the complications are: * When MIPS quiet NaN conventions are in use, the representation of NaNs needs adjusting before making such an integer comparison. This patch does this adjustment only when both arguments are NaNs, as there's no need for it if only one is a NaN, and as long as both are NaNs you can just flip the relevant bits without any problems from this turning a NaN into an infinity. * For the m68k version of ldbl-96, where the high mantissa bit is "don't care" for infinities and NaNs, representations where it differs must compare the same. Note: although the testcase for this compiles, I have not actually tested on m68k. * For ldbl-128ibm, the low part must be ignored when the high part is NaN, and low parts of +0 and -0 must be considered the same whatever the high part. The new tests in libm-test.inc are the first tests there specifying particular payloads for input NaNs. Separate tests are also added for the ldbl-96 and ldbl-128ibm special cases where there are different representations of the same value that must compare equal (which can't be covered in libm-test.inc as that only specifies values, not representations). Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalorder): New declaration. * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalorder): New macro. * math/Versions (totalorder): New libm symbol at version GLIBC_2.25. (totalorderf): Likewise. (totalorderl): Likewise. * math/Makefile (libm-calls): Add s_totalorderF. * math/gen-libm-test.pl (parse_args): Escape quotes in test name string. * math/libm-test.inc (PAYLOAD_DIG): New macro. (qnan_value_pl): Likewise. (snan_value_pl): Likewise. (qnan_value): Define using qnan_value_pl. (snan_value): Define using snan_value_pl. (struct test_ff_i_data): Add comment about which tests use this structure. (RUN_TEST_ff_b): New macro. (RUN_TEST_LOOP_ff_b): Likewise. (totalorder_test_data): New array. (totalorder_test): New function. (main): Call totalorder_test. * math/test-tgmath.c (NCALLS): Increase to 122. (F(compile_test)): Call totalorder. (F(totalorder)): New function. * manual/arith.texi (FP Comparison Functions): Document totalorder, totalorderf and totalorderl. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/dbl-64/s_totalorder.c: New file. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c: Likewise. * sysdeps/ieee754/flt-32/s_totalorderf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_totalorderl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_totalorderl.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-totalorder.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add totalorder. (CFLAGS-nldbl-totalorder.c): New variable. * sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c: New file. * sysdeps/ieee754/ldbl-128ibm/Makefile [$(subdir) = math] (tests): Add test-totalorderl-ldbl-128ibm. * sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c: New file. * sysdeps/ieee754/ldbl-96/Makefile [$(subdir) = math] (tests): Add test-totalorderl-ldbl-96. * 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.
* Build s_nan* objects from a generic templatePaul E. Murphy2016-09-203-10/+1
| | | | | | | This requires adding a macro to synthesize the call to __strto*_nan. Since this is likely to be the only usage ever for strto* functions in generated libm calls, a dedicated macro is defined for it.
* Make ldexpF generic.Paul E. Murphy2016-09-202-6/+46
| | | | | | | | | | | | | | | | | This one is a little more tricky since it is built both for libm and libc, and exports multiple aliases. To simplify aliasing, a new macro is introduced which handles aliasing to two symbols. By default, it just applies declare_mgen_alias to both target symbols. Likewise, the makefile is tweaked a little to generate templates for shared files too, and a new rule is added to build m_*.c objects from the objpfx directory. Verified there are no symbol or code changes using a script to diff the *_ldexp* object files on s390x, aarch64, arm, x86_64, and ppc64.
* Make common fmin implementation generic.Paul E. Murphy2016-09-013-10/+1
|
* Make common fmax implementation generic.Paul E. Murphy2016-09-013-10/+1
| | | | | Also update aarch64 to ensure the correct s_fmin.c is included. The include order favors including the generated copy.
* Make common nextdown implementation generic.Paul E. Murphy2016-09-011-0/+5
| | | | | | | | | | With the exception of those machines using the ldbl-opt in an Implies file, this is a trivial transformation. nextdownl is not subject to the non-trivial versioning rules of the other generated functions, so to keep things simple, it is handled as a one-off case in ldbl-opt to preserve the existing behavior.
* Make common fdim implementation generic.Paul E. Murphy2016-09-014-13/+10
| | | | | | | | | | | | | | The only difference is the usage of math_narrow_eval when building s_fdiml.c. This should be harmless for long double, but I did observe some code generation changes on m68k, but lack the resources to test it. Likewise, to more easily support overriding symbol generation, the aliasing macros are always conditionally defined on their absence to reduce boilerplate. I also ran builds for i486, ppc64, sparcv9, aarch64, s390x and observed no changes to s_fdim* objects.
* Convert remaining complex function to generated filesPaul E. Murphy2016-08-2912-74/+28
| | | | | | Convert cpow, clog, clog10, cexp, csqrt, and cproj functions into generated templates. Note, ldbl-opt still retains s_clog10l.c as the aliasing rules are non-trivial.