sltu
lyszt.net covers sltu and other RISC-V instructions in more detail.
Encoding format
Description
Writes 1 or 0 to record which of two unsigned values is smaller. In sltu rd, rs1, rs2, the result is 1 when the unsigned value in rs1 is less than rs2, otherwise 0. It handles values that cannot be negative, such as memory addresses, sizes and counts, and a bounds check with sltu succeeds where the signed slt test mistakes large addresses for small negative numbers.
Official definition
RV32I defines several arithmetic R-type operations. All operations read the rs1 and rs2 registers as source operands and write the result into register rd. The funct7 and funct3 fields select the type of operation.
ADD performs the addition of rs1 and rs2. SUB performs the subtraction of rs2 from rs1. Overflows are ignored and the low XLEN bits of results are written to the destination rd. SLT and SLTU perform signed and unsigned compares respectively, writing 1 to rd if rs1 < rs2, 0 otherwise. Note, SLTU rd, x0, rs2 sets rd to 1 if rs2 is not equal to zero, otherwise sets rd to zero (assembler pseudoinstruction SNEZ rd, rs). AND, OR, and XOR perform bitwise logical operations.