User Guide

ii Contents
AMD64 Technology 24592—Rev. 3.15—November 2009
3 General-Purpose Programming ................................................23
3.1 Registers..................................................................23
Legacy Registers ...........................................................24
64-Bit-Mode Registers.......................................................26
Implicit Uses of GPRs .......................................................30
Flags Register .............................................................33
Instruction Pointer Register ...................................................36
3.2 Operands .................................................................36
Data Types ................................................................36
Operand Sizes and Overrides..................................................39
Operand Addressing ........................................................40
Data Alignment ............................................................40
3.3 Instruction Summary ........................................................41
Syntax ...................................................................41
Data Transfer ..............................................................42
Data Conversion ...........................................................46
Load Segment Registers .....................................................49
Load Effective Address ......................................................49
Arithmetic ................................................................50
Rotate and Shift ............................................................52
Compare and Test ..........................................................53
Logical ...................................................................56
String ....................................................................56
Control Transfer............................................................58
Flags.....................................................................62
Input/Output...............................................................63
Semaphores ...............................................................64
Processor Information .......................................................65
Cache and Memory Management ..............................................66
No Operation ..............................................................66
System Calls ..............................................................67
3.4 General Rules for Instructions in 64-Bit Mode ....................................67
Address Size ..............................................................67
Canonical Address Format....................................................68
Branch-Displacement Size....................................................68
Operand Size ..............................................................68
High 32 Bits ...............................................................68
Invalid and Reassigned Instructions ............................................69
Instructions with 64-Bit Default Operand Size ....................................70
3.5 Instruction Prefixes .........................................................71
Legacy Prefixes ............................................................71
REX Prefixes ..............................................................74
3.6 Feature Detection...........................................................74
Feature Detection in a Virtualized Environment ...................................76
3.7 Control Transfers ...........................................................76
Overview .................................................................76
Privilege Levels ............................................................76