about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorJoseph Myers <josmyers@redhat.com>2024-05-20 13:41:39 +0000
committerJoseph Myers <josmyers@redhat.com>2024-05-20 13:41:39 +0000
commit79c52daf4740b00bef43e4f5a4281b3480459b38 (patch)
treecc15e0f7402870b20dbebf8d539df033806d48b0 /sysdeps
parentcf0ca8d52e1653d4aa4311a4649af8dc541ce6b4 (diff)
downloadglibc-79c52daf4740b00bef43e4f5a4281b3480459b38.tar.gz
glibc-79c52daf4740b00bef43e4f5a4281b3480459b38.tar.xz
glibc-79c52daf4740b00bef43e4f5a4281b3480459b38.zip
Implement C23 log2p1
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the log2p1 functions (log2(1+x): like log1p, but for
base-2 logarithms).

This illustrates the intended structure of implementations of all
these function families: define them initially with a type-generic
template implementation.  If someone wishes to add type-specific
implementations, it is likely such implementations can be both faster
and more accurate than the type-generic one and can then override it
for types for which they are implemented (adding benchmarks would be
desirable in such cases to demonstrate that a new implementation is
indeed faster).

The test inputs are copied from those for log1p.  Note that these
changes make gen-auto-libm-tests depend on MPFR 4.2 (or later).

The bulk of the changes are fairly generic for any such new function.
(sysdeps/powerpc/nofpu/Makefile only needs changing for those
type-generic templates that use fabs.)

Tested for x86_64 and x86, and with build-many-glibcs.py.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/i686/fpu/multiarch/libm-test-ulps24
-rw-r--r--sysdeps/ieee754/ldbl-128ibm-compat/Versions3
-rw-r--r--sysdeps/ieee754/ldbl-opt/Makefile4
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log2p1.c8
-rw-r--r--sysdeps/mach/hurd/i386/libm.abilist8
-rw-r--r--sysdeps/mach/hurd/x86_64/libm.abilist8
-rw-r--r--sysdeps/powerpc/nofpu/Makefile1
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/alpha/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/arc/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/arm/be/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/arm/le/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/csky/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/hppa/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/i386/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/be/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/le/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/nios2/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/or1k/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist9
-rw-r--r--sysdeps/unix/sysv/linux/riscv/rv32/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/sh/be/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/sh/le/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist8
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps24
39 files changed, 294 insertions, 1 deletions
diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
index da6602f909..9eb3088d7a 100644
--- a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
+++ b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
@@ -1424,6 +1424,30 @@ float: 1
 float128: 1
 ldouble: 1
 
+Function: "log2p1":
+double: 1
+float: 1
+float128: 3
+ldouble: 2
+
+Function: "log2p1_downward":
+double: 1
+float: 1
+float128: 3
+ldouble: 4
+
+Function: "log2p1_towardzero":
+double: 1
+float: 1
+float128: 2
+ldouble: 4
+
+Function: "log2p1_upward":
+double: 1
+float: 1
+float128: 2
+ldouble: 5
+
 Function: "log_downward":
 double: 1
 float128: 1
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Versions b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
index c0679a1153..c9a74366fd 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Versions
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
@@ -137,6 +137,9 @@ libm {
     __fminimum_magieee128;
     __fminimum_mag_numieee128;
   }
