_mm_maskz_gf2p8affine_epi64_epi8
Classification
Other, Arithmetic, CPUID Test: GFNI
Header File
immintrin.h
Instruction
VGF2P8AFFINEQB xmm {z}, xmm, xmm, imm8
Synopsis
 _mm_maskz_gf2p8affine_epi64_epi8(__mmask16 k, __m128i x, __m128i 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" using zeromask "k" (elements are zeroed out 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_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 1
	FOR i := 0 to 7
		IF k[j*8+i]
			dst.qword[j].byte[i] := affine_byte(A.qword[j], x.qword[j].byte[i], b)
		ELSE
			dst.qword[j].byte[i] := 0
		FI
	ENDFOR
ENDFOR
dst[MAX:128] := 0