glibc/sysdeps/i386/fpu
Joseph Myers ec94343f59 Add femode_t functions.
TS 18661-1 defines a type femode_t to represent the set of dynamic
floating-point control modes (such as the rounding mode and trap
enablement modes), and functions fegetmode and fesetmode to manipulate
those modes (without affecting other state such as the raised
exception flags) and a corresponding macro FE_DFL_MODE.

This patch series implements those interfaces for glibc.  This first
patch adds the architecture-independent pieces, the x86 and x86_64
implementations, and the <bits/fenv.h> and ABI baseline updates for
all architectures so glibc keeps building and passing the ABI tests on
all architectures.  Subsequent patches add the fegetmode and fesetmode
implementations for other architectures.

femode_t is generally an integer type - the same type as fenv_t, or as
the single element of fenv_t where fenv_t is a structure containing a
single integer (or the single relevant element, where it has elements
for both status and control registers) - except where architecture
properties or consistency with the fenv_t implementation indicate
otherwise.  FE_DFL_MODE follows FE_DFL_ENV in whether it's a magic
pointer value (-1 cast to const femode_t *), a value that can be
distinguished from valid pointers by its high bits but otherwise
contains a representation of the desired register contents, or a
pointer to a constant variable (the powerpc case; __fe_dfl_mode is
added as an exported constant object, an alias to __fe_dfl_env).

Note that where architectures (that share a register between control
and status bits) gain definitions of new floating-point control or
status bits in future, the implementations of fesetmode for those
architectures may need updating (depending on whether the new bits are
control or status bits and what the implementation does with
previously unknown bits), just like existing implementations of
<fenv.h> functions that take care not to touch reserved bits may need
updating when the set of reserved bits changes.  (As any new bits are
outside the scope of ISO C, that's just a quality-of-implementation
issue for supporting them, not a conformance issue.)

As with fenv_t, femode_t should properly include any software DFP
rounding mode (and for both fenv_t and femode_t I'd consider that
fragment of DFP support appropriate for inclusion in glibc even in the
absence of the rest of libdfp; hardware DFP rounding modes should
already be included if the definitions of which bits are status /
control bits are correct).

Tested for x86_64, x86, mips64 (hard float, and soft float to test the
fallback version), arm (hard float) and powerpc (hard float, soft
float and e500).  Other architecture versions are untested.

	* math/fegetmode.c: New file.
	* math/fesetmode.c: Likewise.
	* sysdeps/i386/fpu/fegetmode.c: Likewise.
	* sysdeps/i386/fpu/fesetmode.c: Likewise.
	* sysdeps/x86_64/fpu/fegetmode.c: Likewise.
	* sysdeps/x86_64/fpu/fesetmode.c: Likewise.
	* math/fenv.h: Update comment on inclusion of <bits/fenv.h>.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (fegetmode): New function
	declaration.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (fesetmode): Likewise.
	* bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (femode_t): New
	typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/aarch64/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/alpha/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/arm/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/hppa/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/ia64/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/m68k/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/microblaze/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/mips/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/nios2/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/powerpc/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (__fe_dfl_mode): New variable
	declaration.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/s390/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/sh/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/sparc/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/tile/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/x86/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* manual/arith.texi (FE_DFL_MODE): Document macro.
	(fegetmode): Document function.
	(fesetmode): Likewise.
	* math/Versions (fegetmode): New libm symbol at version
	GLIBC_2.25.
	(fesetmode): Likewise.
	* math/Makefile (libm-support): Add fegetmode and fesetmode.
	(tests): Add test-femode and test-femode-traps.
	* math/test-femode-traps.c: New file.
	* math/test-femode.c: Likewise.
	* sysdeps/powerpc/fpu/fenv_const.c (__fe_dfl_mode): Declare as
	alias for __fe_dfl_env.
	* sysdeps/powerpc/nofpu/fenv_const.c (__fe_dfl_mode): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fenv_const.c
	(__fe_dfl_mode): Likewise.
	* sysdeps/powerpc/Versions (__fe_dfl_mode): New libm symbol at
	version GLIBC_2.25.
	* sysdeps/nacl/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
