99ed4e3c9c6e34c75d8051836d8ee9822f475651
[riscv-tests.git] / isa / rv64ui / sv_ld_elwidth.S
1 #include "riscv_test.h"
2 #include "sv_test_macros.h"
3
4 RVTEST_RV64U # Define TVM used by program.
5
6 #define SV_ELWIDTH_TEST( inst, vl, elwidth, wid1, wid2, \
7 testdata, expect1, expect2, expect3 ) \
8 \
9 la x12, testdata ; \
10 la x13, (testdata+elwidth); \
11 la x14, (testdata+elwidth*2); \
12 la x15, (testdata+elwidth*3); \
13 la x16, (testdata+elwidth*4); \
14 la x17, (testdata+elwidth*5); \
15 \
16 li x28, 0xa5a5a5a5a5a5a5a5; \
17 li x29, 0xa5a5a5a5a5a5a5a5; \
18 li x30, 0xa5a5a5a5a5a5a5a5; \
19 \
20 SET_SV_MVL( vl); \
21 SET_SV_2CSRS( SV_REG_CSR( 1, 12, wid1, 12, 1), \
22 SV_REG_CSR( 1, 28, wid2, 28, 1)); \
23 SET_SV_VL( vl ); \
24 \
25 inst x28, 0(x12); \
26 \
27 CLR_SV_CSRS(); \
28 SET_SV_VL( 1); \
29 SET_SV_MVL( 1); \
30 \
31 TEST_SV_IMM( x28, expect1 ); \
32 TEST_SV_IMM( x29, expect2 ); \
33 TEST_SV_IMM( x30, expect3 );
34
35
36 # SV test: vector-vector add
37 #
38 # sets up x3 and x4 with data, sets VL to 2, and carries out
39 # an "add 1 to x3". which actually means "add 1 to x3 *AND* add 1 to x4"
40
41 # Test code region.
42 RVTEST_CODE_BEGIN # Start of test code.
43
44 SV_ELWIDTH_TEST( ld , 2, 8, 0, 0, testdata1,
45 0x8979695949398979, 0x8777675747372717, 0xa5a5a5a5a5a5a5a5 )
46 SV_ELWIDTH_TEST( ld , 3, 8, 0, 0, testdata1,
47 0x8979695949398979, 0x8777675747372717, 0x8676665646362616 )
48 SV_ELWIDTH_TEST( ld , 3, 8, 2, 0, testdata1,
49 0xffffffffffff8979, 0x0000000000004939, 0x0000000000006959 )
50
51 RVTEST_PASS # Signal success.
52 fail:
53 RVTEST_FAIL
54 RVTEST_CODE_END # End of test code.
55
56 # Input data section.
57 # This section is optional, and this data is NOT saved in the output.
58 .data
59 .align 3
60 testdata1:
61 .dword 0x8979695949398979
62 .dword 0x8777675747372717
63 .dword 0x8676665646362616
64 .dword 0x8272625242322212
65 .dword 0x8171615141312111
66 .dword 0x8373635343332313
67
68 # Output data section.
69 RVTEST_DATA_BEGIN # Start of test output data region.
70 .align 3
71 result:
72 .dword -1
73 .dword -1
74 .dword -1
75 RVTEST_DATA_END # End of test output data region.
76