GCC made me some assembly code, and inside theres this statement:
lea eax, [ebx+eax]
(Intel Syntax) Just curious, what would the difference between that, and:
add eax, ebx
Be?
eax, and ebx contains return values from functions :)
mov eax, DWORD PTR [ebp+8]
mov DWORD PTR [esp], eax
call CALC1
mov ebx, eax.
mov eax, DWORD PTR [ebp+8]
mov DWORD PTR [esp], eax
call CALC2
lea eax, [ebx+eax]
One difference that immediately springs to mind is that lea
doesn't affect the flags, whereas add
does.
It is impossible to say without seeing the rest of the assembly code whether this is of any relevance. It could simply be an artefact of the GCC's code generator (i.e. it could in fact be producing code for a more general case or just using lea
as a more flexible add
.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With