[PATCH] aarch64: Fix SVE log1pf special case results [BZ #34940]
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Wed Nov 4 15:37:33 GMT 2026
On 04/11/26 12:06, Dylan Fleming wrote:
> In the log1pf special case, inf was loaded as uint32_t,
> and then negated with "-" operator. Negative uint32_t inf
> when cast to float results in 0x1.01p+31, not -inf.
This requires a regression testcase, as we do for all other math function.
And I think I have asked this for BZ 34946 and 34922, so I think we should
also improve testing for such cases.
> ---
> SHARED-FILES | 2 +-
> sysdeps/aarch64/fpu/sve/log1pf.c | 8 ++++----
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/SHARED-FILES b/SHARED-FILES
> index 8f89400177..b6b52793ab 100644
> --- a/SHARED-FILES
> +++ b/SHARED-FILES
> @@ -535,7 +535,7 @@ arm-optimized-routines:
> sysdeps/aarch64/fpu/sve/log10p1f.c
> # math/aarch64/sve/log1p.c, revision 1aad38d
> sysdeps/aarch64/fpu/sve/log1p.c
> - # math/aarch64/sve/log1pf.c, revision 35deb10
> + # math/aarch64/sve/log1pf.c, revision 5e51e52
> sysdeps/aarch64/fpu/sve/log1pf.c
> # math/aarch64/sve/log2.c, revision 91b052e
> sysdeps/aarch64/fpu/sve/log2.c
> diff --git a/sysdeps/aarch64/fpu/sve/log1pf.c b/sysdeps/aarch64/fpu/sve/log1pf.c
> index 450892cedf..3982911808 100644
> --- a/sysdeps/aarch64/fpu/sve/log1pf.c
> +++ b/sysdeps/aarch64/fpu/sve/log1pf.c
> @@ -27,11 +27,11 @@ special_case (svfloat32_t x, svfloat32_t y, svbool_t pg, svbool_t special,
> {
> y = svsel_f32 (special, svreinterpret_f32 (sv_u32 (d->nan)), y);
>
> - svbool_t ret_pinf = svcmpeq (pg, x, asfloat (d->inf));
> + svbool_t ret_pinf = svcmpeq (pg, x, INFINITY);
> svbool_t ret_minf = svcmpeq (pg, x, -1.0f);
>
> - y = svsel_f32 (ret_pinf, svreinterpret_f32 (sv_u32 (d->inf)), y);
> - return svsel_f32 (ret_minf, sv_f32 (-d->inf), y);
> + y = svsel_f32 (ret_pinf, sv_f32 (INFINITY), y);
> + return svsel_f32 (ret_minf, sv_f32 (-INFINITY), y);
> }
>
> /* Vector log1pf approximation using polynomial on reduced interval. Worst-case
> @@ -43,7 +43,7 @@ svfloat32_t SV_NAME_F1 (log1p) (svfloat32_t x, svbool_t pg)
>
> const struct sv_log1pf_data *d = ptr_barrier (&sv_log1pf_data);
> /* x < -1, Inf/Nan. */
> - svbool_t special = svcmpeq (pg, svreinterpret_u32 (x), d->inf);
> + svbool_t special = svcmpeq (pg, x, INFINITY);
> special = svorn_z (pg, special, svcmpge (pg, x, -1.0f));
>
> if (__glibc_unlikely (svptest_any (pg, special)))
More information about the Libc-alpha
mailing list