sle rd, rs, rt # set less or equal
rs are less than or equal to the contents of rt (or rs is less than or equal to the immediate value), this instruction sets the destination register to one; otherwise, it sets the destination register to zero.
sgt rd, rs, rt # set greater
rs are greater than the contents of rt (or rs is greater than the immediate value), this instruction sets the destination register to one; otherwise, it sets the destination register to zero.
sge rd, rs, rt # set greater or equal
rs are greater than or equal to the contents of rt (or rs is greater than or equal to the immediate value), this instruction sets the destination register to one; otherwise, it sets the destination register to zero.
seq |
sne |
Arithmetic Series |
|---|---|---|
.text
li $t0, 0xFF
li $t1, -1
seq $t0, $t0, $t1
beqz $t0, T
li $a0, 1
j put
T: li $a0, 2
put: li $v0, 1
syscall
|
.data
X: .byte 0xFF
.text
lb $t0, X
sne $t0, $t0, -1
beqz $t0, T
li $a0, 1
j put
T: li $a0, 2
put: li $v0, 1
syscall
|
|
| Output | Output | Output |
|
1+2+3+...+input |
|
“Whenever I hear anyone arguing for slavery, I feel a strong impulse to see it tried on him personally.” ― Abraham Lincoln |