Sign extends rax into rdx:rax, filling rdx with copies of the sign bit. idiv divides that 128 bit pair, so signed division is written as cqo then idiv; forgetting the cqo leaves whatever rdx happened to hold in the high half and the result is nonsense rather than an error.
cqo
x86-64 and laterConvert Quadword to Octaword
cqoLoading...
Forms
Every form of cqo the assembler accepts, from NASM's own instruction table.
The second column is the processor that introduced the form; a badge marks a form that needs
an extension, that is lockable, or that long mode dropped.
| Form | Since | Notes |
|---|---|---|
| cqo | x86-64 | long |