aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/mt-vvadd/vvadd.c
diff options
context:
space:
mode:
authorHenry Cook <hcook@eecs.berkeley.edu>2014-11-06 17:24:39 -0800
committerHenry Cook <hcook@eecs.berkeley.edu>2014-11-07 16:52:51 -0800
commitd537de7deffa6036dab573ff174b7f8c8e470437 (patch)
treeddc921eb337cda4889570f0251bdba85059a2531 /benchmarks/mt-vvadd/vvadd.c
parent5afc6b9bc2e3685220cffb3da66ad9f5f1f7b14f (diff)
downloadriscv-tests-d537de7deffa6036dab573ff174b7f8c8e470437.zip
riscv-tests-d537de7deffa6036dab573ff174b7f8c8e470437.tar.gz
riscv-tests-d537de7deffa6036dab573ff174b7f8c8e470437.tar.bz2
Clean up canonical mt benchmarks and reorganize extra versions in /mt. All versions support support at least 1/2/4 threads.
Diffstat (limited to 'benchmarks/mt-vvadd/vvadd.c')
-rw-r--r--benchmarks/mt-vvadd/vvadd.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/benchmarks/mt-vvadd/vvadd.c b/benchmarks/mt-vvadd/vvadd.c
new file mode 100644
index 0000000..8f4d43f
--- /dev/null
+++ b/benchmarks/mt-vvadd/vvadd.c
@@ -0,0 +1,16 @@
+#include "stdlib.h"
+#include "dataset.h"
+
+//--------------------------------------------------------------------------
+// vvadd function
+
+void __attribute__((noinline)) vvadd(int coreid, int ncores, size_t n, const data_t* x, const data_t* y, data_t* z)
+{
+ size_t i;
+
+ // interleave accesses
+ for (i = coreid; i < n; i+=ncores)
+ {
+ z[i] = x[i] + y[i];
+ }
+}