_mm512_maskz_reduce_ph
Classification
AVX-512, Miscellaneous, CPUID Test: AVX512_FP16
Header File
immintrin.h
Instruction
VREDUCEPH zmm {z}, zmm, imm8
Synopsis
 _mm512_maskz_reduce_ph(__mmask32 k, __m512h a, int imm8);
Description
Extract the reduced argument of packed half-precision (16-bit) floating-point elements in "a" by the number of bits specified by "imm8", and store the results in "dst" using zeromask "k" (elements are zeroed out when the corresponding mask bit is not set). [round_imm_note]
Operation
DEFINE ReduceArgumentFP16(src[15:0], imm8[7:0]) {
	m[15:0] := FP16(imm8[7:4]) // number of fraction bits after the binary point to be preserved
	tmp[15:0] := POW(2.0, FP16(-m)) * ROUND(POW(2.0, FP16(m)) * src[15:0], imm8[3:0])
	tmp[15:0] := src[15:0] - tmp[15:0]
	IF IsInf(tmp[15:0])
		tmp[15:0] := FP16(0.0)
	FI
	RETURN tmp[15:0]
}
FOR i := 0 to 31
	IF k[i]
		dst.fp16[i] := ReduceArgumentFP16(a.fp16[i], imm8)
	ELSE
		dst.fp16[i] := 0
	FI
ENDFOR
dst[MAX:512] := 0