Use double-precision routines from arm-optimized-routines

This patch ues exp, exp2, log, log2, and pow from arm optimized
routines.  For pow on x86_64, although slight slower it simplifies
the code required on both bionic and arm-optimized-routines (so
there is no need to select and export the symbol based on
architecture).

Performance-wise the improvements are:

  x86_64    throughput    latency
  exp            1.16x      1.16x
  log            1.08x      0.95x
  exp2           1.27x      1.55x
  log2           1.40x      1.43x
  pow            0.77x      0.89x *

  * I tried to check if AVX2/FMA but without success.

  aarch64   throughput     latency
  exp            2.33x      2.16x
  exp2           1.99x      1.50x
  log            1.79x      1.43x
  log2           2.15x      1.80x
  pow            3.81x      3.07x

Test: ran bionic tests on static mode.
Change-Id: Ib16bf3280c5329fd257a3b3f0b6c4f2f3cb34deb
This commit is contained in:
Adhemerval Zanella 2018-08-08 09:34:42 -03:00
parent 3652bcd775
commit f6b101d3ec
2 changed files with 9 additions and 17 deletions

View file

@ -29,7 +29,6 @@ cc_library {
"upstream-freebsd/lib/msun/src/e_atanhf.c",
"upstream-freebsd/lib/msun/src/e_cosh.c",
"upstream-freebsd/lib/msun/src/e_coshf.c",
"upstream-freebsd/lib/msun/src/e_exp.c",
"upstream-freebsd/lib/msun/src/e_fmod.c",
"upstream-freebsd/lib/msun/src/e_fmodf.c",
"upstream-freebsd/lib/msun/src/e_gamma.c",
@ -50,9 +49,6 @@ cc_library {
"upstream-freebsd/lib/msun/src/e_lgamma_r.c",
"upstream-freebsd/lib/msun/src/e_log10.c",
"upstream-freebsd/lib/msun/src/e_log10f.c",
"upstream-freebsd/lib/msun/src/e_log2.c",
"upstream-freebsd/lib/msun/src/e_log.c",
"upstream-freebsd/lib/msun/src/e_pow.c",
"upstream-freebsd/lib/msun/src/e_remainder.c",
"upstream-freebsd/lib/msun/src/e_remainderf.c",
"upstream-freebsd/lib/msun/src/e_rem_pio2.c",
@ -115,7 +111,6 @@ cc_library {
"upstream-freebsd/lib/msun/src/s_ctanhf.c",
"upstream-freebsd/lib/msun/src/s_erf.c",
"upstream-freebsd/lib/msun/src/s_erff.c",
"upstream-freebsd/lib/msun/src/s_exp2.c",
"upstream-freebsd/lib/msun/src/s_expm1.c",
"upstream-freebsd/lib/msun/src/s_expm1f.c",
"upstream-freebsd/lib/msun/src/s_fdim.c",
@ -349,11 +344,8 @@ cc_library {
"x86/e_asin.S",
"x86/e_atan2.S",
"x86/e_cosh.S",
"x86/e_exp.S",
"x86/e_hypot.S",
"x86/e_log10.S",
"x86/e_log.S",
"x86/e_pow.S",
"x86/e_sinh.S",
"x86/libm_reduce_pi04l.S",
"x86/libm_sincos_huge.S",
@ -374,11 +366,8 @@ cc_library {
"upstream-freebsd/lib/msun/src/e_asin.c",
"upstream-freebsd/lib/msun/src/e_atan2.c",
"upstream-freebsd/lib/msun/src/e_cosh.c",
"upstream-freebsd/lib/msun/src/e_exp.c",
"upstream-freebsd/lib/msun/src/e_hypot.c",
"upstream-freebsd/lib/msun/src/e_log.c",
"upstream-freebsd/lib/msun/src/e_log10.c",
"upstream-freebsd/lib/msun/src/e_pow.c",
"upstream-freebsd/lib/msun/src/e_sinh.c",
"upstream-freebsd/lib/msun/src/e_sqrt.c",
"upstream-freebsd/lib/msun/src/e_sqrtf.c",
@ -430,11 +419,8 @@ cc_library {
"x86_64/e_asin.S",
"x86_64/e_atan2.S",
"x86_64/e_cosh.S",
"x86_64/e_exp.S",
"x86_64/e_hypot.S",
"x86_64/e_log10.S",
"x86_64/e_log.S",
"x86_64/e_pow.S",
"x86_64/e_sinh.S",
"x86_64/lrint.S",
"x86_64/lrintf.S",
@ -452,11 +438,8 @@ cc_library {
"upstream-freebsd/lib/msun/src/e_asin.c",
"upstream-freebsd/lib/msun/src/e_atan2.c",
"upstream-freebsd/lib/msun/src/e_cosh.c",
"upstream-freebsd/lib/msun/src/e_exp.c",
"upstream-freebsd/lib/msun/src/e_hypot.c",
"upstream-freebsd/lib/msun/src/e_log.c",
"upstream-freebsd/lib/msun/src/e_log10.c",
"upstream-freebsd/lib/msun/src/e_pow.c",
"upstream-freebsd/lib/msun/src/e_sinh.c",
"upstream-freebsd/lib/msun/src/e_sqrt.c",
"upstream-freebsd/lib/msun/src/e_sqrtf.c",

View file

@ -45,3 +45,12 @@ void sincosl(long double x, long double* s, long double* c) { sincos(x, (double*
// FreeBSD doesn't have an ld128 implementations of tgammal, so both LP32 and LP64 need this.
long double tgammal(long double x) { return tgamma(x); }
// external/arm-optimized-routines does not provide the long double
// wrappers for the routines it implements.
#if (LDBL_MANT_DIG == 53)
long double expl(long double x) { return exp(x); }
long double exp2l(long double x) { return exp2(x); }
long double logl(long double x) { return log(x); }
long double log2l(long double x) { return log2(x); }
#endif