j label
or b label
beq rs, rt, label
# branch on equal
rs
equal the contents of rt
, or it can branch when the contents of rs
equal the immediate value.
bne rs, rt, label
# branch on not equal
rs
do not equal the contents of rt
, or it can branch when the contents of rs
do not equal the immediate value.
blt rs, rt, label
# branch on less
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 signed 32-bit values.
Unconditional Jump | beq |
Arithmetic Series |
---|---|---|
.text b next li $a0, 1 j put next: li $a0, 2 put: li $v0, 1 syscall |
.text li $t0, 0xFF li $t1, -1 beq $t0, $t1, T li $a0, 1 j put T: li $a0, 2 put: li $v0, 1 syscall |
|
Output | Output | Output |
1+2+3+...+input |
“There are no ordinary moments.” ― Dan Millman, Way of the Peaceful Warrior: A Book That Changes Lives |