glibc/sysdeps/generic
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
..
bits Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
net Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
netinet Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
nfs Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
sys Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
_G_config.h Remove _G_OPEN64, _G_LSEEK64, _G_MMAP64, _G_FSTAT64 from _G_config.h. 2012-10-18 18:50:43 +00:00
_itoa.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
a.out.h
abort-instr.h
aio_misc.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
allocalim.h
asm-syntax.h
confstr.h
device-nrs.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dirstream.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-cache.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-dtprocnum.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-fptr.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-hash.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-irel.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-librecon.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-lookupcfg.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-machine.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-osinfo.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-procinfo.c
dl-procinfo.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-sysdep.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-tls.h
dwarf2.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
eloop-threshold.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
entry.h
errqueue.h
fd_to_filename.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
fips-private.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
fork.h
fpu_control.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
frame.h Remove __ptrvalue, __bounded and __unbounded. 2013-02-13 23:30:40 +00:00
framestate.c Fix leading whitespaces. 2013-06-06 20:36:07 +02:00
gccframe.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
get-rounding-mode.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
gmp-mparam.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
hp-timing.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
ifreq.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
ifunc-sel.h Move sysdeps/generic/elf/* to sysdeps/generic 2012-03-19 21:04:21 +01:00
intr-msg.h
inttypes.h Get rid of __STDC_FORMAT_MACROS, __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS 2013-04-25 11:08:31 -07:00
ldconfig.h Add #include <stdint.h> for uint[32|64]_t usage (except installed headers). 2013-05-16 11:32:54 -05:00
ldsodefs.h Avoid crashing in LD_DEBUG when program name is unavailable 2013-05-29 21:34:12 +05:30
libcidn.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libm-test-ulps
libnss_compat.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_db.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_dns.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_files.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_hesiod.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_nis.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_nisplus.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
local-setxid.h * sysdeps/posix/spawni.c (__spawni): Use local_seteuid and 2006-06-04 22:17:06 +00:00
localplt.data Move localplt baselines to sysdeps directories. 2012-07-20 19:20:34 +00:00
machine-gmon.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
machine-lock.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
machine-sp.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Makefile Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
malloc-machine.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
malloc-sysdep.h Add missing includes to sysdeps/generic/malloc-sysdep.h. 2013-02-05 11:34:06 -08:00
math_ldbl_opt.h * math/math.h [__NO_LONG_DOUBLE_MATH] (__nldbl_nexttowardf): New 2006-01-14 12:10:44 +00:00
math_ldbl.h
math_private.h Set/restore rounding mode only when needed 2013-06-12 10:36:48 +05:30
math-tests.h Add exception information to math-tests.h and use it in libm-test.inc. 2013-06-11 15:44:31 +00:00
memcopy.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
memusage.h Add #include <stdint.h> for uint[32|64]_t usage (except installed headers). 2013-05-16 11:32:54 -05:00
not-cancel.h Flesh out stub not-cancel.h file. 2013-05-06 16:03:35 -07:00
nscd-types.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
pagecopy.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
paths.h generic paths.h: remove old paths from _PATH_STDPATH 2012-11-04 10:11:39 +01:00
profil-counter.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
pty-private.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
register-dump.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
rtld-lowlevel.h Jakub Jelinek <jakub@redhat.com> 2006-10-10 00:51:29 +00:00
sigcontextinfo.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
siglist.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
sigset-cvt-mask.h Avoid use of "register" as optimization hint. 2013-06-07 22:24:35 +00:00
stackguard-macros.h Split up stackguard-macros.h into sysdeps directories. 2012-05-15 23:34:30 +00:00
stackinfo.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
stdint.h Get rid of __STDC_FORMAT_MACROS, __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS 2013-04-25 11:08:31 -07:00
symbol-hacks.h Update. 2004-03-08 21:31:23 +00:00
sysdep-cancel.h * elf/dl-sym.c (do_sym): Use RTLD_SINGLE_THREAD_P. 2006-10-29 21:46:32 +00:00
sysdep.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
testrtsig.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
thread_state.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tininess.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tls-macros.h * elf/tls-macros.h: #include_next <tls-macros.h> to get a sysdeps 2005-03-13 09:09:05 +00:00
tls.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tst-audit.h Move testsuite audit definitions to sysdeps tst-audit.h files. 2012-07-26 11:29:07 +00:00
tst-stack-align.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
unsecvars.h * malloc/malloc.c (_int_malloc): Remove unused any_larger variable. 2006-10-11 16:29:13 +00:00
unwind-dw2-fde-glibc.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
unwind-dw2-fde.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
unwind-dw2-fde.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
unwind-dw2.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
unwind-pe.c Update. 2004-03-10 10:04:19 +00:00
unwind-pe.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
unwind.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
utmp-equal.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00