libc/newlib/libm/common
Szabolcs Nagy c156098271 New expf, exp2f, logf, log2f and powf implementations
Based on code from https://github.com/ARM-software/optimized-routines/

This patch adds a highly optimized generic implementation of expf,
exp2f, logf, log2f and powf.  The new functions are not only
faster (6x for powf!), but are also smaller and more accurate.
In order to achieve this, the algorithm uses double precision
arithmetic for accuracy, avoids divisions and uses small table
lookups to minimize the polynomials.  Special cases are handled
inline to avoid the unnecessary overhead of wrapper functions and
set errno to POSIX requirements.

The new functions are added under newlib/libm/common, but the old
implementations are kept (in newlib/libm/math) for non-IEEE or
pre-C99 systems.  Targets can enable the new math code by defining
__OBSOLETE_MATH_DEFAULT to 0 in newlib/libc/include/machine/ieeefp.h,
users can override the default by defining __OBSOLETE_MATH.
Currently the new code is enabled for AArch64 and AArch32 with VFP.
Targets with a single precision FPU may still prefer the old
implementation.

libm.a size changes:
arm: -1692
arm/thumb/v7-a/nofp: -878
arm/thumb/v7-a+fp/hard: -864
arm/thumb/v7-a+fp/softfp: -908
aarch64: -1476
2017-10-13 10:58:00 +02:00
..
Makefile.am New expf, exp2f, logf, log2f and powf implementations 2017-10-13 10:58:00 +02:00
Makefile.in New expf, exp2f, logf, log2f and powf implementations 2017-10-13 10:58:00 +02:00
acoshl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
acosl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
asinhl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
asinl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
atan2l.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
atanhl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
atanl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
cbrtl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
ceill.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
copysignl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
coshl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
cosl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
erfcl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
erfl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
exp2l.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
expl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
expm1l.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
fabsl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
fdiml.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
fdlibm.h * libc/include/complex.h (cabsl): Add prototype. 2015-02-06 16:14:04 +00:00
floorl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
fmal.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
fmaxl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
fminl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
fmodl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
frexpl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
hypotl.c * libc/include/complex.h (cabsl): Add prototype. 2015-02-06 16:14:04 +00:00
ilogbl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
isgreater.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
ldexpl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
lgammal.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
llrintl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
llroundl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
local.h 2009-04-24 Jeff johnston <jjohnstn@redhat.com> 2009-04-24 22:49:55 +00:00
log1pl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
log2l.c 2014-12-15 Jonathan Roelofs <jonathan@codesourcery.com> 2014-12-15 20:50:23 +00:00
log10l.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
logbl.c 2014-12-15 Jonathan Roelofs <jonathan@codesourcery.com> 2014-12-15 20:50:23 +00:00
logl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
lrintl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
lroundl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
math_config.h New expf, exp2f, logf, log2f and powf implementations 2017-10-13 10:58:00 +02:00
math_errf.c New expf, exp2f, logf, log2f and powf implementations 2017-10-13 10:58:00 +02:00
modfl.c 2013-11-19 Joel Sherrill <joel.sherrill@oarcorp.com> 2013-11-19 17:28:04 +00:00
nanl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
nearbyintl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
nextafterl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
nexttoward.c 2014-12-15 Jonathan Roelofs <jonathan@codesourcery.com> 2014-12-15 20:50:23 +00:00
nexttowardf.c 2014-12-15 Jonathan Roelofs <jonathan@codesourcery.com> 2014-12-15 20:50:23 +00:00
nexttowardl.c 2014-12-15 Jonathan Roelofs <jonathan@codesourcery.com> 2014-12-15 20:50:23 +00:00
powl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
remainderl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
remquol.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
rintl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
roundl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
s_cbrt.c import newlib-2000-02-17 snapshot 2000-02-17 19:39:52 +00:00
s_copysign.c import newlib-2000-02-17 snapshot 2000-02-17 19:39:52 +00:00
s_exp10.c Use makedoc output files which are generated but aren't included 2015-06-24 12:23:55 +01:00
s_expm1.c 2003-10-20 Bob Wilson <bob.wilson@acm.org> 2003-10-20 18:46:38 +00:00
s_fdim.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_finite.c import newlib-2000-02-17 snapshot 2000-02-17 19:39:52 +00:00
s_fma.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_fmax.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_fmin.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_fpclassify.c 2007-04-25 Jeff Johnston <jjohnstn@redhat.com> 2007-04-25 22:28:19 +00:00
s_ilogb.c * libm/common/s_ilogb.c: Fix typo in comments that causes doc 2010-02-26 09:44:25 +00:00
s_infinity.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_isinf.c math: fix isinf/isnan on SPU after move to math.h 2016-04-07 10:18:22 -05:00
s_isinfd.c 2006-02-27 Jeff Johnston <jjohnstn@redhat.com> 2006-02-27 23:51:28 +00:00
s_isnan.c math: fix isinf/isnan on SPU after move to math.h 2016-04-07 10:18:22 -05:00
s_isnand.c math: update isinf/isnan function comments after move to math.h 2016-04-05 08:49:44 -05:00
s_lib_ver.c 2006-09-13 Patrick Mansfield <patmans@us.ibm.com> 2006-09-13 22:06:43 +00:00
s_llrint.c 2010-08-03 Craig Howland <howland@LGSInnovations.com> 2010-08-03 18:21:20 +00:00
s_llround.c 2010-08-03 Craig Howland <howland@LGSInnovations.com> 2010-08-03 18:21:20 +00:00
s_log1p.c 2000-05-26 Marek Michalkiewicz <marekm@linux.org.pl> 2000-05-26 22:42:39 +00:00
s_log2.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_logb.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_lrint.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_lround.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_matherr.c import newlib-2000-02-17 snapshot 2000-02-17 19:39:52 +00:00
s_modf.c 2005-10-28 Bob Wilson <bob.wilson@acm.org> 2005-10-28 21:21:08 +00:00
s_nan.c Fix SYNOPSIS prototypes without marked up parameter names 2015-06-23 17:30:22 +01:00
s_nearbyint.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_nextafter.c 2003-10-20 Bob Wilson <bob.wilson@acm.org> 2003-10-20 18:46:38 +00:00
s_pow10.c Use makedoc output files which are generated but aren't included 2015-06-24 12:23:55 +01:00
s_remquo.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_rint.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_round.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_scalbln.c * libm/common/s_fdim.c: New file. 2002-06-07 21:59:57 +00:00
s_scalbn.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_signbit.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
s_trunc.c Consistently use an em-dash in math functions. 2015-11-02 16:43:22 -05:00
scalblnl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
scalbnl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
sf_cbrt.c * libc/include/machine/ieeefp.h: Comment about new configuration 2001-04-04 13:33:01 +00:00
sf_copysign.c import newlib-2000-02-17 snapshot 2000-02-17 19:39:52 +00:00
sf_exp.c New expf, exp2f, logf, log2f and powf implementations 2017-10-13 10:58:00 +02:00
sf_exp2.c New expf, exp2f, logf, log2f and powf implementations 2017-10-13 10:58:00 +02:00
sf_exp2_data.c New expf, exp2f, logf, log2f and powf implementations 2017-10-13 10:58:00 +02:00
sf_exp10.c 2007-05-17 Yaakov Selkowitz <yselkowitz <at> users.sourceforge.net> 2007-05-17 18:50:57 +00:00
sf_expm1.c * libc/include/machine/ieeefp.h: Comment about new configuration 2001-04-04 13:33:01 +00:00
sf_fdim.c 2009-03-25 Craig Howland <howland@LGSInnovations.com> 2009-03-25 19:13:24 +00:00
sf_finite.c * libc/include/machine/ieeefp.h: Comment about new configuration 2001-04-04 13:33:01 +00:00
sf_fma.c 2009-03-25 Craig Howland <howland@LGSInnovations.com> 2009-03-25 19:13:24 +00:00
sf_fmax.c 2005-08-10 Stephen Huw Clarke <stephen.clarke@st.com> 2005-08-10 21:02:28 +00:00
sf_fmin.c 2005-08-10 Stephen Huw Clarke <stephen.clarke@st.com> 2005-08-10 21:02:28 +00:00
sf_fpclassify.c 2007-04-25 Jeff Johnston <jjohnstn@redhat.com> 2007-04-25 22:28:19 +00:00
sf_ilogb.c 2010-02-11 Craig Howland <howland@LGSInnovations.com> 2010-02-11 21:00:33 +00:00
sf_infinity.c import newlib-2000-02-17 snapshot 2000-02-17 19:39:52 +00:00
sf_isinf.c math: update isinf/isnan function comments after move to math.h 2016-04-05 08:49:44 -05:00
sf_isinff.c 2006-02-27 Jeff Johnston <jjohnstn@redhat.com> 2006-02-27 23:51:28 +00:00
sf_isnan.c math: update isinf/isnan function comments after move to math.h 2016-04-05 08:49:44 -05:00
sf_isnanf.c 2006-02-27 Jeff Johnston <jjohnstn@redhat.com> 2006-02-27 23:51:28 +00:00
sf_llrint.c * libm/common/sf_llrint.c, libm/common/sf_round.c: Add explicit casts 2010-10-08 15:24:56 +00:00
sf_llround.c 2009-03-25 Craig Howland <howland@LGSInnovations.com> 2009-03-25 19:13:24 +00:00
sf_log.c New expf, exp2f, logf, log2f and powf implementations 2017-10-13 10:58:00 +02:00
sf_log1p.c * libc/include/machine/ieeefp.h: Comment about new configuration 2001-04-04 13:33:01 +00:00
sf_log2.c New expf, exp2f, logf, log2f and powf implementations 2017-10-13 10:58:00 +02:00
sf_log2_data.c New expf, exp2f, logf, log2f and powf implementations 2017-10-13 10:58:00 +02:00
sf_log_data.c New expf, exp2f, logf, log2f and powf implementations 2017-10-13 10:58:00 +02:00
sf_logb.c 2009-03-25 Craig Howland <howland@LGSInnovations.com> 2009-03-25 19:13:24 +00:00
sf_lrint.c Add new binutils target: moxie 2009-04-16 15:39:46 +00:00
sf_lround.c 2009-03-25 Craig Howland <howland@LGSInnovations.com> 2009-03-25 19:13:24 +00:00
sf_modf.c import newlib-2000-02-17 snapshot 2000-02-17 19:39:52 +00:00
sf_nan.c 2014-03-21 Maciej W. Rozycki <macro@codesourcery.com> 2014-03-21 21:27:29 +00:00
sf_nearbyint.c * libm/common/s_fdim.c: New file. 2002-06-07 21:59:57 +00:00
sf_nextafter.c * libc/include/machine/ieeefp.h: Comment about new configuration 2001-04-04 13:33:01 +00:00
sf_pow.c New expf, exp2f, logf, log2f and powf implementations 2017-10-13 10:58:00 +02:00
sf_pow10.c 2007-05-17 Yaakov Selkowitz <yselkowitz <at> users.sourceforge.net> 2007-05-17 18:50:57 +00:00
sf_pow_log2_data.c New expf, exp2f, logf, log2f and powf implementations 2017-10-13 10:58:00 +02:00
sf_remquo.c 2009-03-25 Craig Howland <howland@LGSInnovations.com> 2009-03-25 19:13:24 +00:00
sf_rint.c 2010-03-08 Craig Howland <howland@LGSInnovations.com> 2010-03-08 17:16:37 +00:00
sf_round.c Throughout, run newlib with -Wall -Werror option and fix bugs and 2012-08-08 11:04:18 +00:00
sf_scalbln.c * libm/common/s_fdim.c: New file. 2002-06-07 21:59:57 +00:00
sf_scalbn.c * libc/include/machine/ieeefp.h: Comment about new configuration 2001-04-04 13:33:01 +00:00
sf_trunc.c * libm/common/s_fdim.c: New file. 2002-06-07 21:59:57 +00:00
sinhl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
sinl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
sl_finite.c finitel: Use correct GCC builtin 2016-03-26 20:29:20 +01:00
sqrtl.c * libc/include/complex.h (cabsl): Add prototype. 2015-02-06 16:14:04 +00:00
tanhl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
tanl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
tgammal.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00
truncl.c 2009-04-17 Jeff johnston <jjohnstn@redhat.com> 2009-04-17 22:15:43 +00:00