Given two input registers in MIPS: $t0, $t1
How would开发者_开发问答 you figure out which one is bigger without using branches?
You can use the SLT/SLTU instruction (Set Less Than [Unsigned]):
SLT $t2,$t0,$t1
or
SLTU $t2,$t0,$t1
If $t0 is less than $t1 then $t2 will be 1, otherwise $t2 will be 0.
精彩评论