_mm_maskz_roundscale_ph
Classification
AVX-512, Miscellaneous, CPUID Test: AVX512_FP16
Header File
immintrin.h
Instruction
VRNDSCALEPH xmm {z}, xmm, imm8
Synopsis
 _mm_maskz_roundscale_ph(__mmask8 k, __m128h a, int imm8);
Description
Round packed half-precision (16-bit) floating-point elements in "a" to the number of fraction 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 RoundScaleFP16(src.fp16, imm8[7:0]) {
	m.fp16 := FP16(imm8[7:4]) // number of fraction bits after the binary point to be preserved
	tmp.fp16 := POW(FP16(2.0), -m) * ROUND(POW(FP16(2.0), m) * src.fp16, imm8[3:0])
	RETURN tmp.fp16
}
FOR i := 0 to 7
	IF k[i]
		dst.fp16[i] := RoundScaleFP16(a.fp16[i], imm8)
	ELSE
		dst.fp16[i] := 0
	FI
ENDFOR
dest[MAX:128] := 0