summaryrefslogtreecommitdiffstats
path: root/benchmarks
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-08-24 22:57:08 +0000
committerSteve Kondik <steve@cyngn.com>2015-11-07 01:42:32 -0800
commit245c1718cb035268284bea8dabe3faa3f8326ee8 (patch)
treeb3cba5f5b664b0e11cdfb4c980fc05d11724ece9 /benchmarks
parentea4e4e7c8c65e0cc3d087ba4d867851b840b9680 (diff)
downloadbionic-245c1718cb035268284bea8dabe3faa3f8326ee8.zip
bionic-245c1718cb035268284bea8dabe3faa3f8326ee8.tar.gz
bionic-245c1718cb035268284bea8dabe3faa3f8326ee8.tar.bz2
Revert "Revert "Use compiler builtins for fabs.""
Don't enable the inlines when building libm itself. Otherwise clang gets upset by seeing both an inline and a non-inline definition. This reverts commit c5deb0f883cbdca7e5ab75f92f82c31d21367f49. Change-Id: If7abdb351f5a5549d6a331b33af408e8fcfa9868
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/math_benchmark.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/benchmarks/math_benchmark.cpp b/benchmarks/math_benchmark.cpp
index 2e0c962..ed5b56c 100644
--- a/benchmarks/math_benchmark.cpp
+++ b/benchmarks/math_benchmark.cpp
@@ -258,3 +258,29 @@ void BM_math_signbit::Run(int iters, double value) {
StopBenchmarkTiming();
}
+
+BENCHMARK_WITH_ARG(BM_math_fabs_macro, double)->AT_COMMON_VALS;
+void BM_math_fabs_macro::Run(int iters, double value) {
+ StartBenchmarkTiming();
+
+ d = 0.0;
+ v = value;
+ for (int i = 0; i < iters; ++i) {
+ d += fabs(v);
+ }
+
+ StopBenchmarkTiming();
+}
+
+BENCHMARK_WITH_ARG(BM_math_fabs, double)->AT_COMMON_VALS;
+void BM_math_fabs::Run(int iters, double value) {
+ StartBenchmarkTiming();
+
+ d = 0.0;
+ v = value;
+ for (int i = 0; i < iters; ++i) {
+ d += (fabs)(v);
+ }
+
+ StopBenchmarkTiming();
+}