glibc/sysdeps/ieee754/flt-32
Joseph Myers f124cb3811 Fix nearbyint arithmetic moved before feholdexcept (bug 22225).
In <https://sourceware.org/ml/libc-alpha/2013-05/msg00722.html> I
remarked on the possibility of arithmetic in various nearbyint
implementations being scheduled before feholdexcept calls, resulting
in spurious "inexact" exceptions.

I'm now actually observing this occurring in glibc built for ARM with
GCC 7 (in fact, both copies of the same addition/subtraction sequence
being combined and moved out before the conditionals and
feholdexcept/fesetenv pairs), resulting in test failures.

This patch makes the nearbyint implementations with this particular
feholdexcept / arithmetic / fesetenv pattern consistently use
math_opt_barrier on the function argument when first used in
arithmetic, and also consistently use math_force_eval before fesetenv
(the latter was generally already done, but the dbl-64/wordsize-64
implementation used math_opt_barrier instead, and as
math_opt_barrier's intended effect is through its output value being
used, such a use that doesn't use the return value is suspect).

Tested for x86_64 (--disable-multi-arch so more of these
implementations get used), and for ARM in a configuration where I saw
the problem scheduling.

	[BZ #22225]
	* sysdeps/ieee754/dbl-64/s_nearbyint.c (__nearbyint): Use
	math_opt_barrier on argument when doing arithmetic on it.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c (__nearbyint):
	Likewise.  Use math_force_eval not math_opt_barrier after
	arithmetic.
	* sysdeps/ieee754/flt-32/s_nearbyintf.c (__nearbyintf): Use
	math_opt_barrier on argument when doing arithmetic on it.
	* sysdeps/ieee754/ldbl-128/s_nearbyintl.c (__nearbyintl):
	Likewise.
2017-09-28 01:59:02 +00:00
..
e_acosf.c Fix acosf underflow (bug 14153). 2012-05-25 11:07:07 +00:00
e_acoshf.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
e_asinf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
e_atan2f.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
e_atanhf.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
e_coshf.c Avoid excess range overflowing results from cosh, sinh, lgamma (bug 18980). 2015-09-18 20:00:48 +00:00
e_exp2f_data.c Optimized generic expf and exp2f with wrappers 2017-09-25 10:44:39 +01:00
e_exp2f.c Optimized generic expf and exp2f with wrappers 2017-09-25 10:44:39 +01:00
e_expf.c Optimized generic expf and exp2f with wrappers 2017-09-25 10:44:39 +01:00
e_fmodf.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
e_gammaf_r.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
e_hypotf.c Fix hypot sNaN handling (bug 20940). 2016-12-07 01:16:36 +00:00
e_ilogbf.c Remove useless __ilogb*_finite aliases 2012-04-18 00:40:13 +02:00
e_j0f.c Fix y0 and y1 exception handling for zero input [BZ #21134] 2017-02-15 10:30:59 -02:00
e_j1f.c Fix y0 and y1 exception handling for zero input [BZ #21134] 2017-02-15 10:30:59 -02:00
e_jnf.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
e_lgammaf_r.c Narrowing the visibility of libc-internal.h even further. 2017-03-01 20:33:46 -05:00
e_log2f.c Fix lgamma*, log10* and log2* results [BZ #21171] 2017-02-17 09:07:57 -02:00
e_log10f.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
e_logf.c Fix catan, catanh, __ieee754_logf in round-downward mode (bug 16799, bug 16800). 2014-04-02 17:41:02 +00:00
e_powf.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
e_rem_pio2f.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
e_remainderf.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
e_sinhf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
e_sqrtf.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
k_cosf.c Remove trailing whitespace. 2013-06-05 20:44:03 +00:00
k_rem_pio2f.c Narrowing the visibility of libc-internal.h even further. 2017-03-01 20:33:46 -05:00
k_sinf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
k_tanf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
lgamma_negf.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
lgamma_productf.c Fix lgamma (negative) inaccuracy (bug 2542, bug 2543, bug 2558). 2015-09-10 22:27:58 +00:00
math_config.h Optimized generic expf and exp2f with wrappers 2017-09-25 10:44:39 +01:00
math_errf.c Optimized generic expf and exp2f with wrappers 2017-09-25 10:44:39 +01:00
mpn2flt.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
s_asinhf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_atanf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_cbrtf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_ceilf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_copysignf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_cosf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_erff.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_expm1f.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_fabsf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_finitef.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
s_floorf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_fpclassifyf.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
s_frexpf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_fromfpf_main.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_fromfpf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_fromfpxf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_getpayloadf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_isinff.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_isnanf.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
s_issignalingf.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
s_llrintf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_llroundf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_log1pf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_logbf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_lrintf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_lroundf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_modff.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_nearbyintf.c Fix nearbyint arithmetic moved before feholdexcept (bug 22225). 2017-09-28 01:59:02 +00:00
s_nextafterf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_nextupf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_remquof.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_rintf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_roundevenf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_roundf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_scalblnf.c [BZ #6803] Set errno for scalbln, scalbn 2014-06-20 07:48:20 +05:30
s_scalbnf.c Make scalbn set errno (bug 6803). 2015-09-16 21:11:00 +00:00
s_setpayloadf_main.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_setpayloadf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_setpayloadsigf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_signbitf.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
s_sincosf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_sinf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_tanf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_tanhf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_totalorderf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_totalordermagf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_truncf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_ufromfpf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00
s_ufromfpxf.c Use libm_alias_float in flt-32. 2017-09-22 20:24:12 +00:00