Intel vs AT&T Syntax: How to Read Both Without Getting Lost
Read x86 assembly in Intel and AT&T syntax with a six-rule translation method, a side-by-side table of operands and addressing, and a guide to choosing one.

Open a GCC listing and you read movl $5, -4(%rbp). Open the Intel manual and the same instruction is mov dword ptr [rbp - 4], 5. Neither is wrong, the machine code is c7 45 fc 05 00 00 00 either way, and the two notations are about equally old. The trouble is that tutorials, debuggers, kernel sources and manuals disagree about which to use, so an assembly reader has to be fluent in both. This post gives a small set of rules that translate any line from one to the other, a table of the places where the meaning shifts, and a decision table for choosing a syntax for your own work. The examples use x86-64, GNU binutils 2.42 and NASM 2.16. The full tables for every construct are in the cornerstone guide to NASM, GAS and assembler syntax; this post is the short method.
The six rules
Every line translates by applying these in order.
Reverse the operands. Intel is
op dest, src; AT&T isop src, dest. For instructions with three operands, such asimul rax, rbx, 10, AT&T reverses the whole list:imulq $10, %rbx, %rax.Add or drop the register prefix. AT&T writes
%rax, Intel writesrax.Add or drop the immediate prefix. AT&T writes
$5, Intel writes5. In AT&T the same$also marks a symbol's address:$msgis the address ofmsg.Convert the size. AT&T puts a suffix on the mnemonic,
movb,movw,movl,movq. Intel puts a keyword before the memory operand when needed,byte ptr,word ptr,dword ptr,qword ptr. When a register operand already fixes the size, both sides may leave it out.Rewrite the memory operand. Intel is
[base + index*scale + disp]; AT&T isdisp(base,index,scale).Mark indirect branches. AT&T writes
*before an indirect target:call *%rax. Intel writescall raxwith no marker.
Apply them to the opening example in AT&T, movl $5, -4(%rbp). Reverse the operands: -4(%rbp), $5. Drop the prefixes: -4(rbp), 5. The l suffix means 32 bits, so the memory needs dword ptr. Rewrite the memory operand as [rbp - 4]. The result is mov dword ptr [rbp - 4], 5. Going the other way is the same list run backwards.
Side by side
The table below covers what appears in real listings. The Intel column uses the dword ptr spelling that objdump -M intel prints; NASM drops ptr and writes dword [rbp - 4].
| Meaning | Intel | AT&T |
|---|---|---|
| Register copy | mov rax, rbx | movq %rbx, %rax |
| Immediate load | mov eax, 60 | movl $60, %eax |
| Load from memory | mov eax, dword ptr [rbx] | movl (%rbx), %eax |
| Store to memory | mov dword ptr [rbx], eax | movl %eax, (%rbx) |
| Store an immediate | mov dword ptr [rbx], 7 | movl $7, (%rbx) |
| Displacement | mov rax, [rbp - 8] | movq -8(%rbp), %rax |
| Index with scale | mov eax, [rdi + rcx*4] | movl (%rdi,%rcx,4), %eax |
| Full form | mov eax, [rdi + rcx*4 + 16] | movl 16(%rdi,%rcx,4), %eax |
| Address of a symbol | mov edi, offset msg | movl $msg, %edi |
| RIP-relative address | lea rsi, [rip + msg] | leaq msg(%rip), %rsi |
| Zero-extending load | movzx eax, byte ptr [rbx] | movzbl (%rbx), %eax |
| Sign-extending load | movsx rax, dword ptr [rbx] | movslq (%rbx), %rax |
| Indirect call | call rax | call *%rax |
| Indirect call through memory | call qword ptr [rax + 8] | call *8(%rax) |
| Compare | cmp rax, rbx | cmpq %rbx, %rax |
| Segment access | mov rax, qword ptr fs:[0x28] | movq %fs:0x28, %rax |
Two extension mnemonics are worth memorizing because they look unrelated. movzx and movsx become movz and movs plus two size letters, source then destination: movzbl is "move zero-extended byte to long". And cdqe, cqo and cdq become cltq, cqto and cltd.
The three places where meaning, not just spelling, changes
Most of the translation is mechanical. Three places are not, and they are where people get lost.
The first is the operand order of comparisons. cmp rax, rbx followed by jl jumps when RAX is less than RBX. In AT&T the same test is cmpq %rbx, %rax, and anyone who translates the operands without thinking about the jump inverts the condition. The cure is to read AT&T comparisons from right to left: the right operand is the one being tested.
The second is what a bare symbol means. In NASM, mov rax, msg loads the address of msg, and mov rax, [msg] loads the contents. In AT&T, movq $msg, %rax loads the address and movq msg, %rax loads the contents. In GAS's Intel mode, selected with .intel_syntax noprefix, a bare symbol is a memory reference, so mov rax, msg loads the contents and mov rax, offset msg loads the address. That makes GAS Intel syntax and NASM the same in shape and opposite in this one rule.
The third is operand size inference. AT&T infers the suffix from a register operand, so mov %eax, (%rbx) is accepted as movl. When there is no register, as in $5, (%rbx), there is nothing to infer from and GAS reports ambiguous operand size. Intel needs the keyword in the same cases and NASM reports operation size not specified.
Reading real compiler output
Compile a tiny function and read both outputs. The source:
long sum3(long *p, long i)
{
return p[i] + p[i + 1] + p[i + 2];
}gcc -O2 -S sum.c -o sum-att.s
gcc -O2 -S -masm=intel sum.c -o sum-intel.sGCC 14 produces, in AT&T syntax and then Intel syntax:
sum3:
movq (%rdi,%rsi,8), %rax
addq 8(%rdi,%rsi,8), %rax
addq 16(%rdi,%rsi,8), %rax
retsum3:
mov rax, QWORD PTR [rdi+rsi*8]
add rax, QWORD PTR [rdi+8+rsi*8]
add rax, QWORD PTR [rdi+16+rsi*8]
retRead the AT&T version with the rules: each (%rdi,%rsi,8) is [rdi + rsi*8], the leading 8 or 16 is the displacement, %rax is the destination because it comes last, and the q suffix says 64-bit. Both listings show three loads from the array indexed by RSI scaled by 8, summed in RAX, which is the C function exactly. If you can read one listing, the second is a check on your reading.
Seeing both from one binary
objdump prints either syntax from the same object, so you can learn by comparing:
objdump -d --no-show-raw-insn sum.o
objdump -d --no-show-raw-insn -M intel sum.oGDB defaults to AT&T and switches with set disassembly-flavor intel. perf annotate accepts --asm-raw and -M intel. So whichever tool shows you code, you can ask it for the dialect you read faster, and check your translation against its output.
Choosing a syntax for your own code
The notation matters less than being consistent inside a file. These are the situations and what to pick.
| Situation | Choose | Why |
|---|---|---|
| Writing code that lives in a GCC or Linux kernel tree | AT&T | Matches the rest of the tree, shares macros and CFI with compiler output |
| Following the Intel manuals or most online tutorials | Intel (NASM) | The manual's examples copy straight in |
| Inline assembly in C with GCC | AT&T by default, or -masm=intel for the whole file | Extended asm templates assume one dialect per translation unit |
| Writing code for Windows with MASM | Intel (MASM syntax) | MASM is Intel-style with its own directives |
| Reading a disassembly in a debugger | Whichever you read fastest | The tools can print either |
| Teaching beginners | Intel | Fewer symbols per instruction and destination-first order matches = |
| Porting between toolchains | Keep the source dialect, change the assembler | Rewriting syntax and logic together hides bugs |
If you work in a Linux codebase long enough, you will end up reading AT&T whether you like it or not, because that is what perf, kernel oops disassembly and most compiler explorer defaults use. A comfortable plan is to write in Intel, read AT&T with the six rules, and let the debugger translate when the rules slip.
Common slips and how to spot them
A few patterns reveal that someone is reading one dialect as the other. An instruction like mov $0x10, %rax read as Intel looks like a move from $0x10 into %rax with the order mixed up, but the % and $ give it away: if any operand has either prefix, it is AT&T and the destination is last. An instruction like sub rsp, 8 has no prefixes and the destination first, so RSP decreases by 8. Reading subq $8, %rsp as "subtract RSP from 8" instead of "RSP minus 8" is the most common beginner error, and it is cured by remembering that the last operand is always what changes.
A comparison that seems backwards in AT&T is usually correct. cmpl $10, %eax followed by jg jumps when EAX is greater than 10, because the test is eax - 10. Written in Intel, it reads cmp eax, 10, and jg jumps if EAX is greater than 10. The AT&T operand order is only confusing if you read it left to right as a sentence.
Memory operands with only a displacement are another source of mistakes. movl 0x601040, %eax in AT&T loads from the absolute address 0x601040, not the immediate value, because there is no $. The Intel spelling mov eax, dword ptr ds:0x601040 makes the dereference visible, and GDB prints exactly that form. If an AT&T line has a number with no $ in an operand slot, it is an address.


