POOL16D 010011 |
Encoded Immediate |
1 |
6 |
9 |
1 |
ADDIUSP decoded_immediate_value |
microMIPS |
Add Immediate Unsigned Word to Stack Pointer(16-bit instr size) |
Add Immediate Unsigned Word to Stack Pointer(16-bit instr size)
To add a constant to the stack pointer.
GPR[29] = GPR[29] + sign_extend(decoded immediate << 2)
The encoded immediate field is decoded to obtain the actual immediate value.
The actual immediate value is first shifted left by two bits and then sign-extended. This amount is added to the 32-bit value in GPR 29, and the 32-bit arithmetic result is sign-extended and placed into GPR 29.
No Integer Overflow exception occurs under any circumstances.
Table 5.10 Encoded and Decoded Values of Immediate Field
Encoded Value of Instr9..1 (Decimal) |
Encoded Value of Instr9..1 (Hex) |
Decoded Value of Immediate (Decimal) |
Decoded Value of Immediate (Hex) |
0 |
0x0 |
256 |
0x0100 |
1 |
0x1 |
257 |
0x0101 |
2 |
0x2 |
2 |
0x0002 |
3 |
0x3 |
3 |
0x0003 |
... |
... |
... |
... |
254 |
0xfe |
254 |
0x00fe |
255 |
0xff |
255 |
0x00ff |
256 |
0x100 |
-256 |
0xff00 |
257 |
0x101 |
-255 |
0xff01 |
... |
... |
... |
... |
508 |
0x1fc |
-4 |
0xfffc |
509 |
0x1fd |
-3 |
0xfffd |
510 |
0x1fe |
-258 |
0xfefe |
511 |
0x1ff |
-257 |
0xfeff |
If GPR 29 does not contain a sign-extended 32-bit value (bits 63..31 equal), then the result of the operation is
UNPREDICTABLE.
if NotWordValue(GPR[rs]) then UNPREDICTABLE endif temp = GPR[29] + sign_extend(decoded immediate || 02) GPR[29] = sign_extend(temp31..0)
None
The term "unsigned" in the instruction name is a misnomer; this operation is 32-bit modulo arithmetic that does not trap on overflow. This instruction is appropriate for unsigned arithmetic, such as address arithmetic, or integer arithmetic environments that ignore overflow, such as C language arithmetic.