0
mov rax, 2
mov rbx, 2
mul rbx, rax //This does not exist

How would I have to write the above example without using any additional mov instructions?

Im using x86-64 assembly.

stht55
  • 390
  • 1
  • 8
  • 3
    Do you want the high-half result anywhere (what `mul` puts in RDX)? If so, you need one-operand `mul` (or BMI2 `mulx`). If not, use `imul rdi, rsi` or whatever, like a compiler would. – Peter Cordes May 01 '22 at 10:15
  • If you want a 64-bit result, use `imul rbx, rax`. If you want a 128-bit result, you have to use `mul rbx`, which puts the result in rdx:rax. – prl May 01 '22 at 11:09

0 Answers0