Encoding:

POOL32A

000000

rt

rs

rd

0

SUBU32

0111010000

6

5

5

5

1

10

Format:

SUBU rd, rs, rt

microMIPS

Subtract Unsigned Word

Purpose:

Subtract Unsigned Word

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:

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.

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.