Is there a difference between movq and leaq instruction in this example?

32 Views Asked by At
  1. movq %src, %dest

  2. leaq (%src), %dest

I think the two instructions fulfill the same purpose, copying the value of src to dest. I want to know if I'm right or if not, what the difference is between the two.

Let src = 0x100 and 0x100 = 3.

This is what I thought. The first instruction 1. movq will copy 0x100 to dest. The second instruction 2. leaq will copy the reference of 3 which is 0x100 to dest.

0

There are 0 best solutions below