glibc/sysdeps/powerpc/fpu
Joseph Myers 613c92b3b5 Fix ldbl-128ibm nearbyintl in non-default rounding modes (bug 19790).
The ldbl-128ibm implementation of nearbyintl uses logic that only
works in round-to-nearest mode.  This contrasts with rintl, which
works in all rounding modes.

Now, arguably nearbyintl could simply be aliased to rintl, given that
spurious "inexact" is generally allowed for ldbl-128ibm, even for the
underlying arithmetic operations.  But given that the only point of
nearbyintl is to avoid "inexact", this patch follows the more
conservative approach of adding conditionals to the rintl
implementation to make it suitable for use to implement nearbyintl,
then builds it for nearbyintl with USE_AS_NEARBYINTL defined.  The
test test-nearbyint-except-2 shows up issues when traps on "inexact"
are enabled, which turn out to be problems with the powerpc
fenv_private.h implementation (two functions that should disable
exception traps potentially failing to do so in some cases); this
patch duly fixes that as well (I don't see any other existing cases
where this would be user-visible; there isn't much use of *_NOEX,
*hold* etc. in libm that requires exceptions to be discarded and not
trapped on).

Tested for powerpc.

	[BZ #19790]
	* sysdeps/ieee754/ldbl-128ibm/s_rintl.c [USE_AS_NEARBYINTL]
	(rintl): Define as macro.
	[USE_AS_NEARBYINTL] (__rintl): Likewise.
	(__rintl) [USE_AS_NEARBYINTL]: Use SET_RESTORE_ROUND_NOEX instead
	of fesetround.  Ensure results are evaluated before end of scope.
	* sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: Define
	USE_AS_NEARBYINTL and include s_rintl.c.
	* sysdeps/powerpc/fpu/fenv_private.h (libc_feholdsetround_ppc):
	Disable exception traps in new environment.
	(libc_feholdsetround_ppc_ctx): Likewise.
2016-03-09 00:30:59 +00:00
..
e_hypot.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_hypotf.c Remove unused variables 2016-01-27 09:30:16 +01:00
e_rem_pio2f.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_sqrt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_sqrtf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fclrexcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fe_mask.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fe_nomask.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fedisblxcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
feenablxcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fegetenv.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fegetexcept.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fegetround.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
feholdexcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fenv_const.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fenv_libc.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fenv_private.h Fix ldbl-128ibm nearbyintl in non-default rounding modes (bug 19790). 2016-03-09 00:30:59 +00:00
fesetenv.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fesetround.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
feupdateenv.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fgetexcptflg.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fraiseexcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fsetexcptflg.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
ftestexcept.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
k_cosf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
k_rem_pio2f.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
k_sinf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
libm-test-ulps powerpc: Regenerate libm-test-ulps 2016-02-04 16:40:54 -02:00
Makefile
math_ldbl.h
math_private.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_cosf.c Remove unused variables 2016-01-27 09:30:16 +01:00
s_fabs.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fabsf.S
s_fdim.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fdimf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_float_bitwise.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fma.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fmaf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fmax.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fmaxf.S
s_fmin.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fminf.S
s_isnan.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_isnanf.S
s_lrintf.S
s_rint.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_rintf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_sinf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
t_sqrt.c
tst-setcontext-fpscr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00