Qt Creator Assembly Output - LEA instruction [duplicate]
Qt shows me assembler (x86) command this way:
lea (%edx,%eax,1),%ecx
What does it means? I can't find description of this instruction that fits.
UPD
Thanks. So, am i correct?
0) movl $0x0,-0x14(%ebp)
1) mov -0x14(%ebp),%eax
2) inc %eax
3) mov %eax,-0x14(%ebp)
4) mov -0x14(%ebp),%eax
5) inc %eax
6) mov %eax,-0x14(%ebp)
7) mov -0x14(%ebp),%edx
8) mov -0x14(%ebp),%eax
9) lea (%edx,%eax,1),%ecx
10) mov %ecx,-0x14(%ebp)
11) inc %edx
12) mov %edx,-0x14(%ebp)
13) inc %eax
14) mov %eax,-0x14(%ebp)
Makes this("i" is "-0x14(%ebp)"):
0) i=0
1) eax=0
2) eax=1
3) i=1
4) eax=1
5) eax=2
6) i=2
7) edx=2
8) eax=2
9) ecx=2; ecx=4
10) i=4
11) edx=3
12) i=3
13) eax=3
14) i=3
LEA
stands for Load Effective Address. It's used to perform an address computation, but then rather than accessing the value at that address it stores the computed address in the destination register.
In this case, it's storing the value of EDX + (EAX * 1) into ECX. This is an alternative to the two-instruction sequence
movl %edx, %ecx
addl %eax, %ecx
精彩评论