Are certain bare MIPS instructions faster than others? The question that sparked my interest was multiplying a register by a power of 2.
Let's assume $t0 has a number that won't overflow. If I want to multiply that register by 8, is there any quantifiable performance difference between:
a 3-bit sll:
sll $t0, $t0,3
using the mul command (assume $t8's value is 8):
mul $t0, $t0,$t8
or using the mult command?
mult $t0, $t0,$t8
Each example consists of a single instruction, but I don't know if one's faster than the other. Intuition makes me think mul is faster than mult, since there's no storage of the extraneous bits into HI (is that correct?)
Alternatively, does anyone know of any articles/webpages on the topic of individual instruction speed in assembly (MIPS or whatever)? I would imagine that the different instructions are composed of different circuitry/hardware, and that every instruction executes in different amounts of time, but I can't seem to find any resources about this online.
I'm very new to MIPS/assembly, so please forgive me for not running a timing example (or for potentially using incorrect syntax in my examples above).
mult
takes 2 operands. Thehi:lo
output is implicit. – Peter Cordes