Reputation: 3221
lea (%edx,%eax,1),%eax
Anyone knows the usage of (%edx,%eax,1)
?
Upvotes: -1
Views: 85
Reputation: 654
The lea instruction (Load Effective Address) is used to calculate an address in the same manner as indirect addressing and to save the resulting address instead of reading what is in the address. In the case of AT&T syntax, (%edx, %eax, 1) means (%edx + %eax * 1). In this case it is, as Laurent G stated, the equivalent of add %edx, %eax. However, by using other factors (a displacement before the parenthesis and a number other than 1) you can do slightly more complicated math.
This type of addressing is typically used to handle arrays, but the lea instruction does not validate that the resulting address is valid, so you can use this as a short circuit way to do a calculation that would take multiple instructions.
Upvotes: 0
Reputation: 3184
(%edx,%eax,1)
is an operand address corresponding to edx+eax*1
In other words, the instruction being lea
, this is simply an add statement equivalent to eax += edx
Upvotes: 1
Reputation: 13432
Take a look at GAS address operand syntax, it seems to be what you're looking for.
Upvotes: 0