4fe7c2f82be5670eef28353cde85406771eddbe7
[riscv-tests.git] / isa / rv32si / shamt.S
1 # See LICENSE for license details.
2
3 #*****************************************************************************
4 # csr.S
5 #-----------------------------------------------------------------------------
6 #
7 # Test CSRRx and CSRRxI instructions.
8 #
9
10 #include "riscv_test.h"
11 #include "test_macros.h"
12
13 RVTEST_RV32S
14 RVTEST_CODE_BEGIN
15
16 la t0, stvec
17 csrw stvec, t0
18
19 # Make sure slli with shamt[4] set is legal.
20 TEST_CASE( 2, a0, 65536, li a0, 1; slli a0, a0, 16);
21
22 # Make sure slli with shamt[5] set is not legal.
23 TEST_CASE( 3, x0, 1, slli a0, a0, 32);
24
25 TEST_PASSFAIL
26
27 stvec:
28 # Trapping on test 3 is good.
29 # Note that since the test didn't complete, TESTNUM is smaller by 1.
30 li t0, 2
31 bne TESTNUM, t0, fail
32
33 # Make sure CAUSE indicates an illegal instructino.
34 csrr t0, scause
35 li t1, CAUSE_ILLEGAL_INSTRUCTION
36 bne t0, t1, fail
37 j pass
38
39 RVTEST_CODE_END
40
41 .data
42 RVTEST_DATA_BEGIN
43
44 TEST_DATA
45
46 RVTEST_DATA_END