revamp vector tests with new privileged spec, and add scalar pt tests
[riscv-tests.git] / isa / rv64sv / ma_utsd.S
1 # See LICENSE for license details.
2
3 #*****************************************************************************
4 # ma_utsd.S
5 #-----------------------------------------------------------------------------
6 #
7 # Test misaligned ut sd trap.
8 #
9
10 #include "riscv_test.h"
11 #include "test_macros.h"
12
13 RVTEST_RV64SV
14 RVTEST_CODE_BEGIN
15
16 la a3,handler
17 csrw stvec,a3 # set exception handler
18
19 vsetcfg 32,0
20 li a3,4
21 vsetvl a3,a3
22
23 la a3, dest+1
24 vmsv vx1, a3
25 lui a0,%hi(vtcode1)
26 vf %lo(vtcode1)(a0)
27 la a3, dest+1
28 vsd vx1, a3
29 fence
30
31 vtcode1:
32 sw x2, 0(x1)
33 stop
34
35 vtcode2:
36 add x2,x2,x3
37 stop
38
39 handler:
40 vxcptkill
41
42 li TESTNUM,2
43
44 # check cause
45 vxcptcause a3
46 li a4,HWACHA_CAUSE_MISALIGNED_STORE
47 bne a3,a4,fail
48
49 # check vec irq aux
50 vxcptaux a3
51 la a4, dest+1
52 bne a3,a4,fail
53
54 # make sure vector unit has cleared out
55 vsetcfg 32,0
56 li a3,4
57 vsetvl a3,a3
58
59 la a3,src1
60 la a4,src2
61 vld vx2,a3
62 vld vx3,a4
63 lui a0,%hi(vtcode2)
64 vf %lo(vtcode2)(a0)
65 la a5,dest
66 vsd vx2,a5
67 fence
68
69 ld a1,0(a5)
70 li a2,5
71 li TESTNUM,2
72 bne a1,a2,fail
73 ld a1,8(a5)
74 li TESTNUM,3
75 bne a1,a2,fail
76 ld a1,16(a5)
77 li TESTNUM,4
78 bne a1,a2,fail
79 ld a1,24(a5)
80 li TESTNUM,5
81 bne a1,a2,fail
82
83 TEST_PASSFAIL
84
85 RVTEST_CODE_END
86
87 .data
88 RVTEST_DATA_BEGIN
89
90 TEST_DATA
91
92 src1:
93 .dword 1
94 .dword 2
95 .dword 3
96 .dword 4
97 src2:
98 .dword 4
99 .dword 3
100 .dword 2
101 .dword 1
102 dest:
103 .dword 0xdeadbeefcafebabe
104 .dword 0xdeadbeefcafebabe
105 .dword 0xdeadbeefcafebabe
106 .dword 0xdeadbeefcafebabe
107
108 RVTEST_DATA_END