Does MAXU return 0 or 1?
No. It returns the original XLEN-bit value selected from rs1 or rs2 by the comparison rule.
Return the maximum of rs1 and rs2 using unsigned comparison.
MAXU uses opcode 0110011 (0x33), funct3 111, funct7 0000101. The rs1 and rs2 fields select the two source registers, and rd selects the destination register.
MAXU is a Zbb integer min/max instruction. It compares x[rs1] and x[rs2] as unsigned values and writes the original XLEN-bit value that is larger under that ordering to rd. It does not set condition codes and does not branch.
MAXU is useful for branchless clamp, min/max selection, and cases where the original value must be preserved after comparison. It returns the selected rs1 or rs2 bit pattern, not a comparison bit.
Understand this scenario with real code like «maxu x10, x11, x12 ; x10 = unsigned_max(x11, x12)».
Understand this scenario with real code like «maxu x10, x11, x12 ; x10 = unsigned_max(x11, x12)».
No. It returns the original XLEN-bit value selected from rs1 or rs2 by the comparison rule.
Use the U form when data is ordered as unsigned; use the non-U form for signed two's-complement ordering.