Register Guide

RISC-V a6 / x16 Register: Argument

One of the a0-a7 integer argument registers in the standard psABI. It is not preserved across calls.

ABI name: a6; physical register: x16.
Save rule: Not preserved.
Read it through its psABI role first, then inspect how each instruction reads or writes it.
Physical Name x16ABI Name a6Save Rule Not preserved
Role
Argument
Convention
Standard psABI: not preserved across calls
Remember This First
The psABI marks a0-a7 as not preserved across calls.
psABI Reference

Argument register

The standard psABI uses a0-a7 as argument registers, with only a0-a1 also used for return values. They are not preserved across calls.

Preserved across calls: No
RISC-V psABI integer register convention
Quick Understanding & Search Notes

a6 / x16 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.

a0-a7 are argument registers, and a0-a1 are also used for return values.
After a call returns, do not assume the old a6 argument value still exists.

When It Fits Best

  • - a6 is one of the psABI a0-a7 integer argument registers.
  • - a6 is not listed as a return-value register in the psABI table; look first at a0/a1 for returns.
  • - Read a0-a7 first as function argument registers under the psABI.

When Not To Use It This Way

  • - Do not assume a* registers keep their old values after a call.
  • - If the original a* value is needed after a call, do not leave it in a* across that call.

What Happens Around A Call

1

The psABI marks a0-a7 as not preserved across calls.

2

After a call returns, do not assume the old a6 argument value still exists.

3

For a scalar of at most XLEN bits, the psABI passes it by value on the stack when no argument register is available.

Arguments And Return Values

Examples explain the rule, not a complete program
addi a6, zero, 3  # write a6
# a6 is an argument register, outside the a0-a1 return-value registers

FAQ

Does a6 / x16 keep its old argument value after a call?

Do not assume so. The standard psABI marks a0-a7 as not preserved across calls.

Which a registers carry return values?

The psABI uses a0-a1 for return values as well as arguments.