_mm512_mask_extpackstorehi_ps
Classification
KNC, Store, CPUID Test: KNCNI
Header File
immintrin.h
Instruction
VPACKSTOREHPS m512 {k}, zmm
Synopsis
 _mm512_mask_extpackstorehi_ps(void * mt, __mmask16 k, __m512 v1, _MM_DOWNCONV_PS_ENUM conv, int hint);
Description
Down-converts and stores packed single-precision (32-bit) floating-point elements of "v1" into a byte/word/doubleword stream according to "conv" at a logically mapped starting address (mt-64), storing the high-64-byte elements of that stream (those elemetns of the stream that map at or after the first 64-byte-aligned address following (m5-64)). "hint" indicates to the processor whether the data is non-temporal. Elements are stored to memory according to element selector "k" (elements are skipped when the corresponding mask bit is not set).
Operation
DEFINE DOWNCONVERT(element, convertTo) {
	CASE convertTo OF
	_MM_UPCONV_PS_NONE:
		RETURN element[31:0]
	_MM_UPCONV_PS_FLOAT16:
		RETURN Convert_FP32_To_FP16(element[31:0])
	_MM_UPCONV_PS_UINT8:
		RETURN Truncate8(element[31:0])
	_MM_UPCONV_PS_SINT8:
		RETURN Saturate8(element[31:0])
	_MM_UPCONV_PS_UINT16:
		RETURN Truncate16(element[31:0])
	_MM_UPCONV_PS_SINT16:
		RETURN Saturate16(element[31:0])
	ESAC
}
DEFINE DOWNCONVERTSIZE(convertTo) {
	CASE convertTo OF
	_MM_UPCONV_PS_NONE:
		RETURN 4
	_MM_UPCONV_PS_FLOAT16:
		RETURN 2
	_MM_UPCONV_PS_UINT8:
		RETURN 1
	_MM_UPCONV_PS_SINT8:
		RETURN 1
	_MM_UPCONV_PS_UINT16:
		RETURN 2
	_MM_UPCONV_PS_SINT16:
		RETURN 2
	ESAC
}
storeOffset := 0
foundNext64BytesBoundary := false
downSize := DOWNCONVERTSIZE(conv)
addr := mt-64
FOR j := 0 to 15
	IF k[j]
		IF foundNext64BytesBoundary == false
			IF ((addr + (storeOffset + 1)*downSize) % 64) == 0
				foundNext64BytesBoundary := true
			FI
		ELSE
			i := j*32
			tmp := DOWNCONVERT(v1[i+31:i], conv)
			storeAddr := addr + storeOffset * downSize
			CASE downSize OF
			4: MEM[storeAddr] := tmp[31:0]
			2: MEM[storeAddr] := tmp[15:0]
			1: MEM[storeAddr] := tmp[7:0]
			ESAC
		FI
		storeOffset := storeOffset + 1
	FI
ENDFOR
dst[MAX:512] := 0