ret
Return
Returns from a subroutine by jumping to the address in ra.
Used in
- jal, ret and the calling conventionRISC-V assembly
- Floating point and the F and D extensionsRISC-V assembly
- A subroutine with its arguments in registersRISC-V assembly
- Stack arguments and a stack frameRISC-V assembly
- Recursion: factorial and FibonacciRISC-V assembly
- Print a nonnegative number in bases 2–36RISC-V assembly
- Drawing shapes on the screenRISC-V assembly
- A bouncing ballRISC-V assembly
- Move a square with the keyboardRISC-V assembly
- The snake gameRISC-V assembly
Forms
# la sets ra to the local done label to simulate a function return. ret transfers there, where t2 becomes 1.
.text
li t2, 0
la ra, done
ret
addi t2, t2, 100
done:
addi t2, t2, 1