glibc/sysdeps/ieee754/ldbl-opt
Joseph Myers 55a38f8236 Add llogb, llogbf, llogbl.
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.
2016-12-02 01:42:49 +00:00
..
configure rename configure.in to configure.ac 2013-10-30 17:32:08 +10:00
configure.ac rename configure.in to configure.ac 2013-10-30 17:32:08 +10:00
Makefile Add llogb, llogbf, llogbl. 2016-12-02 01:42:49 +00:00
math_ldbl_opt.c
math_ldbl_opt.h Remove --disable-versioning. 2013-09-04 15:25:42 +00:00
math-type-macros-double.h Make ilogb wrappers type-generic. 2016-11-28 23:27:23 +00:00
math-type-macros-ldouble.h Make common fdim implementation generic. 2016-09-01 09:28:05 -05:00
nldbl-acos.c
nldbl-acosh.c
nldbl-asin.c
nldbl-asinh.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_HIDDEN): Removed. 2006-01-14 20:33:13 +00:00
nldbl-asprintf_chk.c * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
nldbl-asprintf.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Don't try 2006-01-14 22:08:18 +00:00
nldbl-atan2.c
nldbl-atan.c
nldbl-atanh.c
nldbl-cabs.c
nldbl-cacos.c
nldbl-cacosh.c
nldbl-canonicalize.c Add canonicalize, canonicalizef, canonicalizel. 2016-10-26 23:14:31 +00:00
nldbl-carg.c
nldbl-casin.c
nldbl-casinh.c
nldbl-catan.c
nldbl-catanh.c
nldbl-cbrt.c
nldbl-ccos.c
nldbl-ccosh.c
nldbl-ceil.c
nldbl-cexp.c
nldbl-cimag.c
nldbl-clog10.c
nldbl-clog.c
nldbl-compat.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nldbl-compat.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nldbl-conj.c
nldbl-copysign.c Use __copysign rather than copysign. 2015-04-22 12:07:56 +00:00
nldbl-cos.c
nldbl-cosh.c
nldbl-cpow.c
nldbl-cproj.c
nldbl-creal.c
nldbl-csin.c
nldbl-csinh.c
nldbl-csqrt.c
nldbl-ctan.c
nldbl-ctanh.c
nldbl-dprintf_chk.c * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
nldbl-dprintf.c * sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c: Restore 2006-01-18 23:30:58 +00:00
nldbl-erf.c
nldbl-erfc.c
nldbl-exp2.c
nldbl-exp10.c
nldbl-exp.c
nldbl-expm1.c
nldbl-fabs.c
nldbl-fdim.c
nldbl-finite.c Replace finite with isfinite. 2015-06-03 16:35:44 +01:00
nldbl-floor.c
nldbl-fma.c
nldbl-fmax.c
nldbl-fmin.c
nldbl-fmod.c
nldbl-fprintf_chk.c
nldbl-fprintf.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Don't try 2006-01-14 22:08:18 +00:00
nldbl-frexp.c
nldbl-fscanf.c
nldbl-fwprintf_chk.c
nldbl-fwprintf.c
nldbl-fwscanf.c
nldbl-gamma.c
nldbl-getpayload.c Add getpayloadl to libnldbl. 2016-10-26 17:10:00 +00:00
nldbl-hypot.c
nldbl-ilogb.c
nldbl-iovfscanf.c
nldbl-isinf.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
nldbl-isnan.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
nldbl-isoc99_fscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_fwscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_scanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_sscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_swscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_vfscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_vfwscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_vscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_vsscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_vswscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_vwscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_wscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-j0.c
nldbl-j1.c
nldbl-jn.c
nldbl-ldexp.c
nldbl-lgamma_r.c
nldbl-lgamma.c
nldbl-llogb.c Add llogb, llogbf, llogbl. 2016-12-02 01:42:49 +00:00
nldbl-llrint.c
nldbl-llround.c
nldbl-log1p.c
nldbl-log2.c
nldbl-log10.c
nldbl-log.c
nldbl-logb.c
nldbl-lrint.c
nldbl-lround.c
nldbl-modf.c
nldbl-nan.c
nldbl-nearbyint.c
nldbl-nextafter.c
nldbl-nextdown.c Add nextup and nextdown math functions 2016-06-16 21:37:45 +05:30
nldbl-nexttoward.c
nldbl-nexttowardf.c
nldbl-nextup.c Add nextup and nextdown math functions 2016-06-16 21:37:45 +05:30
nldbl-obstack_printf_chk.c * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
nldbl-obstack_printf.c
nldbl-obstack_vprintf_chk.c * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
nldbl-obstack_vprintf.c
nldbl-pow10.c
nldbl-pow.c
nldbl-printf_chk.c
nldbl-printf_fp.c
nldbl-printf_size.c
nldbl-printf.c
nldbl-qecvt_r.c
nldbl-qecvt.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Don't try 2006-01-14 22:08:18 +00:00
nldbl-qfcvt_r.c
nldbl-qfcvt.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Don't try 2006-01-14 22:08:18 +00:00
nldbl-qgcvt.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Don't try 2006-01-14 22:08:18 +00:00
nldbl-remainder.c Make drem an alias of remainder (bug 16171). 2015-10-29 22:29:21 +00:00
nldbl-remquo.c
nldbl-rint.c
nldbl-round.c
nldbl-scalb.c
nldbl-scalbln.c
nldbl-scalbn.c
nldbl-scanf.c
nldbl-setpayload.c Add setpayload, setpayloadf, setpayloadl. 2016-11-19 00:16:28 +00:00
nldbl-setpayloadsig.c Add setpayloadsig, setpayloadsigf, setpayloadsigl. 2016-11-24 23:56:48 +00:00
nldbl-signbit.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
nldbl-significand.c
nldbl-sin.c
nldbl-sincos.c
nldbl-sinh.c
nldbl-snprintf_chk.c
nldbl-snprintf.c
nldbl-sprintf_chk.c
nldbl-sprintf.c
nldbl-sqrt.c
nldbl-sscanf.c
nldbl-strfmon_l.c
nldbl-strfmon.c
nldbl-strfroml.c Add strfromd, strfromf, and strfroml functions 2016-10-25 17:03:54 -02:00
nldbl-strtold_l.c Remove pre-ISO C support 2012-01-07 23:57:22 -05:00
nldbl-strtold.c
nldbl-strtoldint.c
nldbl-swprintf_chk.c
nldbl-swprintf.c
nldbl-swscanf.c
nldbl-syslog_chk.c
nldbl-syslog.c
nldbl-tan.c
nldbl-tanh.c
nldbl-tgamma.c
nldbl-totalorder.c Add totalorder, totalorderf, totalorderl. 2016-10-12 01:20:30 +00:00
nldbl-totalordermag.c Add totalordermag, totalordermagf, totalordermagl. 2016-10-15 00:36:48 +00:00
nldbl-trunc.c
nldbl-vasprintf_chk.c * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
nldbl-vasprintf.c
nldbl-vdprintf_chk.c * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
nldbl-vdprintf.c
nldbl-vfprintf_chk.c
nldbl-vfprintf.c
nldbl-vfscanf.c
nldbl-vfwprintf_chk.c
nldbl-vfwprintf.c
nldbl-vfwscanf.c
nldbl-vprintf_chk.c
nldbl-vprintf.c
nldbl-vscanf.c
nldbl-vsnprintf_chk.c
nldbl-vsnprintf.c
nldbl-vsprintf_chk.c
nldbl-vsprintf.c
nldbl-vsscanf.c
nldbl-vswprintf_chk.c
nldbl-vswprintf.c
nldbl-vswscanf.c
nldbl-vsyslog_chk.c
nldbl-vsyslog.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Don't try 2006-01-14 22:08:18 +00:00
nldbl-vwprintf_chk.c
nldbl-vwprintf.c
nldbl-vwscanf.c
nldbl-wcstold_l.c
nldbl-wcstold.c
nldbl-wcstoldint.c
nldbl-wprintf_chk.c
nldbl-wprintf.c
nldbl-wscanf.c
nldbl-y0.c
nldbl-y1.c
nldbl-yn.c
s_asinh.c
s_atan.c
s_canonicalizel.c Add canonicalize, canonicalizef, canonicalizel. 2016-10-26 23:14:31 +00:00
s_cbrt.c
s_ceil.c
s_clog10l.c Convert remaining complex function to generated files 2016-08-29 12:43:38 -05:00
s_copysign.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_erf.c
s_expm1.c
s_fabs.c
s_finite.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_floor.c
s_fma.c Implement accurate fma. 2010-10-13 22:27:03 -04:00
s_fmal.c
s_frexp.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_isinf.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_isnan.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_ldexp.c Make ldexpF generic. 2016-09-20 14:37:40 -05:00
s_ldexpl.c Make ldexpF generic. 2016-09-20 14:37:40 -05:00
s_llrint.c
s_llround.c
s_log1p.c
s_logb.c
s_lrint.c
s_lround.c
s_modf.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_nearbyint.c
s_nextafter.c
s_nextdownl.c Make common nextdown implementation generic. 2016-09-01 09:31:03 -05:00
s_nexttowardfd.c Make nextafter, nexttoward set errno (bug 6799). 2015-11-02 18:54:19 +00:00
s_remquo.c
s_rint.c
s_round.c
s_scalbln.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_scalbn.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_significand.c
s_significandl.c
s_sin.c Fixed powerpc64 build. 2015-06-19 20:42:34 +03:00
s_sincos.c
s_tan.c
s_tanh.c
s_trunc.c
Versions * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
w_acos.c
w_acosh.c
w_acoshl.c
w_acosl.c
w_asin.c
w_asinl.c
w_atan2.c
w_atan2l.c
w_atanh.c
w_atanhl.c
w_cosh.c
w_coshl.c
w_exp10.c
w_exp10l.c
w_exp.c
w_fmod.c
w_fmodl.c
w_hypot.c
w_hypotl.c
w_j0.c
w_j0l.c
w_j1.c
w_j1l.c
w_jn.c
w_jnl.c
w_lgamma_compat.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
w_lgamma_compatl.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
w_lgamma_r.c
w_lgammal_r.c
w_llogbl.c Add llogb, llogbf, llogbl. 2016-12-02 01:42:49 +00:00
w_log2.c
w_log2l.c
w_log10.c
w_log10l.c
w_log.c
w_logl.c
w_pow.c
w_powl.c
w_remainder.c Make drem an alias of remainder (bug 16171). 2015-10-29 22:29:21 +00:00
w_remainderl.c Make drem an alias of remainder (bug 16171). 2015-10-29 22:29:21 +00:00
w_scalb.c
w_scalbl.c
w_sinh.c
w_sinhl.c
w_sqrt.c
w_sqrtl.c
w_tgamma.c
w_tgammal.c