_mm512_mask_gf2p8mul_epi8
Classification
Other, Arithmetic, CPUID Test: GFNI
Header File
immintrin.h
Instruction
VGF2P8MULB zmm {k}, zmm, zmm
Synopsis
 _mm512_mask_gf2p8mul_epi8(__m512i src, __mmask64 k, __m512i a, __m512i b);
Description
Multiply the packed 8-bit integers in "a" and "b" in the finite field GF(2^8), and store the results in "dst" using writemask "k" (elements are copied from "src"" when the corresponding mask bit is not set). The field GF(2^8) is represented in polynomial representation with the reduction polynomial x^8 + x^4 + x^3 + x + 1.
Operation
DEFINE gf2p8mul_byte(src1byte, src2byte) {
	tword := 0
	FOR i := 0 to 7
		IF src2byte.bit[i]
			tword := tword XOR (src1byte << i)
		FI
	ENDFOR
	FOR i := 14 downto 8
		p := 0x11B << (i-8)
		IF tword.bit[i]
			tword := tword XOR p
		FI
	ENDFOR
	RETURN tword.byte[0]
}
FOR j := 0 TO 63
	IF k[j]
		dst.byte[j] := gf2p8mul_byte(a.byte[j], b.byte[j])
	ELSE
		dst.byte[j] := src.byte[j]
	FI
ENDFOR
dst[MAX:512] := 0