movzxd

Move doubleword with zero extension

Copies a doubleword source into the destination, zeroing the high bits when the destination is wider.

386 and later

Intel's reference: MOV

CFPFAFZFSFDFOF –––––––
  • Changes no flag

Forms

Operands

reg
The destination register. Its width is selected independently of the source width; widening uses a larger destination.
r/m32
A 32-bit general-purpose register or doubleword in memory, for example eax or dword [rsi].

NASM assembles movzxd rax, ebx as mov eax, ebx: every 32-bit register write already clears the high 32 bits.

NASM also accepts a 16-bit destination, such as movzxd ax, ebx, which retains the low 16 bits and leaves the rest of rax unchanged. The equal-width 32-bit alias is unavailable in 64-bit mode; use an ordinary mov for that copy.

global _start

section .text
_start:
        mov rax, 12
        mov rbx, 5
        mov rcx, 3
        mov rsi, 9

        movzxd rax, ebx

        mov rax, 60         ; syscall 60: exit
        xor rdi, rdi
        syscall