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

浙公网安备 33010602011771号