x86 64 Reference Sheet GNU assembler format Instructions Data movement movq Src Dest movsbq Src Dest Dest quad Src byte sign extend movzbq Src Dest Dest quad Src byte zero extend Dest Src Negative Equal zero Conditional move cmove Src Dest cmovne Src Dest Not equal not zero cmovs Src Dest cmovns Src Dest Nonnegative cmovg Src Dest cmovge Src Dest Greater or equal signed cmovl Src Dest cmovle Src Dest Less or equal signed cmova Src Dest cmovae Src Dest Above or equal unsigned cmovb Src Dest cmovbe Src Dest Below or equal unsigned Above unsigned Below unsigned Greater signed Less signed Control transfer cmpq Src2 Src1 testq Src2 Src1 jmp label je label jne label js label jns label jg label jge label jl label jle label ja label jb label pushq Src popq Dest call label ret Sets CCs Src1 Src2 Sets CCs Src1 Src2 jump jump equal jump not equal jump negative jump non negative jump greater signed jump greater or equal signed jump less signed jump less or equal signed jump above unsigned jump below unsigned rsp rsp 8 Mem rsp Src Dest Mem rsp rsp rsp 8 push address of next instruction jmp label rip Mem rsp rsp rsp 8 Arithmetic operations Dest address of Src leaq Src Dest Dest Dest 1 incq Dest Dest Dest 1 decq Dest Dest Dest Src addq Src Dest Dest Dest Src subq Src Dest imulq Src Dest Dest Dest Src xorq Src Dest Dest Dest Src Dest Dest Src orq Src Dest Dest Dest Src andq Src Dest Dest Dest negq Dest Dest Dest notq Dest Dest Dest k salq k Dest Dest Dest k arithmetic sarq k Dest Dest Dest k logical shrq k Dest Addressing modes Immediate val Val val constant integer value movq 7 rax Normal R Mem Reg R R register R speci es memory address movq rcx rax Displacement D R Mem Reg R D R register speci es start of memory region D constant displacement D speci es o set movq 8 rdi rdx Indexed D Rb Ri S Mem Reg Rb S Reg Ri D D constant displacement 1 2 or 4 bytes Rb base register any of 8 integer registers Ri index register any except esp S scale 1 2 4 or 8 movq 0x100 rcx rax 4 rdx byte Instruction su xes b w word 2 bytes long 4 bytes l quad 8 bytes q Condition codes CF Carry Flag ZF Zero Flag SF Sign Flag OF Over ow Flag Integer registers rax Return value rbx Callee saved 4th argument rcx 3rd argument rdx rsi 2nd argument rdi 1st argument rbp Callee saved Stack pointer rsp 5th argument r8 r9 6th argument Scratch register r10 r11 Scratch register r12 Callee saved r13 Callee saved r14 Callee saved r15 Callee saved
View Full Document