What is the best solution for the translation of the following C code into MIPS assembly?
x = A[i];
Note that x ⇨ $t0
, A[] ⇨ $s0
, i ⇨ $s1
.
With add
:
sll $t0, $s1, 2
add $t0, $t0, $s0
or with addu
:
sll $t0, $s1, 2
addu $t0, $t0, $s0
I know the difference between add
and addu
, but I not understand when to use one or the other.