* Removed AVX512_ER, AVX512_PF, AVX512_4FMAPS, and AVX512_4VNNIW
extensions and corresponding instructions (these were never
advertised by any x86 CPU and were only used by Xeon Phi acc.,
which AsmJit never supported)
* Removed CPU extensions HLE, MPX, and TSX
* Kept extension RTM, which is only for backward compatibility to
recognize instructions, but it's no longer checked by CpuInfo as
it's been deprecated together with HLE and MPX
* The xtest instruction now reports it requires RTM
* Reorganized x86 extensions a bit - they are now reordered to group
them by category, preparing for the future where extension IDs will
be always added after existing records for ABI compatibility
* Instruction vcvtneps2bf16 no longer accepts form without an explicit
memory operand size
* Removed aliased instructions in CMOVcc, Jcc, And SETcc categories,
now there is only a single instruction id for all aliased instructions.
* Added a new feature to always show instruction aliases in Logger, which
includes formatting instructio nodes (Builder, Compiler)
Instruction DB-only updates (not applied to C++ yet):
* AsmJit DB from now uses the same license as AsmJit (Zlib) and
no longer applies dual licensing (Zlib and Public Domain)
* Added support for aggregated instruction definitions in
x86 instruction database, which should simplify the maintenance
and reduce bugs (also the syntax is comparable to descriptions
used by Intel APX instruction manuals)
* Added support for APX instructions and new features
* Added support for AVX10.1 and AVX10.2 instructions (both new
instructions and new encodings of existing instructions)
* Added support for MOVRS instructions
* Added support for KL instructions (loadiwkey)
* Added support for AESKLE instructions
* Added support for AESKLEWIDE_KL instructions
* Added support for AMX_[AVX512|MOVRS|FP8|TF32|TRANSPOSE]
* NOTE: None of the instruction additions is currently used by
Asmjit, it's a pure database update that needs more work to
make all the instructions available in future AsmJit
10 KiB
X86 ISA - JSON Database Documentation
This file provides a documentation of isa_x86.json file, which contains a compact X86 and X86_64 instruction database. The database has been created from several manuals from Intel and AMD, which describes the encoding of instructions and other properties. The database tries to keep the instruction and opcode formats compatible with the database, however, in cases where applicable it tries to simplify it (for example merging instructions that all use either XMM, YMM, or ZMM registers, etc...).
Instruction Category
Each set of instructions start with category group, which looks like the following:
{"category": "<LIST_OF_CATEGORIES>", "ext": "<LIST_OF_EXTENSIONS>", /* flags, */ "instructions": [
/* (instruction records) */
]}
Fields:
-
category- describes a single or multiple categories this instruction belongs to. In general the database is written in a way to provide "baseline" and "extended" categories, so have the following categories used to distinguish between different set of instructions:GP- General purpose instructions.GP_EXT- Extensions to general purpose instructions (such as BMI, POPCNT, etc...).MMX- MMX and 3DNOW instructions (in general instructions using MM registers).SSE- SSE to SSE4.2 instructions, including other extensions that don't use VEX/EVEX prefixes.AVX- AVX, AVX2, and other instructions that use SIMD registers (XMM, YMM) and VEX prefix.AVX512- AVX512 instructions.
-
ext(optional) - describes extensions required to execute the instruction. When multiple extensions are in the list it means ALL of them must be available. For exampleAESNImeans thatAESNIextension is required,AVX AESNImeans that bothAVXandAESNIextensions are required. -
deprecated(optional) - deprecation flag (eithertrueorfalse), by default instructions are not deprecated. -
volatile(optional) - volatility flag (eithertrueorfalse), by default instructions are not volatile (note that volatile flag is used for code generators and in general it says that the instruction should not be reordered and nothing above it should move below and vice versa). -
instructions- array of instruction records, one line per instruction.
Instruction Record
A single instruction record looks like the following:
{"<ARCH>": "<INSTRUCTION_SIGNATURE>", "op": "[<ENCODING_OPS>] <ENCODING_DATA>" /*, <ADDITIONAL_DATA>*/ }
Architecture Field
<ARCH> field describes the architecture and optionally APX_F promoted instruction:
any- The instruction can run in both 32-bit and 64-bit mode and shares the encoding.x86- The instruction can only run in 32-bit mode. This in general may be an indication that the instruction was deprecated in 64-bit mode or that the instruction has a different signature in 64-bit mode (some instructions require 32-bit registers in 32-bit mode and 64-bit registers in 64-bit mode, for example)x64- The instruction can only run in 64-bit mode.apx- The instruction can only run in 64-bit mode withAPX_Fextension present. This notation is only used forAPX_Finstructions that provide alternativeEVEXencoding to existing instructions, but not newAPX_Fonly instructions. For examplejmpabsinstruction is a newAPX_Finstruction, thus the arch notation it uses isx64.
Explanation: The database uses this "variable" field name to save space and to avoid defining the architecture elsewhere.
Instruction Signature
Instruction signature is composed of the following components:
[<PREFIX>|<OPTIONS>] <INSTRUCTION_NAME>|<ALIASES> <OPERANDS>
-
[<PREFIX>|<OPTIONS>](optional) - prefixes and other options:[bnd]- instruction supportsbndprefix (deprecated).[lock]- instruction supportslockprefix.[xacquire]- instruction supportsxacquireprefix.[xacqrel]- instruction supports bothxacquireandxreleaseprefixes.[xrelease]- instruction supportsxreleaseprefix.[rep]- instruction supportsrepprefix (orrepe).[repne]- instruction supportsrepneprefix.[repIgnore]- instruction supportsrepprefix, which is ignored during execution (to support for examplerep ret).
-
<INSTRUCTION_NAME>|<ALIASES>(required) - the name of the instruction possibly followed by aliases if the instruction has them- if the instruction has aliases, they will be recognized in AsmJit API (the API will provide aliases), but will not have a separate instruction identifier
- for example
cmovz|cmoveis acmovzinstruction that has acmovealias.
-
<OPERANDS>(optional):- When an instruction has multiple operands, they are separated by comma.
- Registers:
r8- 8-bit general purpose register.r16- 16-bit general purpose register.r32- 32-bit general purpose register.r64- 64-bit general purpose register (x64 only).mm- 64-bit MM register.xmm- 128-bit XMM register (SSE).ymm- 256-bit YMM register (AVX)zmm- 512-bit ZMM register (AVX512/AVX10).k- 64-bit K register (AVX512/AVX10).tmm- TMM register (AMX).creg- Control register.dreg- Debug register.st(x)- FPU register.rip- Instruction pointer register (used during addressing).bnd- Bounds register (deprecated).
- Memory:
mem- Memory operand without size specified.m8-m512- Memory operand of a specified size.
- Immediate values
imm4- Signed or unsigned 4-bit immediate value (only used by instructions where the other 4 bits are used to encode additional register operand).imm8- Signed or unsigned 8-bit immediate value.imm16- Signed or unsigned 16-bit immediate value.imm32- Signed or unsigned 32-bit immediate value.imm64- Signed or unsigned 64-bit immediate value.imms8- Signed 8-bit immediate value (instructions that sign-extend the immediate value to 32 or 64 bits).immu8- Unsigned 8-bit immediate value (instructions that zero-extend the immediate value to 32 or 64 bits).immu16- Unsigned 16-bit immediate value (instructions that zero-extend the immediate value to 32 or 64 bits).imms32- Signed 32-bit immediate value (instructions that sign-extend the immediate value to 64 bits).immu32- Unsigned 32-bit immediate value (instructions that zero-extend the immediate value to 64 bits).
- Relative operands (addressing labels and relative locations in code):
rel8- 8-bit signed relative displacement.rel16- 16-bit signed relative displacement.rel32- 32-bit signed relative displacement.
- Registers:
- Combining:
- Register and memory operands can be combined, for example
r8/m8means either 8-bit register or 8-bit memory operand
- Register and memory operands can be combined, for example
- Read/Write access:
- The first operand must be decorated by access in a form
[r|w|x]: <OPERAND>:R:- read access.W:- write access (overwrites the whole register).w:- write access (only overwrites an addressed part of the register - 8-bit and 16-bit GP registers use this access).X:- read/write access (the final write operation overwrites the whole register).x:- read/write access (the final write operation only overwrites the addressed part of the register - 16-bit GP access).
- The access of the second operand and following operands is implied to be read-only, when not specified explicitly.
- The first operand must be decorated by access in a form
- Grouping:
- If the encoding used for multiple register combinations is the same, multiple instructions can be grouped into a single record.
GPInstructions:ry- eitherr32orr64.my- eitherm32orm64.rv- eitherr16,r32, orr64.mv- eitherm16,m32, orm64.immv- eitherimm16,imm32, orsimm32.- All registers must match, example:
add x:rv, rv/mv- either allr16/m16,r32/m32, orr64/m64. - When
rv/mv/immvis used, the instruction must use66hprefix (or 66h part ofVEX/EVEX) when a 16-bitr16/m16is used, andREX.W(orWpart ofVEX/EVEX) when a 64-bitr64/m64is used. The immediate expands toimm16for instructions working with 16-bit registers, toimm32for instructions working with 32-bit registers, and tosimm32for instructions working with 64-bit registers (32-bit immediate sign extended to 64 bits). - When
rv/mvis used withwandxaccess option, it only applies to a 16-bit operation, wider operations would useWorX(this is an architectural constraint that the tool processing the database must be aware of) - Why
yandv?ry/myandrv/mvappeared in initial manuals describingAPX_Fextension, so this database is using exactly this notation to group multiple instructions into a single entry.
AVXInstructions:xy/mxy- eitherxmm/m128orymm/m256register operand.- All registers must match, example:
vfmadd132pd X:xy, xy, xy/mxy- either allxmm/m128or allymm/m256. - Why
xy/mxy? This notation is not used by instruction manuals, but we have found it easy to use and understand.
AVX512andAVX10Instructions:xxx/mxxx- eitherxmm[31:0]/m32,xmm[63:0]/m64, orxmm/m128register operand.xxy/mxxy- eitherxmm[63:0]/m64,xmm/m128, orymm/m256register operand.xyz/mxyz- eitherxmm/m128,ymm/m256, orzmm/m512register operand.- All registers must match, example:
vvfmadd132pd X:xyz {kz}, xyz, xyz/mxyz/b64 {er}- either allxmm/m128,ymm/m256, orzmm/m512. - Embedded rounding
{er}and{sae}are grouped - in AVX512 case only 512-bit operations can use{er}/{sae}; in AVX10.2 case both 256-bit and 512-bit operations can use{er}/{sae}, but not 128-bit operations - the assembler or the tool processing this data must be aware of this architectural constraint. - Why
xyz/mxyz? This notation is not used by instruction manuals, but we have found it easy to use and understand.
- When an instruction has multiple operands, they are separated by comma.