Home/Instructions/Carry-Less Multiply High
CLMULH

RISC-V CLMULH Instruction Details

Instruction ManualR-type

Carry-less multiply (high-part)

Instruction Syntax

clmulh rd, rs1, rs2
Operand Breakdown
Destination rd: register receiving the operation result.
Source rs1: register holding the first operand.
Source rs2: register holding the second operand.
ZbcZbkcBit ManipulationCrypto

Instruction Behavior

clmulh performs GF(2) carry-less multiplication and returns the high XLEN bits.

CLMULH Decode & Execute Animation

This model shows ISA-visible GF(2) XOR partial products; it does not model integer carries, a pipeline, or a cryptographic protocol.

Execution context
32-bit encoding fields
31..25
funct7
0000101
24..20
rs2
01100
19..15
rs1
01011
14..12
funct3
011
11..7
rd
01010
6..0
opcode
0110011
Execution data path

funct7=0000101, funct3=011

x10 <- pending

Quick Understanding & Search Notes

clmulh performs GF(2) carry-less multiplication and returns the high XLEN bits.

These instructions are part of a B-extension subset and operate on XLEN-wide integer register values.
The high-half selection is distinct from signed or unsigned integer MULH semantics.

Common Usage Scenarios

Bit Manipulation

Understand this scenario with real code like «clmulh x10, x11, x12 ; x10 = high_half(clmul(x11, x12))».

Pre-Use Checklist

Syntax Check
  • Verify rd, rs1, rs2 (and rs3) are valid GPRs.
  • Confirm funct3 and funct7 encoding is correct.
Semantic Check
  • Check if the result affects subsequent branches or address calculations.
  • Ensure the rd register is not overwritten by another instruction.

Pitfalls / Common Confusions

The high-half selection is distinct from signed or unsigned integer MULH semantics.

FAQ

Does clmulh access memory?

No. It reads integer register operands and writes rd only.

Does clmulh interpret signed numbers?

These bit operations work on bit patterns directly; aside from the specified word-width selection, arithmetic signed magnitude is not used.