slti

Operands

$reg, $reg, imm

Set on less than immediate (signed) : Sets $t1 = 1 if $t2 < immediate (sign-extended to 32 bits), otherwise $t1 = 0. Convenient for loop bounds and range checking without a separate load instruction.

Variants

  • Set on less than immediate (signed) : Sets $t1 = 1 if $t2 < immediate (sign-extended to 32 bits), otherwise $t1 = 0. Convenient for loop bounds and range checking without a separate load instruction. slti $t1,$t2,-100
# Signed comparison: -1 is less than 1. Inspect $t2: 1.
li $t0, -1
slti $t2, $t0, 1