2016-09-07 16:40:09 +00:00
..
doasin.c
e_acos.S
e_acosf.S
e_acosh.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_acoshf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_acoshl.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_acosl.c
e_asin.S Refactor i386 libm code forcing underflow exceptions. 2015-09-24 21:41:00 +00:00
e_asinf.S Refactor i386 libm code forcing underflow exceptions. 2015-09-24 21:41:00 +00:00
e_atan2.S Refactor i386 libm code forcing underflow exceptions. 2015-09-24 21:41:00 +00:00
e_atan2f.S Refactor i386 libm code forcing underflow exceptions. 2015-09-24 21:41:00 +00:00
e_atan2l.c
e_atanh.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_atanhf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_atanhl.S Fix i386 atanhl (sNaN) (bug 20219). 2016-06-07 23:08:32 +00:00
e_exp2.S Avoid excess range in results from i386 exp, hypot, pow functions (bug 18980). 2015-09-18 21:53:22 +00:00
e_exp2f.S Avoid excess range in results from i386 exp, hypot, pow functions (bug 18980). 2015-09-18 21:53:22 +00:00
e_exp2l.S Refactor i386 libm code forcing underflow exceptions. 2015-09-24 21:41:00 +00:00
e_exp10.S Avoid excess range in results from i386 exp, hypot, pow functions (bug 18980). 2015-09-18 21:53:22 +00:00
e_exp10f.S Avoid excess range in results from i386 exp, hypot, pow functions (bug 18980). 2015-09-18 21:53:22 +00:00
e_exp10l.S
e_exp.S Avoid excess range in results from i386 exp, hypot, pow functions (bug 18980). 2015-09-18 21:53:22 +00:00
e_expf.S Avoid excess range in results from i386 exp, hypot, pow functions (bug 18980). 2015-09-18 21:53:22 +00:00
e_expl.S Fix i386/x86_64 expl, exp10l, expm1l for sNaN input (bug 20226). 2016-06-08 21:55:06 +00:00
e_fmod.S
e_fmodf.S
e_fmodl.c
e_hypot.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_hypotf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_ilogb.S
e_ilogbf.S
e_ilogbl.S
e_log2.S
e_log2f.S
e_log2l.S Fix i386/x86_64 log2l (sNaN) (bug 20235). 2016-06-09 18:04:30 +00:00
e_log10.S
e_log10f.S
e_log10l.S Fix i386/x86_64 log10l (sNaN) (bug 20228). 2016-06-08 22:59:18 +00:00
e_log.S Fix i386/x86_64 log* (1) zero sign for -ffinite-math-only (bug 19213). 2015-11-05 21:56:31 +00:00
e_logf.S Fix i386/x86_64 log* (1) zero sign for -ffinite-math-only (bug 19213). 2015-11-05 21:56:31 +00:00
e_logl.S Fix i386/x86_64 logl (sNaN) (bug 20227). 2016-06-08 22:24:06 +00:00
e_pow.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_powf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_powl.S Fix x86_64 / x86 powl inaccuracy for integer exponents (bug 19848). 2016-03-24 01:32:52 +00:00
e_rem_pio2.c
e_remainder.S
e_remainderf.S
e_remainderl.S
e_scalb.S Avoid excess range in results from i386 scalb functions (bug 18981). 2015-09-18 20:34:59 +00:00
e_scalbf.S Avoid excess range in results from i386 scalb functions (bug 18981). 2015-09-18 20:34:59 +00:00
e_scalbl.S Fix i386/x86_64 scalbl with sNaN input (bug 20296). 2016-06-23 22:17:41 +00:00
e_sqrt.S
e_sqrtf.S
e_sqrtl.c
fclrexcpt.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
fegetmode.c Add femode_t functions. 2016-09-07 16:40:09 +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_private.h
fesetenv.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fesetexcept.c Add fesetexcept. 2016-08-16 16:16:10 +00:00
fesetmode.c Add femode_t functions. 2016-09-07 16:40:09 +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
halfulp.c
i386-math-asm.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Implies
libm-test-ulps i386: move ULPs to i686/multiarch and regenerate new ones for i386 2015-12-20 16:36:45 +01:00
math_private.h Fix math_private.h multiple include guards. 2015-11-20 23:46:23 +00:00
math-tests.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
mpatan2.c
mpatan.c
mpexp.c
mplog.c
mpsqrt.c
s_asinh.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_asinhf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_asinhl.S Fix i386 asinhl (sNaN) (bug 20218). 2016-06-07 22:54:58 +00:00
s_atan.S Refactor i386 libm code forcing underflow exceptions. 2015-09-24 21:41:00 +00:00
s_atanf.S Refactor i386 libm code forcing underflow exceptions. 2015-09-24 21:41:00 +00:00
s_atanl.c
s_cbrt.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_cbrtf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_cbrtl.S Fix i386 cbrtl (sNaN) (bug 20224). 2016-06-08 21:02:40 +00:00
s_ceil.S Avoid "inexact" exceptions in i386/x86_64 ceil functions (bug 15479). 2016-06-27 17:24:30 +00:00
s_ceilf.S Avoid "inexact" exceptions in i386/x86_64 ceil functions (bug 15479). 2016-06-27 17:24:30 +00:00
s_ceill.S Avoid "inexact" exceptions in i386/x86_64 ceil functions (bug 15479). 2016-06-27 17:24:30 +00:00
s_copysign.S
s_copysignf.S
s_copysignl.S
s_expm1.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_expm1f.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_expm1l.S
s_fabs.S
s_fabsf.S
s_fabsl.S
s_fdim.c Fix i386 fdim double rounding (bug 20255). 2016-06-14 16:41:50 +00:00
s_finite.S
s_finitef.S
s_finitel.S
s_floor.S Avoid "inexact" exceptions in i386/x86_64 floor functions (bug 15479). 2016-06-27 17:25:47 +00:00
s_floorf.S Avoid "inexact" exceptions in i386/x86_64 floor functions (bug 15479). 2016-06-27 17:25:47 +00:00
s_floorl.S Avoid "inexact" exceptions in i386/x86_64 floor functions (bug 15479). 2016-06-27 17:25:47 +00:00
s_fmax.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fmaxf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fmaxl.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fmin.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fminf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fminl.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fpclassifyl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_frexp.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_frexpf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_frexpl.S Fix frexp (NaN) (bug 20250). 2016-06-13 17:27:19 +00:00
s_isinfl.c
s_isnanl.c
s_llrint.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_llrintf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_llrintl.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_log1p.S Refactor i386 libm code forcing underflow exceptions. 2015-09-24 21:41:00 +00:00
s_log1pf.S Refactor i386 libm code forcing underflow exceptions. 2015-09-24 21:41:00 +00:00
s_log1pl.S Fix i386/x86_64 log1pl (sNaN) (bug 20229). 2016-06-08 23:11:42 +00:00
s_logb.S
s_logbf.S
s_logbl.c
s_lrint.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_lrintf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_lrintl.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_nearbyint.S Simplify x86 nearbyint functions. 2016-06-22 15:40:30 +00:00
s_nearbyintf.S Simplify x86 nearbyint functions. 2016-06-22 15:40:30 +00:00
s_nearbyintl.S Simplify x86 nearbyint functions. 2016-06-22 15:40:30 +00:00
s_nextafterl.c Fix x86/x86_64 nextafterl incrementing negative subnormals (bug 20205). 2016-06-03 21:30:12 +00:00
s_nexttoward.c Make nextafter, nexttoward set errno (bug 6799). 2015-11-02 18:54:19 +00:00
s_nexttowardf.c Make nextafter, nexttoward set errno (bug 6799). 2015-11-02 18:54:19 +00:00
s_remquo.S
s_remquof.S
s_remquol.S
s_rint.S
s_rintf.S
s_rintl.c
s_scalbln.c
s_scalblnf.c
s_scalblnl.c
s_scalbn.S Avoid excess range in results from i386 scalb functions (bug 18981). 2015-09-18 20:34:59 +00:00
s_scalbnf.S Avoid excess range in results from i386 scalb functions (bug 18981). 2015-09-18 20:34:59 +00:00
s_scalbnl.S Make scalbn set errno (bug 6803). 2015-09-16 21:11:00 +00:00
s_significand.S
s_significandf.S
s_significandl.c
s_trunc.S Avoid "inexact" exceptions in i386/x86_64 trunc functions (bug 15479). 2016-06-27 17:26:52 +00:00
s_truncf.S Avoid "inexact" exceptions in i386/x86_64 trunc functions (bug 15479). 2016-06-27 17:26:52 +00:00
s_truncl.S Avoid "inexact" exceptions in i386/x86_64 trunc functions (bug 15479). 2016-06-27 17:26:52 +00:00
slowexp.c
slowpow.c
t_exp.c
Versions
w_sqrt.c