Many times a program will use a constant in an operation—for example, incrementing
an index to point to the next element of an array. In fact, more than half
of the MIPS arithmetic instructions have a constant as an operand when running
the SPEC CPU2006 benchmarks.
Using only the instructions we have seen so far, we would have to load a constant
from memory to use one. (The constants would have been placed in memory when
the program was loaded.) For example, to add the constant 4 to register $s3, we
could use the code