REM
Remainder
REM rd, rs1, rs2
Computes the signed remainder of division.
Details
REM computes the signed remainder of rs1 ÷ rs2, writing the result to rd. The sign of the result equals the sign of the dividend (rs1). Remainder by zero yields the dividend; overflow (INT_MIN % −1) yields zero.
Pseudocode Operation
R[rd] = R[rs1] % R[rs2];
Example
REM x5, x6, x7
Encoding
Binary Layout
0000001
31:25
rs2
24:20
rs1
19:15
110
14:12
rd
11:7
0110011
6:0
Operands
-
rd
Dest (Remainder) -
rs1
Dividend -
rs2
Divisor