about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128/e_j1l.c
diff options
context:
space:
mode:
authorMichael Hudson-Doyle <michael.hudson@canonical.com>2022-08-12 11:29:31 +1200
committerMichael Hudson-Doyle <michael.hudson@canonical.com>2022-08-18 12:32:18 +1200
commit2b274fd8c9c776cf70fcdb8356e678ada522a7b0 (patch)
treeb2e927948d5e45d4fb332712c49c34544097029a /sysdeps/ieee754/ldbl-128/e_j1l.c
parent1d7829991112ac32c28bc6e3c4f1695125c1aa44 (diff)
downloadglibc-2b274fd8c9c776cf70fcdb8356e678ada522a7b0.tar.gz
glibc-2b274fd8c9c776cf70fcdb8356e678ada522a7b0.tar.xz
glibc-2b274fd8c9c776cf70fcdb8356e678ada522a7b0.zip
Ensure calculations happen with desired rounding mode in y1lf128
math/test-float128-y1 fails on x86_64 and ppc64el with gcc 12 and -O3,
because code inside a block guarded by SET_RESTORE_ROUNDL is being moved
after the rounding mode has been restored. Use math_force_eval to
prevent this (and insert some math_opt_barrier calls to prevent code
from being moved before the rounding mode is set).

Fixes #29463

Reviewed-By: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Diffstat (limited to 'sysdeps/ieee754/ldbl-128/e_j1l.c')
-rw-r--r--sysdeps/ieee754/ldbl-128/e_j1l.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128/e_j1l.c b/sysdeps/ieee754/ldbl-128/e_j1l.c
index 54c457681a..9a9c5c6f00 100644
--- a/sysdeps/ieee754/ldbl-128/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j1l.c
@@ -869,10 +869,13 @@ __ieee754_y1l (_Float128 x)
     {
       /* 0 <= x <= 2 */
       SET_RESTORE_ROUNDL (FE_TONEAREST);
+      xx = math_opt_barrier (xx);
+      x = math_opt_barrier (x);
       z = xx * xx;
       p = xx * neval (z, Y0_2N, NY0_2N) / deval (z, Y0_2D, NY0_2D);
       p = -TWOOPI / xx + p;
       p = TWOOPI * __ieee754_logl (x) * __ieee754_j1l (x) + p;
+      math_force_eval (p);
       return p;
     }