Does a3 / x13 keep its old argument value after a call?
Do not assume so. a0-a7 are not preserved across calls, and the callee may overwrite them.
Function argument register 3. Passes fourth argument.
The psABI uses a0-a7 as argument registers, with a0-a1 also carrying return values. They are not callee-saved and may be overwritten by calls.
a3 / x13 belongs to the a0-a7 argument-register group. The psABI uses a0-a7 for arguments and a0-a1 for return values; these registers are not preserved across calls.
a* registers are caller-saved, so callees may overwrite them.
After a call returns, do not assume the old a3 argument value still exists; the callee may overwrite it.
When arguments exceed a0-a7, the extra ones go on the stack.
addi a0, zero, 3 # first argument
addi a1, zero, 4 # second argument
call add2
# after return, a0 holds the return valueDo not assume so. a0-a7 are not preserved across calls, and the callee may overwrite them.
The psABI uses a0-a1 for return values as well as arguments.