8

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.

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
DomX23
  • 867
  • 5
  • 13
  • 26
  • For reference: [Address operand syntax](http://en.wikibooks.org/wiki/X86_Assembly/GAS_Syntax#Address_operand_syntax). – outis Sep 25 '11 at 09:43

1 Answers1

15

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.

harold
  • 61,398
  • 6
  • 86
  • 164