Encoding:

ADDI

001000

rs

rt

immediate

6

5

5

16

Format:

ADDI rt, rs, immediate

MIPS32, removed in Release 6

Add Immediate Word

Purpose:

Add Immediate Word

To add a constant to a 32-bit integer. If overflow occurs, then trap.

Description:

GPR[rt] = GPR[rs] + immediate

The 16-bit signed immediate is added to the 32-bit value in GPR rs to produce a 32-bit result.

Restrictions:

If GPR rs does not contain a sign-extended 32-bit value (bits 63..31 equal), then the result of the operation is

UNPREDICTABLE.

Availability and Compatibility:

This instruction has been removed in Release 6. The encoding has been reused for other instructions introduced by

Release 6.

Operation:

if NotWordValue(GPR[rs]) then 
   UNPREDICTABLE
endif
temp = (GPR[rs]31||GPR[rs]31..0) + sign_extend(immediate)
if temp32 != temp31 then
   SignalException(IntegerOverflow)
else
   GPR[rt] = sign_extend(temp31..0)
endif

Exceptions:

Integer Overflow

Programming Notes:

ADDIU performs the same arithmetic operation but does not trap on overflow.