bgt rs, rt, label
# branch on greater
rs
are greater than the contents of rt
, when the contents of rs
are greater than the immediate value.
The comparison treats the comparands as signed 32-bit values.
bge rs, rt, label
# branch on greater or equal
rs
are greater than or equal to the contents of rt
, or it can branch when the contents of rs
are greater than or equal to the immediate value.
The comparison treats the comparands as signed 32-bit values.
bltu rs, rt, label
# branch on less than unsigned
rs
are less than the contents of rt
, or it can branch when the contents of rs
are less than the immediate value.
The comparison treats the comparands as unsigned 32-bit values.
bgtz rs, label
# branch on greater than zero
rs
are greater than zero.
bge |
bgeu |
beqz |
---|---|---|
.text li $t0, 0xFF li $t1, 0 bge $t0, $t1, T li $a0, 1 j put T: li $a0, 2 put: li $v0, 1 syscall |
.text li $t0, -1 bgeu $t0, -2, T li $a0, 1 j put T: li $a0, 2 put: li $v0, 1 syscall |
.data X: .byte 0xFF .text lb $t0, X add $t0, $t0, 1 beqz $t0, T li $a0, 1 j put T: li $a0, 2 put: li $v0, 1 syscall |
Output | Output | Output |