add sv c_lwsp unit test
[riscv-tests.git] / isa / rv64uc / sv_c_lwsp.S
1 # See LICENSE for license details.
2
3 #*****************************************************************************
4 # rvc.S
5 #-----------------------------------------------------------------------------
6 #
7 # Test RVC corner cases.
8 #
9
10 #include "riscv_test.h"
11 #include "sv_test_macros.h"
12
13 RVTEST_RV64U
14 RVTEST_CODE_BEGIN
15
16 .align 2
17 .option push
18 .option norvc
19
20 li a2, 0
21 li a3, 0
22
23 SET_SV_MVL(2)
24 SET_SV_2CSRS( SV_REG_CSR(1, 12, 0, 12, 1, 0),
25 SV_REG_CSR(1, 2, 0, 2, 1, 0) )
26 SET_SV_VL(2)
27
28 mv a1, sp
29 la sp, data;
30
31 .option push;
32 .option rvc;
33 .align 2;
34 c.lwsp a2, 0(sp);
35 #lw a2, 0(sp);
36 .option pop
37
38
39 SET_SV_VL(0)
40 CLR_SV_CSRS()
41 SET_SV_MVL(0)
42
43 mv sp, a1
44
45 TEST_SV_IMM(a2, 1001)
46 TEST_SV_IMM(a3, 1002)
47
48 .option pop
49
50 RVTEST_PASS # Signal success.
51 fail:
52 RVTEST_FAIL
53
54 RVTEST_CODE_END # End of test code.
55
56 .data
57 data:
58 .word 1001;
59 .word 1002;
60 .word 0x01234567;
61
62 RVTEST_DATA_BEGIN
63
64 RVTEST_DATA_END