comments on remap csrs
[riscv-tests.git] / isa / rv64ud / sv_fadd_remap.S
1 #include "riscv_test.h"
2 #include "sv_test_macros.h"
3
4 RVTEST_RV64UF
5
6
7 # SV test: vector-vector fadd
8 #
9 # sets up x3 and x4 with data, sets VL to 2, and carries out
10 # an "add 1 to x3". which actually means "add 1 to x3 *AND* add 1 to x4"
11
12 # Test code region.
13 RVTEST_CODE_BEGIN # Start of test code.
14
15 SV_FLD_DATA( f1, testdata , 0)
16 SV_FLD_DATA( f2, testdata+(1*8) , 0)
17 SV_FLD_DATA( f3, testdata+(2*8), 0)
18 SV_FLD_DATA( f4, testdata+(3*8), 0)
19 SV_FLD_DATA( f5, testdata+(4*8), 0)
20 SV_FLD_DATA( f6, testdata+(5*8), 0)
21 SV_FLD_DATA( f7, testdata+(6*8), 0)
22 SV_FLD_DATA( f8, testdata+(7*8), 0)
23 SV_FLD_DATA( f9, testdata+(8*8), 0)
24 SV_FLD_DATA( f10, testdata+(9*8), 0)
25 SV_FLD_DATA( f11, testdata+(10*8), 0)
26 SV_FLD_DATA( f12, testdata+(11*8), 0)
27
28 SET_SV_MVL(6)
29 SET_SV_2CSRS( SV_REG_CSR(0, 1, 0, 1, 1),
30 SV_REG_CSR(0, 7, 0, 7, 1) )
31 SET_SV_REMAP_CSR(7, 0, 0, 0, 0, 0);
32 // x=3, y=2, z=1, where remap swaps xy to yx. therefore:
33 // 0 1 2 -> 0 3
34 // 3 4 5 -> 1 4
35 // -> 2 5
36 SET_SV_SHAPE0_CSR(3, 2, 1, 0, SV_SHAPE_PERM_YXZ );
37 SET_SV_VL(6)
38
39 fadd.d f1, f1, f7;
40
41 CLR_SV_CSRS()
42 SET_SV_VL(1)
43 SET_SV_MVL(1)
44
45 TEST_SV_FD(0, f1, results, 0)
46 TEST_SV_FD(0, f2, results+1*8, 0)
47 TEST_SV_FD(0, f3, results+2*8, 0)
48 TEST_SV_FD(0, f4, results+3*8, 0)
49 TEST_SV_FD(0, f5, results+4*8, 0)
50 TEST_SV_FD(0, f6, results+5*8, 0)
51
52 RVTEST_PASS # Signal success.
53 fail:
54 RVTEST_FAIL
55 RVTEST_CODE_END # End of test code.
56
57 # Input data section.
58 # This section is optional, and this data is NOT saved in the output.
59 .data
60 .align 3
61 testdata:
62 .double 0.0
63 .double 1.0
64 .double 2.0
65 .double 3.0
66 .double 4.0
67 .double 5.0
68 .double 100.0
69 .double 200.0
70 .double 300.0
71 .double 400.0
72 .double 500.0
73 .double 600.0
74
75 .align 3
76 results:
77 .double 100.0
78 .double 401.0
79 .double 202.0
80 .double 503.0
81 .double 304.0
82 .double 605.0
83
84 # Output data section.
85 RVTEST_DATA_BEGIN # Start of test output data region.
86 .align 3
87 result:
88 .dword -1
89 .dword -1
90 .dword -1
91 RVTEST_DATA_END # End of test output data region.
92