LEA

Contents

LEA#

lea (Load Effective Address) computes an addressing-mode expression without dereferencing. Use it as a fast arithmetic instruction; the operator gets base + index*scale + disp in one instruction with no memory traffic.

lea     rax, [rbx + rcx*4 + 8] ; rax = rbx + rcx*4 + 8 (no memory access)

Compute a pointer to an array element.

lea     rdi, [arr + rsi*8]     ; &arr[rsi] for an 8-byte element

Multiply by a constant cheaply (the assembler picks scale).

lea     rax, [rdi + rdi*4]     ; rax = rdi * 5

References#

  • Addressing modes for the operand forms lea accepts.

  • Operators for imul and the integer-arithmetic surface lea substitutes for.