summaryrefslogtreecommitdiffstats
path: root/tests/j.S
diff options
context:
space:
mode:
Diffstat (limited to 'tests/j.S')
-rw-r--r--tests/j.S49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/j.S b/tests/j.S
new file mode 100644
index 0000000..259a236
--- /dev/null
+++ b/tests/j.S
@@ -0,0 +1,49 @@
+# See LICENSE for license details.
+
+#*****************************************************************************
+# j.S
+#-----------------------------------------------------------------------------
+#
+# Test j instruction.
+#
+
+#include "riscv_test.h"
+#include "test_macros.h"
+
+RVTEST_RV32U
+RVTEST_CODE_BEGIN
+
+ #-------------------------------------------------------------
+ # Test basic
+ #-------------------------------------------------------------
+
+ li TESTNUM, 2;
+ j test_2;
+ j fail;
+test_2:
+
+ #-------------------------------------------------------------
+ # Test delay slot instructions not executed nor bypassed
+ #-------------------------------------------------------------
+
+ TEST_CASE( 3, x1, 3, \
+ li x1, 1; \
+ j 1f; \
+ addi x1, x1, 1; \
+ addi x1, x1, 1; \
+ addi x1, x1, 1; \
+ addi x1, x1, 1; \
+1: addi x1, x1, 1; \
+ addi x1, x1, 1; \
+ )
+
+ TEST_PASSFAIL
+
+RVTEST_CODE_END
+
+ .data
+RVTEST_DATA_BEGIN
+
+ TEST_DATA
+
+RVTEST_DATA_END