Use compiler builtins for fabs.

Change-Id: Id3bf761d6dfc187f218b5215c53d76bddc83d50b
This commit is contained in:
Elliott Hughes
2015-08-21 11:04:23 -07:00
parent 079fc83313
commit d76f16973a
7 changed files with 81 additions and 68 deletions

View File

@@ -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();
}