MIPS __asm Statement Registers
The following table gives MIPS macro names and associated register descriptions.
MIPS16 macro name | MIPSII macro name | Associated Register | Description |
---|---|---|---|
zero | zero | $0 | Always zero; writes to this register are ignored. |
N/A | AT | $1 | Assembler temporary. |
v0 | v0 | $2 | Used to hold return value. |
v1 | v1 | $3 | Used to hold return value. |
a0 | a0 | $4 | Argument registers; used to pass first four words of integer arguments. |
a1 | a1 | $5 | Argument registers; used to pass first four words of integer arguments. |
a2 | a2 | $6 | Argument registers; used to pass first four words of integer arguments. |
a3 | a3 | $7 | Argument registers; used to pass first four words of integer arguments. |
N/A | t0 | $8 | Temporary registers; may be freely changed. |
N/A | t1 | $9 | Temporary registers; may be freely changed. |
N/A | t2 | $10 | Temporary registers; may be freely changed. |
N/A | t3 | $11 | Temporary registers; may be freely changed. |
N/A | t4 | $12 | Temporary registers; may be freely changed. |
N/A | t5 | $13 | Temporary registers; may be freely changed. |
N/A | t6 | $14 | Temporary registers; may be freely changed. |
N/A | t7 | $15 | Temporary registers; may be freely changed. |
N/A | s0 | $16 | Saved registers; must be preserved across function calls. |
N/A | s1 | $17 | Saved registers; must be preserved across function calls. |
N/A | s2 | $18 | Saved registers; must be preserved across function calls. |
N/A | s3 | $19 | Saved registers; must be preserved across function calls. |
N/A | s4 | $20 | Saved registers; must be preserved across function calls. |
N/A | s5 | $21 | Saved registers; must be preserved across function calls. |
N/A | s6 | $22 | Saved registers; must be preserved across function calls. |
N/A | s7 | $23 | Saved registers; must be preserved across function calls. |
t8 | t8 | $24 | Additional temporary registers. |
N/A | t9 | $25 | Additional temporary registers. |
N/A | k0 | $26 | Kernel reserved registers. |
N/A | k1 | $27 | Kernel reserved registers. |
N/A | gp | $28 | Global pointer. |
sp | sp | $29 | Stack pointer. |
N/A | s8 | $30 | Additional saved register. |
ra | ra | $31 | Return address register. |
The register macro names are interchangeable with their numeric names using a dollar sign prefix. For example, the following two statements are equivalent:
__asm("add v0, a0, $16");
__asm("add $2, $4, s0");
See Also
The _asm Keyword in MIPS Inline Assembly | C or C++ References in MIPS Inline Assembly | Restrictions to MIPS __asm Statements
Last updated on Thursday, April 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.