0% found this document useful (0 votes)
326 views1 page

x86-64 Reference Sheet (GNU Assembler Format) : Arithmetic Operations

This document provides a reference sheet for the x86-64 instruction set in GNU assembler format. It lists various arithmetic, logical, data movement, and control transfer instructions. It also describes addressing modes including immediate, displacement, and indexed addressing using registers. Condition codes and integer registers are also defined.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
326 views1 page

x86-64 Reference Sheet (GNU Assembler Format) : Arithmetic Operations

This document provides a reference sheet for the x86-64 instruction set in GNU assembler format. It lists various arithmetic, logical, data movement, and control transfer instructions. It also describes addressing modes including immediate, displacement, and indexed addressing using registers. Condition codes and integer registers are also defined.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

x86-64 Reference Sheet (GNU assembler format)

Instructions Arithmetic operations Instruction suffixes


leaq Src, Dest Dest = address of Src b byte
Data movement incq Dest Dest = Dest + 1 w word (2 bytes)
movq Src, Dest Dest = Src decq Dest Dest = Dest − 1 l long (4 bytes)
movsbq Src,Dest Dest (quad) = Src (byte), sign-extend addq Src, Dest Dest = Dest + Src q quad (8 bytes)
movzbq Src,Dest Dest (quad) = Src (byte), zero-extend subq Src, Dest Dest = Dest − Src
imulq Src, Dest Dest = Dest ∗ Src
Conditional move xorq Src, Dest Dest = Dest ˆ Src Condition codes
orq Src, Dest Dest = Dest | Src CF Carry Flag
cmove Src, Dest Equal / zero
andq Src, Dest Dest = Dest & Src ZF Zero Flag
cmovne Src, Dest Not equal / not zero
negq Dest Dest = − Dest SF Sign Flag
cmovs Src, Dest Negative
notq Dest Dest = ∼ Dest OF Overflow Flag
cmovns Src, Dest Nonnegative
salq k, Dest Dest = Dest ≪ k
cmovg Src, Dest Greater (signed >)
sarq k, Dest Dest = Dest ≫ k (arithmetic)
cmovge Src, Dest Greater or equal (signed ≥) Integer registers
shrq k, Dest Dest = Dest ≫ k (logical)
cmovl Src, Dest Less (signed <)
cmovle Src, Dest Less or equal (signed ≤) %rax Return value
cmova Src, Dest Above (unsigned >) Addressing modes %rbx Callee saved
cmovae Src, Dest Above or equal (unsigned ≥) %rcx 4th argument
cmovb Src, Dest Below (unsigned <) • Immediate %rdx 3rd argument
cmovbe Src, Dest Below or equal (unsigned ≤) $val Val %rsi 2nd argument
val: constant integer value %rdi 1st argument
movq $7, %rax %rbp Callee saved
Control transfer
• Normal %rsp Stack pointer
cmpq Src2, Src1 Sets CCs Src1 Src2
(R) Mem[Reg[R]] %r8 5th argument
testq Src2, Src1 Sets CCs Src1 & Src2
R: register R specifies memory address %r9 6th argument
jmp label jump
movq (%rcx), %rax %r10 Scratch register
je label jump equal
%r11 Scratch register
jne label jump not equal
• Displacement %r12 Callee saved
js label jump negative
D(R) Mem[Reg[R]+D] %r13 Callee saved
jns label jump non-negative
R: register specifies start of memory region %r14 Callee saved
jg label jump greater (signed >)
D: constant displacement D specifies offset %r15 Callee saved
jge label jump greater or equal (signed ≥)
movq 8(%rdi), %rdx
jl label jump less (signed <)
jle label jump less or equal (signed ≤) • Indexed
ja label jump above (unsigned >) D(Rb,Ri,S) Mem[Reg[Rb]+S*Reg[Ri]+D]
jb label jump below (unsigned <) D: constant displacement 1, 2, or 4 bytes
pushq Src %rsp = %rsp 8, Mem[%rsp] = Src Rb: base register: any of 8 integer registers
popq Dest Dest = Mem[%rsp], %rsp = %rsp + 8 Ri: index register: any, except %esp
call label push address of next instruction, jmp label S: scale: 1, 2, 4, or 8
ret %rip = Mem[%rsp], %rsp = %rsp + 8 movq 0x100(%rcx,%rax,4), %rdx

You might also like