Make qsort input size more reasonable
[riscv-tests.git] / benchmarks / vvadd / vvadd_main.c
1 //**************************************************************************
2 // Vector-vector add benchmark
3 //--------------------------------------------------------------------------
4 //
5 // This benchmark uses adds to vectors and writes the results to a
6 // third vector. The input data (and reference data) should be
7 // generated using the vvadd_gendata.pl perl script and dumped
8 // to a file named dataset1.h The smips-gcc toolchain does not
9 // support system calls so printf's can only be used on a host system,
10 // not on the smips processor simulator itself. You should not change
11 // anything except the HOST_DEBUG and PREALLOCATE macros for your timing
12 // runs.
13
14 #include "util.h"
15
16 //--------------------------------------------------------------------------
17 // Input/Reference Data
18
19 #include "dataset1.h"
20
21 //--------------------------------------------------------------------------
22 // vvadd function
23
24 void vvadd( int n, int a[], int b[], int c[] )
25 {
26 int i;
27 for ( i = 0; i < n; i++ )
28 c[i] = a[i] + b[i];
29 }
30
31 //--------------------------------------------------------------------------
32 // Main
33
34 int main( int argc, char* argv[] )
35 {
36 int results_data[DATA_SIZE];
37
38 // Output the input array
39 printArray( "input1", DATA_SIZE, input1_data );
40 printArray( "input2", DATA_SIZE, input2_data );
41 printArray( "verify", DATA_SIZE, verify_data );
42
43 #if PREALLOCATE
44 // If needed we preallocate everything in the caches
45 vvadd( DATA_SIZE, input1_data, input2_data, results_data );
46 #endif
47
48 // Do the vvadd
49 setStats(1);
50 vvadd( DATA_SIZE, input1_data, input2_data, results_data );
51 setStats(0);
52
53 // Print out the results
54 printArray( "results", DATA_SIZE, results_data );
55
56 // Check the results
57 return verify( DATA_SIZE, results_data, verify_data );
58 }