ia32-64/x86/movd.movq.html

279 lines
11 KiB
HTML
Raw Normal View History

2025-07-08 02:23:29 -03:00
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:x86="http://www.felixcloutier.com/x86"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" type="text/css" href="style.css"></link><title>MOVD/MOVQ
— Move Doubleword/Move Quadword</title></head><body><header><nav><ul><li><a href='index.html'>Index</a></li><li>December 2023</li></ul></nav></header><h1>MOVD/MOVQ
— Move Doubleword/Move Quadword</h1>
<table>
<tr>
<th>Opcode/Instruction</th>
<th>Op/ En</th>
<th>64/32-bit Mode</th>
<th>CPUID Feature Flag</th>
<th>Description</th></tr>
<tr>
<td>NP 0F 6E /r MOVD mm, r/m32</td>
<td>A</td>
<td>V/V</td>
<td>MMX</td>
<td>Move doubleword from r/m32 to mm.</td></tr>
<tr>
<td>NP REX.W + 0F 6E /r MOVQ mm, r/m64</td>
<td>A</td>
<td>V/N.E.</td>
<td>MMX</td>
<td>Move quadword from r/m64 to mm.</td></tr>
<tr>
<td>NP 0F 7E /r MOVD r/m32, mm</td>
<td>B</td>
<td>V/V</td>
<td>MMX</td>
<td>Move doubleword from mm to r/m32.</td></tr>
<tr>
<td>NP REX.W + 0F 7E /r MOVQ r/m64, mm</td>
<td>B</td>
<td>V/N.E.</td>
<td>MMX</td>
<td>Move quadword from mm to r/m64.</td></tr>
<tr>
<td>66 0F 6E /r MOVD xmm, r/m32</td>
<td>A</td>
<td>V/V</td>
<td>SSE2</td>
<td>Move doubleword from r/m32 to xmm.</td></tr>
<tr>
<td>66 REX.W 0F 6E /r MOVQ xmm, r/m64</td>
<td>A</td>
<td>V/N.E.</td>
<td>SSE2</td>
<td>Move quadword from r/m64 to xmm.</td></tr>
<tr>
<td>66 0F 7E /r MOVD r/m32, xmm</td>
<td>B</td>
<td>V/V</td>
<td>SSE2</td>
<td>Move doubleword from xmm register to r/m32.</td></tr>
<tr>
<td>66 REX.W 0F 7E /r MOVQ r/m64, xmm</td>
<td>B</td>
<td>V/N.E.</td>
<td>SSE2</td>
<td>Move quadword from xmm register to r/m64.</td></tr>
<tr>
<td>VEX.128.66.0F.W0 6E / VMOVD xmm1, r32/m32</td>
<td>A</td>
<td>V/V</td>
<td>AVX</td>
<td>Move doubleword from r/m32 to xmm1.</td></tr>
<tr>
<td>VEX.128.66.0F.W1 6E /r VMOVQ xmm1, r64/m64</td>
<td>A</td>
<td>V/N.E<sup>1</sup>.</td>
<td>AVX</td>
<td>Move quadword from r/m64 to xmm1.</td></tr>
<tr>
<td>VEX.128.66.0F.W0 7E /r VMOVD r32/m32, xmm1</td>
<td>B</td>
<td>V/V</td>
<td>AVX</td>
<td>Move doubleword from xmm1 register to r/m32.</td></tr>
<tr>
<td>VEX.128.66.0F.W1 7E /r VMOVQ r64/m64, xmm1</td>
<td>B</td>
<td>V/N.E<sup>1</sup>.</td>
<td>AVX</td>
<td>Move quadword from xmm1 register to r/m64.</td></tr>
<tr>
<td>EVEX.128.66.0F.W0 6E /r VMOVD xmm1, r32/m32</td>
<td>C</td>
<td>V/V</td>
<td>AVX512F</td>
<td>Move doubleword from r/m32 to xmm1.</td></tr>
<tr>
<td>EVEX.128.66.0F.W1 6E /r VMOVQ xmm1, r64/m64</td>
<td>C</td>
<td>V/N.E.<sup>1</sup></td>
<td>AVX512F</td>
<td>Move quadword from r/m64 to xmm1.</td></tr>
<tr>
<td>EVEX.128.66.0F.W0 7E /r VMOVD r32/m32, xmm1</td>
<td>D</td>
<td>V/V</td>
<td>AVX512F</td>
<td>Move doubleword from xmm1 register to r/m32.</td></tr>
<tr>
<td>EVEX.128.66.0F.W1 7E /r VMOVQ r64/m64, xmm1</td>
<td>D</td>
<td>V/N.E.<sup>1</sup></td>
<td>AVX512F</td>
<td>Move quadword from xmm1 register to r/m64.</td></tr></table>
<blockquote>
<p>1. For this specific instruction, VEX.W/EVEX.W in non-64 bit is ignored; the instruction behaves as if the W0 version is used.</p></blockquote>
<h2 id="instruction-operand-encoding">Instruction Operand Encoding<a class="anchor" href="#instruction-operand-encoding">
</a></h2>
<table>
<tr>
<th>Op/En</th>
<th>Tuple Type</th>
<th>Operand 1</th>
<th>Operand 2</th>
<th>Operand 3</th>
<th>Operand 4</th></tr>
<tr>
<td>A</td>
<td>N/A</td>
<td>ModRM:reg (w)</td>
<td>ModRM:r/m (r)</td>
<td>N/A</td>
<td>N/A</td></tr>
<tr>
<td>B</td>
<td>N/A</td>
<td>ModRM:r/m (w)</td>
<td>ModRM:reg (r)</td>
<td>N/A</td>
<td>N/A</td></tr>
<tr>
<td>C</td>
<td>Tuple1 Scalar</td>
<td>ModRM:reg (w)</td>
<td>ModRM:r/m (r)</td>
<td>N/A</td>
<td>N/A</td></tr>
<tr>
<td>D</td>
<td>Tuple1 Scalar</td>
<td>ModRM:r/m (w)</td>
<td>ModRM:reg (r)</td>
<td>N/A</td>
<td>N/A</td></tr></table>
<h2 id="description">Description<a class="anchor" href="#description">
</a></h2>
<p>Copies a doubleword from the source operand (second operand) to the destination operand (first operand). The source and destination operands can be general-purpose registers, MMX technology registers, XMM registers, or 32-bit memory locations. This instruction can be used to move a doubleword to and from the low doubleword of an MMX technology register and a general-purpose register or a 32-bit memory location, or to and from the low doubleword of an XMM register and a general-purpose register or a 32-bit memory location. The instruction cannot be used to transfer data between MMX technology registers, between XMM registers, between general-purpose registers, or between memory locations.</p>
<p>When the destination operand is an MMX technology register, the source operand is written to the low doubleword of the register, and the register is zero-extended to 64 bits. When the destination operand is an XMM register, the source operand is written to the low doubleword of the register, and the register is zero-extended to 128 bits.</p>
<p>In 64-bit mode, the instructions default operation size is 32 bits. Use of the REX.R prefix permits access to additional registers (R8-R15). Use of the REX.W prefix promotes operation to 64 bits. See the summary chart at the beginning of this section for encoding data and limits.</p>
<p>MOVD/Q with XMM destination:</p>
<p>Moves a dword/qword integer from the source operand and stores it in the low 32/64-bits of the destination XMM register. The upper bits of the destination are zeroed. The source operand can be a 32/64-bit register or 32/64-bit memory location.</p>
<p>128-bit Legacy SSE version: Bits (MAXVL-1:128) of the corresponding YMM destination register remain unchanged. Qword operation requires the use of REX.W=1.</p>
<p>VEX.128 encoded version: Bits (MAXVL-1:128) of the destination register are zeroed. Qword operation requires the use of VEX.W=1.</p>
<p>EVEX.128 encoded version: Bits (MAXVL-1:128) of the destination register are zeroed. Qword operation requires the use of EVEX.W=1.</p>
<p>MOVD/Q with 32/64 reg/mem destination:</p>
<p>Stores the low dword/qword of the source XMM register to 32/64-bit memory location or general-purpose register. Qword operation requires the use of REX.W=1, VEX.W=1, or EVEX.W=1.</p>
<p>Note: VEX.vvvv and EVEX.vvvv are reserved and must be 1111b otherwise instructions will #UD.</p>
<p>If VMOVD or VMOVQ is encoded with VEX.L= 1, an attempt to execute the instruction encoded with VEX.L= 1 will cause an #UD exception.</p>
<h2 id="operation">Operation<a class="anchor" href="#operation">
</a></h2>
<h3 id="movd--when-destination-operand-is-an-mmx-technology-register-">MOVD (When Destination Operand is an MMX Technology Register)<a class="anchor" href="#movd--when-destination-operand-is-an-mmx-technology-register-">
</a></h3>
<pre>DEST[31:0] := SRC;
DEST[63:32] := 00000000H;
</pre>
<h3 id="movd--when-destination-operand-is-an-xmm-register-">MOVD (When Destination Operand is an XMM Register)<a class="anchor" href="#movd--when-destination-operand-is-an-xmm-register-">
</a></h3>
<pre>DEST[31:0] := SRC;
DEST[127:32] := 000000000000000000000000H;
DEST[MAXVL-1:128] (Unmodified)
</pre>
<h3 id="movd--when-source-operand-is-an-mmx-technology-or-xmm-register-">MOVD (When Source Operand is an MMX Technology or XMM Register)<a class="anchor" href="#movd--when-source-operand-is-an-mmx-technology-or-xmm-register-">
</a></h3>
<pre>DEST := SRC[31:0];
</pre>
<h3 id="vmovd--vex-encoded-version-when-destination-is-an-xmm-register-">VMOVD (VEX-Encoded Version when Destination is an XMM Register)<a class="anchor" href="#vmovd--vex-encoded-version-when-destination-is-an-xmm-register-">
</a></h3>
<pre>DEST[31:0] := SRC[31:0]
DEST[MAXVL-1:32] := 0
</pre>
<h3 id="movq--when-destination-operand-is-an-xmm-register-">MOVQ (When Destination Operand is an XMM Register)<a class="anchor" href="#movq--when-destination-operand-is-an-xmm-register-">
</a></h3>
<pre>DEST[63:0] := SRC[63:0];
DEST[127:64] := 0000000000000000H;
DEST[MAXVL-1:128] (Unmodified)
</pre>
<h3 id="movq--when-destination-operand-is-r-m64-">MOVQ (When Destination Operand is r/m64)<a class="anchor" href="#movq--when-destination-operand-is-r-m64-">
</a></h3>
<pre>DEST[63:0] := SRC[63:0];
</pre>
<h3 id="movq--when-source-operand-is-an-xmm-register-or-r-m64-">MOVQ (When Source Operand is an XMM Register or r/m64)<a class="anchor" href="#movq--when-source-operand-is-an-xmm-register-or-r-m64-">
</a></h3>
<pre>DEST := SRC[63:0];
</pre>
<h3 id="vmovq--vex-encoded-version-when-destination-is-an-xmm-register-">VMOVQ (VEX-Encoded Version When Destination is an XMM Register)<a class="anchor" href="#vmovq--vex-encoded-version-when-destination-is-an-xmm-register-">
</a></h3>
<pre>DEST[63:0] := SRC[63:0]
DEST[MAXVL-1:64] := 0
</pre>
<h3 id="vmovd--evex-encoded-version-when-destination-is-an-xmm-register-">VMOVD (EVEX-Encoded Version When Destination is an XMM Register)<a class="anchor" href="#vmovd--evex-encoded-version-when-destination-is-an-xmm-register-">
</a></h3>
<pre>DEST[31:0] := SRC[31:0]
DEST[MAXVL-1:32] := 0
</pre>
<h3 id="vmovq--evex-encoded-version-when-destination-is-an-xmm-register-">VMOVQ (EVEX-Encoded Version When Destination is an XMM Register)<a class="anchor" href="#vmovq--evex-encoded-version-when-destination-is-an-xmm-register-">
</a></h3>
<pre>DEST[63:0] := SRC[63:0]
DEST[MAXVL-1:64] := 0
</pre>
<h2 id="intel-c-c++-compiler-intrinsic-equivalent">Intel C/C++ Compiler Intrinsic Equivalent<a class="anchor" href="#intel-c-c++-compiler-intrinsic-equivalent">
</a></h2>
<pre>MOVD __m64 _mm_cvtsi32_si64 (int i )
</pre>
<pre>MOVD int _mm_cvtsi64_si32 ( __m64m )
</pre>
<pre>MOVD __m128i _mm_cvtsi32_si128 (int a)
</pre>
<pre>MOVD int _mm_cvtsi128_si32 ( __m128i a)
</pre>
<pre>MOVQ __int64 _mm_cvtsi128_si64(__m128i);
</pre>
<pre>MOVQ __m128i _mm_cvtsi64_si128(__int64);
</pre>
<pre>VMOVD __m128i _mm_cvtsi32_si128( int);
</pre>
<pre>VMOVD int _mm_cvtsi128_si32( __m128i );
</pre>
<pre>VMOVQ __m128i _mm_cvtsi64_si128 (__int64);
</pre>
<pre>VMOVQ __int64 _mm_cvtsi128_si64(__m128i );
</pre>
<pre>VMOVQ __m128i _mm_loadl_epi64( __m128i * s);
</pre>
<pre>VMOVQ void _mm_storel_epi64( __m128i * d, __m128i s);
</pre>
<h2 id="flags-affected">Flags Affected<a class="anchor" href="#flags-affected">
</a></h2>
<p>None.</p>
<h2 class="exceptions" id="simd-floating-point-exceptions">SIMD Floating-Point Exceptions<a class="anchor" href="#simd-floating-point-exceptions">
</a></h2>
<p>None.</p>
<h2 class="exceptions" id="other-exceptions">Other Exceptions<a class="anchor" href="#other-exceptions">
</a></h2>
<p>Non-EVEX-encoded instruction, see <span class="not-imported">Table 2-22</span>, “Type 5 Class Exception Conditions.”</p>
<p>EVEX-encoded instruction, see <span class="not-imported">Table 2-57</span>, “Type E9NF Class Exception Conditions.”</p>
<p>Additionally:</p>
<table>
<tr>
<td rowspan="2">#UD</td>
<td>If VEX.L = 1.</td></tr>
<tr>
<td>If VEX.vvvv != 1111B or EVEX.vvvv != 1111B.</td></tr></table><footer><p>
This UNOFFICIAL, mechanically-separated, non-verified reference is provided for convenience, but it may be
inc<span style="opacity: 0.2">omp</span>lete or b<sub>r</sub>oke<sub>n</sub> in various obvious or non-obvious
ways. Refer to <a href="https://software.intel.com/en-us/download/intel-64-and-ia-32-architectures-sdm-combined-volumes-1-2a-2b-2c-2d-3a-3b-3c-3d-and-4">Intel® 64 and IA-32 Architectures Software Developers Manual</a> for anything serious.
</p></footer></body></html>