sgt
Set if greater than
Sets the first register to 1 if the second is greater than the third, or an immediate, as signed values, otherwise to 0.
Forms
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. $t3- A general-purpose register. It may be the same register as
$t1. imm- An immediate value: a signed 16-bit value (
-32768to32767) or a 32-bit value (-2147483648to4294967295). The size your value needs decides which real instructions the assembler uses. Open the row to see them for each size.
# Compare signed and unsigned bit patterns: $t0 is -1 (0xFFFFFFFF), $t1 is 1. Inspect $t2: 0.
li $t0, -1
li $t1, 1
sgt $t2, $t0, $t1