vpmovm2d

Move Mask Register to Doubleword Mask

VPMOVM2D zmm1, k1

Expands k-register bits to doubleword elements in ZMM.

Details

Expands each bit from an 8-bit mask register into a full doubleword (0x00000000 or 0xFFFFFFFF) in a 512-bit ZMM register, producing 16 doubleword elements. Each set bit in the source k-register generates a doubleword of all 1s (0xFFFFFFFF) in the destination; each clear bit generates a doubleword of all 0s (0x00000000). No flags are affected; this is a mask-expansion operation with no conditional behavior.

Pseudocode Operation

for i in 0 to 15:
  zmm1[i*32:i*32+31] ← (k1[i] ? 0xFFFFFFFF : 0x00000000)

Example

VPMOVM2D zmm1, k1

Encoding

Binary Layout
EVEX
+0
opcode
+4
ModRM
+5
 
Format EVEX
Opcode EVEX.512.F3.0F38.W0 38 /r
Extension AVX-512DQ

Operands

  • dest
    512-bit ZMM AVX-512 register
  • src
    AVX-512 opmask register (k0-k7)

Reference (Intel® SDM)

Instruction Forms

Opcode Instruction Op/En 64/32-bit Mode CPUID Description
EVEX.128.F3.0F38.W0 28 /r VPMOVM2B xmm1, k1 RM V/V (AVX512VL AND AVX512BW) OR AVX10.1 Sets each byte in XMM1 to all 1’s or all 0’s based on the value of the corresponding bit in k1.
EVEX.256.F3.0F38.W0 28 /r VPMOVM2B ymm1, k1 RM V/V (AVX512VL AND AVX512BW) OR AVX10.1 Sets each byte in YMM1 to all 1’s or all 0’s based on the value of the corresponding bit in k1.
EVEX.512.F3.0F38.W0 28 /r VPMOVM2B zmm1, k1 RM V/V AVX512BW OR AVX10.1 Sets each byte in ZMM1 to all 1’s or all 0’s based on the value of the corresponding bit in k1.
EVEX.128.F3.0F38.W1 28 /r VPMOVM2W xmm1, k1 RM V/V (AVX512VL AND AVX512BW) OR AVX10.1 Sets each word in XMM1 to all 1’s or all 0’s based on the value of the corresponding bit in k1.
EVEX.256.F3.0F38.W1 28 /r VPMOVM2W ymm1, k1 RM V/V (AVX512VL AND AVX512BW) OR AVX10.1 Sets each word in YMM1 to all 1’s or all 0’s based on the value of the corresponding bit in k1.
EVEX.512.F3.0F38.W1 28 /r VPMOVM2W zmm1, k1 RM V/V AVX512BW OR AVX10.1 Sets each word in ZMM1 to all 1’s or all 0’s based on the value of the corresponding bit in k1.
EVEX.128.F3.0F38.W0 38 /r VPMOVM2D xmm1, k1 RM V/V (AVX512VL AND AVX512DQ) OR AVX10.1 Sets each doubleword in XMM1 to all 1’s or all 0’s based on the value of the corresponding bit in k1.
EVEX.256.F3.0F38.W0 38 /r VPMOVM2D ymm1, k1 RM V/V (AVX512VL AND AVX512DQ) OR AVX10.1 Sets each doubleword in YMM1 to all 1’s or all 0’s based on the value of the corresponding bit in k1.
EVEX.512.F3.0F38.W0 38 /r VPMOVM2D zmm1, k1 RM V/V AVX512DQ OR AVX10.1 Sets each doubleword in ZMM1 to all 1’s or all 0’s based on the value of the corresponding bit in k1.
EVEX.128.F3.0F38.W1 38 /r VPMOVM2Q xmm1, k1 RM V/V (AVX512VL AND AVX512DQ) OR AVX10.1 Sets each quadword in XMM1 to all 1’s or all 0’s based on the value of the corresponding bit in k1.
EVEX.256.F3.0F38.W1 38 /r VPMOVM2Q ymm1, k1 RM V/V (AVX512VL AND AVX512DQ) OR AVX10.1 Sets each quadword in YMM1 to all 1’s or all 0’s based on the value of the corresponding bit in k1.
EVEX.512.F3.0F38.W1 38 /r VPMOVM2Q zmm1, k1 RM V/V AVX512DQ OR AVX10.1 Sets each quadword in ZMM1 to all 1’s or all 0’s based on the value of the corresponding bit in k1.

