about summary refs log tree commit diff
path: root/sysdeps/powerpc
diff options
context:
space:
mode:
authorJoseph Myers <josmyers@redhat.com>2024-06-17 13:47:09 +0000
committerJoseph Myers <josmyers@redhat.com>2024-06-17 13:47:09 +0000
commitbb014f50c4a0c8d8db1ba5af55c104e430b5533d (patch)
treea1ca91748bb999691442701c3b786ebc3372114f /sysdeps/powerpc
parentca38eff28015f376c020b4dfad5351e45be8d090 (diff)
downloadglibc-bb014f50c4a0c8d8db1ba5af55c104e430b5533d.tar.gz
glibc-bb014f50c4a0c8d8db1ba5af55c104e430b5533d.tar.xz
glibc-bb014f50c4a0c8d8db1ba5af55c104e430b5533d.zip
Implement C23 logp1
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the logp1 functions (aliases for log1p functions - the
name is intended to be more consistent with the new log2p1 and
log10p1, where clearly it would have been very confusing to name those
functions log21p and log101p).  As aliases rather than new functions,
the content of this patch is somewhat different from those actually
adding new functions.

Tests are shared with log1p, so this patch *does* mechanically update
all affected libm-test-ulps files to expect the same errors for both
functions.

The vector versions of log1p on aarch64 and x86_64 are *not* updated
to have logp1 aliases (and thus there are no corresponding header,
tests, abilist or ulps changes for vector functions either).  It would
be reasonable for such vector aliases and corresponding changes to
other files to be made separately.  For now, the log1p tests instead
avoid testing logp1 in the vector case (a Makefile change is needed to
avoid problems with grep, used in generating the .c files for vector
function tests, matching more than one ALL_RM_TEST line in a file
testing multiple functions with the same inputs, when it assumes that
the .inc file only has a single such line).

Tested for x86_64 and x86, and with build-many-glibcs.py.
Diffstat (limited to 'sysdeps/powerpc')
-rw-r--r--sysdeps/powerpc/fpu/libm-test-ulps24
-rw-r--r--sysdeps/powerpc/nofpu/libm-test-ulps20
-rw-r--r--sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile2
-rw-r--r--sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects.h4
-rw-r--r--sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.h4
-rw-r--r--sysdeps/powerpc/powerpc64/le/fpu/multiarch/math-type-macros-float128.h2
6 files changed, 54 insertions, 2 deletions
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 78e9a9ad6e..e41e585979 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -1546,6 +1546,30 @@ float: 2
 float128: 1
 ldouble: 1
 
+Function: "logp1":
+double: 1
+float: 1
+float128: 3
+ldouble: 2
+
+Function: "logp1_downward":
+double: 1
+float: 2
+float128: 3
+ldouble: 2
+
+Function: "logp1_towardzero":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: "logp1_upward":
+double: 2
+float: 2
+float128: 2
+ldouble: 3
+
 Function: "mul_downward_ldouble":
 double: 1
 float: 1
diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
index 35a1e7b7fd..94d737a400 100644
--- a/sysdeps/powerpc/nofpu/libm-test-ulps
+++ b/sysdeps/powerpc/nofpu/libm-test-ulps
@@ -1260,6 +1260,26 @@ double: 1
 float: 2
 ldouble: 1
 
+Function: "logp1":
+double: 1
+float: 1
+ldouble: 2
+
+Function: "logp1_downward":
+double: 2
+float: 2
+ldouble: 2
+
+Function: "logp1_towardzero":
+double: 2
+float: 2
+ldouble: 2
+
+Function: "logp1_upward":
+double: 2
+float: 2
+ldouble: 2
+
 Function: "mul_downward_ldouble":
 double: 1
 float: 1
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile
index b59c4b21ba..43d9e5fa13 100644
--- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile
@@ -295,7 +295,7 @@ CFLAGS-s_llrintf128-ifunc.c += -fno-builtin-llrintf64x
 CFLAGS-s_llroundf128-ifunc.c += -fno-builtin-llroundf64x
 CFLAGS-e_logf128-ifunc.c += -fno-builtin-logf64x
 CFLAGS-w_log10f128-ifunc.c += -fno-builtin-log10f64x
-CFLAGS-w_log1pf128-ifunc.c += -fno-builtin-log1pf64x
+CFLAGS-w_log1pf128-ifunc.c += -fno-builtin-log1pf64x -fno-builtin-logp1f64x
 CFLAGS-e_log2f128-ifunc.c += -fno-builtin-log2f64x
 CFLAGS-s_logbf128-ifunc.c += -fno-builtin-logbf64x
 CFLAGS-s_lrintf128-ifunc.c += -fno-builtin-lrintf64x
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects.h b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects.h
index 40df525ea5..155aabc4b0 100644
--- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects.h
+++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects.h
@@ -33,6 +33,10 @@ extern __typeof (ldexpf128) F128_SFX_APPEND (__ldexpf128);
 
 #define __ldexpf128 F128_SFX_APPEND (__ldexpf128)
 
+extern __typeof (log1pf128) F128_SFX_APPEND (__w_log1pf128);
+
+#define __w_log1pf128 F128_SFX_APPEND (__w_log1pf128)
+
 /* libm_hidden_proto is disabled by the time we reach here.
    Ensure some internally called functions are still called
    without going through the PLT.  Note, this code is only
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.h b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.h
index ce337e4257..f235f824ae 100644
--- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.h
+++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.h
@@ -138,7 +138,9 @@
 
 /* Ensure the wrapper functions get exposed via IFUNC, not the
    wrappee (e.g __w_log1pf128_power8 instead of __log1pf128_power8.  */
-#define DECL_ALIAS_w_log1p(x) MAKE_IFUNCP_WRAP_R(w_,x,)
+#define DECL_ALIAS_w_log1p(x)			\
+  MAKE_IFUNCP_WRAP_R (w_, x, )			\
+  MAKE_IFUNCP_WRAP_R (w_, logp1, )
 #define DECL_ALIAS_w_scalbln(x) MAKE_IFUNCP_WRAP_R(w_,x,)
 
 /* These are declared in their respective jX objects.  */
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/math-type-macros-float128.h b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/math-type-macros-float128.h
index 790d9743f8..0506db0855 100644
--- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/math-type-macros-float128.h
+++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/math-type-macros-float128.h
@@ -106,11 +106,13 @@ F128_REDIR (__remainderf128);
 extern _Float128 __wrap_scalbnf128 (_Float128, int);
 extern _Float128 __w_scalblnf128 (_Float128, long int);
 extern _Float128 __w_log1pf128 (_Float128);
+extern _Float128 __w_logp1f128 (_Float128);
 extern _Float128 __scalbf128 (_Float128, _Float128);
 F128_REDIR (__scalbf128);
 F128_REDIR (__wrap_scalbnf128);
 F128_REDIR (__w_scalblnf128);
 F128_REDIR (__w_log1pf128);
+F128_REDIR (__w_logp1f128);
 
 /* Include the redirects shared with math_private.h users.  */
 #include <float128-ifunc-redirects.h>