_mm256_gf2p8affine_epi64_epi8
Classification
Other, Arithmetic, CPUID Test: GFNI
Header File
immintrin.h
Instruction
VGF2P8AFFINEQB ymm, ymm, ymm, imm8
Synopsis
 _mm256_gf2p8affine_epi64_epi8(__m256i x, __m256i A, int b);
Description
Compute an 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. 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_byte(tsrc2qw, src1byte, imm8) {
	FOR i := 0 to 7
		retbyte.bit[i] := parity(tsrc2qw.byte[7-i] AND src1byte) XOR imm8.bit[i]
	ENDFOR
	RETURN retbyte
}
FOR j := 0 TO 3
	FOR i := 0 to 7
		dst.qword[j].byte[i] := affine_byte(A.qword[j], x.qword[j].byte[i], b)
	ENDFOR
ENDFOR
dst[MAX:256] := 0