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,17 +1,28 @@
# expected: 00000004, 0000008, 00000014, 0000000B
# expected: 000002BC, 000004BC, 000007BC, 000005BC
.text
_start:
jal x31, step1
step1:
jal x31, step2
step4:
addi x31, x0, 0x00B
jal x0, finish
step2:
jal x31, step3
step3:
jal x0, step4
addi x31, x0, 0x00A # This instruction should never be executed
finish:
nop
# forward jal -> should jump to target and set x1 to return addr
jal x1, jal_target
add x31, x0, 0x1BC
jal_target:
add x31, x0, 0x2BC
add x5, x0, 0x1
jal x2, jal_back_target
add x31, x0, 0x3BC
jal_back_target:
add x31, x0, 0x4BC
jal x0, after_jal_back
jal_back_flag:
add x31, x0, 0x5BC
after_jal_back:
# same-target jal to next insn (offset small) -> should set x3 and continue
jal x3, same_jal_target
add x31, x0, 0x6BC
same_jal_target:
add x31, x0, 0x7BC
# final marker
add x31, x0, 0x5BC