+  GLIBC_2.40 {
+    __log2p1ieee128;
+  }
 }
 libc {
   LDBL_IBM128_VERSION {
diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile
index 74788ac999..80727613c7 100644
--- a/sysdeps/ieee754/ldbl-opt/Makefile
+++ b/sysdeps/ieee754/ldbl-opt/Makefile
@@ -51,7 +51,8 @@ libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \
 		 roundeven fromfp ufromfp fromfpx ufromfpx fadd dadd \
 		 fdiv ddiv ffma dfma fmul dmul fsqrt dsqrt fsub dsub \
 		 fmaximum fmaximum_mag fmaximum_num fmaximum_mag_num \
-		 fminimum fminimum_mag fminimum_num fminimum_mag_num
+		 fminimum fminimum_mag fminimum_num fminimum_mag_num \
+		 log2p1
 libnldbl-routines = $(libnldbl-calls:%=nldbl-%)
 libnldbl-inhibit-o = $(object-suffixes)
 libnldbl-static-only-routines = $(libnldbl-routines)
@@ -151,6 +152,7 @@ CFLAGS-nldbl-log.c = -fno-builtin-logl
 CFLAGS-nldbl-log10.c = -fno-builtin-log10l
 CFLAGS-nldbl-log1p.c = -fno-builtin-log1pl
 CFLAGS-nldbl-log2.c = -fno-builtin-log2l
+CFLAGS-nldbl-log2p1.c = -fno-builtin-log2p1l
 CFLAGS-nldbl-logb.c = -fno-builtin-logbl
 CFLAGS-nldbl-lrint.c = -fno-builtin-lrintl
 CFLAGS-nldbl-lround.c = -fno-builtin-lroundl
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-log2p1.c b/sysdeps/ieee754/ldbl-opt/nldbl-log2p1.c
new file mode 100644
index 0000000000..989c69e3d7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-log2p1.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+log2p1l (double x)
+{
+  return log2p1 (x);
+}
diff --git a/sysdeps/mach/hurd/i386/libm.abilist b/sysdeps/mach/hurd/i386/libm.abilist
index 8f40ddb150..113daa4b44 100644
--- a/sysdeps/mach/hurd/i386/libm.abilist
+++ b/sysdeps/mach/hurd/i386/libm.abilist
@@ -1181,3 +1181,11 @@ GLIBC_2.35 fsqrt F
 GLIBC_2.35 fsqrtl F
 GLIBC_2.35 hypot F
 GLIBC_2.35 hypotf F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/mach/hurd/x86_64/libm.abilist b/sysdeps/mach/hurd/x86_64/libm.abilist
index 5c762b937b..0c7ffd4e3f 100644
--- a/sysdeps/mach/hurd/x86_64/libm.abilist
+++ b/sysdeps/mach/hurd/x86_64/libm.abilist
@@ -1038,3 +1038,11 @@ GLIBC_2.38 ynf32x F
 GLIBC_2.38 ynf64 F
 GLIBC_2.38 ynf64x F
 GLIBC_2.38 ynl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/powerpc/nofpu/Makefile b/sysdeps/powerpc/nofpu/Makefile
index fa462339ba..96657c9676 100644
--- a/sysdeps/powerpc/nofpu/Makefile
+++ b/sysdeps/powerpc/nofpu/Makefile
@@ -54,4 +54,5 @@ CFLAGS-s_fmaximum_magl.c += -fno-builtin-fabsl
 CFLAGS-s_fmaximum_mag_numl.c += -fno-builtin-fabsl
 CFLAGS-s_fminimum_magl.c += -fno-builtin-fabsl
 CFLAGS-s_fminimum_mag_numl.c += -fno-builtin-fabsl
+CFLAGS-s_log2p1l.c += -fno-builtin-fabsl
 endif
diff --git a/sysdeps/unix/sysv/linux/aarch64/libm.abilist b/sysdeps/unix/sysv/linux/aarch64/libm.abilist
index f0da228fbb..a4bb539670 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libm.abilist
@@ -1149,3 +1149,11 @@ GLIBC_2.35 hypotf F
 GLIBC_2.38 fmod F
 GLIBC_2.38 fmodf F
 GLIBC_2.39 exp10 F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/alpha/libm.abilist b/sysdeps/unix/sysv/linux/alpha/libm.abilist
index f5d8023d62..8ff65e3f7e 100644
--- a/sysdeps/unix/sysv/linux/alpha/libm.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libm.abilist
@@ -1308,3 +1308,11 @@ GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/arc/libm.abilist b/sysdeps/unix/sysv/linux/arc/libm.abilist
index f2169f8f57..af9df2673c 100644
--- a/sysdeps/unix/sysv/linux/arc/libm.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libm.abilist
@@ -757,3 +757,9 @@ GLIBC_2.35 fminimumf64 F
 GLIBC_2.35 fminimuml F
 GLIBC_2.35 fsqrt F
 GLIBC_2.35 fsqrtl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libm.abilist b/sysdeps/unix/sysv/linux/arm/be/libm.abilist
index f020a8a904..0e460259f3 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libm.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libm.abilist
@@ -848,3 +848,9 @@ GLIBC_2.4 y1l F
 GLIBC_2.4 yn F
 GLIBC_2.4 ynf F
 GLIBC_2.4 ynl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libm.abilist b/sysdeps/unix/sysv/linux/arm/le/libm.abilist
index f020a8a904..0e460259f3 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libm.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libm.abilist
@@ -848,3 +848,9 @@ GLIBC_2.4 y1l F
 GLIBC_2.4 yn F
 GLIBC_2.4 ynf F
 GLIBC_2.4 ynl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/csky/libm.abilist b/sysdeps/unix/sysv/linux/csky/libm.abilist
index 225a5e9b81..4c1216044d 100644
--- a/sysdeps/unix/sysv/linux/csky/libm.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libm.abilist
@@ -823,3 +823,9 @@ GLIBC_2.35 fminimumf64 F
 GLIBC_2.35 fminimuml F
 GLIBC_2.35 fsqrt F
 GLIBC_2.35 fsqrtl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/hppa/libm.abilist b/sysdeps/unix/sysv/linux/hppa/libm.abilist
index 450ac03223..3ea5b611eb 100644
--- a/sysdeps/unix/sysv/linux/hppa/libm.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libm.abilist
@@ -848,3 +848,9 @@ GLIBC_2.38 fmod F
 GLIBC_2.38 fmodf F
 GLIBC_2.39 exp10 F
 GLIBC_2.4 exp2l F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/i386/libm.abilist b/sysdeps/unix/sysv/linux/i386/libm.abilist
index 5d89aaa08e..696e52e65a 100644
--- a/sysdeps/unix/sysv/linux/i386/libm.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libm.abilist
@@ -1188,3 +1188,11 @@ GLIBC_2.35 fsqrt F
 GLIBC_2.35 fsqrtl F
 GLIBC_2.35 hypot F
 GLIBC_2.35 hypotf F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist b/sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist
index b3dbd00001..1c6f02ac5a 100644
--- a/sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist
@@ -1028,3 +1028,11 @@ GLIBC_2.36 ynf32x F
 GLIBC_2.36 ynf64 F
 GLIBC_2.36 ynf64x F
 GLIBC_2.36 ynl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist
index f020a8a904..0e460259f3 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist
@@ -848,3 +848,9 @@ GLIBC_2.4 y1l F
 GLIBC_2.4 yn F
 GLIBC_2.4 ynf F
 GLIBC_2.4 ynl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist
index e7cd739a54..be8262bb48 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist
@@ -884,3 +884,9 @@ GLIBC_2.35 fsqrt F
 GLIBC_2.35 fsqrtl F
 GLIBC_2.35 hypot F
 GLIBC_2.35 hypotf F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libm.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libm.abilist
index 1f7f63f60c..cc091b2d4e 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libm.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libm.abilist
@@ -848,3 +848,9 @@ GLIBC_2.35 hypotf F
 GLIBC_2.38 fmod F
 GLIBC_2.38 fmodf F
 GLIBC_2.39 exp10 F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libm.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libm.abilist
index 1f7f63f60c..cc091b2d4e 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libm.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libm.abilist
@@ -848,3 +848,9 @@ GLIBC_2.35 hypotf F
 GLIBC_2.38 fmod F
 GLIBC_2.38 fmodf F
 GLIBC_2.39 exp10 F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist
index 797071aee8..4d442a989d 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist
@@ -848,3 +848,9 @@ GLIBC_2.38 fmod F
 GLIBC_2.38 fmodf F
 GLIBC_2.39 exp10 F
 GLIBC_2.4 exp2l F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist
index 14758703cf..ae7b4a7558 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist
@@ -1149,3 +1149,11 @@ GLIBC_2.35 hypotf F
 GLIBC_2.38 fmod F
 GLIBC_2.38 fmodf F
 GLIBC_2.39 exp10 F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/nios2/libm.abilist b/sysdeps/unix/sysv/linux/nios2/libm.abilist
index c0ebe119dc..9ed3fbdee4 100644
--- a/sysdeps/unix/sysv/linux/nios2/libm.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libm.abilist
@@ -848,3 +848,9 @@ GLIBC_2.35 hypotf F
 GLIBC_2.38 fmod F
 GLIBC_2.38 fmodf F
 GLIBC_2.39 exp10 F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/or1k/libm.abilist b/sysdeps/unix/sysv/linux/or1k/libm.abilist
index 9d26508ff5..69655f7d23 100644
--- a/sysdeps/unix/sysv/linux/or1k/libm.abilist
+++ b/sysdeps/unix/sysv/linux/or1k/libm.abilist
@@ -757,3 +757,9 @@ GLIBC_2.35 ynf32 F
 GLIBC_2.35 ynf32x F
 GLIBC_2.35 ynf64 F
 GLIBC_2.35 ynl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist
index 4f88e0af9c..564eb87d4b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist
@@ -995,3 +995,9 @@ GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist
index edc26140dc..a57eedb779 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist
@@ -994,3 +994,9 @@ GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist
index 0a8a1433d7..7564069a37 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist
@@ -988,3 +988,9 @@ GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist
index 5174d20032..b02a7115af 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist
@@ -1321,3 +1321,12 @@ GLIBC_2.35 hypotf F
 GLIBC_2.38 fmod F
 GLIBC_2.38 fmodf F
 GLIBC_2.39 exp10 F
+GLIBC_2.40 __log2p1ieee128 F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libm.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libm.abilist
index 45ca5c677a..7bf0bd7c7a 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libm.abilist
@@ -1028,3 +1028,11 @@ GLIBC_2.35 fminimumf64x F
 GLIBC_2.35 fminimuml F
 GLIBC_2.35 fsqrt F
 GLIBC_2.35 fsqrtl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist
index 4838edf991..c22d9bb7c6 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist
@@ -1125,3 +1125,11 @@ GLIBC_2.35 fminimumf64x F
 GLIBC_2.35 fminimuml F
 GLIBC_2.35 fsqrt F
 GLIBC_2.35 fsqrtl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist
index 5ff11fb54f..2fb712ec71 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist
@@ -1252,3 +1252,11 @@ GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
index 0e246c2c54..40489589a7 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
@@ -1252,3 +1252,11 @@ GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libm.abilist b/sysdeps/unix/sysv/linux/sh/be/libm.abilist
index 7b43a866e2..a5363e90d6 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libm.abilist
@@ -848,3 +848,9 @@ GLIBC_2.38 fmod F
 GLIBC_2.38 fmodf F
 GLIBC_2.39 exp10 F
 GLIBC_2.4 exp2l F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libm.abilist b/sysdeps/unix/sysv/linux/sh/le/libm.abilist
index 7b43a866e2..a5363e90d6 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libm.abilist
@@ -848,3 +848,9 @@ GLIBC_2.38 fmod F
 GLIBC_2.38 fmodf F
 GLIBC_2.39 exp10 F
 GLIBC_2.4 exp2l F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
index e3dcf3d4e7..9bda9bdeb5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
@@ -1259,3 +1259,11 @@ GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist
index 20fef20c8b..61d2aa05a9 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist
@@ -1149,3 +1149,11 @@ GLIBC_2.35 hypotf F
 GLIBC_2.38 fmod F
 GLIBC_2.38 fmodf F
 GLIBC_2.39 exp10 F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist
index c1c5c76e26..bbf646fe7f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist
@@ -1182,3 +1182,11 @@ GLIBC_2.35 hypotf F
 GLIBC_2.38 fmod F
 GLIBC_2.38 fmodf F
 GLIBC_2.39 exp10 F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist
index fac219d45a..7c7b884dde 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist
@@ -1182,3 +1182,11 @@ GLIBC_2.35 hypotf F
 GLIBC_2.38 fmod F
 GLIBC_2.38 fmodf F
 GLIBC_2.39 exp10 F
+GLIBC_2.40 log2p1 F
+GLIBC_2.40 log2p1f F
+GLIBC_2.40 log2p1f128 F
+GLIBC_2.40 log2p1f32 F
+GLIBC_2.40 log2p1f32x F
+GLIBC_2.40 log2p1f64 F
+GLIBC_2.40 log2p1f64x F
+GLIBC_2.40 log2p1l F
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index e0015347d0..893c22b19b 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -1847,6 +1847,30 @@ float: 1
 Function: "log2_vlen8_avx2":
 float: 1
 
+Function: "log2p1":
+double: 1
+float: 1
+float128: 3
+ldouble: 2
+
+Function: "log2p1_downward":
+double: 2
+float: 2
+float128: 3
+ldouble: 4
+
+Function: "log2p1_towardzero":
+double: 2
+float: 2
+float128: 2
+ldouble: 4
+
+Function: "log2p1_upward":
+double: 1
+float: 2
+float128: 2
+ldouble: 5
+
 Function: "log_downward":
 float: 2
 float128: 1