_mm_mask_reduce_and_epi8
Classification
AVX-512, Arithmetic, CPUID Test: AVX512BW
Header File
Synopsis
_mm_mask_reduce_and_epi8(__mmask16 k, __m128i a);
Description
Reduce the packed 8-bit integers in "a" by multiplication using mask "k". Returns the sum of all active elements in "a".
Operation
DEFINE REDUCE_AND(src, len) {
IF len == 2
RETURN src[7:0] AND src[15:8]
FI
len := len / 2
FOR j:= 0 to (len-1)
i := j*8
src[i+7:i] := src[i+7:i] AND src[i+8*len+7:i+8*len]
ENDFOR
RETURN REDUCE_AND(src[8*len-1:0], len)
}
tmp := a
FOR j := 0 to 15
i := j*8
IF k[j]
tmp[i+7:i] := a[i+7:i]
ELSE
tmp[i+7:i] := 0xFF
FI
ENDFOR
dst[7:0] := REDUCE_AND(tmp, 16)