Jump and Branch Instructions


The table below lists some jump and branch instructions. Jump is with the J-type format and branch instructions are with the I-type format. The unconditional instructions (j and b) transfer control to the instruction at label when executed. The conditional branches first perform the indicated comparison, then branch if the result of the comparison is true.

For the ‘z’ instructions (beqz, bltz, etc.), the register contents are compared with 0. For the instructions with two registers, the comparison is performed between the contents of the two registers. The rt register can be replaced with a constant instead of a register designation; this produces a “branch immediate” type of pseudoinstruction.
Instruction Description
j label Jump
b label Unconditional branch
beq rs, rt, label Branch on equal
beqz rs, label Branch on equal zero
bne rs, rt, label Branch on not equal
bnez rs, label Branch on not equal zero
blt rs, rt, label Branch on less than
bltu rs, rt, label Branch on less than unsigned
bltz rs, label Branch on less than zero
ble rs, rt, label Branch on less/equal
bleu rs, rt, label Branch on less/equal unsigned
blez rs, label Branch on less/equal zero
bgt rs, rt, label Branch on greater
bgtu rs, rt, label Branch on greater unsigned
bgtz rs, label Branch on greater zero
bge rs, rt, label Branch on greater/equal
bgeu rs, rt, label Branch on greater/equal unsigned
bgez rs, label Branch on greater/equal zero

Pseudoinstructions do not correspond to real MIPS instructions. Instead, the assembler would translate pseudoinstructions to real instructions, usually requiring at least one or more instructions. Most of the conditional branches are pseudoinstructions, composed of a “set” (comparison) instruction, followed by a beq or bne instruction.