Reputation: 375
add rd, rs, rt
addu rd, rs, rt
sub rd, rs, rt
subu rd, rs, rt
In MIPS, what's the difference between signed addition, unsigned addition, signed subtraction and unsigned subtraction? If their results are the same, what's the point to classified as using signed and unsigned methods?
Upvotes: 4
Views: 3617
Reputation: 58427
The u
simply means that they don't trap on overflow.
Quoting from "MIPS32 Architecture For Programmers Volume II":
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.
Upvotes: 6