Home/Instructions/Carry-Less Multiply
CLMUL

RISC-V CLMUL Instruction Details

Instruction ManualR-type

Carry-less multiply (low-part)

Instruction Syntax

clmul 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

clmul performs GF(2) carry-less multiplication and returns the low XLEN bits.

CLMUL 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
001
11..7
rd
01010
6..0
opcode
0110011
Execution data path

funct7=0000101, funct3=001

x10 <- pending

Quick Understanding & Search Notes

clmul performs GF(2) carry-less multiplication and returns the low XLEN bits.

These instructions are part of a B-extension subset and operate on XLEN-wide integer register values.
Carry-less multiplication combines partial products with XOR and does not propagate integer carries.

Common Usage Scenarios

Bit Manipulation

Understand this scenario with real code like «clmul x10, x11, x12 ; x10 = low_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

Carry-less multiplication combines partial products with XOR and does not propagate integer carries.

FAQ

Does clmul access memory?

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

Does clmul interpret signed numbers?

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