_mm512_mask_gf2p8affineinv_epi64_epi8
Classification
Other, Arithmetic, CPUID Test: GFNI
Header File
immintrin.h
Instruction
VGF2P8AFFINEINVQB zmm {k}, zmm, zmm, imm8
Synopsis
 _mm512_mask_gf2p8affineinv_epi64_epi8(__m512i src, __mmask64 k, __m512i x, __m512i A, int b);
Description
Compute an inverse affine transformation in the Galois Field 2^8. An affine transformation is defined by "A" * "x" + "b", where "A" represents an 8 by 8 bit matrix, "x" represents an 8-bit vector, and "b" is a constant immediate byte. The inverse of the 8-bit values in "x" is defined with respect to the reduction polynomial x^8 + x^4 + x^3 + x + 1. Store the packed 8-bit results in "dst" using writemask "k" (elements are copied from "src" when the corresponding mask bit is not set).
Operation
DEFINE parity(x) {
	t := 0
	FOR i := 0 to 7
		t := t XOR x.bit[i]
	ENDFOR
	RETURN t
}
DEFINE affine_inverse_byte(tsrc2qw, src1byte, imm8) {
	FOR i := 0 to 7
		retbyte.bit[i] := parity(tsrc2qw.byte[7-i] AND inverse(src1byte)) XOR imm8.bit[i]
	ENDFOR
	RETURN retbyte
}
FOR j := 0 TO 7
	FOR i := 0 to 7
		IF k[j*8+i]
			dst.qword[j].byte[i] := affine_inverse_byte(A.qword[j], x.qword[j].byte[i], b)
		ELSE
			dst.qword[j].byte[i] := src.qword[j].byte[b]
		FI
	ENDFOR
ENDFOR
dst[MAX:512] := 0