PPT Slide
MIPS jump, branch, compare instructions (PATTERSON)
Instruction Example Meaning
branch on equal beq $1,$2,100 if ($1 == $2) go to PC+4+100 Equal test; PC relative branch
branch on not eq. bne $1,$2,100 if ($1!= $2) go to PC+4+100 Not equal test; PC relative
set on less than slt $1,$2,$3 if ($2 < $3) $1=1; else $1=0 Compare less than; 2’s comp.
set less than imm. slti $1,$2,100 if ($2 < 100) $1=1; else $1=0 Compare < constant; 2’s comp.
set less than uns. sltu $1,$2,$3 if ($2 < $3) $1=1; else $1=0 Compare less than; natural no.
set l. t. imm. uns. sltiu $1,$2,100 if ($2 < 100) $1=1; else $1=0 Compare < constant; natural
jump j 10000 go to 10000 Jump to target address
jump register jr $31 go to $31 For switch, procedure return
jump and link jal 10000 $31 = PC + 4; go to 10000 For procedure call