SUB(U)
Signed or Unsigned Integer Subtraction Without Saturation
3-130
Note:
Subtraction with a signed constant on the .L and .S units allows either the first
or the second operand to be the signed 5-bit constant.
SUB
src1, scst5, dst is encoded as ADD –scst5, src2, dst where the src1
register is now
src2 and scst5 is now –scst5.
However, the .D unit provides only the second operand as a constant since
it is an unsigned 5-bit constant.
ucst5 allows a greater offset for addressing
with the .D unit.
Pipeline
Stage
E1
Read
src1, src2
Written
dst
Unit in use
.L, .S, or .D
Instruction Type
Single-cycle
Delay Slots
0
Example 1
SUB .L1
A1,A2,A3
Before instruction
1 cycle after instruction
A1
0000 325Ah
12810
A1
0000 325Ah
A2
FFFF FF12h
–238
A2
FFFF FF12h
A3
XXXX XXXXh
A3
0000 3348h
13128
Example 2
SUBU .L1
A1,A2,A5:A4
Before instruction
1 cycle after instruction
A1
0000 325Ah
12810
†
A1
0000 325Ah
A2
FFFF FF12h
4294967058
†
A2
FFFF FF12h
A5:A4
XXXX XXXXh
XXXX XXXXh
A5:A4
0000 00FFh
0000 3348h
–4294954168
‡
† Unsigned 32-bit integer
‡ Signed 40-bit (long) integer
Pipeline