I study programming in Assembler and just can not understand:

In what situations is it better to use lea to achieve a higher program execution speed, and in which situations - to manage with standard arithmetic operations (add / sub / div / mul / ...)?

  • one
    There is no universal answer to such a question. x86 (by the way, you forgot to specify x86 in tags) works on a huge number of very different hardware implementations. Talking about micro-optimization makes little sense without specifying a specific processor model. Specifically, your question was actively discussed 7-8 years ago in the English-speaking SO. Google is easy to find. - tum_
  • @tum_, okay, google it, thanks. By the way. And what about x64? Does lea work on it in any other way? - user263096 pm
  • one
    Are you about tags? Yes, and x64 would fit :) Under the ассемблер tag, people ask about ARM, and about MIPS, and about a lot more. So that by the form of instructions not to guess what it is about - it is better to indicate. And the link here is stackoverflow.com/questions/6323027/lea-or-add-instruction - tum_

0