bump env
[riscv-tests.git] / benchmarks / vvadd / vvadd_main.c
1 // See LICENSE for license details.
2
3 //**************************************************************************
4 // Vector-vector add benchmark
5 //--------------------------------------------------------------------------
6 //
7 // This benchmark uses adds to vectors and writes the results to a
8 // third vector. The input data (and reference data) should be
9 // generated using the vvadd_gendata.pl perl script and dumped
10 // to a file named dataset1.h.
11
12 #include "util.h"
13
14 //--------------------------------------------------------------------------
15 // Input/Reference Data
16
17 #include "dataset1.h"
18
19 //--------------------------------------------------------------------------
20 // vvadd function
21
22 void vvadd( int n, int a[], int b[], int c[] )
23 {
24 int i;
25 for ( i = 0; i < n; i++ )
26 c[i] = a[i] + b[i];
27 }
28
29 //--------------------------------------------------------------------------
30 // Main
31
32 int main( int argc, char* argv[] )
33 {
34 int results_data[DATA_SIZE];
35
36 #if PREALLOCATE
37 // If needed we preallocate everything in the caches
38 vvadd( DATA_SIZE, input1_data, input2_data, results_data );
39 #endif
40
41 // Do the vvadd
42 setStats(1);
43 vvadd( DATA_SIZE, input1_data, input2_data, results_data );
44 setStats(0);
45
46 // Check the results
47 return verify( DATA_SIZE, results_data, verify_data );
48 }