Improves test for jumps

This commit is contained in:
2025-11-14 08:52:41 +01:00
parent 6bbecc252e
commit f5d8c77d06
8 changed files with 333 additions and 75 deletions

View File

@@ -1,16 +1,21 @@
# expected: 000000BA, 000001C, 0000000A
# expected: 000002BC, 000003BC, 000000BC
.text
_start:
jal x1, step1
addi x31, x0, 0x00A
jal x0, finish
step1:
jal x2, step2
addi x31, x0, 0x0AB # This instruction should never be executed
addi x31, x0, 0x0BA
jalr x31, 0(x1) # Check if return address is written to x31
step2:
jalr x0, 4(x2) # return to step1, but 1 further
finish:
nop
addi x31, x0, 0x0AB # This instruction should never be executed
add x5, x0, 0x00C
jalr x1, x5, 0
add x31, x0, 0x1BC
# target for jalr (placed immediately)
add x31, x0, 0x2BC
# jalr with immediate offset -> jump forward
add x6, x0, 0x018
jalr x2, x6, 0
add x31, x0, 0x3BC
# jalr to same register (should set rd to return addr) and continue
add x7, x0, 0x028
jalr x3, x7, 0
add x31, x0, 0x4BC
# final marker
add x31, x0, 0x0BC