[PATCH 6/8] math: Remove log2pf1 fma usage
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Mon Oct 13 16:15:51 GMT 2025
On 13/10/25 06:31, Paul Zimmermann wrote:
> Hi Adhemerval,
>
> within CORE-MATH I get a failure:
>
> zimmerma@croissant:/tmp/core-math$ EXTRA_CFLAGS=-march=x86-64-v2 ./check.sh log2p1f
> Running exhaustive check in --rndn mode...
> FAIL x=-0x1.da285cp-5 ref=-0x1.60549p-4 y=-0x1.60548ep-4
>
> zimmerma@croissant:/tmp/core-math$ git diff
> diff --git a/src/binary32/log2p1/log2p1f.c b/src/binary32/log2p1/log2p1f.c
> index 71147a36..ede3a033 100644
> --- a/src/binary32/log2p1/log2p1f.c
> +++ b/src/binary32/log2p1/log2p1f.c
> @@ -183,7 +183,7 @@ float cr_log2p1f(float x) {
> int j = (m + ((int64_t)1<<(52-8)))>>(52-7), k = j>53;
> e += k;
> b64u64_u xd = {.u = m | (uint64_t)0x3ff<<52};
> - z = __builtin_fma(xd.f, ix[j], -1.0);
> + z = xd.f * ix[j] - 1.0;
> static const double c[] =
> {0x1.71547652b82fep+0, -0x1.71547652b82ffp-1, 0x1.ec709dc32988bp-2, -0x1.715476521ec2bp-2,
> 0x1.277801a1ad904p-2, -0x1.ec731704d6a88p-3};
>
> Please can you check that value, and add it to math/auto-libm-test-in?
I was an issue with my testing end, where I though I had checked
negative values correctly. I will update the patch and add a testcase.
>
> 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:24 -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_log2p1f.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/sysdeps/ieee754/flt-32/s_log2p1f.c b/sysdeps/ieee754/flt-32/s_log2p1f.c
>> index 09e77dc08ad..8aa46359998 100644
>> --- a/sysdeps/ieee754/flt-32/s_log2p1f.c
>> +++ b/sysdeps/ieee754/flt-32/s_log2p1f.c
>> @@ -231,7 +231,7 @@ __log2p1f (float x)
>> int j = (m + ((int64_t) 1 << (52 - 8))) >> (52 - 7), k = j > 53;
>> e += k;
>> double xd = asdouble (m | (uint64_t) 0x3ff << 52);
>> - z = fma (xd, ix[j], -1.0);
>> + z = xd * ix[j] - 1.0;
>> static const double c[] =
>> {
>> 0x1.71547652b82fep+0, -0x1.71547652b82ffp-1, 0x1.ec709dc32988bp-2,
>> --
>> 2.43.0
>>
>>
More information about the Libc-alpha
mailing list