Some differences:
- Source order. To store 5 into eax, Intel syntax would use
- Code: Select all
mov eax, 5
- Code: Select all
movl $5, %eax
- Decorations. Immediate are written with a $ in AT&T, and registers with a %. Intel doesn't use these decorations. (See above for examples.)
- Operand lengths. AT&T combines a suffix with the instruction mnemonic, while Intel uses qualifiers on the operand. To load a 1-byte value at the address in eax into ebx, Intel syntax would use
- Code: Select all
mov ebx, byte ptr [eax]
- Code: Select all
movb (%eax), %ebx
- Memory offsets are written differently. A simple offset (e.g. a structure or array access) would, in Intel syntax be
- Code: Select all
mov ebx, [eax + 4]
- Code: Select all
movl 4(%eax), %ebx
- Code: Select all
mov ecx, fs:[eax + ebx * 8 + 4]
- Code: Select all
mov %fs:4(%eax, %ebx, 8), %ecx
Note: don't trust me on any of this. I don't know if I've actually written x86 in either syntax, though I have done a lot of reading it in Intel syntax. I prefer it a lot; I think it's much cleaner and makes more sense.