Description

Converts a mask register to a vector register. Each element in the destination register is set to all 1’s or all 0’s depending on the value of the corresponding bit in the source mask register. The source operand is a mask register. The destination operand is a ZMM/YMM/XMM register. EVEX.vvvv is reserved and must be 1111b otherwise instructions will #UD. VPMOVM2B/VPMOVM2W/VPMOVM2D/VPMOVM2Q—Convert a Mask Register to a Vector Register Vol. 2C 5-585

Operation

VPMOVM2B (EVEX encoded versions)
(KL, VL) = (16, 128), (32, 256), (64, 512)
FOR j := 0 TO KL-1
i := j * 8
IF SRC[j]
THEN    DEST[i+7:i] := -1
ELSE     DEST[i+7:i] := 0
FI;
ENDFOR
DEST[MAXVL-1:VL] := 0

VPMOVM2W (EVEX encoded versions)
(KL, VL) = (8, 128), (16, 256), (32, 512)
FOR j := 0 TO KL-1
i := j * 16
IF SRC[j]
THEN    DEST[i+15:i] := -1
ELSE    DEST[i+15:i] := 0
FI;
ENDFOR
DEST[MAXVL-1:VL] := 0

VPMOVM2D (EVEX encoded versions)
(KL, VL) = (4, 128), (8, 256), (16, 512)
FOR j := 0 TO KL-1
i := j * 32
IF SRC[j]
THEN    DEST[i+31:i] := -1
ELSE    DEST[i+31:i] := 0
FI;
ENDFOR
DEST[MAXVL-1:VL] := 0

VPMOVM2Q (EVEX encoded versions)
(KL, VL) = (2, 128), (4, 256), (8, 512)
FOR j := 0 TO KL-1
i := j * 64
IF SRC[j]
THEN    DEST[i+63:i] := -1
ELSE    DEST[i+63:i] := 0
FI;
ENDFOR
DEST[MAXVL-1:VL] := 0





VPMOVM2B/VPMOVM2W/VPMOVM2D/VPMOVM2Q—Convert a Mask Register to a Vector Register                                          Vol. 2C 5-586

Intel C/C++ Compiler Intrinsic Equivalent

VPMOVM2B __m512i _mm512_movm_epi8(__mmask64 );
VPMOVM2D __m512i _mm512_movm_epi32(__mmask8 );
VPMOVM2Q __m512i _mm512_movm_epi64(__mmask16 );
VPMOVM2W __m512i _mm512_movm_epi16(__mmask32 );
VPMOVM2B __m256i _mm256_movm_epi8(__mmask32 );
VPMOVM2D __m256i _mm256_movm_epi32(__mmask8 );
VPMOVM2Q __m256i _mm256_movm_epi64(__mmask8 );
VPMOVM2W __m256i _mm256_movm_epi16(__mmask16 );
VPMOVM2B __m128i _mm_movm_epi8(__mmask16 );
VPMOVM2D __m128i _mm_movm_epi32(__mmask8 );
VPMOVM2Q __m128i _mm_movm_epi64(__mmask8 );
VPMOVM2W __m128i _mm_movm_epi16(__mmask8 );

Exceptions

SIMD Floating-Point Exceptions

None.

Other Exceptions

EVEX-encoded instruction, see Table 2-57, “Type E7NM Class Exception Conditions.” Additionally: #UD If EVEX.vvvv != 1111B. VPMOVM2B/VPMOVM2W/VPMOVM2D/VPMOVM2Q—Convert a Mask Register to a Vector Register Vol. 2C 5-587