[PATCH 3/8] math: Remove asinhf fma usage

Paul Zimmermann Paul.Zimmermann@inria.fr
Mon Oct 13 09:19:27 GMT 2025


LGTM.

Tested by exhaustive search on all four rounding modes with the CORE-MATH
test suite and -march=x86-64-v2.

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>

Paul

> From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> Cc: Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
> 	Paul Zimmermann <Paul.Zimmermann@inria.fr>,
> 	DJ Delorie <dj@redhat.com>
> Date: Fri, 10 Oct 2025 14:49:21 -0300
> 
> The fma is not required to provide correctly rounded and it helps
> on !__FP_FAST_FMA ISAs.
> 
> Checked on x86_64-linux-gnu and i686-linux-gnu.
> ---
>  sysdeps/ieee754/flt-32/s_asinhf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sysdeps/ieee754/flt-32/s_asinhf.c b/sysdeps/ieee754/flt-32/s_asinhf.c
> index 9353b421d4b..471a448992f 100644
> --- a/sysdeps/ieee754/flt-32/s_asinhf.c
> +++ b/sysdeps/ieee754/flt-32/s_asinhf.c
> @@ -84,10 +84,10 @@ __asinhf (float x)
>  	  const double ln2h = 0x1.62e4p-1;
>  	  double Lh = ln2h * e;
>  	  double Ll = ln2l * e;
> -	  r = fma (z, c0, Ll + LIX[j]) + Lh;
> +	  r = (z * c0 + (Ll + LIX[j])) + Lh;
>  	  if (__glibc_unlikely ((asuint64 (r) & INT64_C(0xfffffff)) == 0))
>  	    {
> -	      double h = fma (z, c0, Ll + LIX[j]) + (Lh - r);
> +	      double h = (z * c0 + (Ll + LIX[j])) + (Lh - r);
>  	      r = r + 64 * h;
>  	    }
>  	}
> -- 
> 2.43.0
> 
> 


More information about the Libc-alpha mailing list