glibc/sysdeps/i386/fpu
Siddhesh Poyarekar 2506109403 Set/restore rounding mode only when needed
The most common use case of math functions is with default rounding
mode, i.e. rounding to nearest.  Setting and restoring rounding mode
is an unnecessary overhead for this, so I've added support for a
context, which does the set/restore only if the FP status needs a
change.  The code is written such that only x86 uses these.  Other
architectures should be unaffected by it, but would definitely benefit
if the set/restore has as much overhead relative to the rest of the
code, as the x86 bits do.

Here's a summary of the performance improvement due to these
improvements; I've only mentioned functions that use the set/restore
and have benchmark inputs for x86_64:

Before:

cos(): ITERS:4.69335e+08: TOTAL:28884.6Mcy, MAX:4080.28cy, MIN:57.562cy, 16248.6 calls/Mcy
exp(): ITERS:4.47604e+08: TOTAL:28796.2Mcy, MAX:207.721cy, MIN:62.385cy, 15543.9 calls/Mcy
pow(): ITERS:1.63485e+08: TOTAL:28879.9Mcy, MAX:362.255cy, MIN:172.469cy, 5660.86 calls/Mcy
sin(): ITERS:3.89578e+08: TOTAL:28900Mcy, MAX:704.859cy, MIN:47.583cy, 13480.2 calls/Mcy
tan(): ITERS:7.0971e+07: TOTAL:28902.2Mcy, MAX:1357.79cy, MIN:388.58cy, 2455.55 calls/Mcy

After:

cos(): ITERS:6.0014e+08: TOTAL:28875.9Mcy, MAX:364.283cy, MIN:45.716cy, 20783.4 calls/Mcy
exp(): ITERS:5.48578e+08: TOTAL:28764.9Mcy, MAX:191.617cy, MIN:51.011cy, 19071.1 calls/Mcy
pow(): ITERS:1.70013e+08: TOTAL:28873.6Mcy, MAX:689.522cy, MIN:163.989cy, 5888.18 calls/Mcy
sin(): ITERS:4.64079e+08: TOTAL:28891.5Mcy, MAX:6959.3cy, MIN:36.189cy, 16062.8 calls/Mcy
tan(): ITERS:7.2354e+07: TOTAL:28898.9Mcy, MAX:1295.57cy, MIN:380.698cy, 2503.7 calls/Mcy

So the improvements are:

cos: 27.9089%
exp: 22.6919%
pow: 4.01564%
sin: 19.1585%
tan: 1.96086%

