#define CLR_SV_CSRS( ) csrrw x0, 0x4c0, 0
#define CLR_SV_PRED_CSRS( ) csrrw x0, 0x4c8, 0
-#define SET_SV_MVL( val ) csrrwi x0, 0x4f2, val
-#define SET_SV_VL( val ) csrrwi x0, 0x4f0, val
+#define SET_SV_MVL( val ) csrrwi x0, 0x4f1, (val-1)
+#define SET_SV_VL( val ) csrrwi x0, 0x4f0, (val-1)
#define SV_LD_DATA( reg, from, offs ) \
la x1, from; \
sv_c_lwsp \
sv_c_lwsp_predication \
sv_c_swsp \
+ sv_c_beqz \
rv64uc_p_tests = $(addprefix rv64uc-p-, $(rv64uc_sv_tests))
rv64uc_v_tests = $(addprefix rv64uc-v-, $(rv64uc_sv_tests))
--- /dev/null
+#include "riscv_test.h"
+#include "sv_test_macros.h"
+
+RVTEST_RV64U # Define TVM used by program.
+
+
+# SV test: vector-vector add different rd and rs1
+#
+# sets up x6 and x7 with data, sets VL to 2, and carries out
+# an "x3 = 1 + x6". which actually means "x3 = 1 + x6 *AND* x4 = 1 + x7"
+
+# Test code region.
+RVTEST_CODE_BEGIN # Start of test code.
+
+ .align 2
+ .option push
+ .option norvc
+
+ li a3, 0x3
+ li a4, 0x0
+
+ SET_SV_MVL(2)
+ SET_SV_2CSRS( SV_REG_CSR(1, 10, 0, 3, 1),
+ SV_REG_CSR(1, 0 , 0, 0, 1) )
+ SET_SV_2PREDCSRS( \
+ SV_PRED_CSR(1, 10, 0, 0, 13, 0), \
+ SV_PRED_CSR(1, 0, 0, 0, 14, 0) );\
+
+ li x3, 0
+ li x4, 0
+
+ SET_SV_VL(2)
+
+ .option push;
+ .option rvc;
+ .align 2;
+
+ c.beqz a0,here
+
+ .option pop;
+
+here:
+
+ CLR_SV_CSRS()
+ SET_SV_VL(1)
+ SET_SV_MVL(1)
+
+ TEST_SV_IMM(a4, 0x3)
+
+ .option pop;
+ RVTEST_PASS # Signal success.
+fail:
+ RVTEST_FAIL
+RVTEST_CODE_END # End of test code.
+
+# Input data section.
+# This section is optional, and this data is NOT saved in the output.
+.data
+ .align 3
+testdata:
+ .dword 1001
+ .dword 0
+ .dword 0
+ .dword 1002
+
+# Output data section.
+RVTEST_DATA_BEGIN # Start of test output data region.
+ .align 3
+result:
+ .dword -1
+ .dword -1
+ .dword -1
+RVTEST_DATA_END # End of test output data region.
+
.option pop
- SET_SV_VL(0)
+ SET_SV_VL(1)
CLR_SV_CSRS()
- SET_SV_MVL(0)
+ SET_SV_MVL(1)
mv sp, a1
.option pop
- SET_SV_VL(0)
+ SET_SV_VL(1)
CLR_SV_CSRS()
- SET_SV_MVL(0)
+ SET_SV_MVL(1)
mv sp, a6
c.mv x3, x6
.option norvc
- SET_SV_VL(0)
+ SET_SV_VL(1)
CLR_SV_CSRS()
- SET_SV_MVL(0)
+ SET_SV_MVL(1)
TEST_SV_IMM(x3, 1001) # should not be modified
TEST_SV_IMM(x4, 41)
c.mv x3, x6; \
.option norvc; \
\
- SET_SV_VL(0); \
+ SET_SV_VL(1); \
CLR_SV_CSRS(); \
- SET_SV_MVL(0); \
+ SET_SV_MVL(1); \
\
TEST_SV_IMM(x3, expect1); \
TEST_SV_IMM(x4, expect2); \
.option pop
- SET_SV_VL(0)
+ SET_SV_VL(1)
CLR_SV_CSRS()
- SET_SV_MVL(0)
+ SET_SV_MVL(1)
mv sp, a1
fadd.d f2, f2, f6;
CLR_SV_CSRS()
- SET_SV_VL(0)
- SET_SV_MVL(0)
+ SET_SV_VL(1)
+ SET_SV_MVL(1)
TEST_SV_FD(0, f1, testdata+64, 0)
TEST_SV_FD(0, f2, testdata+72, 0)
addi x3, x3, 1
CLR_SV_CSRS()
- SET_SV_VL(0)
- SET_SV_MVL(0)
+ SET_SV_VL(1)
+ SET_SV_MVL(1)
TEST_SV_IMM(x2, 1001) # should not be modified
TEST_SV_IMM(x3, 42)
addi x3, x3, 1; \
\
CLR_SV_CSRS(); \
- SET_SV_VL( 0); \
- SET_SV_MVL( 0); \
+ SET_SV_VL( 1); \
+ SET_SV_MVL( 1); \
\
TEST_SV_IMM( x2, 1001); \
TEST_SV_IMM( x3, expect1); \
addi x16, x16, 1
CLR_SV_CSRS()
- SET_SV_VL(0)
- SET_SV_MVL(0)
+ SET_SV_VL(1)
+ SET_SV_MVL(1)
TEST_SV_IMM(x2, 1001) # should not be modified
TEST_SV_IMM(x3, 42)
addi x3, x6, 1 # x3 = x6+1 *AND* x4 = x6+1
CLR_SV_CSRS()
- SET_SV_VL(0)
- SET_SV_MVL(0)
+ SET_SV_VL(1)
+ SET_SV_MVL(1)
TEST_SV_IMM(x2, 1001) # should not be modified
TEST_SV_IMM(x3, 42)
addi x3, x6, 1
CLR_SV_CSRS()
- SET_SV_VL(0)
- SET_SV_MVL(0)
+ SET_SV_VL(1)
+ SET_SV_MVL(1)
TEST_SV_IMM(x2, 1001) # should not be modified
TEST_SV_IMM(x3, 42)
here:
CLR_SV_CSRS()
- SET_SV_VL(0)
- SET_SV_MVL(0)
+ SET_SV_VL(1)
+ SET_SV_MVL(1)
TEST_SV_IMM(a4, 0x3)