[PATCH] aarch64: Fix SVE log1p helper mixed-lane shortcut [BZ #34923]
Dylan Fleming
Dylan.Fleming@arm.com
Wed Nov 4 15:06:37 GMT 2026
The log1p helper only selects the original input for k == 0 when all
active lanes have k == 0. If another lane needs exponent reduction, the
shortcut is skipped even though the correction term is already zeroed
for k == 0. This loses accuracy in SVE acosh near 1, for example with
inputs [0x1.0000000000001p0, 2.0, ...].
Select the original input for k == 0 independently in each lane by
removing the vector-wide condition around svsel.
---
SHARED-FILES | 2 +-
sysdeps/aarch64/fpu/sve/sv_log1p_inline.h | 5 +----
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/SHARED-FILES b/SHARED-FILES
index 8f89400177..1f176aa6f8 100644
--- a/SHARED-FILES
+++ b/SHARED-FILES
@@ -591,7 +591,7 @@ arm-optimized-routines:
sysdeps/aarch64/fpu/sve/sv_expf_special_inline.h
# math/aarch64/sve/sv_expm1f_inline.h, revision 78cd003
sysdeps/aarch64/fpu/sve/sv_expm1f_inline.h
- # math/aarch64/sve/sv_log1p_inline.h, revision 7d08237
+ # math/aarch64/sve/sv_log1p_inline.h, revision 5e51e52
sysdeps/aarch64/fpu/sve/sv_log1p_inline.h
# math/aarch64/sve/sv_log1pf_inline.h, revision a553540
sysdeps/aarch64/fpu/sve/sv_log1pf_inline.h
diff --git a/sysdeps/aarch64/fpu/sve/sv_log1p_inline.h b/sysdeps/aarch64/fpu/sve/sv_log1p_inline.h
index 1b2c542851..2e17280cf6 100644
--- a/sysdeps/aarch64/fpu/sve/sv_log1p_inline.h
+++ b/sysdeps/aarch64/fpu/sve/sv_log1p_inline.h
@@ -102,10 +102,7 @@ sv_log1p_inline (svfloat64_t x, const svbool_t pg)
that the approximation is solely the polynomial. */
svbool_t knot0 = svcmpne (pg, k, 0);
cm = svdiv_z (knot0, c, m);
- if (__glibc_likely (!svptest_any (pg, knot0)))
- {
- f = svsel (knot0, f, x);
- }
+ f = svsel (knot0, f, x);
#else
/* No shortcut. */
cm = svdiv_x (pg, c, m);
--
2.43.0
More information about the Libc-alpha
mailing list