# `cwd`

[x86-64 Documentation](https://asm-editor.specy.app/documentation/x86.md) › [Instructions](https://asm-editor.specy.app/documentation/x86/instruction.md)

Web page: https://asm-editor.specy.app/documentation/x86/instruction/cwd

**Sign-extend ax into dx:ax**

Category: Arithmetic

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](https://intel.github.io/SDM/instruction/CWD-CDQ-CQO.html)

## Flags

| Flag | Effect |
| --- | --- |
| CF | not changed |
| PF | not changed |
| AF | not changed |
| ZF | not changed |
| SF | not changed |
| DF | not changed |
| OF | not changed |

## Forms

- `cwd`

## Description

The rest of `rax` and `rdx` is unchanged.

## Example

```x86
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
```
