Add pow benchmark

As for exp/exp2 benchmark, this patch add two benchmark for pow:
one which measures thoughput and one which measures latency.

The input data is the same as powf.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: I04335fac9e76fb3f39935323dacf6b7be6a6f917
This commit is contained in:
Adhemerval Zanella 2018-08-08 13:36:14 -03:00
parent 56f4511c39
commit 72fe1c8df6

View file

@ -331,6 +331,9 @@ BIONIC_BENCHMARK(BM_math_exp2_speccpu2017_latency);
#include "powf_input.cpp"
static const std::vector<std::pair<double, double>> pow_input
(powf_input.begin(), powf_input.end());
static void BM_math_powf_speccpu2006(benchmark::State& state) {
f = 0.0;
auto cin = powf_input.cbegin();
@ -353,6 +356,28 @@ static void BM_math_powf_speccpu2017_latency(benchmark::State& state) {
}
BIONIC_BENCHMARK(BM_math_powf_speccpu2017_latency);
static void BM_math_pow_speccpu2006(benchmark::State& state) {
d = 0.0;
auto cin = pow_input.cbegin();
for (auto _ : state) {
f = pow(cin->first, cin->second);
if (++cin == pow_input.cend())
cin = pow_input.cbegin();
}
}
BIONIC_BENCHMARK(BM_math_pow_speccpu2006);
static void BM_math_pow_speccpu2017_latency(benchmark::State& state) {
d = 0.0;
auto cin = pow_input.cbegin();
for (auto _ : state) {
d = powf(d * zero + cin->first, cin->second);
if (++cin == pow_input.cend())
cin = pow_input.cbegin();
}
}
BIONIC_BENCHMARK(BM_math_pow_speccpu2017_latency);
#include "logf_input.cpp"
static const std::vector<double> log_input (logf_input.begin(),