summaryrefslogtreecommitdiffstats
path: root/benchmarks
diff options
context:
space:
mode:
authorSerban Constantinescu <serban.constantinescu@arm.com>2014-06-08 16:55:22 +0100
committerElliott Hughes <enh@google.com>2014-06-09 13:52:28 -0700
commita147a1da5c268e9d556c207be0d3da0a519b2d54 (patch)
tree57aaa17251e634a0930926a61e7bf5a3cefdeaa6 /benchmarks
parent36ed5971c45425bf258c72e7baaa68ebdd70c7bb (diff)
downloadbionic-a147a1da5c268e9d556c207be0d3da0a519b2d54.zip
bionic-a147a1da5c268e9d556c207be0d3da0a519b2d54.tar.gz
bionic-a147a1da5c268e9d556c207be0d3da0a519b2d54.tar.bz2
AArch64: libm: Fix ARM64 fenv_t and refactor ARM64 libm implementation.
This patch fixes the ARM64 ABI for libm. fenv_t is now split in 32bit status and 32bit control. This mirrors the AArch64 FPU control and status registers (FPCR, FPSR). The patch also refactors the libm implementation for ARM64 into a finer grained control over the FPU registers. Bionic-benchmarks has been expanded with 3 more benchmarks for floating point operations. The new libm implementation for ARM64 performs better over all the math benchmarks available. Change-Id: I2a7f81d6b4e55c91f8a63a4c69614fc8b1bcf2db Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/math_benchmark.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/benchmarks/math_benchmark.cpp b/benchmarks/math_benchmark.cpp
index 3602de4..a9748cd 100644
--- a/benchmarks/math_benchmark.cpp
+++ b/benchmarks/math_benchmark.cpp
@@ -16,6 +16,7 @@
#include "benchmark.h"
+#include <fenv.h>
#include <math.h>
// Avoid optimization.
@@ -113,10 +114,49 @@ static void BM_math_isinf_ZERO(int iters) {
}
BENCHMARK(BM_math_isinf_ZERO);
+static void BM_math_sin_fast(int iters) {
+ StartBenchmarkTiming();
+ d = 1.0;
+ for (int i = 0; i < iters; ++i) {
+ d += sin(d);
+ }
+
+ StopBenchmarkTiming();
+}
+BENCHMARK(BM_math_sin_fast);
+static void BM_math_sin_feupdateenv(int iters) {
+ StartBenchmarkTiming();
+ d = 1.0;
+ for (int i = 0; i < iters; ++i) {
+ fenv_t __libc_save_rm;
+ feholdexcept(&__libc_save_rm);
+ fesetround(FE_TONEAREST);
+ d += sin(d);
+ feupdateenv(&__libc_save_rm);
+ }
+ StopBenchmarkTiming();
+}
+BENCHMARK(BM_math_sin_feupdateenv);
+
+static void BM_math_sin_fesetenv(int iters) {
+ StartBenchmarkTiming();
+
+ d = 1.0;
+ for (int i = 0; i < iters; ++i) {
+ fenv_t __libc_save_rm;
+ feholdexcept(&__libc_save_rm);
+ fesetround(FE_TONEAREST);
+ d += sin(d);
+ fesetenv(&__libc_save_rm);
+ }
+
+ StopBenchmarkTiming();
+}
+BENCHMARK(BM_math_sin_fesetenv);
static void BM_math_fpclassify_NORMAL(int iters) {
StartBenchmarkTiming();