_mm_roundscale_round_sd
Classification
AVX-512, Miscellaneous, CPUID Test: AVX512F
Header File
immintrin.h
Instruction
VRNDSCALESD xmm, xmm, xmm, imm8 {sae}
Synopsis
 _mm_roundscale_round_sd(__m128d a, __m128d b, const int imm8, const int sae);
Description
Round the lower double-precision (64-bit) floating-point element in "b" to the number of fraction bits specified by "imm8", store the result in the lower element of "dst", and copy the upper element from "a" to the upper element of "dst". [round_imm_note][sae_note]
Operation
DEFINE RoundScaleFP64(src1[63:0], imm8[7:0]) {
	m[63:0] := FP64(imm8[7:4]) // number of fraction bits after the binary point to be preserved
	tmp[63:0] := POW(2.0, -m) * ROUND(POW(2.0, m) * src1[63:0], imm8[3:0])
	IF IsInf(tmp[63:0])
		tmp[63:0] := src1[63:0]
	FI
	RETURN tmp[63:0]
}
dst[63:0] := RoundScaleFP64(b[63:0], imm8[7:0])
dst[127:64] := a[127:64]
dst[MAX:128] := 0