The downside of the change is that it will have an adverse performance
impact on non-default rounding modes, but I think the tradeoff is
justified.
2013-06-12 10:36:48 +05:30
..
doasin.c
e_acos.S Fix x86 acos near 1 (bug 13942). 2012-04-30 18:56:39 +00:00
e_acosf.S Fix acos (-1) in round-downwards mode on x86 (bug 14034). 2012-04-30 09:38:06 +00:00
e_acosh.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
e_acoshf.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
e_acoshl.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
e_acosl.c Fix x86 acos near 1 (bug 13942). 2012-04-30 18:56:39 +00:00
e_asin.S Fix x86 acos near 1 (bug 13942). 2012-04-30 18:56:39 +00:00
e_asinf.S Optimize libm 2011-10-12 11:27:51 -04:00
e_atan2.S Optimize libm 2011-10-12 11:27:51 -04:00
e_atan2f.S Optimize libm 2011-10-12 11:27:51 -04:00
e_atan2l.c Optimize libm 2011-10-12 11:27:51 -04:00
e_atanh.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
e_atanhf.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
e_atanhl.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
e_exp2.S Optimize libm 2011-10-12 11:27:51 -04:00
e_exp2f.S Optimize libm 2011-10-12 11:27:51 -04:00
e_exp2l.S Optimize libm 2011-10-12 11:27:51 -04:00
e_exp10.S Optimize libm 2011-10-12 11:27:51 -04:00
e_exp10f.S Optimize libm 2011-10-12 11:27:51 -04:00
e_exp10l.S Fix exp10 inaccuracy and exceptions (bugs 13884, 13914). 2012-05-06 18:23:44 +00:00
e_exp.S Optimize exp 2011-10-15 20:22:59 -04:00
e_expf.S Optimize exp 2011-10-15 20:22:59 -04:00
e_expl.S Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}. 2012-08-02 21:04:29 +02:00
e_fmod.S Optimize libm 2011-10-12 11:27:51 -04:00
e_fmodf.S Optimize libm 2011-10-12 11:27:51 -04:00
e_fmodl.c Optimize libm 2011-10-12 11:27:51 -04:00
e_hypot.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
e_hypotf.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
e_ilogb.S Remove useless __ilogb*_finite aliases 2012-04-18 00:40:13 +02:00
e_ilogbf.S Remove useless __ilogb*_finite aliases 2012-04-18 00:40:13 +02:00
e_ilogbl.S Remove useless __ilogb*_finite aliases 2012-04-18 00:40:13 +02:00
e_log2.S Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}. 2012-08-02 21:04:29 +02:00
e_log2f.S Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}. 2012-08-02 21:04:29 +02:00
e_log2l.S Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}. 2012-08-02 21:04:29 +02:00
e_log10.S Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}. 2012-08-02 21:04:29 +02:00
e_log10f.S Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}. 2012-08-02 21:04:29 +02:00
e_log10l.S Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}. 2012-08-02 21:04:29 +02:00
e_log.S Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}. 2012-08-02 21:04:29 +02:00
e_logf.S Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}. 2012-08-02 21:04:29 +02:00
e_logl.S Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}. 2012-08-02 21:04:29 +02:00
e_pow.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
e_powf.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
e_powl.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
e_rem_pio2.c
e_remainder.S Optimize libm 2011-10-12 11:27:51 -04:00
e_remainderf.S Optimize libm 2011-10-12 11:27:51 -04:00
e_remainderl.S Optimize libm 2011-10-12 11:27:51 -04:00
e_scalb.S Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}. 2012-08-02 21:04:29 +02:00
e_scalbf.S Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}. 2012-08-02 21:04:29 +02:00
e_scalbl.S Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}. 2012-08-02 21:04:29 +02:00
e_sqrt.S Optimize libm 2011-10-12 11:27:51 -04:00
e_sqrtf.S Optimize libm 2011-10-12 11:27:51 -04:00
e_sqrtl.c Optimize libm 2011-10-12 11:27:51 -04:00
fclrexcpt.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
fedisblxcpt.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
feenablxcpt.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
fegetenv.c Remove bp-sym.h and BP_SYM uses from C code. 2013-02-14 13:12:02 +00:00
fegetexcept.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
fegetround.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
feholdexcpt.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
fenv_private.h Set/restore rounding mode only when needed 2013-06-12 10:36:48 +05:30
fesetenv.c Remove bp-sym.h and BP_SYM uses from C code. 2013-02-14 13:12:02 +00:00
fesetround.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
feupdateenv.c Remove bp-sym.h and BP_SYM uses from C code. 2013-02-14 13:12:02 +00:00
fgetexcptflg.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
fraiseexcpt.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
fsetexcptflg.c Remove bp-sym.h and BP_SYM uses from C code. 2013-02-14 13:12:02 +00:00
ftestexcept.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
halfulp.c
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
libm-test-ulps Test drem and pow10 in libm-test.inc. 2013-05-24 20:33:14 +00:00
math_private.h Optimize private 387 fenv access; share code between i386 and x86_64. 2012-03-19 06:51:39 -07:00
math-tests.h Refer to two GCC PRs. 2013-04-03 14:13:44 +02:00
mpatan2.c
mpatan.c
mpexp.c
mplog.c
mpsqrt.c
s_asinh.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_asinhf.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_asinhl.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_atan.S
s_atanf.S
s_atanl.c
s_cbrt.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_cbrtf.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_cbrtl.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_ceil.S
s_ceilf.S
s_ceill.S
s_copysign.S
s_copysignf.S
s_copysignl.S
s_expm1.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_expm1f.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00: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.S
s_fabsf.S
s_fabsl.S
s_fdim.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_fdimf.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_fdiml.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_finite.S Update. 2002-09-10 01:40:26 +00:00
s_finitef.S Update. 2002-09-10 01:40:26 +00:00
s_finitel.S Update. 2002-09-10 01:40:26 +00:00
s_floor.S
s_floorf.S
s_floorl.S
s_fmax.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_fmaxf.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_fmaxl.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_fmin.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_fminf.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_fminl.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_fpclassifyl.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_frexp.S Remove remaining bounded-pointers support from i386 .S files. 2013-02-21 22:21:52 +00:00
s_frexpf.S Remove remaining bounded-pointers support from i386 .S files. 2013-02-21 22:21:52 +00:00
s_frexpl.S Remove remaining bounded-pointers support from i386 .S files. 2013-02-21 22:21:52 +00:00
s_isinfl.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_isnanl.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_llrint.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_llrintf.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_llrintl.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_log1p.S Remove __ELF__ conditionals 2012-02-07 00:41:11 +01:00
s_log1pf.S Remove __ELF__ conditionals 2012-02-07 00:41:11 +01:00
s_log1pl.S Remove __ELF__ conditionals 2012-02-07 00:41:11 +01:00
s_logb.S
s_logbf.S
s_logbl.c
s_lrint.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_lrintf.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_lrintl.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_nearbyint.S * intl/Makefile (tst-gettext[45].out): Pass also $(run-program-prefix) 2005-05-04 17:58:13 +00:00
s_nearbyintf.S * intl/Makefile (tst-gettext[45].out): Pass also $(run-program-prefix) 2005-05-04 17:58:13 +00:00
s_nearbyintl.S * intl/Makefile (tst-gettext[45].out): Pass also $(run-program-prefix) 2005-05-04 17:58:13 +00:00
s_nextafterl.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_nexttoward.c Fix nexttoward bugs (bugs 2550, 2570). 2012-05-01 15:37:43 +00:00
s_nexttowardf.c Fix nexttoward bugs (bugs 2550, 2570). 2012-05-01 15:37:43 +00:00
s_remquo.S Remove remaining bounded-pointers support from i386 .S files. 2013-02-21 22:21:52 +00:00
s_remquof.S Remove remaining bounded-pointers support from i386 .S files. 2013-02-21 22:21:52 +00:00
s_remquol.S Remove remaining bounded-pointers support from i386 .S files. 2013-02-21 22:21:52 +00:00
s_rint.S
s_rintf.S
s_rintl.c
s_scalbln.c
s_scalblnf.c
s_scalblnl.c
s_scalbn.S
s_scalbnf.S
s_scalbnl.S
s_significand.S
s_significandf.S
s_significandl.c (__significandl): Really return significand and not the exponent. 2003-01-07 07:42:11 +00:00
s_trunc.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_truncf.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
s_truncl.S Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
slowexp.c
slowpow.c
t_exp.c
Versions