CLMUL instruction set


Carry-less Multiplication is an extension to the x86 instruction set used by microprocessors from Intel and AMD which was proposed by Intel in March 2008 and made available in the Intel Westmere processors announced in early 2010. Mathematically, the instruction implements multiplication of polynomials over the finite field GF where the bitstring represents the polynomial. The CLMUL instruction also allows a more efficient implementation of the closely related multiplication of larger finite fields GF than the traditional instruction set.
One use of these instructions is to improve the speed of applications doing block cipher encryption in Galois/Counter Mode, which depends on finite field GF multiplication. Another application is the fast calculation of CRC values, including those used to implement the LZ77 sliding window DEFLATE algorithm in zlib and pngcrush.
ARMv8 also has a version of CLMUL.

New instructions

The instruction computes the 128-bit carry-less product of two 64-bit values. The destination is a 128-bit XMM register. The source may be another XMM register or memory. An immediate operand specifies which halves of the 128-bit operands are multiplied. Mnemonics specifying specific values of the immediate operand are also defined:
InstructionOpcodeDescription
PCLMULQDQ xmmreg,xmmrm,immPerform a carry-less multiplication of two 64-bit polynomials over the finite field GF.
PCLMULLQLQDQ xmmreg,xmmrmMultiply the low halves of the two registers.
PCLMULHQLQDQ xmmreg,xmmrmMultiply the high half of the destination register by the low half of the source register.
PCLMULLQHQDQ xmmreg,xmmrmMultiply the low half of the destination register by the high half of the source register.
PCLMULHQHQDQ xmmreg,xmmrmMultiply the high halves of the two registers.

A EVEX vectorized version is seen in AVX-512.

CPUs with CLMUL instruction set

The presence of the CLMUL instruction set can be checked by testing one of the.