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

Forms

  • slti , ,

Operands

$t1
Any general-purpose register, $0 to $31, using its numeric or named spelling, such as $8 or $t0 ($zero is $0; $ra is $31).
$t2
A general-purpose register. It may be the same register as $t1.
imm16
A signed 16-bit immediate, -32768 to 32767.

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