Home/Instructions/Carry-Less Multiply Reversed
CLMULR

RISC-V CLMULR Instruction Details

Instruction ManualR-type

RV32/RV64 Zbc carry-less multiply, returning bits 2*XLEN-2:XLEN-1 of the 2*XLEN-bit product.

Instruction Syntax

clmulr rd, rs1, rs2

RV32/RV64 Zbc 1.0; syntax clmulr rd, rs1, rs2, with no rs3 or immediate.

32-bit R-type: funct7=0000101, funct3=010, opcode=0110011; register fields select x0–x31.

Select shifted rs1 terms with set rs2 bits and combine with XOR; select full-product bits 2*XLEN-2:XLEN-1. Sources use old XLEN-bit patterns; x0 reads zero and discards writes.

ZbcBit Manipulation

Instruction Behavior

clmulr returns bits 2*XLEN-2:XLEN-1 of the 2*XLEN carry-less product and can accelerate CRC calculations.

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

funct7=0000101, funct3=010

x10 <- pending

Quick Understanding & Search Notes

clmulr returns bits 2*XLEN-2:XLEN-1 of the 2*XLEN carry-less product and can accelerate CRC calculations.

RV32/RV64: Zbc 1.0; read two XLEN-bit integer-register patterns and combine partial products with XOR.
Select bits 2*XLEN-2:XLEN-1 from the full 2*XLEN-bit carry-less product, without polynomial modular reduction.
x0 reads as zero and discards writes; overlapping source and destination registers use the pre-writeback sources.

Common Usage Scenarios

Bit Manipulation

RV32 Zbc, x11=0x80000000 and x12=1: full carry-less product=0x0000000080000000; selecting bits62:31, clmulr writes x10=1.

Pre-Use Checklist

Syntax Check
  • RV32/RV64 Zbc 1.0; syntax clmulr rd, rs1, rs2, with no rs3 or immediate.
  • 32-bit R-type: funct7=0000101, funct3=010, opcode=0110011; register fields select x0–x31.
Semantic Check
  • Select shifted rs1 terms with set rs2 bits and combine with XOR; select full-product bits 2*XLEN-2:XLEN-1. Sources use old XLEN-bit patterns; x0 reads zero and discards writes.

Pitfalls / Common Confusions

Selects bits 2*XLEN-2:XLEN-1, one bit lower than the clmulh high-half slice; the selection rules are not interchangeable.

FAQ

Does clmulr access memory?

It does not access data memory. It reads two integer registers and delivers the selected product bits to rd; rd=x0 discards the result.

Does clmulr interpret signed numbers?

It treats XLEN-bit patterns as polynomial operands for carry-less multiplication, without signed-integer multiplication semantics; partial products combine with XOR.