_mm512_roundscale_ph
Classification
AVX-512, Miscellaneous, CPUID Test: AVX512_FP16
Header File
Instruction
VRNDSCALEPH zmm, zmm, imm8
Synopsis
_mm512_roundscale_ph(__m512h 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". [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 31
dst.fp16[i] := RoundScaleFP16(a.fp16[i], imm8)
ENDFOR
dest[MAX:512] := 0