[PATCH 3/4] Use libc_fe* macros in ldbl-128/e_expl.c.
Adhemerval Zanella
adhemerval.zanella@linaro.org
Wed Mar 25 15:00:34 GMT 2020
On 25/03/2020 07:13, Stefan Liebler via Libc-alpha wrote:
> Unfortunately, this patch is responsible for testfails on x86_64:
>
> math/test-float128-exp.out:
> Failure: exp (-0x1p-10000): Exception "Underflow" set
> Failure: exp (-0x2p-16384): Exception "Underflow" set
> ...
>
> math/test-float128-cexp.out:
> Failure: Real part of: cexp (0x2p-16384 - 0x4p-1076 i): Exception "Underflow" set
> Failure: Real part of: cexp (0x2p-16384 - 0x8p-152 i): Exception "Underflow" set
The sysdeps/x86/fpu/fenv_private.h states:
296 #ifdef __x86_64__
297 /* The SSE rounding mode is used by soft-fp (libgcc and glibc) on
298 x86_64, so that must be set for float128 computations. */
299 # define SET_RESTORE_ROUNDF128(RM) \
300 SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround_sse, libc_feresetround_sse)
So
>> diff --git a/sysdeps/ieee754/ldbl-128/e_expl.c b/sysdeps/ieee754/ldbl-128/e_expl.c
>> index 37c1538c08..104ace1690 100644
>> --- a/sysdeps/ieee754/ldbl-128/e_expl.c
>> +++ b/sysdeps/ieee754/ldbl-128/e_expl.c
>> @@ -66,6 +66,7 @@
>> #include <inttypes.h>
>> #include <math-barriers.h>
>> #include <math_private.h>
>> +#include <fenv_private.h>
>> #include <math-underflow.h>
>> #include <stdlib.h>
>> #include "t_expl.h"
>> @@ -146,9 +147,10 @@ __ieee754_expl (_Float128 x)
>> union ieee854_long_double ex2_u, scale_u;
>> fenv_t oldenv;
>> - feholdexcept (&oldenv);
>> #ifdef FE_TONEAREST
>> - fesetround (FE_TONEAREST);
>> + libc_feholdexcept_setroundl (&oldenv, FE_TONEAREST);
Should be libc_feholdexcept_setroundf128.
>> +#else
>> + libc_feholdexceptl (&oldenv);
And here libc_fesetenvf128.
>> #endif
>> /* Calculate n. */
>> @@ -198,7 +200,7 @@ __ieee754_expl (_Float128 x)
>> math_force_eval (x22);
>> /* Return result. */
>> - fesetenv (&oldenv);
>> + libc_fesetenvl (&oldenv);
>> result = x22 * ex2_u.d + ex2_u.d;
It might require extend the libc_*f128 macros to other architectures
(not sure).
More information about the Libc-alpha
mailing list