glibc/sysdeps/x86_64/fpu
Joseph Myers 2145f97cee Handle more state in i386/x86_64 fesetenv (bug 16068).
fenv_t should include architecture-specific floating-point modes and
status flags.  i386 and x86_64 fesetenv limit which bits they use from
the x87 status and control words, when using saved state, and limit
which parts of the state they set to fixed values, when using
FE_DFL_ENV / FE_NOMASK_ENV.  The following should be included but are
excluded in at least some cases: status and masking for the "denormal
operand" exception (which isn't part of FE_ALL_EXCEPT); precision
control (explicitly mentioned in Annex F as something that counts as
part of the floating-point environment); MXCSR FZ and DAZ bits (for
FE_DFL_ENV and FE_NOMASK_ENV).  This patch arranges for this extra
state to be handled by fesetenv (and thereby by feupdateenv, which
calls fesetenv).

(Note that glibc functions using floating point are not generally
expected to work correctly with non-default values of this state,
especially precision control, but it is still logically part of the
floating-point environment and should be handled as such by fesetenv.
Changes to the state relating to subnormals ought generally to work
with libm functions when the arguments aren't subnormal and neither
are the expected results; that's a consequence of functions avoiding
spurious internal underflows.)

A question arising from this is whether FE_NOMASK_ENV should or should
not mask the "denormal operand" exception.  I decided it should mask
that exception.  This is the status quo - previously that exception
could only be unmasked by direct manipulation of control registers
(possibly via <fpu_control.h>).  In addition, it means that use of
FE_NOMASK_ENV leaves a floating-point environment the same as could be
obtained by fesetenv (FE_DFL_ENV); feenableexcept (FE_ALL_EXCEPT);,
rather than an environment in which an exception is unmasked that
could only be masked again by using fesetenv with FE_DFL_ENV (or a
previously saved environment) - this exception not being usable with
other <fenv.h> functions because it's outside FE_ALL_EXCEPT.

