Other-Application-Targeted-XMM

Other-Application-Targeted-XMM#

_mm_clmulepi64_si128#

Tech:

Other

Category:

Application-Targeted

Header:

wmmintrin.h

Searchable:

Other-Application-Targeted-XMM

Register:

XMM 128 bit

Return Type:

__m128i

Param Types:

__m128i a, __m128i b, const int imm8

Param ETypes:

M128 a, M128 b, IMM imm8

__m128i _mm_clmulepi64_si128(__m128i a, __m128i b,
                             const int imm8)

Intel Description

Perform a carry-less multiplication of two 64-bit integers, selected from “a” and “b” according to “imm8”, and store the results in “dst”.

Intel Implementation Psudeo-Code

IF (imm8[0] == 0)
        TEMP1 := a[63:0]
ELSE
        TEMP1 := a[127:64]
FI
IF (imm8[4] == 0)
        TEMP2 := b[63:0]
ELSE
        TEMP2 := b[127:64]
FI
FOR i := 0 to 63
        TEMP[i] := (TEMP1[0] and TEMP2[i])
        FOR j := 1 to i
                TEMP[i] := TEMP[i] XOR (TEMP1[j] AND TEMP2[i-j])
        ENDFOR
        dst[i] := TEMP[i]
ENDFOR
FOR i := 64 to 127
        TEMP[i] := 0
        FOR j := (i - 63) to 63
                TEMP[i] := TEMP[i] XOR (TEMP1[j] AND TEMP2[i-j])
        ENDFOR
        dst[i] := TEMP[i]
ENDFOR
dst[127] := 0