MULH
Multiply High Signed
MULH rd, rs1, rs2
Performs a signed multiplication and stores the upper bits of the result.
Encoding
Binary Layout
0000001
31:25
rs2
24:20
rs1
19:15
001
14:12
rd
11:7
0110011
6:0
Operands
-
rd
Dest (Upper Bits) -
rs1
Source register 1 (integer) -
rs2
Source register 2 (integer)
Example
MULH x5, x6, x7
// Get upper bits of signed multiplication.
Related
Across architectures
Integer Multiply : how x86, ARM, RISC-V, and PowerISA each do this.
More in M
Reference
View in RISC-V Unprivileged ISA Specification ↗
RISC-V ISA Manual
Description
MULH multiplies rs1 and rs2 as signed values and writes the upper XLEN bits of the 2×XLEN-bit product to rd.
Operation
R[rd] = (sext(R[rs1]) * sext(R[rs2])) >> XLEN;