glibc/sysdeps
Joseph Myers 1356f38df5 Fix f64xdivf128, f64xmulf128 spurious underflows (bug 28358)
As described in bug 28358, the round-to-odd computations used in the
libm functions that round their results to a narrower format can yield
spurious underflow exceptions in the following circumstances: the
narrowing only narrows the precision of the type and not the exponent
range (i.e., it's narrowing _Float128 to _Float64x on x86_64, x86 or
ia64), the architecture does after-rounding tininess detection (which
applies to all those architectures), the result is inexact, tiny
before rounding but not tiny after rounding (with the chosen rounding
mode) for _Float64x (which is possible for narrowing mul, div and fma,
not for narrowing add, sub or sqrt), so the underflow exception
resulting from the toward-zero computation in _Float128 is spurious
for _Float64x.

Fixed by making ROUND_TO_ODD call feclearexcept (FE_UNDERFLOW) in the
problem cases (as indicated by an extra argument to the macro); there
is never any need to preserve underflow exceptions from this part of
the computation, because the conversion of the round-to-odd value to
the narrower type will underflow in exactly the cases in which the
function should raise that exception, but it may be more efficient to
avoid the extra manipulation of the floating-point environment when
not needed.

Tested for x86_64 and x86, and with build-many-glibcs.py.
2021-09-21 21:54:37 +00:00
..
aarch64 elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
alpha elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
arc elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
arm elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
csky elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
generic Extend struct r_debug to support multiple namespaces [BZ #15971] 2021-09-19 13:51:35 -07:00
gnu Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
hppa elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
htl htl: Reimplement GSCOPE 2021-09-16 01:04:17 +02:00
hurd Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
i386 Fix f64xdivf128, f64xmulf128 spurious underflows (bug 28358) 2021-09-21 21:54:37 +00:00
ia64 elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
ieee754 Fix f64xdivf128, f64xmulf128 spurious underflows (bug 28358) 2021-09-21 21:54:37 +00:00
m68k elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
mach elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
microblaze elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
mips elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
nios2 elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
nptl nptl: Fix type of pthread_mutexattr_getrobust_np, pthread_mutexattr_setrobust_np (bug 28036) 2021-09-21 07:13:05 +02:00
posix Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
powerpc powerpc: Fix unrecognized instruction errors with recent GCC 2021-09-20 16:52:38 -05:00
pthread nptl: pthread_kill needs to return ESRCH for old programs (bug 19193) 2021-09-20 14:56:08 +02:00
riscv elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
s390 elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
sh elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
sparc elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
unix Add MADV_POPULATE_READ and MADV_POPULATE_WRITE from Linux 5.14 to bits/mman-linux.h 2021-09-14 14:19:24 +00:00
wordsize-32 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
wordsize-64 Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
x86 Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
x86_64 elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00