[patch, mips] Add new inline functions to mips math_private.h
Steve Ellcey
sellcey@mips.com
Tue Feb 25 19:10:00 GMT 2014
This is a patch to the MIPS math_private.h file to define HAVE_RM_CTX and
implement the ctx macros. I also defined a few other macros and inline
functions that I skipped the first time.
Testing did not show any correctness regressions and I got some performance
improvements plus a few small regressions. I included a before and after
bench.out file along with the patch. Some tests slowed down but log2() was
the only one that slowed down more then 1%. 5 tests improved by about 2.5%,
cosh improved by 11.55%, sinh by 7.8%, and sincos() by 10%. I think the
sinh/cosh improvements being larger are due to simple/small inputs in the
test cases.
I am not completely sure about the difference between the libc_feholdsetround
functions and the libc_feholdexcept_setround functions (likewise
libc_feupdateenv and libc_feresetround), but I believe my changes are safe,
even if they may not be optimal. If anyone has any comments on these in
particular I would like to hear them.
OK to checkin?
Steve Ellcey
2014-02-25 Steve Ellcey <sellcey@mips.com>
* sysdeps/mips/math_private.h (_FPU_MASK_ALL) New.
(libc_feholdexcept_mips): Use _FPU_MASK_ALL.
(libc_feholdexcept_setround_mips): Ditto.
(libc_feholdsetround): New.
(libc_feholdsetroundf): New.
(libc_feholdsetroundl): New.
(libc_feupdateenv_test_mips): New.
(libc_feupdateenv_test): New.
(libc_feupdateenv_testf): New.
(libc_feupdateenv_testl): New.
(libc_feresetround): New.
(libc_feresetroundf): New.
(libc_feresetroundl): New.
(libc_fetestexcept_mips): New.
(libc_fetestexcept): New.
(libc_fetestexceptf): New.
(libc_fetestexceptl): New.
(HAVE_RM_CTX): New.
(libc_feholdexcept_setround_mips_ctx): New.
(libc_feholdexcept_setround_ctx): New.
(libc_feholdexcept_setroundf_ctx): New.
(libc_feholdexcept_setroundl_ctx): New.
(libc_fesetenv_mips_ctx): New.
(libc_fesetenv_ctx): New.
(libc_fesetenv_ctxf): New.
(libc_fesetenv_ctxl): New.
(libc_feupdateenv_mips_ctx): New.
(libc_feupdateenv_ctx): New.
(libc_feupdateenvf_ctx): New.
(libc_feupdateenvl_ctx): New.
(libc_feholdsetround_mips_ctx): New.
(libc_feholdsetround_ctx): New.
(libc_feholdsetroundf_ctx): New.
(libc_feholdsetroundl_ctx): New.
(libc_feresetround_mips_ctx): New.
(libc_feresetround_ctx): New.
(libc_feresetroundf_ctx): New.
(libc_feresetroundl_ctx): New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mips_math_private.patch
Type: text/x-patch
Size: 6139 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20140225/3afeaa82/attachment.bin>
-------------- next part --------------
acos(): ITERS:8.1e+06: TOTAL:14.75s, MAX:20833.3ns, MIN:0ns, 549153 iter/s
acos(slow): ITERS:12000: TOTAL:10.1042s, MAX:854167ns, MIN:833333ns, 1187.63 iter/s
acosh(): ITERS:1.11e+07: TOTAL:10.0208s, MAX:20833.3ns, MIN:0ns, 1.10769e+06 iter/s
asin(): ITERS:7.5e+06: TOTAL:13.4583s, MAX:20833.3ns, MIN:0ns, 557276 iter/s
asin(slow): ITERS:15000: TOTAL:12.5833s, MAX:854167ns, MIN:833333ns, 1192.05 iter/s
asinh(): ITERS:1.14e+07: TOTAL:10.0208s, MAX:20833.3ns, MIN:0ns, 1.13763e+06 iter/s
atan(): ITERS:7.2e+06: TOTAL:10.0208s, MAX:20833.3ns, MIN:0ns, 718503 iter/s
atan(144bits): ITERS:51000: TOTAL:10.5417s, MAX:208333ns, MIN:187500ns, 4837.94 iter/s
atanh(): ITERS:1.44e+07: TOTAL:10.0625s, MAX:20833.3ns, MIN:0ns, 1.43106e+06 iter/s
cos(): ITERS:4.6e+06: TOTAL:10.5417s, MAX:20833.3ns, MIN:0ns, 436364 iter/s
cos(768bits): ITERS:105000: TOTAL:90.6667s, MAX:875000ns, MIN:854167ns, 1158.09 iter/s
cosh(): ITERS:2.12e+07: TOTAL:10.0833s, MAX:20833.3ns, MIN:0ns, 2.10248e+06 iter/s
exp(): ITERS:1.028e+06: TOTAL:12.625s, MAX:41666.7ns, MIN:0ns, 81425.7 iter/s
exp(768bits): ITERS:20000: TOTAL:10.25s, MAX:562500ns, MIN:479167ns, 1951.22 iter/s
exp(144bits): ITERS:305000: TOTAL:10.9167s, MAX:41666.7ns, MIN:20833.3ns, 27938.9 iter/s
exp2(): ITERS:1.3566e+07: TOTAL:10.0208s, MAX:20833.3ns, MIN:0ns, 1.35378e+06 iter/s
log(): ITERS:7.592e+06: TOTAL:10.0625s, MAX:20833.3ns, MIN:0ns, 754484 iter/s
log2(): ITERS:2.34e+07: TOTAL:10.0833s, MAX:20833.3ns, MIN:0ns, 2.32066e+06 iter/s
modf(): ITERS:1.24036e+08: TOTAL:9.8125s, MAX:20833.3ns, MIN:0ns, 1.26406e+07 iter/s
pow(): ITERS:4.214e+06: TOTAL:10.1667s, MAX:20833.3ns, MIN:0ns, 414492 iter/s
pow(768bits): ITERS:101000: TOTAL:276.917s, MAX:2.875e+06ns, MIN:1.35417e+06ns, 364.731 iter/s
pow(240bits): ITERS:100000: TOTAL:21.0417s, MAX:250000ns, MIN:166667ns, 4752.48 iter/s
rint(): ITERS:1.36932e+08: TOTAL:9.72917s, MAX:20833.3ns, MIN:0ns, 1.40744e+07 iter/s
sin(): ITERS:5.6e+06: TOTAL:12.875s, MAX:20833.3ns, MIN:0ns, 434951 iter/s
sin(768bits): ITERS:107000: TOTAL:92.3333s, MAX:875000ns, MIN:833333ns, 1158.84 iter/s
sincos(): ITERS:7.32e+06: TOTAL:10s, MAX:20833.3ns, MIN:0ns, 732000 iter/s
sincos(768bits): ITERS:12000: TOTAL:10.25s, MAX:875000ns, MIN:833333ns, 1170.73 iter/s
sinh(): ITERS:1.8e+07: TOTAL:10.0417s, MAX:20833.3ns, MIN:0ns, 1.79253e+06 iter/s
sqrt(): ITERS:1.0479e+08: TOTAL:9.85417s, MAX:20833.3ns, MIN:0ns, 1.06341e+07 iter/s
tan(): ITERS:6.486e+06: TOTAL:14.0208s, MAX:20833.3ns, MIN:0ns, 462597 iter/s
tan(768bits): ITERS:12000: TOTAL:11.0625s, MAX:937500ns, MIN:895833ns, 1084.75 iter/s
tan(240bits): ITERS:800000: TOTAL:10.3333s, MAX:20833.3ns, MIN:0ns, 77419.4 iter/s
tanh(): ITERS:1.54e+07: TOTAL:9.95833s, MAX:20833.3ns, MIN:0ns, 1.54644e+06 iter/s
-------------- next part --------------
acos(): ITERS:8.1e+06: TOTAL:14.7917s, MAX:20833.3ns, MIN:0ns, 547606 iter/s
acos(slow): ITERS:12000: TOTAL:10.0208s, MAX:854167ns, MIN:833333ns, 1197.51 iter/s
acosh(): ITERS:1.11e+07: TOTAL:10.0417s, MAX:20833.3ns, MIN:0ns, 1.10539e+06 iter/s
asin(): ITERS:7.5e+06: TOTAL:13.4167s, MAX:20833.3ns, MIN:0ns, 559006 iter/s
asin(slow): ITERS:15000: TOTAL:12.5625s, MAX:854167ns, MIN:833333ns, 1194.03 iter/s
asinh(): ITERS:1.14e+07: TOTAL:10.0417s, MAX:20833.3ns, MIN:0ns, 1.13527e+06 iter/s
atan(): ITERS:7.2e+06: TOTAL:10s, MAX:20833.3ns, MIN:0ns, 720000 iter/s
atan(144bits): ITERS:48000: TOTAL:10.0417s, MAX:229167ns, MIN:208333ns, 4780.08 iter/s
atanh(): ITERS:1.44e+07: TOTAL:10s, MAX:20833.3ns, MIN:0ns, 1.44e+06 iter/s
cos(): ITERS:4.6e+06: TOTAL:10.8125s, MAX:20833.3ns, MIN:0ns, 425434 iter/s
cos(768bits): ITERS:105000: TOTAL:90.75s, MAX:875000ns, MIN:833333ns, 1157.02 iter/s
cosh(): ITERS:1.92e+07: TOTAL:10.1667s, MAX:20833.3ns, MIN:0ns, 1.88852e+06 iter/s
exp(): ITERS:1.028e+06: TOTAL:12.4792s, MAX:41666.7ns, MIN:0ns, 82377.3 iter/s
exp(768bits): ITERS:25000: TOTAL:12.4167s, MAX:541667ns, MIN:479167ns, 2013.42 iter/s
exp(144bits): ITERS:305000: TOTAL:10.7708s, MAX:41666.7ns, MIN:20833.3ns, 28317.2 iter/s
exp2(): ITERS:1.3158e+07: TOTAL:9.97917s, MAX:20833.3ns, MIN:0ns, 1.31855e+06 iter/s
log(): ITERS:7.592e+06: TOTAL:10.0417s, MAX:20833.3ns, MIN:0ns, 756050 iter/s
log2(): ITERS:2.4e+07: TOTAL:10.0417s, MAX:20833.3ns, MIN:0ns, 2.39004e+06 iter/s
modf(): ITERS:1.24e+08: TOTAL:9.72917s, MAX:20833.3ns, MIN:0ns, 1.27452e+07 iter/s
pow(): ITERS:4.214e+06: TOTAL:10.4167s, MAX:20833.3ns, MIN:0ns, 404544 iter/s
pow(768bits): ITERS:101000: TOTAL:275.229s, MAX:2.83333e+06ns, MIN:1.33333e+06ns, 366.967 iter/s
pow(240bits): ITERS:100000: TOTAL:21.1042s, MAX:250000ns, MIN:166667ns, 4738.4 iter/s
rint(): ITERS:1.3694e+08: TOTAL:9.77083s, MAX:20833.3ns, MIN:0ns, 1.40152e+07 iter/s
sin(): ITERS:5.6e+06: TOTAL:13.2083s, MAX:20833.3ns, MIN:0ns, 423975 iter/s
sin(768bits): ITERS:107000: TOTAL:92.5s, MAX:875000ns, MIN:833333ns, 1156.76 iter/s
sincos(): ITERS:6.648e+06: TOTAL:10s, MAX:20833.3ns, MIN:0ns, 664800 iter/s
sincos(768bits): ITERS:12000: TOTAL:10.1667s, MAX:854167ns, MIN:833333ns, 1180.33 iter/s
sinh(): ITERS:1.68e+07: TOTAL:10.125s, MAX:20833.3ns, MIN:0ns, 1.65926e+06 iter/s
sqrt(): ITERS:1.04783e+08: TOTAL:9.85417s, MAX:20833.3ns, MIN:0ns, 1.06334e+07 iter/s
tan(): ITERS:6.486e+06: TOTAL:14.4375s, MAX:20833.3ns, MIN:0ns, 449247 iter/s
tan(768bits): ITERS:12000: TOTAL:11.0417s, MAX:937500ns, MIN:895833ns, 1086.79 iter/s
tan(240bits): ITERS:800000: TOTAL:10.3958s, MAX:20833.3ns, MIN:0ns, 76953.9 iter/s
tanh(): ITERS:1.54e+07: TOTAL:10.0208s, MAX:20833.3ns, MIN:0ns, 1.5368e+06 iter/s
More information about the Libc-alpha
mailing list