aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/common/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/common/util.h')
-rw-r--r--benchmarks/common/util.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/benchmarks/common/util.h b/benchmarks/common/util.h
index 081cfd6..6258709 100644
--- a/benchmarks/common/util.h
+++ b/benchmarks/common/util.h
@@ -41,6 +41,22 @@ static int verifyDouble(int n, const volatile double* test, const double* verify
return 0;
}
+static int verifyFloat(int n, const volatile float* test, const float* verify)
+{
+ int i;
+ // Unrolled for faster verification
+ for (i = 0; i < n/2*2; i+=2)
+ {
+ float t0 = test[i], t1 = test[i+1];
+ float v0 = verify[i], v1 = verify[i+1];
+ int eq1 = t0 == v0, eq2 = t1 == v1;
+ if (!(eq1 & eq2)) return i+1+eq1;
+ }
+ if (n % 2 != 0 && test[n-1] != verify[n-1])
+ return n;
+ return 0;
+}
+
static void __attribute__((noinline)) barrier(int ncores)
{
static volatile int sense;