[PATCH v2 1/2] AArch64: Fix SVE pow and powf negative-base predication [BZ #34920]
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Mon Nov 2 13:30:15 GMT 2026
On 30/10/26 11:14, Pierre Blanchard wrote:
> Preserve positive-base lanes when checking whether exponents of
> negative bases are integers. Otherwise, a vector containing both
> negative and positive bases returns NaN for the positive-base lanes.
>
> Co-authored-by: Dylan Fleming <Dylan.Fleming@arm.com>
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> ---
> OK for master? If so please commit for me as I don't have commit rights.
> Likewise if OK for backport to release branches as far back as 2.42.
> Thanks,
I will handle it.
> Pierre
> sysdeps/aarch64/fpu/sve/pow.c | 4 ++--
> sysdeps/aarch64/fpu/sve/powf.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/sysdeps/aarch64/fpu/sve/pow.c b/sysdeps/aarch64/fpu/sve/pow.c
> index 463a8cff0c..6fa3b44a41 100644
> --- a/sysdeps/aarch64/fpu/sve/pow.c
> +++ b/sysdeps/aarch64/fpu/sve/pow.c
> @@ -102,8 +102,8 @@ svfloat64_t SV_NAME_D2 (pow) (svfloat64_t x, svfloat64_t y, const svbool_t pg)
> svuint64_t vix = vix0;
> if (__glibc_unlikely (svptest_any (pg, xisneg)))
> {
> - /* Determine nature of y. */
> - yint_or_xpos = sv_isint (xisneg, y);
> + /* Determine nature of y, preserving lanes where x isn't negative. */
> + yint_or_xpos = svorn_z (pg, sv_isint (xisneg, y), xisneg);
> svbool_t yisodd_xisneg = sv_isodd (xisneg, y);
> /* ix set to abs(ix) if y is integer. */
> vix = svand_m (yint_or_xpos, vix0, 0x7fffffffffffffff);
> diff --git a/sysdeps/aarch64/fpu/sve/powf.c b/sysdeps/aarch64/fpu/sve/powf.c
> index 44a70105af..8f6da3be21 100644
> --- a/sysdeps/aarch64/fpu/sve/powf.c
> +++ b/sysdeps/aarch64/fpu/sve/powf.c
> @@ -85,8 +85,8 @@ svfloat32_t SV_NAME_F2 (pow) (svfloat32_t x, svfloat32_t y, const svbool_t pg)
> svuint32_t vix = vix0;
> if (__glibc_unlikely (svptest_any (pg, xisneg)))
> {
> - /* Determine nature of y. */
> - yint_or_xpos = svisint (xisneg, y);
> + /* Determine nature of y, preserving lanes where x isn't negative. */
> + yint_or_xpos = svorn_z (pg, svisint (xisneg, y), xisneg);
> svbool_t yisodd_xisneg = svisodd (xisneg, y);
> /* ix set to abs(ix) if y is integer. */
> vix = svand_m (yint_or_xpos, vix0, 0x7fffffff);
More information about the Libc-alpha
mailing list