slti
Set on less than immediate (signed)
Sets $t1 to 1 if $t2 is less than an immediate as signed integers, otherwise to 0.
Used in
- Comparing two numbersMIPS assembly
Forms
slti , ,
Operands
$t1- Any general-purpose register,
$0to$31, using its numeric or named spelling, such as$8or$t0($zerois$0;$rais$31). $t2- A general-purpose register. It may be the same register as
$t1. imm16- A signed 16-bit immediate,
-32768to32767.
Convenient for loop bounds and range checking without a separate load instruction.
# Signed comparison: -1 is less than 1. Inspect $t2: 1.
li $t0, -1
slti $t2, $t0, 1