add sv scalar src test which highlighted flaw in spike-sv
[riscv-tests.git] / isa / rv64ui / sv_addi_scalar_src.S
1 #include "riscv_test.h"
2 #include "sv_test_macros.h"
3
4 RVTEST_RV64U # Define TVM used by program.
5
6
7 # SV test: sets up x6 data as a scalar, sets VL to 2, and carries out
8 # an "add 1 to x6 and store in x3".
9 # which actually means:
10 # "add add 1 to x6 and store in x3" *AND*
11 # "add add 1 to x6 and store in x4"
12
13 # Test code region.
14 RVTEST_CODE_BEGIN # Start of test code.
15
16 SV_LD_DATA( x2, testdata , 0)
17 SV_LD_DATA( x5, testdata+24, 0)
18
19 li x6, 41
20
21 SET_SV_MVL(2)
22 SET_SV_CSR(1, 3, 0, 3, 1, 0)
23 SET_SV_VL(2)
24
25 addi x3, x6, 1
26
27 CLR_SV_CSRS()
28 SET_SV_VL(0)
29 SET_SV_MVL(0)
30
31 TEST_SV_IMM(x2, 1001) # should not be modified
32 TEST_SV_IMM(x3, 42)
33 TEST_SV_IMM(x4, 42)
34 TEST_SV_IMM(x5, 1002) # should not be modified
35
36 RVTEST_PASS # Signal success.
37 fail:
38 RVTEST_FAIL
39 RVTEST_CODE_END # End of test code.
40
41 # Input data section.
42 # This section is optional, and this data is NOT saved in the output.
43 .data
44 .align 3
45 testdata:
46 .dword 1001
47 .dword 49
48 .dword 49
49 .dword 1002
50
51 # Output data section.
52 RVTEST_DATA_BEGIN # Start of test output data region.
53 .align 3
54 result:
55 .dword -1
56 .dword -1
57 .dword -1
58 RVTEST_DATA_END # End of test output data region.
59