Tested for x86_64 and x86.

	[BZ #16068]
	* sysdeps/i386/fpu/fesetenv.c: Include <fpu_control.h>.
	(FE_ALL_EXCEPT_X86): New macro.
	(__fesetenv): Use FE_ALL_EXCEPT_X86 in most places instead of
	FE_ALL_EXCEPT.  Ensure precision control is included in
	floating-point state.  Ensure that FE_DFL_ENV and FE_NOMASK_ENV
	handle "denormal operand exception" and clear FZ and DAZ bits.
	* sysdeps/x86_64/fpu/fesetenv.c: Include <fpu_control.h>.
	(FE_ALL_EXCEPT_X86): New macro.
	(__fesetenv): Use FE_ALL_EXCEPT_X86 in most places instead of
	FE_ALL_EXCEPT.  Ensure precision control is included in
	floating-point state.  Ensure that FE_DFL_ENV and FE_NOMASK_ENV
	handle "denormal operand exception" and clear FZ and DAZ bits.
	* sysdeps/x86/fpu/test-fenv-sse-2.c: New file.
	* sysdeps/x86/fpu/test-fenv-x87.c: Likewise.
	* sysdeps/x86/fpu/Makefile [$(subdir) = math] (tests): Add
	test-fenv-x87 and test-fenv-sse-2.
	[$(subdir) = math] (CFLAGS-test-fenv-sse-2.c): New variable.
2015-10-28 22:58:29 +00:00
..
multiarch Remove configure tests for FMA4 support. 2015-10-09 16:02:54 +00:00
dla.h Remove x86_64 __GNUC_PREREQ (4, 6) conditional. 2014-11-14 18:53:07 +00:00
e_acosl.c Update. 2001-09-19 10:37:31 +00:00
e_atan2l.c Update. 2001-09-19 10:37:31 +00:00
e_exp2l.S Refactor x86_64 libm code forcing underflow exceptions. 2015-09-24 22:25:30 +00:00
e_exp10l.S Fix exp10 inaccuracy and exceptions (bugs 13884, 13914). 2012-05-06 18:23:44 +00:00
e_expf.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
e_expl.S Refactor x86_64 libm code forcing underflow exceptions. 2015-09-24 22:25:30 +00:00
e_fmodl.S Optimize libm 2011-10-12 11:27:51 -04:00
e_ilogbl.S Remove useless __ilogb*_finite aliases 2012-04-18 00:40:13 +02:00
e_log2l.S Fix log2 (1) in round-downward mode (bug 17042). 2014-06-10 12:07:15 +00:00
e_log10l.S Fix log10 (1) in round-downward mode (bug 16977). 2014-05-23 12:07:50 +00:00
e_logl.S Fix __ieee754_logl (-LDBL_MAX) in FE_DOWNWARD mode (bug 17022). 2014-06-18 12:32:01 +00:00
e_powl.S Fix pow missing underflows (bug 18825). 2015-09-25 22:29:10 +00:00
e_remainderl.S Optimize libm 2011-10-12 11:27:51 -04:00
e_scalbl.S Fix x86/x86_64 scalb (qNaN, -Inf) (bug 16783). 2015-02-24 17:30:02 +00:00
e_sqrt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
e_sqrtf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
e_sqrtl.c Update. 2001-09-19 10:37:31 +00:00
fclrexcpt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fedisblxcpt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
feenablxcpt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fegetenv.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fegetexcept.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fegetround.c Fix libm fegetround namespace (bug 17748). 2015-01-02 20:44:42 +00:00
feholdexcpt.c Fix libm feholdexcept namespace (bug 17748). 2015-01-05 23:06:14 +00:00
fesetenv.c Handle more state in i386/x86_64 fesetenv (bug 16068). 2015-10-28 22:58:29 +00:00
fesetround.c Fix libm fesetround namespace (bug 17748). 2015-01-07 00:41:23 +00:00
feupdateenv.c Fix libm feupdateenv namespace (bug 17748). 2015-01-07 19:01:20 +00:00
fgetexcptflg.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fraiseexcpt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fsetexcptflg.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
ftestexcept.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Implies Use x86_64 fpu/bits/fenv.h for i386 and x86_64 2012-06-06 10:13:19 -07:00
k_rem_pio2l.c Dummy files to prevent stub versions from being used. 2007-05-17 18:39:55 +00:00
libm-test-ulps x86_64: Regenerate ulps [BZ #19168] 2015-10-26 13:15:48 +01:00
Makefile Update libmvec multiarch functions for <cpu-features.h> 2015-08-13 03:41:47 -07:00
math_ldbl.h Update. 2001-09-19 10:37:31 +00:00
math_private.h Use movq for 64-bit operations 2013-05-15 20:33:45 +02:00
math-tests-arch.h Update libmvec multiarch functions for <cpu-features.h> 2015-08-13 03:41:47 -07:00
printf_fphex.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_atanl.c Update. 2001-09-19 10:37:31 +00:00
s_ceill.S Remove trailing whitespace. 2013-06-05 20:44:03 +00:00
s_copysign.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_copysignf.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_copysignl.S Update. 2002-07-06 15:07:30 +00:00
s_cosf.S Align stack to 16 bytes when calling __errno_location 2015-08-05 08:36:27 -07:00
s_expm1l.S Fix x86/x86_64 expm1l inaccuracy and exceptions (bugs 13885, 13923). 2012-05-07 19:13:08 +00:00
s_fabs.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fabsf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fabsl.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fdiml.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_finitel.S Update. 2002-09-10 01:40:26 +00:00
s_floorl.S Update. 2003-11-18 07:25:02 +00:00
s_fmax.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fmaxf.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fmaxl.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fmin.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fminf.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fminl.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fpclassifyl.c Update. 2001-09-19 10:37:31 +00:00
s_isinfl.c Update. 2001-09-19 10:37:31 +00:00
s_isnanl.c Update. 2001-09-19 10:37:31 +00:00
s_llrint.S Update lrint/lrintf/lrintl for x32 2015-10-09 11:42:10 -07:00
s_llrintf.S Update lrint/lrintf/lrintl for x32 2015-10-09 11:42:10 -07:00
s_llrintl.S Update lrint/lrintf/lrintl for x32 2015-10-09 11:42:10 -07:00
s_log1pl.S Set errno for log1p on pole/domain error. 2015-04-13 21:19:27 +02:00
s_logbl.c Update. 2001-09-19 10:37:31 +00:00
s_lrint.S lrint and llrint implementation for x86-64. 2002-04-08 08:14:22 +00:00
s_lrintf.S lrint and llrint implementation for x86-64. 2002-04-08 08:14:22 +00:00
s_lrintl.S lrint and llrint implementation for x86-64. 2002-04-08 08:14:22 +00:00
s_nearbyintl.S Fix i386 / x86_64 nearbyint exception clearing (bug 15491). 2015-10-22 23:14:55 +00:00
s_nextafterl.c Update. 2001-09-19 10:37:31 +00:00
s_nexttoward.c Update. 2001-09-19 10:37:31 +00:00
s_nexttowardf.c Update. 2001-09-19 10:37:31 +00:00
s_rintl.c Update. 2001-09-19 10:37:31 +00:00
s_scalbnl.S Make scalbn set errno (bug 6803). 2015-09-16 21:11:00 +00:00
s_signbit.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_signbitf.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_significandl.c Update. 2001-09-19 10:37:31 +00:00
s_sincosf.S Align stack to 16 bytes when calling __errno_location 2015-08-05 08:36:27 -07:00
s_sinf.S Align stack to 16 bytes when calling __errno_location 2015-08-05 08:36:27 -07:00
s_truncl.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
svml_d_cos2_core.S Combination of data tables for x86_64 vector functions sin, cos and sincos. 2015-06-23 19:21:50 +03:00
svml_d_cos4_core_avx.S Start of series of patches with x86_64 vector math functions. 2015-06-09 14:25:49 +03:00
svml_d_cos4_core.S Combination of data tables for x86_64 vector functions sin, cos and sincos. 2015-06-23 19:21:50 +03:00
svml_d_cos8_core.S Combination of data tables for x86_64 vector functions sin, cos and sincos. 2015-06-23 19:21:50 +03:00
svml_d_exp2_core.S Vector exp for x86_64 and tests. 2015-06-17 15:58:05 +03:00
svml_d_exp4_core_avx.S Vector exp for x86_64 and tests. 2015-06-17 15:58:05 +03:00
svml_d_exp4_core.S Vector exp for x86_64 and tests. 2015-06-17 15:58:05 +03:00
svml_d_exp8_core.S Vector exp for x86_64 and tests. 2015-06-17 15:58:05 +03:00
svml_d_exp_data.h Vector exp for x86_64 and tests. 2015-06-17 15:58:05 +03:00
svml_d_exp_data.S Vector exp for x86_64 and tests. 2015-06-17 15:58:05 +03:00
svml_d_log2_core.S Vector log for x86_64 and tests. 2015-06-17 15:38:29 +03:00
svml_d_log4_core_avx.S Vector log for x86_64 and tests. 2015-06-17 15:38:29 +03:00
svml_d_log4_core.S Vector log for x86_64 and tests. 2015-06-17 15:38:29 +03:00
svml_d_log8_core.S Vector log for x86_64 and tests. 2015-06-17 15:38:29 +03:00
svml_d_log_data.h Vector log for x86_64 and tests. 2015-06-17 15:38:29 +03:00
svml_d_log_data.S Vector log for x86_64 and tests. 2015-06-17 15:38:29 +03:00
svml_d_pow2_core.S Vector pow for x86_64 and tests. 2015-06-17 16:22:26 +03:00
svml_d_pow4_core_avx.S Vector pow for x86_64 and tests. 2015-06-17 16:22:26 +03:00
svml_d_pow4_core.S Vector pow for x86_64 and tests. 2015-06-17 16:22:26 +03:00
svml_d_pow8_core.S Vector pow for x86_64 and tests. 2015-06-17 16:22:26 +03:00
svml_d_pow_data.h Vector pow for x86_64 and tests. 2015-06-17 16:22:26 +03:00
svml_d_pow_data.S Vector pow for x86_64 and tests. 2015-06-17 16:22:26 +03:00
svml_d_sin2_core.S Vector sin for x86_64 and tests. 2015-06-11 17:12:38 +03:00
svml_d_sin4_core_avx.S Vector sin for x86_64 and tests. 2015-06-11 17:12:38 +03:00
svml_d_sin4_core.S Vector sin for x86_64 and tests. 2015-06-11 17:12:38 +03:00
svml_d_sin8_core.S Vector sin for x86_64 and tests. 2015-06-11 17:12:38 +03:00
svml_d_sincos2_core.S Vector sincos for x86_64 and tests. 2015-06-18 17:55:55 +03:00
svml_d_sincos4_core_avx.S Vector sincos for x86_64 and tests. 2015-06-18 17:55:55 +03:00
svml_d_sincos4_core.S Vector sincos for x86_64 and tests. 2015-06-18 17:55:55 +03:00
svml_d_sincos8_core.S Vector sincos for x86_64 and tests. 2015-06-18 17:55:55 +03:00
svml_d_trig_data.h Combination of data tables for x86_64 vector functions sin, cos and sincos. 2015-06-23 19:21:50 +03:00
svml_d_trig_data.S Combination of data tables for x86_64 vector functions sin, cos and sincos. 2015-06-23 19:21:50 +03:00
svml_d_wrapper_impl.h Fixed several libmvec bugs found during testing on KNL hardware. 2015-07-24 14:47:23 +03:00
svml_s_cosf4_core.S Vector cosf for x86_64. 2015-06-09 18:29:47 +03:00
svml_s_cosf8_core_avx.S Vector cosf for x86_64. 2015-06-09 18:29:47 +03:00
svml_s_cosf8_core.S Vector cosf for x86_64. 2015-06-09 18:29:47 +03:00
svml_s_cosf16_core.S Vector cosf for x86_64. 2015-06-09 18:29:47 +03:00
svml_s_expf4_core.S Vector expf for x86_64 and tests. 2015-06-17 16:10:51 +03:00
svml_s_expf8_core_avx.S Vector expf for x86_64 and tests. 2015-06-17 16:10:51 +03:00
svml_s_expf8_core.S Vector expf for x86_64 and tests. 2015-06-17 16:10:51 +03:00
svml_s_expf16_core.S Vector expf for x86_64 and tests. 2015-06-17 16:10:51 +03:00
svml_s_expf_data.h Vector expf for x86_64 and tests. 2015-06-17 16:10:51 +03:00
svml_s_expf_data.S Vector expf for x86_64 and tests. 2015-06-17 16:10:51 +03:00
svml_s_logf4_core.S Vector logf for x86_64 and tests. 2015-06-17 15:53:00 +03:00
svml_s_logf8_core_avx.S Vector logf for x86_64 and tests. 2015-06-17 15:53:00 +03:00
svml_s_logf8_core.S Vector logf for x86_64 and tests. 2015-06-17 15:53:00 +03:00
svml_s_logf16_core.S Vector logf for x86_64 and tests. 2015-06-17 15:53:00 +03:00
svml_s_logf_data.h Vector logf for x86_64 and tests. 2015-06-17 15:53:00 +03:00
svml_s_logf_data.S Vector logf for x86_64 and tests. 2015-06-17 15:53:00 +03:00
svml_s_powf4_core.S Vector powf for x86_64 and tests. 2015-06-18 17:04:07 +03:00
svml_s_powf8_core_avx.S Vector powf for x86_64 and tests. 2015-06-18 17:04:07 +03:00
svml_s_powf8_core.S Vector powf for x86_64 and tests. 2015-06-18 17:04:07 +03:00
svml_s_powf16_core.S Vector powf for x86_64 and tests. 2015-06-18 17:04:07 +03:00
svml_s_powf_data.h Vector powf for x86_64 and tests. 2015-06-18 17:04:07 +03:00
svml_s_powf_data.S Vector powf for x86_64 and tests. 2015-06-18 17:04:07 +03:00
svml_s_sincosf4_core.S Vector sincosf for x86_64 and tests. 2015-06-18 20:11:27 +03:00
svml_s_sincosf8_core_avx.S Vector sincosf for x86_64 and tests. 2015-06-18 20:11:27 +03:00
svml_s_sincosf8_core.S Vector sincosf for x86_64 and tests. 2015-06-18 20:11:27 +03:00
svml_s_sincosf16_core.S Vector sincosf for x86_64 and tests. 2015-06-18 20:11:27 +03:00
svml_s_sinf4_core.S Vector sinf for x86_64 and tests. 2015-06-15 15:06:53 +03:00
svml_s_sinf8_core_avx.S Vector sinf for x86_64 and tests. 2015-06-15 15:06:53 +03:00
svml_s_sinf8_core.S Vector sinf for x86_64 and tests. 2015-06-15 15:06:53 +03:00
svml_s_sinf16_core.S Vector sinf for x86_64 and tests. 2015-06-15 15:06:53 +03:00
svml_s_trig_data.h Combination of data tables for x86_64 vector functions sinf, cosf and sincosf. 2015-06-24 17:44:35 +03:00
svml_s_trig_data.S Combination of data tables for x86_64 vector functions sinf, cosf and sincosf. 2015-06-24 17:44:35 +03:00
svml_s_wrapper_impl.h Fixed several libmvec bugs found during testing on KNL hardware. 2015-07-24 14:47:23 +03:00
test-double-vlen2-wrappers.c Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-double-vlen2.c Vector sincos for x86_64 and tests. 2015-06-18 17:55:55 +03:00
test-double-vlen4-avx2-wrappers.c Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-double-vlen4-avx2.c Vector sincos for x86_64 and tests. 2015-06-18 17:55:55 +03:00
test-double-vlen4-wrappers.c Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-double-vlen4.c Added runtime check for AVX vector math tests. 2015-07-29 19:47:29 +03:00
test-double-vlen8-wrappers.c Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-double-vlen8.c Vector sincos for x86_64 and tests. 2015-06-18 17:55:55 +03:00
test-float-vlen4-wrappers.c Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-float-vlen4.c Vector sincosf for x86_64 and tests. 2015-06-18 20:11:27 +03:00
test-float-vlen8-avx2-wrappers.c Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-float-vlen8-avx2.c Vector sincosf for x86_64 and tests. 2015-06-18 20:11:27 +03:00
test-float-vlen8-wrappers.c Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-float-vlen8.c Added runtime check for AVX vector math tests. 2015-07-29 19:47:29 +03:00
test-float-vlen16-wrappers.c Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-float-vlen16.c Vector sincosf for x86_64 and tests. 2015-06-18 20:11:27 +03:00
Versions Vector sincosf for x86_64 and tests. 2015-06-18 20:11:27 +03:00
x86_64-math-asm.h Fix pow missing underflows (bug 18825). 2015-09-25 22:29:10 +00:00