Encoding:

POOL16A

000001

rs

rt

rd

1

6

3

3

3

1

Format:

SUBU16 rd, rs, rt

microMIPS

Subtract Unsigned Word (16-bit instr size)

Purpose:

Subtract Unsigned Word (16-bit instr size)

To subtract 32-bit integers

Description:

 GPR[rd] = GPR[rs] - GPR[rt]

The 32-bit word value in GPR rt is subtracted from the 32-bit value in GPR rs and the 32-bit arithmetic result is signextended and placed into GPR rd.

No integer overflow exception occurs under any circumstances.

Restrictions:

The 3-bit register fields can only specify GPRs $2-$7, $16, $17.

On 64-bit processors, if either GPR rt or GPR rs does not contain sign-extended 32-bit values (bits 63..31 equal), then the result of the operation is UNPREDICTABLE.

Availability and Compatibility:

This instruction has been recoded for Release 6.

Operation:

if NotWordValue(GPR[rs]) or NotWordValue(GPR[rt]) then
   UNPREDICTABLE
endif
temp = GPR[rs] - GPR[rt]
GPR[rd] = sign_extend(temp)

Exceptions:

None

Programming Notes:

The term "unsigned" in the instruction name is a misnomer; this operation is 32-bit modulo arithmetic that does not trap on overflow. It is appropriate for unsigned arithmetic, such as address arithmetic, or integer arithmetic environments that ignore overflow, such as C language arithmetic.