MAX
Maximum
MAX rd, rs1, rs2
Computes the signed maximum of two registers.
Encoding
Binary Layout
0000101
31:25
rs2
24:20
rs1
19:15
110
14:12
rd
11:7
0110011
6:0
Operands
-
rd
Destination register (integer) -
rs1
Source register 1 (integer) -
rs2
Source register 2 (integer)
Example
MAX x10, x11, x12
// Signed Max.
Related
More in Zbb
Reference
View in RISC-V Unprivileged ISA Specification ↗
RISC-V ISA Manual
Description
MAX computes the signed maximum of rs1 and rs2, writing the result to rd.
Operation
R[rd] = (R[rs1] >s R[rs2]) ? R[rs1] : R[rs2];