0

I'm looking at Oracle's documentation for x86, and the documentation for cltd says:

%eax -> %edx:%eax

So what I'm asking is, what is the instruction that does this:

%rax -> %rdx:%rax

I think it's cqto or cqo but is this correct?

Dovahkiin
  • 946
  • 14
  • 25
  • 3
    Misread the question at first. Yes `cqto` (or `cqo`) is what you are looking for. – Michael Petch May 30 '18 at 23:38
  • Have you tried assembling `cqto`? As far as I'm concerned, that is indeed correct. – fuz May 30 '18 at 23:40
  • [My answer on What does cltq do in assembly?](https://stackoverflow.com/a/45386217) runs down the full details on Intel vs. AT&T syntax for cdq (cltd) / cqo (cqto) and so on, and what they do. **Yes, `cqto`, aka Intel CQO, sign extends RAX into RDX:RAX.** Modern GAS probably accepts either mnemonic. – Peter Cordes May 30 '18 at 23:41

0 Answers0