I have the following C row code:
B[x] = A[x+7] + A[x+2];
Assuming that A is stored in $s0, B in $s1 and x in $t0.
I have got the following MIPS code:
add $t1, $t0, 7
add $t2, $t0, 2
lw $t3, $t1($s0)
lw $t4, $t2($s0)
add $t3, $t3, $t4
sw $t3, $t0($s1)
Now my question is, am I allow to use in MIPS code like this: $t0($s1), if not can anybody explain why and what are the other alternatives I can use?
I searched online and I could not get a proper answer to this issue!