Fix MIPS libc_feresetround*_ctx to preserve exceptions.
authorJoseph Myers <joseph@codesourcery.com>
Tue, 11 Mar 2014 22:30:40 +0000 (22:30 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Tue, 11 Mar 2014 22:30:40 +0000 (22:30 +0000)
commit76c96cf7ec0dc38089c9a887f80b3222f6084c82
treeb0bb1b7138d9742ad7879b8f49f1c27a21f31425
parent600fa36158cd741d897b2d22c735c60247b982e0
Fix MIPS libc_feresetround*_ctx to preserve exceptions.

Testing on mips64 showed missing underflow exceptions (from exp, for
example) in non-default rounding modes, caused by
libc_feresetround*_ctx wrongly restoring a saved environment without
preserving exceptions, when that's only valid for the _noex variants.
(I don't know why Steve didn't see this in his testing.)  This patch
fixes this by using libc_feupdateenv_mips_ctx for the relevant macros
and removing the problem definitions.

The problem definitions aren't suitable for the _noex macros either
because they only discard exceptions in non-default rounding modes,
and while for some uses of *_noex/*_NOEX it doesn't matter whether
exceptions are discarded, dbl-64/e_remainder.c requires
SET_RESTORE_ROUND_NOEX to cause exceptions to be discarded.  I think
the accumulated set of macros / functions for optimized exception /
rounding mode handling could do with a careful review by now, and
possible refactoring, and at least one new feature (extracting the
saved rounding mode from an environment / context variable - see
dbl-64/e_sqrt.c for a case where this could be used).

Tested mips64.

* sysdeps/mips/math_private.h [__mips_hard_float]
(libc_feresetround_ctx): Define to libc_feupdateenv_mips_ctx not
libc_feresetround_mips_ctx.
[__mips_hard_float] (libc_feresetroundf_ctx): Likewise.
[__mips_hard_float] (libc_feresetroundl_ctx): Likewise.
[__mips_hard_float] (libc_feresetround_mips_ctx): Remove.
ChangeLog
sysdeps/mips/math_private.h