cwd

Sign-extend ax into dx:ax

Sign-extends ax into dx:ax, filling dx with copies of the sign bit of ax.

8086 and later

Intel's reference: CWD/CDQ/CQO

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

Forms

  • cwd

The rest of rax and rdx is unchanged.

global _start

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

        cwd

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