aboutsummaryrefslogtreecommitdiff
path: root/sim/testsuite/riscv/jalr.s
diff options
context:
space:
mode:
Diffstat (limited to 'sim/testsuite/riscv/jalr.s')
-rw-r--r--sim/testsuite/riscv/jalr.s22
1 files changed, 22 insertions, 0 deletions
diff --git a/sim/testsuite/riscv/jalr.s b/sim/testsuite/riscv/jalr.s
new file mode 100644
index 0000000..daccf4f
--- /dev/null
+++ b/sim/testsuite/riscv/jalr.s
@@ -0,0 +1,22 @@
+# Basic jalr tests.
+# mach: riscv
+
+.include "testutils.inc"
+
+ start
+
+ # Load desination into register a0.
+ la a0, good_dest
+
+ # Jump to the destination in a0.
+ jalr a0, a0, 0
+
+ # If we write destination into a0 before reading it in order
+ # to jump, we might end up here.
+bad_dest:
+ fail
+
+ # We should end up here.
+good_dest:
+ pass
+ fail