_mm256_reduce_ph
Classification
AVX-512, Miscellaneous, CPUID Test: AVX512_FP16
Header File
immintrin.h
Instruction
VREDUCEPH ymm, ymm, imm8
Synopsis
 _mm256_reduce_ph(__m256h 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". [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 15
	dst.fp16[i] := ReduceArgumentFP16(a.fp16[i], imm8)
ENDFOR
dst[MAX:256] := 0