The x86 instruction set refers to the set of instructions that x86 -compatible microprocessors support. The instructions are usually part of an executable program, often stored as a computer file and executed on the processor.
26-426: The x86 instruction set has been extended several times, introducing wider registers and datatypes as well as new functionality. Below is the full 8086 / 8088 instruction set of Intel (81 instructions total). These instructions are also available in 32-bit mode, they operate instead on 32-bit registers ( eax , ebx , etc.) and values instead of their 16-bit ( ax , bx , etc.) counterparts. The updated instruction set
52-419: A memory address e.g. DEC PDP-10 , ICT 1900 . Almost all computers, whether load/store architecture or not, load items of data from a larger memory into registers where they are used for arithmetic operations , bitwise operations , and other operations, and are manipulated or tested by machine instructions . Manipulated items are then often stored back to main memory, either by the same instruction or by
78-446: A shadow stack (CET_SS), and indirect branch tracking (CET_IBT). The XSAVE instruction set extensions are designed to save/restore CPU extended state (typically for the purpose of context switching ) in a manner that can be extended to cover new instruction set extensions without the OS context-switching code needing to understand the specifics of the new extensions. This is done by defining
104-610: A 16/32-bit offset rather than just an 8-bit offset. Offset part is stored in destination register argument, segment part in FS/GS/SS segment register as indicated by the instruction mnemonic. Moves to the CR3 control register are serializing and will flush the TLB . On Pentium and later processors, moves to the CR0 and CR4 control registers are also serializing. On Pentium and later processors, moves to
130-656: A basic arrangement known as the von Neumann architecture , first proposed by the Hungarian-American mathematician John von Neumann . It is also noteworthy that the number of registers on GPUs is much higher than that on CPUs. (64 elements) (if FP present) 8 (if SSE/MMX present) (if AVX-512 available) (if FP present) + 2 × 32 Vector (dedicated vector co-processor located nearby its GPU) 16 in G5 and later S/390 models and z/Architecture (if FP present) (if FPP present) (up to 32) The number of registers available on
156-477: A data size of 16 bits will cause only the bottom 16 bits of the 32-bit general-purpose registers to be modified – the top 16 bits are left unchanged.) The default OperandSize and AddressSize to use for each instruction is given by the D bit of the segment descriptor of the current code segment - D=0 makes both 16-bit, D=1 makes both 32-bit. Additionally, they can be overridden on a per-instruction basis with two new instruction prefixes that were introduced in
182-505: A dividend for the 32-bit IDIV (signed divide) instruction. Instruction is serializing. Second operand specifies which bit of the first operand to test. The bit to test is copied to EFLAGS . CF . Second operand specifies which bit of the first operand to test and set. Second operand specifies which bit of the first operand to test and clear. Second operand specifies which bit of the first operand to test and toggle. Differs from older variants of conditional jumps in that they accept
208-604: A new mnemonic in Intel syntax when used with a 64 bit operand size. Bit manipulation instructions. For all of the VEX-encoded instructions defined by BMI1 and BMI2, the operand size may be 32 or 64 bits, controlled by the VEX.W bit – none of these instructions are available in 16-bit variants. Intel CET (Control-Flow Enforcement Technology) adds two distinct features to help protect against security exploits such as return-oriented programming :
234-511: A processor and the operations that can be performed using those registers has a significant impact on the efficiency of code generated by optimizing compilers . The Strahler number of an expression tree gives the minimum number of registers required to evaluate that expression tree. List of discontinued x86 instructions Too Many Requests If you report this error to the Wikimedia System Administrators, please include
260-464: A series of state-components , each with a size and offset within a given save area, and each corresponding to a subset of the state needed for one CPU extension or another. The EAX=0Dh CPUID leaf is used to provide information about which state-components the CPU supports and what their sizes/offsets are, so that the OS can reserve the proper amount of space and set the associated enable-bits. Instruction
286-682: A subsequent one. Modern processors use either static or dynamic RAM as main memory, with the latter usually accessed via one or more cache levels . Processor registers are normally at the top of the memory hierarchy , and provide the fastest way to access data. The term normally refers only to the group of registers that are directly encoded as part of an instruction, as defined by the instruction set . However, modern high-performance CPUs often have duplicates of these "architectural registers" in order to improve performance via register renaming , allowing parallel and speculative execution . Modern x86 design acquired these techniques around 1995 with
SECTION 10
#1732858445796312-538: Is a need to use more than 9 bytes of NOP padding, it is recommended to use multiple NOPs. These instructions can only be encoded in 64 bit mode. They fall in four groups: Most instructions with a 64 bit operand size encode this using a REX.W prefix; in the absence of the REX.W prefix, the corresponding instruction with 32 bit operand size is encoded. This mechanism also applies to most other instructions with 32 bit operand size. These are not listed here as they do not gain
338-425: Is grouped according to architecture ( i186 , i286 , i386 , i486 , i586 / i686 ) and is referred to as (32-bit) x86 and (64-bit) x86-64 (also known as AMD64 ). This is the original instruction set. In the 'Notes' column, r means register , m means memory address and imm means immediate (i.e. a value). Note that since the lower half is the same for unsigned and signed multiplication, this version of
364-676: Is present. Instruction atomic only if used with LOCK prefix. In early processors, the TSC was a cycle counter, incrementing by 1 for each clock cycle (which could cause its rate to vary on processors that could change clock speed at runtime) – in later processors, it increments at a fixed rate that doesn't necessarily match the CPU clock speed. Other than AMD K7/K8, broadly unsupported in non-Intel processors released before 2005. These instructions are provided for software testing to explicitly generate invalid opcodes. The opcodes for these instructions are reserved for this purpose. For cases where there
390-492: Is serializing on AMD but not Intel CPUs. The C-states are processor-specific power states, which do not necessarily correspond 1:1 to ACPI C-states . Any unsupported value in EAX causes an #UD exception. Any unsupported value in the register argument causes a #GP exception. Depending on function, the instruction may return data in RBX and/or an error code in EAX. Depending on function,
416-513: Is serializing. Integer/system instructions that were not present in the basic 80486 instruction set, but were added in various x86 processors prior to the introduction of SSE. ( Discontinued instructions are not included.) Instruction is, with some exceptions, serializing. Instruction is serializing. Instruction is serializing, and causes a mandatory #VMEXIT under virtualization. Support for CPUID can be checked by toggling bit 21 of EFLAGS (EFLAGS.ID) – if this bit can be toggled, CPUID
442-523: The 80386: The 80386 also introduced the two new segment registers FS and GS as well as the x86 control , debug and test registers . The new instructions introduced in the 80386 can broadly be subdivided into two classes: For instruction forms where the operand size can be inferred from the instruction's arguments (e.g. ADD EAX,EBX can be inferred to have a 32-bit OperandSize due to its use of EAX as an argument), new instruction mnemonics are not needed and not provided. Mainly used to prepare
468-468: The DR0-DR7 debug registers are serializing. Performs software interrupt #1 if executed when not using in-circuit emulation. Performs same operation as MOV if executed when not doing in-circuit emulation. Using BSWAP with a 16-bit register argument produces an undefined result. Instruction atomic only if used with LOCK prefix. Instruction atomic only if used with LOCK prefix. Instruction
494-460: The above definition of a register. The following table shows the number of registers in several mainstream CPU architectures. Note that in x86 -compatible processors, the stack pointer ( ESP ) is counted as an integer register, even though there are a limited number of instructions that may be used to operate on its contents. Similar caveats apply to most architectures. Although all of the below-listed architectures are different, almost all are in
520-469: The first or last register in the integer register file is a pseudo-register in that it is hardwired to always return zero when read (mostly to simplify indexing modes), and it cannot be overwritten. In Alpha , this is also done for the floating-point register file. As a result of this, register files are commonly quoted as having one register more than how many of them are actually usable; for example, 32 registers are quoted when only 31 of them fit within
546-408: The instruction can be used for unsigned multiplication as well. The new instructions added in 80286 add support for x86 protected mode . Some but not all of the instructions are available in real mode as well. The TSS ( Task State Segment ) specified by the 16-bit argument is marked busy, but a task switch is not done. The 80386 added support for 32-bit operation to the x86 instruction set. This
SECTION 20
#1732858445796572-491: The instruction may return data/status information in EAX and/or RCX. Register (computing) A processor register is a quickly accessible location available to a computer's processor . Registers usually consist of a small amount of fast storage , although some registers have specific hardware functions, and may be read-only or write-only. In computer architecture , registers are typically addressed by mechanisms other than main memory , but may in some cases be assigned
598-400: The number of bits they can hold, for example, an " 8-bit register", " 32-bit register", " 64-bit register", or even more. In some instruction sets , the registers can operate in various modes, breaking down their storage memory into smaller parts (32-bit into four 8-bit ones, for instance) to which multiple data (vector, or one-dimensional array of data) can be loaded and operated upon at
624-436: The releases of Pentium Pro , Cyrix 6x86 , Nx586 , and AMD K5 . When a computer program accesses the same data repeatedly, this is called locality of reference . Holding frequently used values in registers can be critical to a program's performance. Register allocation is performed either by a compiler in the code generation phase, or manually by an assembly language programmer. Registers are normally measured by
650-514: The same time. Typically it is implemented by adding extra registers that map their memory into a larger register. Processors that have the ability to execute single instructions on multiple data are called vector processors . A processor often contains several kinds of registers, which can be classified according to the types of values they can store or the instructions that operate on them: Hardware registers are similar, but occur outside CPUs. In some architectures (such as SPARC and MIPS ),
676-540: Was done by widening the general-purpose registers to 32 bits and introducing the concepts of OperandSize and AddressSize – most instruction forms that would previously take 16-bit data arguments were given the ability to take 32-bit arguments by setting their OperandSize to 32 bits, and instructions that could take 16-bit address arguments were given the ability to take 32-bit address arguments by setting their AddressSize to 32 bits. (Instruction forms that work on 8-bit data continue to be 8-bit regardless of OperandSize. Using
#795204