Fix i386 fenv_private.h float128 for 32-bit --with-fpmath=sse (bug 22902).
commite2bcf6a8551c6b6a7eeed8f84be42b29eef4d0e2
authorJoseph Myers <joseph@codesourcery.com>
Wed, 28 Feb 2018 21:55:51 +0000 (28 21:55 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 28 Feb 2018 21:55:51 +0000 (28 21:55 +0000)
tree002d326503070320fc59c589ee532b21d2ee859d
parent000f290ff179c9910f09b7f76797bdab575abb15
Fix i386 fenv_private.h float128 for 32-bit --with-fpmath=sse (bug 22902).

As discussed in bug 22902, the i386 fenv_private.h implementation has
problems for float128 for the case of 32-bit glibc built with libgcc
from GCC configured using --with-fpmath=sse.

The optimized floating-point state handling in fenv_private.h needs to
know which floating-point state - x87 or SSE - is used for each
floating-point type, so that only one state needs updating / testing
for libm code using that state internally.  On 32-bit x86, the x87
rounding mode is always used for float128, but the x87 exception flags
are only used when libgcc is built using x87 floating-point
arithmetic; if libgcc is built for SSE arithmetic, the SSE exception
flags are used.

The choice of arithmetic with which libgcc is built is independent of
that with which glibc is built.  Thus, since glibc cannot tell the
choice used in libgcc, the default implementations of
libc_feholdexcept_setroundf128 and libc_feupdateenv_testf128 (which
use the <fenv.h> functions, thus using both x87 and SSE state on
processors that have both) need to be used; this patch updates the
code accordingly.

Tested for 32-bit x86; HJ reports testing in the --with-fpmath=sse
case.

[BZ #22902]
* sysdeps/i386/fpu/fenv_private.h [!__x86_64__]
(libc_feholdexcept_setroundf128): New macro.
[!__x86_64__] (libc_feupdateenv_testf128): Likewise.
ChangeLog
sysdeps/i386/fpu/fenv_private.h