Computer instructions are normally executed sequentially. Sequence control instructions transfer execution to a different place in the program. They are used for implementing control structures, such as if statements and while statements, and subprograms.

There are two types of sequence control instructions.

Branch Instructions

Instruction Operation
b label branch to label unconditionally
beq Rs1, Rcs2, label branch to label if Rs1 == Rcs2
ble Rs1, Rcs2, label branch to label if Rs1 <= Rcs2
blt Rs1, Rcs2, label branch to label if Rs1 < Rcs2
bge Rs1, Rcs2, label branch to label if greater than or equal
bgt Rs1, Rcs2, label branch to label if Rs1 > Rcs2
bne Rs1, Rcs2, label branch to label Rs1 != Rcs2
beqz Rs, label branch to label if Rs == 0
blez Rs, label branch to label if Rs <= 0
bltz Rs, label branch to label if Rs < 0
bgez Rs, label branch to label if Rs >= 0
bgtz Rs, label branch to label if Rs > 0
bnez Rs, label branch to label if Rs != 0
bleu Rs1, Rcs2, label branch to label if Rs1 <= Rcs2 unsigned
bltu Rs1, Rcs2, label branch to label if Rs1 < Rcs2 unsigned
bgeu Rs1, Rcs2, label branch to label if Rs1 >= Rcs2 unsigned
bgtu Rs1, Rcs2, label branch to label if Rs1 > Rcs2 unsigned
bltzal Rs, label branch to label if Rs < 0 and link
bgezal Rs, label branch to label if Rs >= 0 and link
bc1t label branch to label if the FP coprocessor flag is true
bc1f label branch to label if the FP coprocessor flag is false

The bltzal and bgezal instructions save the address of the following instruction in $ra. They can be used for conditional subprogram calls.

The bc1t and bc1f instructions test the floating point coprocessor flag, which is set or cleared by floating point compare instructions.

Integer Conditional Branch Instructions

Instruction Operation
b label branch to label unconditionally
beq Rs1, Rcs2, label branch to label if Rs1 == Rcs2
ble Rs1, Rcs2, label branch to label if Rs1 <= Rcs2
blt Rs1, Rcs2, label branch to label if Rs1 < Rcs2
bge Rs1, Rcs2, label branch to label if Rs1 >= Rcs2
bgt Rs1, Rcs2, label branch to label if Rs1 > Rcs2
bne Rs1, Rcs2, label branch to label if Rs1 != Rcs2
beqz Rs, label branch to label if Rs == 0
blez Rs, label branch to label if Rs <= 0
bltz Rs, label branch to label if Rs < 0
bgez Rs, label branch to label if Rs >= 0
bgtz Rs, label branch to label if Rs > 0
bnez Rs, label branch to label if Rs != 0

Jump Instructions

Instruction Operation
j addr unconditional jump
jr Rtarg unconditional jump
jal addr subprogram call
jalr Rsave, Rtarg subprogram call

Rtarg indicates a register that contains the target address of a register jump. Subprogram returns are accomplished by using $ra for Rtarg.

Rsave indicates a register that receives the return address of a jalr instruction. This operand is optional. If it is omitted $ra receives the return address.