Example
To sum 3 consecutive elements of a sequence a0, a1 and a2, and put the result in a3.
Suppose that these values are stored in memory starting at address A.
- lw $10,A(0) # $10 = a0
- lw $3,A(4) # $3 = a1
- add $10,$10,$3 # $10 = a0 + a1
- lw $3,A(8) # $3 = a2
- add $10,$10,$3 # $10 = a0 + a1+ a2
- sw $10,A(12) # a3 gets $10