System: LEA vs. MOV

The difference between mov and lea is mov does dereference while lea does not.

movq (%rax, %rbx, 2), %rsi 
C:  rsi = *(2 * rbx + rax)

leaq (%rax, %rbx, 2), %rsi
C: rsi = (2 * rbx + rax) => does not dereference 

Use mov when you need to access the value in the computed address

Use lea when you don't need the value, you only need the address

原文地址:https://www.cnblogs.com/JasperZhao/p/14128162.html