File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ riscv64-linux-gnu-gcc -static -O2 -o hello $CI/hello.c
2626riscv64-linux-gnu-gcc -static -O2 -o dummy-slliuw $CI /dummy-slliuw.c
2727riscv64-linux-gnu-gcc -static -O2 -o customcsr $CI /customcsr.c
2828riscv64-linux-gnu-gcc -static -O2 -o atomics $CI /atomics.c
29+ riscv64-linux-gnu-gcc -static -O2 -march=rv64gcbv -ftree-vectorize -o vector-sum $CI /vector-sum.c
30+ # make sure the vector test actually vectorized
31+ riscv64-linux-gnu-objdump -d vector-sum | grep vredsum.vs
2932
3033# run snippy-based tests
3134wget https://github.com/syntacore/snippy/releases/download/snippy-2.1/snippy-x86_64-linux.tar.xz
@@ -45,6 +48,7 @@ g++ -std=c++2a -I$INSTALL/include -L$INSTALL/lib $CI/testlib.cc -lriscv -o /dev/
4548
4649# run tests
4750time $INSTALL /bin/spike --isa=rv64gc $BUILD /pk/pk hello | grep " Hello, world! Pi is approximately 3.141588."
51+ time $INSTALL /bin/spike --isa=rv64gcbv $BUILD /pk/pk vector-sum | grep " The sum of the first 1000 positive integers is 500500."
4852$INSTALL /bin/spike --log-commits --isa=rv64gc $BUILD /pk/pk atomics 2> /dev/null | grep " First atomic counter is 1000, second is 100"
4953LD_LIBRARY_PATH=$INSTALL /lib ./test-libriscv $BUILD /pk/pk hello | grep " Hello, world! Pi is approximately 3.141588."
5054LD_LIBRARY_PATH=$INSTALL /lib ./test-customext $BUILD /pk/pk dummy-slliuw | grep " Executed successfully"
Original file line number Diff line number Diff line change 1+ #include <stdio.h>
2+ #include <string.h>
3+
4+ int main ()
5+ {
6+ const size_t N = 1001 ;
7+ volatile size_t a [N ];
8+ size_t * b = (size_t * )a ;
9+
10+ for (size_t i = 0 ; i < N ; i ++ )
11+ a [i ] = i ;
12+
13+ size_t sum = 0 ;
14+ for (size_t i = 0 ; i < N ; i ++ )
15+ sum += b [i ];
16+
17+ printf ("The sum of the first %zu positive integers is %zu.\n" , N - 1 , sum );
18+
19+ return 0 ;
20+ }
You can’t perform that action at this time.
0 commit comments