Comparison Instructions (Cont.)

sle rd, rs, rt         # set less or equal
Compares two signed 32-bit values. If the contents of 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
Compares two signed 32-bit values. If the contents of 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
Compares two signed 32-bit values. If the contents of 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
     .text 
     li    $v0, 5
     syscall
     # input ≥ 0
     li    $a0, 0
 L1: 
     bnez  $t0, L2
     add   $a0, $a0, $v0
     sub   $v0, $v0, 1
     j     L1
 L2: 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