I have the following MIPS code (for swapping adjacent elements from an array) from a class slide:
muli $2, $5,4
add $2, $4,$2
lw $15, 0($2)
lw $16, 4($2)
sw $16, 0($2)
sw $15, 4($2)
jr $31
This exact code will come up via google, so it must be a sort of standard example used in various colleges.
I understand all of it; in class I assumed "muli" was multiply immediate. (Editor's note: multiply by a power of 2 is best done with a left shift like sll $2, $5, 2
, never a multiply. No compiler would ever emit this, and you'd only write this way by hand to dumb down the array indexing for this swap function.)
Now it appears "muli" is not a command at all (at least I don't see it on any of my references).
What am I missing? I apologize if this is a dumb question but it is stumping me.
li
andmove
) implemented by whatever MIPS assembler the person that wrote that example was using. – Arson