I'm not exactly sure what this add
instruction is doing:
add 0x0(%rbp,%rbx,4),%eax
If it were:
add %rbx,%eax
I know it would add the contents of rbx
and the contents in eax
and store them back into eax
. However, the 0x0(%rbp,%rbx,4)
is throwing me off.
The add instruction adds together its two operands, storing the result in its first operand. Note, whereas both operands may be registers, at most one operand may be a memory location. The inc instruction increments the contents of its operand by one. The dec instruction decrements the contents of its operand by one.
ADD is not always faster than INC , but it is almost always at least as fast (there are a few corner cases on certain older micro-architectures, but they are exceedingly rare), and sometimes significantly faster.
CX is known as the count register, as the ECX, CX registers store the loop count in iterative operations. DX is known as the data register. It is also used in input/output operations. It is also used with AX register along with DX for multiply and divide operations involving large values.
The LEA (Load Effective Address) instruction is a way of obtaining the address which arises from any of the Intel processor's memory addressing modes. it moves the contents of the designated memory location into the target register.
That's because it's stupid&confusing AT&T syntax.
In normal Intel syntax it's add eax,dword ptr[rbp+4*rbx+0]
ie add the dword at rbp+4*rbx to eax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With