_mm512_maskz_range_pd
Classification
AVX-512, Miscellaneous, CPUID Test: AVX512DQ
Header File
immintrin.h
Instruction
VRANGEPD zmm {z}, zmm, zmm, imm8
Synopsis
 _mm512_maskz_range_pd(__mmask8 k, __m512d a, __m512d b, int imm8);
Description
Calculate the max, min, absolute max, or absolute min (depending on control in "imm8") for packed double-precision (64-bit) floating-point elements in "a" and "b", and store the results in "dst" using zeromask "k" (elements are zeroed out when the corresponding mask bit is not set). imm8[1:0] specifies the operation control: 00 = min, 01 = max, 10 = absolute max, 11 = absolute min. imm8[3:2] specifies the sign control: 00 = sign from a, 01 = sign from compare result, 10 = clear sign bit, 11 = set sign bit.
Operation
DEFINE RANGE(src1[63:0], src2[63:0], opCtl[1:0], signSelCtl[1:0]) {
	CASE opCtl[1:0] OF
	0: tmp[63:0] := (src1[63:0] <= src2[63:0]) ? src1[63:0] : src2[63:0]
	1: tmp[63:0] := (src1[63:0] <= src2[63:0]) ? src2[63:0] : src1[63:0]
	2: tmp[63:0] := (ABS(src1[63:0]) <= ABS(src2[63:0])) ? src1[63:0] : src2[63:0]
	3: tmp[63:0] := (ABS(src1[63:0]) <= ABS(src2[63:0])) ? src2[63:0] : src1[63:0]
	ESAC
	
	CASE signSelCtl[1:0] OF
	0: dst[63:0] := (src1[63] << 63) OR (tmp[62:0])
	1: dst[63:0] := tmp[63:0]
	2: dst[63:0] := (0 << 63) OR (tmp[62:0])
	3: dst[63:0] := (1 << 63) OR (tmp[62:0])
	ESAC
	
	RETURN dst
}
FOR j := 0 to 7
	i := j*64
	IF k[j]
		dst[i+63:i] := RANGE(a[i+63:i], b[i+63:i], imm8[1:0], imm8[3:2])
	ELSE
		dst[i+63:i] := 0
	FI
ENDFOR
dst[MAX:512] := 0