_mm256_gf2p8affineinv_epi64_epi8
Classification
Other, Arithmetic, CPUID Test: GFNI
Header File
immintrin.h
Instruction
VGF2P8AFFINEINVQB ymm, ymm, ymm, imm8
Synopsis
 _mm256_gf2p8affineinv_epi64_epi8(__m256i x, __m256i 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".
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 3
	FOR i := 0 to 7
		dst.qword[j].byte[i] := affine_inverse_byte(A.qword[j], x.qword[j].byte[i], b)
	ENDFOR
ENDFOR
dst[MAX:256] := 0