Add logf and log2f benchmark

Similar to expf/exp2f, this patch add two benchmarks for logf and log2f:
one which measures thoughput and one which measures latency.

The input data is based on a reduced trace based on 2.8 billion samples
extracted from specpu2017 521.wrf_r benchmark.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: If4fbd7eb3d40f8e155935149a82f162b222d5506
diff --git a/benchmarks/math_benchmark.cpp b/benchmarks/math_benchmark.cpp
index f7c11d5..3e5f81e 100644
--- a/benchmarks/math_benchmark.cpp
+++ b/benchmarks/math_benchmark.cpp
@@ -302,3 +302,49 @@
   }
 }
 BIONIC_BENCHMARK(BM_math_powf_speccpu2017_latency);
+
+#include "logf_input.cpp"
+
+static void BM_math_logf_speccpu2017(benchmark::State& state) {
+  f = 0.0;
+  auto cin = logf_input.cbegin();
+  for (auto _ : state) {
+    f = logf(*cin);
+    if (++cin == logf_input.cend())
+      cin = logf_input.cbegin();
+  }
+}
+BIONIC_BENCHMARK(BM_math_logf_speccpu2017);
+
+static void BM_math_logf_speccpu2017_latency(benchmark::State& state) {
+  f = 0.0;
+  auto cin = logf_input.cbegin();
+  for (auto _ : state) {
+    f = logf(f * zero + *cin);
+    if (++cin == logf_input.cend())
+      cin = logf_input.cbegin();
+  }
+}
+BIONIC_BENCHMARK(BM_math_logf_speccpu2017_latency);
+
+static void BM_math_log2f_speccpu2017(benchmark::State& state) {
+  f = 0.0;
+  auto cin = logf_input.cbegin();
+  for (auto _ : state) {
+    f = log2f(*cin);
+    if (++cin == logf_input.cend())
+      cin = logf_input.cbegin();
+  }
+}
+BIONIC_BENCHMARK(BM_math_log2f_speccpu2017);
+
+static void BM_math_log2f_speccpu2017_latency(benchmark::State& state) {
+  f = 0.0;
+  auto cin = logf_input.cbegin();
+  for (auto _ : state) {
+    f = log2f(f * zero + *cin);
+    if (++cin == logf_input.cend())
+      cin = logf_input.cbegin();
+  }
+}
+BIONIC_BENCHMARK(BM_math_log2f_speccpu2017_latency);