Failures in assembly and motion difference

leal(%eax,%ecx,4), %edx 

as I read from my book on computer systems, if there are such objects that $ eax contains the value x, and% ecx contains y, then this means that x + 4y is placed in% edx.

then if it

 movl(%eax,%ecx,4), %edx 

isn't that the same with the leal expression above?

As I know, leal creates an address that can be referenced without referring to it as movl, but

when I saw leal(%eax,%ecx,4), %edx , putting x+4y in the edx doesn t it mean that it 'referenced' % eax and % ecx` and the extracted value of x and y to use the calculation

  • doesn`t it "()" mean 'referenced' ??
+2
assembly x86 att
Nov 22 '12 at 16:50
source share
1 answer

LEA loads the effective address generated by calculating the address into the register. MOV moves something somewhere, when SIB addressing is used as the source operand, it moves everything that is at the address generated by the address calculation to the target operand.

So:

 leal (%eax,%ecx,4), %edx ← moves %eax+%ecx*4 into %edx movl (%eax,%ecx,4), %edx ← moves whatever is at address %eax+%ecx*4 into %edx 
+11
Nov 22 '12 at 22:37
source share



All Articles