Associate Professor of Computer Science
All arithmetic instructions in MIPS have three operands and all operands must be registers.
The indicated operation is performed on the two operands and the result is stored in the destination. For example,
add $s0, $s1, $s2 # A = B + C
Design Principles. The design of the arithmetic instructions is derived from two basic principles: simplicity favors regularity and smaller is faster.
Example. This simplicity can complicate some things, however. Consider the following statement.
A = B + C + D;
This one high-level language statement will require several MIPS instructions.
add $t0, $s1, $s2 # t0 = B + C add $s0, $t0, $s3 # A = t0 + D
Arithmetic Integer Operations
The following table lists the most common arithmetic integer operations in MIPS. All of these operations work on registers with rdest being the destination register for the operation and rs and rt being the operand registers.
MIPS also provides add instructions when working with immediate or literal values.