bgez

Operands

$reg, id

Branch on greater than or equal to zero : Branches to 'label' if $t1 >= 0 (signed comparison). Uses a PC-relative 16-bit signed offset. Commonly used to test the sign bit.

Variants

  • Branch on greater than or equal to zero : Branches to 'label' if $t1 >= 0 (signed comparison). Uses a PC-relative 16-bit signed offset. Commonly used to test the sign bit. bgez $t1,label
# Run bgez with one true and one false condition. A taken branch skips the assignment of 1; inspect $t2=2 for taken and $t3=1 for fall-through.
li $t0, 2
li $t2, 0
bgez $t0, taken_one
li $t2, 1
b first_done # Skip the other marker unconditionally.
 taken_one: li $t2, 2
first_done:
li $t0, -2
li $t3, 0
bgez $t0, taken_two
li $t3, 1
b second_done # Skip the other marker unconditionally.
 taken_two: li $t3, 2
second_done: