glibc/manual
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
..
examples libio: Multiple fixes for open_{w}memstram (BZ#18241 and BZ#20181) 2016-09-30 09:14:15 -07:00
argp.texi Manual typos: The Basic Program/System Interface 2016-10-06 12:19:25 +05:30
arith.texi Add setpayloadsig, setpayloadsigf, setpayloadsigl. 2016-11-24 23:56:48 +00:00
charset.texi
check-safety.sh
conf.texi Manual typos: System Configuration Parameters 2016-10-06 12:24:07 +05:30
contrib.texi Manual typos: Contributors to 2016-10-06 12:30:03 +05:30
creature.texi Support __STDC_WANT_IEC_60559_FUNCS_EXT__ feature test macro. 2016-08-03 22:21:37 +00:00
crypt.texi Manual typos: DES Encryption and Password Handling 2016-10-06 12:25:00 +05:30
ctype.texi
debug.texi Manual typos: Debugging support 2016-10-06 12:25:38 +05:30
dir
errno.texi
fdl-1.3.texi
filesys.texi Manual typos: File System Interface 2016-10-06 12:01:51 +05:30
freemanuals.texi
getopt.texi Manual typos: The Basic Program/System Interface 2016-10-06 12:19:25 +05:30
header.texi
install-plain.texi
install.texi Add configure check to test if gcc supports attribute ifunc. 2016-10-07 10:02:59 +02:00
intro.texi
io.texi
ipc.texi
job.texi Manual typos: Job Control 2016-10-06 12:20:28 +05:30
lang.texi Manual typos: C Language Facilities in the Library 2016-10-06 12:27:48 +05:30
lgpl-2.1.texi
libc-texinfo.sh
libc.texinfo
libcbook.texi
libdl.texi
libm-err-tab.pl Add llogb, llogbf, llogbl. 2016-12-02 01:42:49 +00:00
llio.texi Manual typos: Low-Level Input/Output 2016-10-06 11:58:02 +05:30
locale.texi
macros.texi
maint.texi Manual typos: Library Maintenance 2016-10-06 12:29:11 +05:30
Makefile
math.texi Add llogb, llogbf, llogbl. 2016-12-02 01:42:49 +00:00
memory.texi Remove references to sbrk to grow/shrink arenas 2016-10-26 15:07:07 +05:30
message.texi
nss.texi Manual typos: System Databases and Name Service Switch 2016-10-06 12:36:26 +05:30
nsswitch.texi
pattern.texi
pipe.texi
platform.texi
probes.texi Manual typos: Internal probes 2016-10-06 12:26:35 +05:30
process.texi Manual typos: Processes 2016-10-06 12:20:00 +05:30
resource.texi Manual typos: Resource Usage and Limitation 2016-10-06 12:16:53 +05:30
search.texi
setjmp.texi Manual typos: Non-Local Exits 2016-10-06 12:17:29 +05:30
signal.texi Manual typos: Signal Handling 2016-10-06 12:18:05 +05:30
socket.texi Manual typos: Sockets 2016-10-06 12:05:11 +05:30
startup.texi Manual typos: The Basic Program/System Interface 2016-10-06 12:19:25 +05:30
stdio-fp.c
stdio.texi Manual typos: Input/Output on Streams 2016-10-06 11:55:58 +05:30
string.texi manual: Clarify the documentation of strverscmp [BZ #20524] 2016-09-21 15:41:17 +02:00
summary.awk
sysinfo.texi manual: Remove non-existent mount options S_IMMUTABLE and S_APPEND [BZ #11235] 2016-11-15 15:56:00 -05:00
syslog.texi Manual typos: Syslog 2016-10-06 12:08:46 +05:30
terminal.texi Manual typos: Low-Level Terminal Interface 2016-10-06 12:07:28 +05:30
texinfo.tex
texis.awk
threads.texi Manual typos: POSIX Threads 2016-10-06 12:26:06 +05:30
time.texi Manual typos: Date and Time 2016-10-06 12:14:36 +05:30
tsort.awk
users.texi Manual typos: Users and Groups 2016-10-06 12:21:46 +05:30
xtract-typefun.awk