x86-64 AT&T versus Intel syntax

x86 (both 32- and 64-bit) has two alternative syntaxes available for it. Some assemblers can only work with one or the other, while a few can work with both. We will primarily use the AT&T syntax in this course, but you should be aware of the Intel syntax.

This table summarizes the main differences between AT&T and Intel syntax:

AT&T Intel
Comments // ;
Instructions Tagged with operand sizes: addq Untagged add
Registers %eax,%ebx, etc. eax, ebx, etc.
Immediates $0x100 0x100
Indirect (%eax) [eax]
General indirect displacement(reg, reg, scale) [base + reg + reg * scale + displacement]

Note that in the generalized indirect format, the Intel syntax will computer base + displacement for you, as the opcodes really only allow a single immediate displacement. In the AT&T syntax, you have to do this yourself, using the result of the sum as the third value in the parenthesis.

The main difference between Intel and AT&T syntax is that AT&T makes the sizes of the instruction operands explicit by appending suffixes to the instruction name, whereas Intel leaves the size implicit.