diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ab2896..88a4c0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ remains unsupported. ### Added - Added four Wave32 gfx1030 VOP2 select and carry forms through the semantic registry. Conditional select, add with carry and both subtract orders with borrow use a per-lane VCC bit and have a guide-derived CPU oracle. Native Metal verification and independent acceptance are pending. Part of #215. +- Added XADD and CMPXCHG for 8- to 64-bit register and memory destinations, and the LOCK prefix on their memory forms (#198). LOCK anywhere else, CMPXCHG8B and CMPXCHG16B stay rejected. Both engines run the new forms on the shared semantics, one instruction at a time, so a locked instruction is indivisible today and LOCK changes no result; `docs/cpu/instruction-registry.md` states the ordering, alignment, compare-failure and fault rules a guest scheduler must preserve. A failed compare still writes the destination, so it faults on memory that cannot be written. Nothing is lowered to ARM64 atomic instructions, and no multi-thread behaviour is established. Fourteen SDM-derived cases already in `cpu_known_answers.rs` moved from refused to verified, with 62 LLVM-assembled fixtures and five new tests in `x86_atomic.rs`; not compared with x86 hardware and awaiting independent review. +- Added CPUID with a fixed, host-independent guest contract (#130). It reports a synthetic processor with the vendor string `Xenora guest` and sets a feature bit only when every instruction of that feature is implemented: CMOV, POPCNT, LZCNT and long mode today. SSE and SSE2 are not reported while parts of them, such as RSQRTPS and MFENCE, are still rejected, so the table is truthful about Xenora and not a plausible hardware model. Unlisted leaves return zeros. `tests/cpu_features.rs` pins every leaf in both engines, requires each reported feature's instructions among the executed fixtures, and holds a refused witness instruction for 31 unreported features. `docs/cpu/instruction-registry.md` gives the table and the rule for reporting a new feature. Not compared with a processor; awaiting independent review. +- Added six Wave32 gfx1030 VOP1 integer forms through the semantic registry, including bit scans and a two-register swap under EXEC (AMD RDNA 2 ISA guide section 12.8, #215). The compiler accepts 752 guide-derived cases and rejects 610 programs at the oracle’s expected offsets. Native Metal verification and independent acceptance are pending. - Added delay-loaded imports to the static PE probe (#244). `xenora probe --mode static` now reads the PE32+ delay-load directory and lists each delay-loaded import in `imports.csv` with its DLL, symbol or ordinal, and delay import address table slot. A new `import_table` column, inserted after `iat_rva`, marks every row `ordinary` or `delayed`; `import_kind` stays the last column. The existing totals and `missing_imports.csv` still cover ordinary imports only, and the JSON report adds `delayed_imports`, `delayed_imported_dlls_count` and `delay_import_error`. The table is bounded by the directory's declared size, which must hold the empty descriptor that ends it, and each descriptor's DLL name, import address table and import name table must be present and start in section data. A table that breaks these rules, is truncated, sets a reserved attribute bit or uses the earlier virtual-address descriptor form is reported with the entries read before the problem. `xenora imports sync` leaves delayed rows out of its backlog. Inspection stays static: nothing is bound or executed. Covered by an original fixture (`fixtures/pe/delay-imports.exe`, generated by `fixtures/pe/delay-imports.py`) whose imports were cross-checked locally with `llvm-readobj --coff-imports` from LLVM 23.1.6; awaiting independent review. - Added the sixteen gfx1030 SOPK integer forms through the semantic registry: `s_movk_i32`, `s_cmovk_i32`, `s_cmpk_{eq,lg,gt,ge,lt,le}_{i32,u32}`, `s_addk_i32` and `s_mulk_i32` (AMD guide sections 12.2 and 13.1.2), with SDST s0-s105 only and SIMM16 sign-extended (zero-extended for the unsigned compares). The registry gained the operand rules `sopk_sgpr` and `sopk_compare` and the operations `mov` and `cmov`; the decoder and the scalar translation fold them like SOP2 and SOPC. An independent guide-derived oracle (`tests/validation/tests/sopk.rs`, 4,184 cases and 398 rejections on both CPU interpreters and native Metal), an LLVM-assembled fixture `scalar-immediate.s` with IR and MSL goldens, and the LLVM three-way decoder check cover them (part of #215). - Added an independent guide-derived oracle for the Wave32 16-bit (`v_cmp_{lt..ge}_{i16,u16}_e32`) and 64-bit (`v_cmp_{f..t}_{i64,u64}_e32`) integer compares in the reference and the second interpreter (6,212 lane cases, 1,208 rejections; contract in `docs/shaders/vector-compare.md` section 2a). The decoder and translator still reject these forms, and native Metal agreement is not yet shown. Part of #215. diff --git a/crates/decoder/src/lib.rs b/crates/decoder/src/lib.rs index 482ca4f..3dfd698 100644 --- a/crates/decoder/src/lib.rs +++ b/crates/decoder/src/lib.rs @@ -5,7 +5,7 @@ use std::fmt; pub use xenora_isa::{ Architecture, CompareRelation, ExportTarget, Instruction, InterpolationPhase, ScalarAluOp, ScalarCompareOp, ScalarImmediateCompareOp, ScalarImmediateOp, ScalarSource, ScalarUnaryOp, - VectorAluOp, VectorAluVop3Op, VectorCompareOp, VectorSource, + VectorAluOp, VectorAluVop3Op, VectorCompareOp, VectorSource, VectorSwapOp, VectorUnaryOp, }; use xenora_isa::{ BUFFER_LOAD_DWORD, BUFFER_STORE_DWORD, EXP, IMAGE_SAMPLE_LZ, S_BRANCH, S_CBRANCH_EXECZ, @@ -15,7 +15,7 @@ use xenora_isa::{ use xenora_isa::meta::EncodingFamily; use xenora_isa::semantics::{FORM_IDS, OperandRule}; -pub use xenora_isa::semantics::{VectorBinary, VectorLowering, VectorVcc}; +pub use xenora_isa::semantics::{VectorBinary, VectorLowering, VectorUnary, VectorVcc}; /// Metadata forms that [`decode`] turns into an [`Instruction`] for at least one /// operand combination: the hand-written forms below followed by every form of @@ -316,6 +316,23 @@ fn decode_gfx1030(bytes: &[u8], offset: usize) -> Result<(Instruction, u8), Deco if V_MOV_B32.matches(first) { return move_b32(first, bytes); } + // AMD RDNA 2 ISA guide 13.3.2: VDST occupies bits 17–24 and SRC0 bits 0–8. + if let Some(op) = VectorUnaryOp::from_word(first) { + let dst = (first >> 17) as u8; + let (src, len) = vector_src0(first, bytes, op.assembly_name())?; + return Ok((Instruction::VectorUnary { op, dst, src }, len)); + } + if let Some(op) = VectorSwapOp::from_word(first) { + if first & 0x100 == 0 { + return Err(unsupported( + op.assembly_name(), + "expected a VGPR SRC0 for writeback", + )); + } + let dst = (first >> 17) as u8; + let src = first as u8; + return Ok((Instruction::VectorSwap { op, dst, src }, 4)); + } if let Some(op) = VectorCompareOp::from_word(first) { return vector_compare(op, first, bytes); } @@ -664,7 +681,7 @@ fn vector_compare( Ok((Instruction::VectorCompare { op, src0, src1 }, len)) } -/// The 9-bit SRC0 of a VOPC or VOP2 word: a VGPR, `s0-s105`, `vcc_lo`, an +/// The 9-bit SRC0 of a VOP1, VOP2 or VOPC word: a VGPR, `s0-s105`, `vcc_lo`, an /// inline integer -16..64 or a literal word; everything else is unsupported. fn vector_src0( first: u32, diff --git a/crates/decoder/tests/gfx1030.rs b/crates/decoder/tests/gfx1030.rs index 9488edb..5fa0ca8 100644 --- a/crates/decoder/tests/gfx1030.rs +++ b/crates/decoder/tests/gfx1030.rs @@ -5,12 +5,12 @@ use std::process::{Command, Stdio}; use xenora_decoder::{ Architecture, CompareRelation, DecodeError, DecodeErrorKind, DecodedInstruction, Instruction, ScalarAluOp, ScalarImmediateOp, ScalarSource, ScalarUnaryOp, VectorAluOp, VectorAluVop3Op, - VectorSource, decode, decode_at, + VectorSource, VectorUnaryOp, decode, decode_at, }; use xenora_isa::semantics::Signedness; use xenora_ref::{ BranchCondition, CompareSource, Comparison, Op, ScalarAlu, ScalarImmediate, ScalarUnary, - Source, VectorAlu, VectorInteger, + Source, VectorAlu, VectorInteger, VectorUnary, }; const FIXTURE: &[u8] = include_bytes!("../../../fixtures/rdna2/add.bin"); @@ -330,6 +330,22 @@ fn reference_op(instruction: Instruction) -> Op { src: VectorSource::Scalar(src), } => Op::MoveScalar(dst, src), Instruction::MoveB32 { dst, src } => Op::Move(dst, reference_source(src)), + Instruction::VectorUnary { op, dst, src } => Op::VectorUnary( + match op { + VectorUnaryOp::NotB32 => VectorUnary::Not, + VectorUnaryOp::BfrevB32 => VectorUnary::ReverseBits, + VectorUnaryOp::FfbhU32 => VectorUnary::FindFirstOneFromMsb, + VectorUnaryOp::FfblB32 => VectorUnary::FindFirstOneFromLsb, + VectorUnaryOp::FfbhI32 => VectorUnary::FindSignChange, + }, + dst, + match src { + VectorSource::Register(reg) => CompareSource::Vector(reg), + VectorSource::Scalar(reg) => CompareSource::Scalar(reg), + VectorSource::Immediate(bits) => CompareSource::Immediate(bits), + }, + ), + Instruction::VectorSwap { dst, src, .. } => Op::Swap(dst, src), Instruction::ScalarAlu { op, dst, @@ -573,12 +589,13 @@ fn compares_fixture_instructions_against_llvm() { include_bytes!("../../../fixtures/rdna2/vector-vcc.bin"), include_bytes!("../../../fixtures/rdna2/vector-compare.bin"), include_bytes!("../../../fixtures/rdna2/vector-compare-ft.bin"), + include_bytes!("../../../fixtures/rdna2/vector-unary.bin"), high_registers, &matrix, ] { count += compare_against_llvm(fixture, &mut forms); } - assert_eq!(forms.len(), 124, "forms compared: {forms:?}"); + assert_eq!(forms.len(), 130, "forms compared: {forms:?}"); eprintln!( "{count} three-way instruction comparisons across {} forms", forms.len() diff --git a/crates/isa/generate_semantics.py b/crates/isa/generate_semantics.py index 7fb4ec9..79fe54a 100755 --- a/crates/isa/generate_semantics.py +++ b/crates/isa/generate_semantics.py @@ -61,7 +61,7 @@ OPERATIONS = { "mul": "Multiply", "mul_hi": "MultiplyHigh", "bfe": "BitfieldExtract", "absdiff": "AbsoluteDifference", "lshl_add": "ShiftLeftAdd", "mul24": "Multiply24", "mul_hi24": "MultiplyHigh24", - "mov": "Move", "cmov": "ConditionalMove", + "mov": "Move", "cmov": "ConditionalMove", "swap": "Swap", } # Unary operations read one source; they need an operand rule of the unary kind. UNARY = {"not", "brev", "bcnt0", "bcnt1", "ff0", "ff1", "flbit", "sext", "abs"} @@ -97,7 +97,7 @@ COMPARE_PRIMITIVES = { # the signedness their primitive names, and their S1 is an unsigned count. LOGICAL = { "and", "or", "xor", "andn2", "orn2", "nand", "nor", "xnor", - "not", "brev", "bcnt0", "bcnt1", "ff0", "ff1", "cselect", "bfm", + "not", "brev", "bcnt0", "bcnt1", "ff0", "ff1", "cselect", "bfm", "swap", } ARITHMETIC = { "add", "sub", "min", "max", "mul", "mul_hi", "bfe", "absdiff", "lshl_add", "mul24", "mul_hi24", @@ -134,16 +134,13 @@ SCC = { "relation": "Relation", "selected_src0": "SelectedSrc0", } -# lane_mask: the Wave32 VOPC result written to VCC_LO (vcc only; EXEC writes -# such as v_cmpx have no contract yet, so exec must stay unchanged). +# lane_mask: the Wave32 compare or carry result written to VCC_LO. +# EXEC writes such as v_cmpx have no contract, so exec must stay unchanged. MASK = {"unchanged": "Unchanged", "lane_mask": "LaneMask"} WAVE = {"any": "Any", "wave32": "Wave32"} -# Which wave declaration each operand-rule kind must make. The decoder has no -# wave-size input, so "wave32" is only true where the caller's ABI fixes the -# wave size: the lane-mask compares, whose one entry point is the Wave32 -# compute fixture ABI (docs/shaders/vector-compare.md section 2). Every other -# kind must be "any". -WAVE_BY_KIND = {"vector_compare": "wave32"} +# The synthetic compute fixture ABI fixes the wave size for these operand-rule +# kinds and for the VCC-reading VOP2 rule. Other forms declare "any". +WAVE_BY_KIND = {"vector_compare": "wave32", "vector_unary": "wave32", "vector_swap": "wave32"} VCC_VECTOR_PRIMITIVES = { ("cselect", "bitwise"): "Select", ("add", "unsigned"): "AddCarry", @@ -264,7 +261,45 @@ UNSUPPORTED_COMBOS = { # VOP3 rules also name source classes and encoding fields they refuse. VOP3_COMBOS = {"src_sgpr", "src_inline", "src_literal", "modifiers", "src2"} ALL_COMBOS = UNSUPPORTED_COMBOS | {"src_vcc_hi", "src_null"} | VOP3_COMBOS +VECTOR_UNARY_PRIMITIVES = { + ("not", "bitwise"): "Not", + ("brev", "bitwise"): "ReverseBits", + ("flbit", "unsigned"): "FindHighUnsigned", + ("ff1", "bitwise"): "FindLow", + ("flbit", "signed"): "FindHighSigned", +} + OPERAND_RULES = { + "vop1_vgpr": { + "rust": "Vop1Vgpr", + "enum": "VectorUnaryOp", + "shape": { + "family": "VOP1", + "dst": {"field": "VDST", "class": "vgpr", "min": 0, "max": 255}, + "src": [{"field": "SRC0", "class": "vector_source"}], + "max_literals": 1, + }, + "unsupported": { + "src_vcc_hi", "src_exec", "src_m0", "src_ttmp", "src_null", "src_float_inline", + "src_special", + }, + "kind": "vector_unary", + }, + "vop1_swap": { + "rust": "Vop1Swap", + "enum": "VectorSwapOp", + "shape": { + "family": "VOP1", + "dst": {"field": "VDST", "class": "vgpr", "min": 0, "max": 255}, + "src": [{"field": "SRC0", "class": "vgpr"}], + "max_literals": 0, + }, + "unsupported": { + "src_sgpr", "src_vcc", "src_exec", "src_m0", "src_ttmp", "src_null", "src_inline", + "src_float_inline", "src_special", "src_literal", + }, + "kind": "vector_swap", + }, "sop2_sgpr": { "rust": "Sop2Sgpr", "enum": "ScalarAluOp", @@ -676,7 +711,10 @@ def _check_xml(form, rule, snapshot, errors): expected = bits if type(bits) is int else form["width"] if size != expected: errors.append(f"{label}: {field} is {size} bits in the XML, declared {expected}") - if (is_input, is_output) != (is_source, not is_source): + # The XML marks both swap operands as outputs. Guide 12.8 also + # reads both old values before assigning either result. + direction = (False, True) if _rule_kind(form) == "vector_swap" else (is_source, not is_source) + if (is_input, is_output) != direction: errors.append(f"{label}: {field} direction disagrees with the XML") if field == count_field: if data_format != "FMT_NUM_U32": @@ -850,11 +888,16 @@ def validate(registry, snapshot): if form["carry_in"] != "none": errors.append(f"{label}: carry_in {form['carry_in']} contradicts compare") primitive = (scc, None, False) - elif _rule_kind(form) == "vector": + elif _rule_kind(form) in ("vector", "vector_unary", "vector_swap"): if RELATION_KEY in form: errors.append(f"{label}: {RELATION_KEY} on a non-compare operation") key = (form["operation"], form["signedness"]) - lowering = (VCC_VECTOR_PRIMITIVES if reads_vcc else VECTOR_PRIMITIVES).get(key) + table = { + "vector": VCC_VECTOR_PRIMITIVES if reads_vcc else VECTOR_PRIMITIVES, + "vector_unary": VECTOR_UNARY_PRIMITIVES, + "vector_swap": {("swap", "bitwise"): "Swap"}, + }[_rule_kind(form)] + lowering = table.get(key) primitive = None if lowering is None else ("unchanged", lowering, False) else: if RELATION_KEY in form: @@ -882,6 +925,8 @@ def validate(registry, snapshot): elif form["operands"] in OPERAND_RULES and OPERAND_RULES[form["operands"]]["kind"] != ( (_rule_kind(form) if _rule_kind(form) in ("vector_compare", "immediate_compare") else "compare") if form["operation"] == "compare" + else "vector_swap" if form["operation"] == "swap" + else "vector_unary" if _rule_kind(form) == "vector_unary" and form["operation"] in UNARY else "unary" if form["operation"] in UNARY or ( form["operation"] == "mov" and form["family"] == "SOP1" ) @@ -1072,7 +1117,7 @@ def render(registry, snapshot): "use crate::primitive;", "use crate::semantics::{", " CarryIn, Document, Evidence, FormSemantics, MaskEffect, Operation, OperandRule, SccEffect,", - " Signedness, SpecRef, VectorBinary, VectorLowering, VectorVcc, Wave,", + " Signedness, SpecRef, VectorBinary, VectorLowering, VectorUnary, VectorVcc, Wave,", "};", "use crate::CompareRelation;", "", @@ -1319,6 +1364,31 @@ def _render_enum(rule_name, forms, snapshot, positions): " }]", " }", ] + if kind in ("vector_unary", "vector_swap"): + out += [ + "", + " /// Assembler name of the 32-bit VOP1 encoding.", + " pub const fn assembly_name(self) -> &'static str {", + " match self {", + ] + suffix = "_e32" if kind == "vector_unary" else "" + out += [f" Self::{form['variant']} => \"{form['name'].lower()}{suffix}\"," for form in forms] + out += [" }", " }"] + if kind == "vector_swap": + return out + ["}"] + if kind == "vector_unary": + out += [ + "", + " /// Per-lane integer operation selected by the registry.", + " pub const fn lowering(self) -> VectorUnary {", + " match self {", + ] + out += [ + f" Self::{form['variant']} => " + f"VectorUnary::{VECTOR_UNARY_PRIMITIVES[(form['operation'], form['signedness'])]}," + for form in forms + ] + return out + [" }", " }", "}"] if kind == "immediate": out += [ "", diff --git a/crates/isa/semantics/rdna2.toml b/crates/isa/semantics/rdna2.toml index 232c9cc..51648c3 100644 --- a/crates/isa/semantics/rdna2.toml +++ b/crates/isa/semantics/rdna2.toml @@ -21,6 +21,7 @@ include = [ "rdna2/sopc.toml", "rdna2/sopk.toml", "rdna2/sop1.toml", + "rdna2/vop1.toml", "rdna2/vop2.toml", "rdna2/vopc.toml", "rdna2/vop3.toml", @@ -47,7 +48,7 @@ file = "amdgpu_isa_rdna2.xml" # width operand and result width in bits # scc unchanged | carry_out | borrow | signed_overflow | nonzero | relation | selected_src0 # vcc, exec unchanged (stated, not implied) | lane_mask (Wave32 VOPC compare or VOP2 carry output) -# wave any | wave32 (wave32 exactly for the VOPC lane-mask compares) +# wave any | wave32 (wave32 for VOPC compares, VOP1 integer forms and VCC-reading VOP2 forms) # operands a key of [operand_rules] # spec references; at least one guide section with a page # verify evidence required before the form counts as verified diff --git a/crates/isa/semantics/rdna2/vop1.toml b/crates/isa/semantics/rdna2/vop1.toml new file mode 100644 index 0000000..b27a57d --- /dev/null +++ b/crates/isa/semantics/rdna2/vop1.toml @@ -0,0 +1,123 @@ +# Wave32 VOP1 integer forms, AMD RDNA 2 ISA guide 12.8. + +[operand_rules.vop1_vgpr] +family = "VOP1" +dst = { field = "VDST", class = "vgpr", min = 0, max = 255 } +src = [{ field = "SRC0", class = "vector_source" }] +max_literals = 1 +unsupported = [ + "src_vcc_hi", "src_exec", "src_m0", "src_ttmp", "src_null", "src_float_inline", "src_special", +] + +# Both operands are read and written by swap; SRC0 must select a VGPR. +[operand_rules.vop1_swap] +family = "VOP1" +dst = { field = "VDST", class = "vgpr", min = 0, max = 255 } +src = [{ field = "SRC0", class = "vgpr" }] +max_literals = 0 +unsupported = [ + "src_sgpr", "src_vcc", "src_exec", "src_m0", "src_ttmp", "src_null", "src_inline", + "src_float_inline", "src_special", "src_literal", +] + +[[form]] +name = "V_NOT_B32" +family = "VOP1" +opcode = 55 +variant = "NotB32" +operation = "not" +signedness = "bitwise" +carry_in = "none" +width = 32 +scc = "unchanged" +vcc = "unchanged" +exec = "unchanged" +wave = "wave32" +operands = "vop1_vgpr" +spec = [{ document = "guide", section = "12.8", page = 143 }] +verify = ["reference", "independent", "metal", "llvm_encoding"] + +[[form]] +name = "V_BFREV_B32" +family = "VOP1" +opcode = 56 +variant = "BfrevB32" +operation = "brev" +signedness = "bitwise" +carry_in = "none" +width = 32 +scc = "unchanged" +vcc = "unchanged" +exec = "unchanged" +wave = "wave32" +operands = "vop1_vgpr" +spec = [{ document = "guide", section = "12.8", page = 143 }] +verify = ["reference", "independent", "metal", "llvm_encoding"] + +[[form]] +name = "V_FFBH_U32" +family = "VOP1" +opcode = 57 +variant = "FfbhU32" +operation = "flbit" +signedness = "unsigned" +carry_in = "none" +width = 32 +scc = "unchanged" +vcc = "unchanged" +exec = "unchanged" +wave = "wave32" +operands = "vop1_vgpr" +spec = [{ document = "guide", section = "12.8", page = 143 }] +verify = ["reference", "independent", "metal", "llvm_encoding"] + +[[form]] +name = "V_FFBL_B32" +family = "VOP1" +opcode = 58 +variant = "FfblB32" +operation = "ff1" +signedness = "bitwise" +carry_in = "none" +width = 32 +scc = "unchanged" +vcc = "unchanged" +exec = "unchanged" +wave = "wave32" +operands = "vop1_vgpr" +spec = [{ document = "guide", section = "12.8", page = 143 }] +verify = ["reference", "independent", "metal", "llvm_encoding"] + +[[form]] +name = "V_FFBH_I32" +family = "VOP1" +opcode = 59 +variant = "FfbhI32" +operation = "flbit" +signedness = "signed" +carry_in = "none" +width = 32 +scc = "unchanged" +vcc = "unchanged" +exec = "unchanged" +wave = "wave32" +operands = "vop1_vgpr" +spec = [{ document = "guide", section = "12.8", page = 144 }] +verify = ["reference", "independent", "metal", "llvm_encoding"] + +[[form]] +name = "V_SWAP_B32" +family = "VOP1" +opcode = 101 +variant = "SwapB32" +operation = "swap" +signedness = "bitwise" +carry_in = "none" +width = 32 +scc = "unchanged" +vcc = "unchanged" +exec = "unchanged" +wave = "wave32" +operands = "vop1_swap" +spec = [{ document = "guide", section = "12.8", page = 149 }] +verify = ["reference", "independent", "metal", "llvm_encoding"] diff --git a/crates/isa/src/lib.rs b/crates/isa/src/lib.rs index ec4d691..3a2a73d 100644 --- a/crates/isa/src/lib.rs +++ b/crates/isa/src/lib.rs @@ -20,7 +20,7 @@ pub use rdna2::{ }; pub use semantics_gen::{ ScalarAluOp, ScalarCompareOp, ScalarImmediateCompareOp, ScalarImmediateOp, ScalarUnaryOp, - VectorAluOp, VectorAluVop3Op, VectorCompareOp, + VectorAluOp, VectorAluVop3Op, VectorCompareOp, VectorSwapOp, VectorUnaryOp, }; impl VectorAluOp { @@ -167,6 +167,14 @@ pub enum Instruction { WaitStore, /// VOP1 unmodified 32-bit vector move. MoveB32 { dst: u8, src: VectorSource }, + /// VOP1 unary integer operation with a single VGPR result. + VectorUnary { + op: VectorUnaryOp, + dst: u8, + src: VectorSource, + }, + /// VOP1 register swap. Both operands are inputs and outputs. + VectorSwap { op: VectorSwapOp, dst: u8, src: u8 }, /// VOP3 encoding of a registry VOP2 integer operation (operand rule /// `vop3_vgpr2`): two VGPR sources and no input or output modifiers. VectorAluVop3 { @@ -291,6 +299,8 @@ impl Instruction { Self::WaitLoad => "s_waitcnt", Self::WaitStore => "s_waitcnt_vscnt", Self::MoveB32 { .. } => "v_mov_b32_e32", + Self::VectorUnary { op, .. } => op.assembly_name(), + Self::VectorSwap { op, .. } => op.assembly_name(), Self::VectorAluVop3 { op, .. } => op.assembly_name(), Self::ScalarUnary { op, .. } => op.mnemonic(), Self::ScalarAlu { op, .. } => op.mnemonic(), @@ -342,7 +352,10 @@ impl fmt::Display for Instruction { } Self::WaitLoad => formatter.write_str(" vmcnt(0)"), Self::WaitStore => formatter.write_str(" null, 0"), - Self::MoveB32 { dst, src } => write!(formatter, " v{dst}, {src}"), + Self::MoveB32 { dst, src } | Self::VectorUnary { dst, src, .. } => { + write!(formatter, " v{dst}, {src}") + } + Self::VectorSwap { dst, src, .. } => write!(formatter, " v{dst}, v{src}"), Self::VectorAluVop3 { dst, src0, src1, .. } diff --git a/crates/isa/src/semantics.rs b/crates/isa/src/semantics.rs index 15d72f8..d6a9e72 100644 --- a/crates/isa/src/semantics.rs +++ b/crates/isa/src/semantics.rs @@ -94,6 +94,23 @@ pub enum Operation { Move, /// SOPK: SDST receives the sign-extended SIMM16 when SCC is set. ConditionalMove, + /// Swap the two old per-lane VGPR values (guide 12.8). + Swap, +} + +/// Per-lane integer operation with one input and one result. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum VectorUnary { + /// Bitwise complement. + Not, + /// Reverse bit order. + ReverseBits, + /// Count leading zeros, or return all ones for zero. + FindHighUnsigned, + /// Count trailing zeros, or return all ones for zero. + FindLow, + /// Count leading sign bits, or return all ones if every bit matches. + FindHighSigned, } /// The per-lane integer operation a vector form lowers to. One reusable MSL @@ -257,6 +274,10 @@ pub enum OperandRule { /// VOP2 vector, VGPR sources only: VDST is v0-v255; SRC0 and VSRC1 are VGPRs. /// Everything else (SGPR, inline, literal SRC0) is rejected as unsupported. Vop2Vgpr2, + /// VOP1 unary: VGPR VDST and the same SRC0 domain as VOP2. + Vop1Vgpr, + /// VOP1 swap: VDST and SRC0 each read and write a VGPR. + Vop1Swap, } /// Evidence a form needs before it counts as verified. diff --git a/crates/isa/src/semantics_gen.rs b/crates/isa/src/semantics_gen.rs index 54aa288..cd0c459 100644 --- a/crates/isa/src/semantics_gen.rs +++ b/crates/isa/src/semantics_gen.rs @@ -5,7 +5,7 @@ use crate::meta::EncodingFamily; use crate::primitive; use crate::semantics::{ CarryIn, Document, Evidence, FormSemantics, MaskEffect, Operation, OperandRule, SccEffect, - Signedness, SpecRef, VectorBinary, VectorLowering, VectorVcc, Wave, + Signedness, SpecRef, VectorBinary, VectorLowering, VectorUnary, VectorVcc, Wave, }; use crate::CompareRelation; @@ -1503,6 +1503,649 @@ impl ScalarImmediateOp { } } +/// VOP1 operations declared in the semantic registry (operand rule `vop1_swap`). +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum VectorSwapOp { + /// `v_swap_b32` (VOP1 opcode 101): bitwise swap, SCC = unchanged. + SwapB32, +} + +/// VectorSwapOp by VOP1 OP field value; `None` for undeclared opcodes. +const VECTOR_SWAP_OP_BY_OPCODE: [Option; 256] = [ + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + Some(VectorSwapOp::SwapB32), + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, +]; + +impl VectorSwapOp { + /// Every operation, in registry order. + pub const ALL: [Self; 1] = [ + Self::SwapB32, + ]; + + /// Selects the operation from a first instruction word: the VOP1 encoding + /// bits (mask 0xfe00_0000) and then the OP field (bits 9-16). + pub const fn from_word(word: u32) -> Option { + if word & 0xfe00_0000 != 0x7e00_0000 { + return None; + } + VECTOR_SWAP_OP_BY_OPCODE[((word >> 9) & 0xff) as usize] + } + + /// Lower-case mnemonic. + pub const fn mnemonic(self) -> &'static str { + match self { + Self::SwapB32 => "v_swap_b32", + } + } + + /// The validated registry row. + pub fn semantics(self) -> &'static FormSemantics { + &FORMS[match self { + Self::SwapB32 => 78, + }] + } + + /// Assembler name of the 32-bit VOP1 encoding. + pub const fn assembly_name(self) -> &'static str { + match self { + Self::SwapB32 => "v_swap_b32", + } + } +} + +/// VOP1 operations declared in the semantic registry (operand rule `vop1_vgpr`). +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum VectorUnaryOp { + /// `v_not_b32` (VOP1 opcode 55): bitwise not, SCC = unchanged. + NotB32, + /// `v_bfrev_b32` (VOP1 opcode 56): bitwise brev, SCC = unchanged. + BfrevB32, + /// `v_ffbh_u32` (VOP1 opcode 57): unsigned flbit, SCC = unchanged. + FfbhU32, + /// `v_ffbl_b32` (VOP1 opcode 58): bitwise ff1, SCC = unchanged. + FfblB32, + /// `v_ffbh_i32` (VOP1 opcode 59): signed flbit, SCC = unchanged. + FfbhI32, +} + +/// VectorUnaryOp by VOP1 OP field value; `None` for undeclared opcodes. +const VECTOR_UNARY_OP_BY_OPCODE: [Option; 256] = [ + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + Some(VectorUnaryOp::NotB32), + Some(VectorUnaryOp::BfrevB32), + Some(VectorUnaryOp::FfbhU32), + Some(VectorUnaryOp::FfblB32), + Some(VectorUnaryOp::FfbhI32), + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, +]; + +impl VectorUnaryOp { + /// Every operation, in registry order. + pub const ALL: [Self; 5] = [ + Self::NotB32, + Self::BfrevB32, + Self::FfbhU32, + Self::FfblB32, + Self::FfbhI32, + ]; + + /// Selects the operation from a first instruction word: the VOP1 encoding + /// bits (mask 0xfe00_0000) and then the OP field (bits 9-16). + pub const fn from_word(word: u32) -> Option { + if word & 0xfe00_0000 != 0x7e00_0000 { + return None; + } + VECTOR_UNARY_OP_BY_OPCODE[((word >> 9) & 0xff) as usize] + } + + /// Lower-case mnemonic. + pub const fn mnemonic(self) -> &'static str { + match self { + Self::NotB32 => "v_not_b32", + Self::BfrevB32 => "v_bfrev_b32", + Self::FfbhU32 => "v_ffbh_u32", + Self::FfblB32 => "v_ffbl_b32", + Self::FfbhI32 => "v_ffbh_i32", + } + } + + /// The validated registry row. + pub fn semantics(self) -> &'static FormSemantics { + &FORMS[match self { + Self::NotB32 => 73, + Self::BfrevB32 => 74, + Self::FfbhU32 => 75, + Self::FfblB32 => 76, + Self::FfbhI32 => 77, + }] + } + + /// Assembler name of the 32-bit VOP1 encoding. + pub const fn assembly_name(self) -> &'static str { + match self { + Self::NotB32 => "v_not_b32_e32", + Self::BfrevB32 => "v_bfrev_b32_e32", + Self::FfbhU32 => "v_ffbh_u32_e32", + Self::FfblB32 => "v_ffbl_b32_e32", + Self::FfbhI32 => "v_ffbh_i32_e32", + } + } + + /// Per-lane integer operation selected by the registry. + pub const fn lowering(self) -> VectorUnary { + match self { + Self::NotB32 => VectorUnary::Not, + Self::BfrevB32 => VectorUnary::ReverseBits, + Self::FfbhU32 => VectorUnary::FindHighUnsigned, + Self::FfblB32 => VectorUnary::FindLow, + Self::FfbhI32 => VectorUnary::FindHighSigned, + } + } +} + /// VOP2 operations declared in the semantic registry (operand rules `vop2_vcc`, `vop2_vgpr`, `vop2_vgpr2`). #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VectorAluOp { @@ -1687,28 +2330,28 @@ impl VectorAluOp { /// The validated registry row. pub fn semantics(self) -> &'static FormSemantics { &FORMS[match self { - Self::MulI32I24 => 73, - Self::MulHiI32I24 => 74, - Self::MulU32U24 => 75, - Self::MulHiU32U24 => 76, - Self::MinI32 => 77, - Self::MaxI32 => 78, - Self::MinU32 => 79, - Self::MaxU32 => 80, - Self::XnorB32 => 81, - Self::AddNcU32 => 82, - Self::SubNcU32 => 83, - Self::SubrevNcU32 => 84, - Self::LshrrevB32 => 85, - Self::AshrrevI32 => 86, - Self::LshlrevB32 => 87, - Self::AndB32 => 88, - Self::OrB32 => 89, - Self::XorB32 => 90, - Self::CndmaskB32 => 91, - Self::AddCoCiU32 => 92, - Self::SubCoCiU32 => 93, - Self::SubrevCoCiU32 => 94, + Self::MulI32I24 => 79, + Self::MulHiI32I24 => 80, + Self::MulU32U24 => 81, + Self::MulHiU32U24 => 82, + Self::MinI32 => 83, + Self::MaxI32 => 84, + Self::MinU32 => 85, + Self::MaxU32 => 86, + Self::XnorB32 => 87, + Self::AddNcU32 => 88, + Self::SubNcU32 => 89, + Self::SubrevNcU32 => 90, + Self::LshrrevB32 => 91, + Self::AshrrevI32 => 92, + Self::LshlrevB32 => 93, + Self::AndB32 => 94, + Self::OrB32 => 95, + Self::XorB32 => 96, + Self::CndmaskB32 => 97, + Self::AddCoCiU32 => 98, + Self::SubCoCiU32 => 99, + Self::SubrevCoCiU32 => 100, }] } @@ -2177,22 +2820,22 @@ impl VectorCompareOp { /// The validated registry row. pub fn semantics(self) -> &'static FormSemantics { &FORMS[match self { - Self::CmpLtI32 => 95, - Self::CmpEqI32 => 96, - Self::CmpLeI32 => 97, - Self::CmpGtI32 => 98, - Self::CmpNeI32 => 99, - Self::CmpGeI32 => 100, - Self::CmpLtU32 => 101, - Self::CmpEqU32 => 102, - Self::CmpLeU32 => 103, - Self::CmpGtU32 => 104, - Self::CmpNeU32 => 105, - Self::CmpGeU32 => 106, - Self::CmpFI32 => 107, - Self::CmpTI32 => 108, - Self::CmpFU32 => 109, - Self::CmpTU32 => 110, + Self::CmpLtI32 => 101, + Self::CmpEqI32 => 102, + Self::CmpLeI32 => 103, + Self::CmpGtI32 => 104, + Self::CmpNeI32 => 105, + Self::CmpGeI32 => 106, + Self::CmpLtU32 => 107, + Self::CmpEqU32 => 108, + Self::CmpLeU32 => 109, + Self::CmpGtU32 => 110, + Self::CmpNeU32 => 111, + Self::CmpGeU32 => 112, + Self::CmpFI32 => 113, + Self::CmpTI32 => 114, + Self::CmpFU32 => 115, + Self::CmpTU32 => 116, }] } @@ -2328,13 +2971,13 @@ impl VectorAluVop3Op { /// The validated registry row of this encoding. pub fn semantics(self) -> &'static FormSemantics { &FORMS[match self { - Self::AddNcU32 => 111, + Self::AddNcU32 => 117, }] } } /// Identity of every registry form and encoding variant, in registry order. -pub const FORM_IDS: [(&str, EncodingFamily); 112] = [ +pub const FORM_IDS: [(&str, EncodingFamily); 118] = [ ("S_ADD_U32", EncodingFamily::Sop2), ("S_SUB_U32", EncodingFamily::Sop2), ("S_ADD_I32", EncodingFamily::Sop2), @@ -2408,6 +3051,12 @@ pub const FORM_IDS: [(&str, EncodingFamily); 112] = [ ("S_SEXT_I32_I8", EncodingFamily::Sop1), ("S_SEXT_I32_I16", EncodingFamily::Sop1), ("S_ABS_I32", EncodingFamily::Sop1), + ("V_NOT_B32", EncodingFamily::Vop1), + ("V_BFREV_B32", EncodingFamily::Vop1), + ("V_FFBH_U32", EncodingFamily::Vop1), + ("V_FFBL_B32", EncodingFamily::Vop1), + ("V_FFBH_I32", EncodingFamily::Vop1), + ("V_SWAP_B32", EncodingFamily::Vop1), ("V_MUL_I32_I24", EncodingFamily::Vop2), ("V_MUL_HI_I32_I24", EncodingFamily::Vop2), ("V_MUL_U32_U24", EncodingFamily::Vop2), @@ -2450,7 +3099,7 @@ pub const FORM_IDS: [(&str, EncodingFamily); 112] = [ ]; /// One validated row per registry form, in registry order. -pub static FORMS: [FormSemantics; 112] = [ +pub static FORMS: [FormSemantics; 118] = [ FormSemantics { name: "S_ADD_U32", family: EncodingFamily::Sop2, @@ -3984,6 +4633,132 @@ pub static FORMS: [FormSemantics; 112] = [ spec: &[SpecRef { document: Document::Guide, section: "12.3", page: 0 }, SpecRef { document: Document::Guide, section: "5.3", page: 33 }], verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding], }, + FormSemantics { + name: "V_NOT_B32", + family: EncodingFamily::Vop1, + opcode: 55, + operation: Operation::Not, + signedness: Signedness::Bitwise, + carry_in: CarryIn::None, + width: 32, + shift_count_bits: 0, + shift_amount: 0, + swap_sources: false, + source_bits: 32, + relation: None, + scc: SccEffect::Unchanged, + vcc: MaskEffect::Unchanged, + exec: MaskEffect::Unchanged, + wave: Wave::Wave32, + operands: OperandRule::Vop1Vgpr, + spec: &[SpecRef { document: Document::Guide, section: "12.8", page: 143 }], + verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding], + }, + FormSemantics { + name: "V_BFREV_B32", + family: EncodingFamily::Vop1, + opcode: 56, + operation: Operation::ReverseBits, + signedness: Signedness::Bitwise, + carry_in: CarryIn::None, + width: 32, + shift_count_bits: 0, + shift_amount: 0, + swap_sources: false, + source_bits: 32, + relation: None, + scc: SccEffect::Unchanged, + vcc: MaskEffect::Unchanged, + exec: MaskEffect::Unchanged, + wave: Wave::Wave32, + operands: OperandRule::Vop1Vgpr, + spec: &[SpecRef { document: Document::Guide, section: "12.8", page: 143 }], + verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding], + }, + FormSemantics { + name: "V_FFBH_U32", + family: EncodingFamily::Vop1, + opcode: 57, + operation: Operation::FindLastBit, + signedness: Signedness::Unsigned, + carry_in: CarryIn::None, + width: 32, + shift_count_bits: 0, + shift_amount: 0, + swap_sources: false, + source_bits: 32, + relation: None, + scc: SccEffect::Unchanged, + vcc: MaskEffect::Unchanged, + exec: MaskEffect::Unchanged, + wave: Wave::Wave32, + operands: OperandRule::Vop1Vgpr, + spec: &[SpecRef { document: Document::Guide, section: "12.8", page: 143 }], + verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding], + }, + FormSemantics { + name: "V_FFBL_B32", + family: EncodingFamily::Vop1, + opcode: 58, + operation: Operation::FindFirstOne, + signedness: Signedness::Bitwise, + carry_in: CarryIn::None, + width: 32, + shift_count_bits: 0, + shift_amount: 0, + swap_sources: false, + source_bits: 32, + relation: None, + scc: SccEffect::Unchanged, + vcc: MaskEffect::Unchanged, + exec: MaskEffect::Unchanged, + wave: Wave::Wave32, + operands: OperandRule::Vop1Vgpr, + spec: &[SpecRef { document: Document::Guide, section: "12.8", page: 143 }], + verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding], + }, + FormSemantics { + name: "V_FFBH_I32", + family: EncodingFamily::Vop1, + opcode: 59, + operation: Operation::FindLastBit, + signedness: Signedness::Signed, + carry_in: CarryIn::None, + width: 32, + shift_count_bits: 0, + shift_amount: 0, + swap_sources: false, + source_bits: 32, + relation: None, + scc: SccEffect::Unchanged, + vcc: MaskEffect::Unchanged, + exec: MaskEffect::Unchanged, + wave: Wave::Wave32, + operands: OperandRule::Vop1Vgpr, + spec: &[SpecRef { document: Document::Guide, section: "12.8", page: 144 }], + verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding], + }, + FormSemantics { + name: "V_SWAP_B32", + family: EncodingFamily::Vop1, + opcode: 101, + operation: Operation::Swap, + signedness: Signedness::Bitwise, + carry_in: CarryIn::None, + width: 32, + shift_count_bits: 0, + shift_amount: 0, + swap_sources: false, + source_bits: 32, + relation: None, + scc: SccEffect::Unchanged, + vcc: MaskEffect::Unchanged, + exec: MaskEffect::Unchanged, + wave: Wave::Wave32, + operands: OperandRule::Vop1Swap, + spec: &[SpecRef { document: Document::Guide, section: "12.8", page: 149 }], + verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding], + }, FormSemantics { name: "V_MUL_I32_I24", family: EncodingFamily::Vop2, diff --git a/crates/loader/generate_x86.py b/crates/loader/generate_x86.py index a02753a..d7bbefc 100644 --- a/crates/loader/generate_x86.py +++ b/crates/loader/generate_x86.py @@ -7,8 +7,9 @@ differs. Never writes. Rejects unknown keys and vocabulary, overlapping encodings, digit and plain -forms sharing an opcode, operand constraints that contradict each other, and -flags declared both written and undefined. Standard library only (Python 3.11+). +forms sharing an opcode, operand constraints that contradict each other, LOCK +on a form that cannot write memory, and flags declared both written and +undefined. Standard library only (Python 3.11+). """ import sys @@ -26,7 +27,7 @@ RUST = HERE / "src/x86_table.rs" TOP_KEYS = {"schema", "architecture", "documents", "operation", "alu", "form", "group"} OPERATION_KEYS = {"reads", "writes", "undefined", "conditional", "terminator", "faults", "ref"} FORM_KEYS = {"op", "map", "prefix", "opcode", "count", "digit", "enc", "size", "imm", "src", - "memory_only", "register_only", "no_rex_b", "unaligned"} + "memory_only", "register_only", "no_rex_b", "unaligned", "lock"} GROUP_KEYS = {"map", "opcodes", "digits"} FLAGS = ["cf", "zf", "sf", "of", "pf", "af"] MAPS = {"1": "ONE_BYTE", "0f": "TWO_BYTE"} @@ -63,6 +64,8 @@ ENCS = { "reg_xmm": ("RegXmm", True, {""}), "reg_xmm_imm": ("RegXmmImm", True, {"ub"}), } +# Encodings whose ModRM operand is the destination, so LOCK can apply to it. +RM_DESTINATIONS = {"rm_reg", "rm", "rm_imm", "rm_one", "rm_cl"} # Encodings whose ModRM operand is an XMM register or memory of the source width. XMM_RM = {"xmm_rm", "rm_xmm", "xmm_rm_imm", "rm_imm_xmm", "reg_xmm", "reg_xmm_imm"} # One-byte opcodes that are prefixes or the two-byte escape, never instructions. @@ -171,6 +174,8 @@ def load(text): if (form["size"] == "x") != (form["enc"] in XMM_RM - {"reg_xmm", "reg_xmm_imm"} or form["enc"] == "xmm_gpr_imm"): fail(f"{where}: XMM size does not match the encoding") + if form.get("lock") and (form["enc"] not in RM_DESTINATIONS or form.get("register_only")): + fail(f"{where}: LOCK needs a memory destination") if form.get("unaligned") and form["src"] != "x": fail(f"{where}: alignment applies only to 16-byte operands") if form["prefix"] and form["map"] != "0f": @@ -266,7 +271,8 @@ def generate(operations, forms): f"memory_only: {str(bool(form.get('memory_only'))).lower()}, " f"register_only: {str(bool(form.get('register_only'))).lower()}, " f"no_rex_b: {str(bool(form.get('no_rex_b'))).lower()}, " - f"unaligned: {str(bool(form.get('unaligned'))).lower()} }},") + f"unaligned: {str(bool(form.get('unaligned'))).lower()}, " + f"lockable: {str(bool(form.get('lock'))).lower()} }},") out += ["];", ""] groups = [] diff --git a/crates/loader/src/cpu.rs b/crates/loader/src/cpu.rs index 92c9cf6..d61df08 100644 --- a/crates/loader/src/cpu.rs +++ b/crates/loader/src/cpu.rs @@ -123,6 +123,35 @@ impl CpuState { } } +/// CPUID leaf 1, EDX: CMOVcc. +pub const CPUID_CMOV: u32 = 1 << 15; +/// CPUID leaf 1, ECX: POPCNT. +pub const CPUID_POPCNT: u32 = 1 << 23; +/// CPUID leaf 0x8000_0001, ECX: LZCNT. +pub const CPUID_LZCNT: u32 = 1 << 5; +/// CPUID leaf 0x8000_0001, EDX: 64-bit mode. +pub const CPUID_LONG_MODE: u32 = 1 << 29; + +/// What the guest's CPUID returns in EAX, EBX, ECX and EDX. +/// +/// The table is fixed and never reads the host. It names a synthetic +/// processor, not an Intel or AMD product, and sets a feature bit only when +/// every instruction of that feature is implemented. A leaf that is not +/// listed returns zeros. +pub fn cpuid(leaf: u32, _subleaf: u32) -> [u32; 4] { + let word = |text: &[u8; 4]| u32::from_le_bytes(*text); + match leaf { + // Highest basic leaf, then "Xenora guest" in EBX, EDX, ECX. + 0 => [1, word(b"Xeno"), word(b"uest"), word(b"ra g")], + // No family, model or stepping: this is no shipped processor. + 1 => [0, 0, CPUID_POPCNT, CPUID_CMOV], + // Highest extended leaf. + 0x8000_0000 => [0x8000_0001, 0, 0, 0], + 0x8000_0001 => [0, 0, CPUID_LZCNT, CPUID_LONG_MODE], + _ => [0; 4], + } +} + /// Termination reason for guest execution. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum ExitReason { diff --git a/crates/loader/src/x86_decode.rs b/crates/loader/src/x86_decode.rs index 3051748..4a994ff 100644 --- a/crates/loader/src/x86_decode.rs +++ b/crates/loader/src/x86_decode.rs @@ -50,6 +50,8 @@ pub struct Form { pub no_rex_b: bool, /// A 16-byte memory operand may have any alignment. pub unaligned: bool, + /// The LOCK prefix is accepted when the ModRM operand is memory. + pub lockable: bool, } /// Opcode table entry. @@ -167,6 +169,9 @@ pub struct Insn { pub imm: u64, /// Condition code for Jcc, CMOVcc and SETcc. pub condition: u8, + /// Carries a LOCK prefix. Set only for a lockable form with a memory + /// destination. + pub lock: bool, } impl Insn { @@ -231,8 +236,9 @@ impl Result> Cursor { /// Decode one instruction at `rip`. `fetch` supplies the byte at an address and /// is called only for bytes that belong to the instruction, in order. /// -/// Forms the registry does not declare, LOCK, address-size overrides and an -/// ignored segment override after FS or GS are rejected rather than approximated. +/// Forms the registry does not declare, LOCK anywhere but on a lockable form +/// with a memory destination, address-size overrides and an ignored segment +/// override after FS or GS are rejected rather than approximated. pub fn decode( rip: u64, fetch: impl FnMut(u64) -> Result, @@ -246,6 +252,7 @@ pub fn decode( let mut operand_size = false; let mut rep = false; let mut repne = false; + let mut lock = false; let mut segment = None; let mut byte = cursor.u8()?; loop { @@ -267,6 +274,11 @@ pub fn decode( byte = cursor.u8()?; continue; } + 0xF0 => { + lock = true; + byte = cursor.u8()?; + continue; + } // CS, DS, ES and SS overrides have no effect in 64-bit mode. After // FS or GS their meaning is not relied on, so it is rejected. 0x26 | 0x2E | 0x36 | 0x3E if segment.is_none() => { @@ -413,6 +425,11 @@ pub fn decode( } else if matches!(form.encoding, Encoding::OpReg | Encoding::OpRegImm) { reg = register(opcode & 7, rex_b, size); } + // LOCK is an invalid opcode unless the instruction is lockable and its + // destination is memory (Intel SDM Vol. 2, "LOCK"). + if lock && !(form.lockable && matches!(rm, Some(RmOperand::Mem(_)))) { + return Err(DecodeError::Unsupported(0xF0)); + } let mut imm = match form.immediate { Immediate::None => 0, @@ -449,6 +466,7 @@ pub fn decode( reg, imm, condition: opcode & 0xF, + lock, }) } diff --git a/crates/loader/src/x86_exec.rs b/crates/loader/src/x86_exec.rs index d0e4ec4..0d82413 100644 --- a/crates/loader/src/x86_exec.rs +++ b/crates/loader/src/x86_exec.rs @@ -10,7 +10,7 @@ //! the state unchanged. Flags that the architecture leaves undefined keep their //! previous value, which is permitted but not something guests may rely on. -use crate::cpu::{CpuState, ExitReason, RFlags, Register}; +use crate::cpu::{CpuState, ExitReason, RFlags, Register, cpuid}; use crate::memory::GuestMemory; use crate::x86_decode::{Encoding, Insn, MemOperand, RegOperand, RmOperand, Segment}; use crate::x86_simd; @@ -19,6 +19,7 @@ use crate::x86_table::Op; const RAX: usize = Register::Rax as usize; const RCX: usize = Register::Rcx as usize; const RDX: usize = Register::Rdx as usize; +const RBX: usize = Register::Rbx as usize; const RSP: usize = Register::Rsp as usize; const RBP: usize = Register::Rbp as usize; @@ -369,6 +370,35 @@ pub fn execute( write_rm(cpu, memory, insn, b)?; write_reg(cpu, insn.reg, size, a); } + Op::Xadd => { + let (a, b) = operands(cpu, memory, insn)?; + let (value, flags) = add(a, b, false, size); + write_rm(cpu, memory, insn, value)?; + // The source is loaded before the destination is stored, so a + // register added to itself keeps the sum. + if insn.rm != Some(RmOperand::Reg(insn.reg)) { + write_reg(cpu, insn.reg, size, a); + } + cpu.flags = flags; + } + Op::Cmpxchg => { + let (destination, source) = operands(cpu, memory, insn)?; + let expected = cpu.gpr[RAX] & mask(size); + let (_, flags) = sub(expected, destination, false, size); + // The destination is written whether or not the values match, so a + // mismatch on memory that cannot be written still faults. + let matched = expected == destination; + write_rm( + cpu, + memory, + insn, + if matched { source } else { destination }, + )?; + if !matched { + write_reg(cpu, accumulator(RAX), size, destination); + } + cpu.flags = flags; + } Op::Bswap => { let value = read_reg(cpu, insn.reg, size).swap_bytes() >> (64 - 8 * u32::from(size)); write_reg(cpu, insn.reg, size, value); @@ -544,6 +574,14 @@ pub fn execute( cpu.gpr[RSP] = sp.wrapping_add(8).wrapping_add(insn.imm); } Op::Nop => {} + Op::Cpuid => { + // The leaf is EAX and the subleaf ECX. Each result is a 32-bit + // register write, so the upper halves are cleared. + let values = cpuid(cpu.gpr[RAX] as u32, cpu.gpr[RCX] as u32); + for (register, value) in [RAX, RBX, RCX, RDX].into_iter().zip(values) { + cpu.gpr[register] = u64::from(value); + } + } Op::Clc => cpu.flags.cf = false, Op::Stc => cpu.flags.cf = true, Op::Cmc => cpu.flags.cf = !cpu.flags.cf, diff --git a/crates/loader/src/x86_table.rs b/crates/loader/src/x86_table.rs index 57812be..ccb06dd 100644 --- a/crates/loader/src/x86_table.rs +++ b/crates/loader/src/x86_table.rs @@ -27,6 +27,8 @@ pub enum Op { Movsxd, Lea, Xchg, + Xadd, + Cmpxchg, Bswap, Cwde, Cdq, @@ -64,6 +66,7 @@ pub enum Op { Clc, Stc, Cmc, + Cpuid, Movaps, Movups, Movdqa, @@ -202,7 +205,7 @@ pub enum Op { } impl Op { - pub const ALL: &[Op] = &[Op::Add, Op::Or, Op::Adc, Op::Sbb, Op::And, Op::Sub, Op::Xor, Op::Cmp, Op::Test, Op::Inc, Op::Dec, Op::Neg, Op::Not, Op::Mov, Op::Movzx, Op::Movsx, Op::Movsxd, Op::Lea, Op::Xchg, Op::Bswap, Op::Cwde, Op::Cdq, Op::Rol, Op::Ror, Op::Shl, Op::Shr, Op::Sar, Op::Mul, Op::Imul, Op::Imul2, Op::Div, Op::Idiv, Op::Cmov, Op::Setcc, Op::Bt, Op::Bts, Op::Btr, Op::Btc, Op::Bsf, Op::Bsr, Op::Popcnt, Op::Tzcnt, Op::Lzcnt, Op::Push, Op::Pop, Op::Leave, Op::Call, Op::Jmp, Op::Jcc, Op::Ret, Op::Nop, Op::Hlt, Op::Syscall, Op::Clc, Op::Stc, Op::Cmc, Op::Movaps, Op::Movups, Op::Movdqa, Op::Movdqu, Op::Movntdq, Op::Movntps, Op::Movss, Op::Movsd, Op::Movq, Op::Movd, Op::Movlps, Op::Movhps, Op::Movmskps, Op::Movmskpd, Op::Pmovmskb, Op::Pand, Op::Pandn, Op::Por, Op::Pxor, Op::Punpcklbw, Op::Punpcklwd, Op::Punpckldq, Op::Packsswb, Op::Pcmpgtb, Op::Pcmpgtw, Op::Pcmpgtd, Op::Packuswb, Op::Punpckhbw, Op::Punpckhwd, Op::Punpckhdq, Op::Packssdw, Op::Punpcklqdq, Op::Punpckhqdq, Op::Pcmpeqb, Op::Pcmpeqw, Op::Pcmpeqd, Op::Paddq, Op::Pmullw, Op::Psubusb, Op::Psubusw, Op::Pminub, Op::Paddusb, Op::Paddusw, Op::Pmaxub, Op::Pavgb, Op::Pavgw, Op::Pmulhuw, Op::Pmulhw, Op::Psubsb, Op::Psubsw, Op::Pminsw, Op::Paddsb, Op::Paddsw, Op::Pmaxsw, Op::Pmuludq, Op::Pmaddwd, Op::Psadbw, Op::Psubb, Op::Psubw, Op::Psubd, Op::Psubq, Op::Paddb, Op::Paddw, Op::Paddd, Op::Psrlw, Op::Psraw, Op::Psllw, Op::Psrld, Op::Psrad, Op::Pslld, Op::Psrlq, Op::Psllq, Op::Psrldq, Op::Pslldq, Op::Pshufd, Op::Pshufhw, Op::Pshuflw, Op::Shufps, Op::Shufpd, Op::Pinsrw, Op::Pextrw, Op::Ldmxcsr, Op::Stmxcsr, Op::Sqrtps, Op::Sqrtpd, Op::Sqrtss, Op::Sqrtsd, Op::Addps, Op::Addpd, Op::Addss, Op::Addsd, Op::Mulps, Op::Mulpd, Op::Mulss, Op::Mulsd, Op::Subps, Op::Subpd, Op::Subss, Op::Subsd, Op::Minps, Op::Minpd, Op::Minss, Op::Minsd, Op::Divps, Op::Divpd, Op::Divss, Op::Divsd, Op::Maxps, Op::Maxpd, Op::Maxss, Op::Maxsd, Op::Cmpps, Op::Cmppd, Op::Cmpss, Op::Cmpsd, Op::Ucomiss, Op::Comiss, Op::Ucomisd, Op::Comisd, Op::Cvtps2pd, Op::Cvtpd2ps, Op::Cvtss2sd, Op::Cvtsd2ss, Op::Cvtdq2ps, Op::Cvtps2dq, Op::Cvttps2dq, Op::Cvttpd2dq, Op::Cvtdq2pd, Op::Cvtpd2dq, Op::Cvtsi2ss, Op::Cvttss2si, Op::Cvtss2si, Op::Cvtsi2sd, Op::Cvttsd2si, Op::Cvtsd2si]; + pub const ALL: &[Op] = &[Op::Add, Op::Or, Op::Adc, Op::Sbb, Op::And, Op::Sub, Op::Xor, Op::Cmp, Op::Test, Op::Inc, Op::Dec, Op::Neg, Op::Not, Op::Mov, Op::Movzx, Op::Movsx, Op::Movsxd, Op::Lea, Op::Xchg, Op::Xadd, Op::Cmpxchg, Op::Bswap, Op::Cwde, Op::Cdq, Op::Rol, Op::Ror, Op::Shl, Op::Shr, Op::Sar, Op::Mul, Op::Imul, Op::Imul2, Op::Div, Op::Idiv, Op::Cmov, Op::Setcc, Op::Bt, Op::Bts, Op::Btr, Op::Btc, Op::Bsf, Op::Bsr, Op::Popcnt, Op::Tzcnt, Op::Lzcnt, Op::Push, Op::Pop, Op::Leave, Op::Call, Op::Jmp, Op::Jcc, Op::Ret, Op::Nop, Op::Hlt, Op::Syscall, Op::Clc, Op::Stc, Op::Cmc, Op::Cpuid, Op::Movaps, Op::Movups, Op::Movdqa, Op::Movdqu, Op::Movntdq, Op::Movntps, Op::Movss, Op::Movsd, Op::Movq, Op::Movd, Op::Movlps, Op::Movhps, Op::Movmskps, Op::Movmskpd, Op::Pmovmskb, Op::Pand, Op::Pandn, Op::Por, Op::Pxor, Op::Punpcklbw, Op::Punpcklwd, Op::Punpckldq, Op::Packsswb, Op::Pcmpgtb, Op::Pcmpgtw, Op::Pcmpgtd, Op::Packuswb, Op::Punpckhbw, Op::Punpckhwd, Op::Punpckhdq, Op::Packssdw, Op::Punpcklqdq, Op::Punpckhqdq, Op::Pcmpeqb, Op::Pcmpeqw, Op::Pcmpeqd, Op::Paddq, Op::Pmullw, Op::Psubusb, Op::Psubusw, Op::Pminub, Op::Paddusb, Op::Paddusw, Op::Pmaxub, Op::Pavgb, Op::Pavgw, Op::Pmulhuw, Op::Pmulhw, Op::Psubsb, Op::Psubsw, Op::Pminsw, Op::Paddsb, Op::Paddsw, Op::Pmaxsw, Op::Pmuludq, Op::Pmaddwd, Op::Psadbw, Op::Psubb, Op::Psubw, Op::Psubd, Op::Psubq, Op::Paddb, Op::Paddw, Op::Paddd, Op::Psrlw, Op::Psraw, Op::Psllw, Op::Psrld, Op::Psrad, Op::Pslld, Op::Psrlq, Op::Psllq, Op::Psrldq, Op::Pslldq, Op::Pshufd, Op::Pshufhw, Op::Pshuflw, Op::Shufps, Op::Shufpd, Op::Pinsrw, Op::Pextrw, Op::Ldmxcsr, Op::Stmxcsr, Op::Sqrtps, Op::Sqrtpd, Op::Sqrtss, Op::Sqrtsd, Op::Addps, Op::Addpd, Op::Addss, Op::Addsd, Op::Mulps, Op::Mulpd, Op::Mulss, Op::Mulsd, Op::Subps, Op::Subpd, Op::Subss, Op::Subsd, Op::Minps, Op::Minpd, Op::Minss, Op::Minsd, Op::Divps, Op::Divpd, Op::Divss, Op::Divsd, Op::Maxps, Op::Maxpd, Op::Maxss, Op::Maxsd, Op::Cmpps, Op::Cmppd, Op::Cmpss, Op::Cmpsd, Op::Ucomiss, Op::Comiss, Op::Ucomisd, Op::Comisd, Op::Cvtps2pd, Op::Cvtpd2ps, Op::Cvtss2sd, Op::Cvtsd2ss, Op::Cvtdq2ps, Op::Cvtps2dq, Op::Cvttps2dq, Op::Cvttpd2dq, Op::Cvtdq2pd, Op::Cvtpd2dq, Op::Cvtsi2ss, Op::Cvttss2si, Op::Cvtss2si, Op::Cvtsi2sd, Op::Cvttsd2si, Op::Cvtsd2si]; /// Lower-case mnemonic stem. pub const fn name(self) -> &'static str { @@ -226,6 +229,8 @@ impl Op { Op::Movsxd => "movsxd", Op::Lea => "lea", Op::Xchg => "xchg", + Op::Xadd => "xadd", + Op::Cmpxchg => "cmpxchg", Op::Bswap => "bswap", Op::Cwde => "cwde", Op::Cdq => "cdq", @@ -263,6 +268,7 @@ impl Op { Op::Clc => "clc", Op::Stc => "stc", Op::Cmc => "cmc", + Op::Cpuid => "cpuid", Op::Movaps => "movaps", Op::Movups => "movups", Op::Movdqa => "movdqa", @@ -423,6 +429,8 @@ impl Op { Op::Movsxd => 0, Op::Lea => 0, Op::Xchg => 0, + Op::Xadd => 0, + Op::Cmpxchg => 0, Op::Bswap => 0, Op::Cwde => 0, Op::Cdq => 0, @@ -460,6 +468,7 @@ impl Op { Op::Clc => 0, Op::Stc => 0, Op::Cmc => 1, + Op::Cpuid => 0, Op::Movaps => 0, Op::Movups => 0, Op::Movdqa => 0, @@ -620,6 +629,8 @@ impl Op { Op::Movsxd => 0, Op::Lea => 0, Op::Xchg => 0, + Op::Xadd => 63, + Op::Cmpxchg => 63, Op::Bswap => 0, Op::Cwde => 0, Op::Cdq => 0, @@ -657,6 +668,7 @@ impl Op { Op::Clc => 1, Op::Stc => 1, Op::Cmc => 1, + Op::Cpuid => 0, Op::Movaps => 0, Op::Movups => 0, Op::Movdqa => 0, @@ -817,6 +829,8 @@ impl Op { Op::Movsxd => 0, Op::Lea => 0, Op::Xchg => 0, + Op::Xadd => 63, + Op::Cmpxchg => 63, Op::Bswap => 0, Op::Cwde => 0, Op::Cdq => 0, @@ -854,6 +868,7 @@ impl Op { Op::Clc => 1, Op::Stc => 1, Op::Cmc => 1, + Op::Cpuid => 0, Op::Movaps => 0, Op::Movups => 0, Op::Movdqa => 0, @@ -1014,6 +1029,8 @@ impl Op { Op::Movsxd => 0, Op::Lea => 0, Op::Xchg => 0, + Op::Xadd => 0, + Op::Cmpxchg => 0, Op::Bswap => 0, Op::Cwde => 0, Op::Cdq => 0, @@ -1051,6 +1068,7 @@ impl Op { Op::Clc => 0, Op::Stc => 0, Op::Cmc => 0, + Op::Cpuid => 0, Op::Movaps => 0, Op::Movups => 0, Op::Movdqa => 0, @@ -1211,6 +1229,8 @@ impl Op { Op::Movsxd => false, Op::Lea => false, Op::Xchg => false, + Op::Xadd => false, + Op::Cmpxchg => false, Op::Bswap => false, Op::Cwde => false, Op::Cdq => false, @@ -1248,6 +1268,7 @@ impl Op { Op::Clc => false, Op::Stc => false, Op::Cmc => false, + Op::Cpuid => false, Op::Movaps => false, Op::Movups => false, Op::Movdqa => false, @@ -1408,6 +1429,8 @@ impl Op { Op::Movsxd => false, Op::Lea => false, Op::Xchg => false, + Op::Xadd => false, + Op::Cmpxchg => false, Op::Bswap => false, Op::Cwde => false, Op::Cdq => false, @@ -1445,6 +1468,7 @@ impl Op { Op::Clc => false, Op::Stc => false, Op::Cmc => false, + Op::Cpuid => false, Op::Movaps => false, Op::Movups => false, Op::Movdqa => false, @@ -1605,6 +1629,8 @@ impl Op { Op::Movsxd => false, Op::Lea => false, Op::Xchg => false, + Op::Xadd => false, + Op::Cmpxchg => false, Op::Bswap => false, Op::Cwde => false, Op::Cdq => false, @@ -1642,6 +1668,7 @@ impl Op { Op::Clc => false, Op::Stc => false, Op::Cmc => false, + Op::Cpuid => false, Op::Movaps => true, Op::Movups => true, Op::Movdqa => true, @@ -1781,410 +1808,415 @@ impl Op { } } -pub static FORMS: [Form; 358] = [ - Form { op: Op::Movsxd, encoding: Encoding::RegRm, size: OperandSize::Wide, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Push, encoding: Encoding::OpReg, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pop, encoding: Encoding::OpReg, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Push, encoding: Encoding::Imm, size: OperandSize::Quad, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Push, encoding: Encoding::Imm, size: OperandSize::Quad, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Push, encoding: Encoding::Rm, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pop, encoding: Encoding::Rm, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Imul2, encoding: Encoding::RegRmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Imul2, encoding: Encoding::RegRmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Imul2, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Jcc, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Jcc, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::Signed32, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmov, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Setcc, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Test, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Test, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Test, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Test, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Test, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Test, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Xchg, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Xchg, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mov, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mov, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mov, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mov, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Lea, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Nop, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: true, unaligned: false }, - Form { op: Op::Nop, encoding: Encoding::RmUnread, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cwde, encoding: Encoding::None, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cdq, encoding: Encoding::None, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mov, encoding: Encoding::OpRegImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mov, encoding: Encoding::OpRegImm, size: OperandSize::Variable, immediate: Immediate::Full, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mov, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mov, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Ret, encoding: Encoding::Imm, size: OperandSize::None, immediate: Immediate::Word, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Ret, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Leave, encoding: Encoding::None, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Call, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::Signed32, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Jmp, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::Signed32, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Jmp, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Call, encoding: Encoding::Rm, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Jmp, encoding: Encoding::Rm, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Hlt, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmc, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Clc, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Stc, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Syscall, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movzx, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 1, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movzx, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 2, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movsx, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 1, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movsx, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 2, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Bswap, encoding: Encoding::OpReg, size: OperandSize::Wide, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Bsf, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Bsr, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Popcnt, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Tzcnt, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Lzcnt, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Bt, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Bts, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Btr, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Btc, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Movaps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movaps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movaps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movaps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movups, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: true }, - Form { op: Op::Movups, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: true }, - Form { op: Op::Movups, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: true }, - Form { op: Op::Movups, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: true }, - Form { op: Op::Movdqa, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movdqa, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movdqu, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: true }, - Form { op: Op::Movdqu, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: true }, - Form { op: Op::Movntdq, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movntps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movntps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movss, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movsd, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movq, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movd, encoding: Encoding::XmmGpr, size: OperandSize::Wide, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movd, encoding: Encoding::GprXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movlps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movlps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movlps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movlps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movhps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movhps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movhps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movhps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Movmskps, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Movmskpd, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Pmovmskb, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Pand, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pand, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pand, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pandn, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pandn, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pandn, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Por, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Por, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Por, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pxor, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pxor, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pxor, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Punpcklbw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Punpcklwd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Punpckldq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Packsswb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pcmpgtb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pcmpgtw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pcmpgtd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Packuswb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Punpckhbw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Punpckhwd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Punpckhdq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Packssdw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Punpcklqdq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Punpckhqdq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pcmpeqb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pcmpeqw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pcmpeqd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Paddq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pmullw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psubusb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psubusw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pminub, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Paddusb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Paddusw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pmaxub, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pavgb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pavgw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pmulhuw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pmulhw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psubsb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psubsw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pminsw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Paddsb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Paddsw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pmaxsw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pmuludq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pmaddwd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psadbw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psubb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psubw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psubd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psubq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Paddb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Paddw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Paddd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psrlw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psrlw, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Psraw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psraw, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Psllw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psllw, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Psrld, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psrld, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Psrad, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psrad, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Pslld, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pslld, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Psrlq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psrlq, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Psllq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Psllq, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Psrldq, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Pslldq, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Pshufd, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pshufhw, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pshuflw, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shufps, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shufpd, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Punpckldq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Punpcklqdq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Punpckhdq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Punpckhqdq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pinsrw, encoding: Encoding::XmmGprImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 2, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Pextrw, encoding: Encoding::RegXmmImm, size: OperandSize::Wide, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false }, - Form { op: Op::Ldmxcsr, encoding: Encoding::Rm, size: OperandSize::None, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Stmxcsr, encoding: Encoding::Rm, size: OperandSize::None, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sqrtps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sqrtpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sqrtss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sqrtsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Addps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Addpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Addss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Addsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mulps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mulpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mulss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mulsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Subps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Subpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Subss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Subsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Minps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Minpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Minss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Minsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Divps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Divpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Divss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Divsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Maxps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Maxpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Maxss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Maxsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmpps, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmppd, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmpss, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmpsd, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Ucomiss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Comiss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Ucomisd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Comisd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvtps2pd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvtpd2ps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvtss2sd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvtsd2ss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvtdq2ps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvtps2dq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvttps2dq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvttpd2dq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvtdq2pd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvtpd2dq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvtsi2ss, encoding: Encoding::XmmGpr, size: OperandSize::Wide, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvttss2si, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvtss2si, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvtsi2sd, encoding: Encoding::XmmGpr, size: OperandSize::Wide, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvttsd2si, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cvtsd2si, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Add, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Add, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Add, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Add, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Add, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Add, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Add, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Add, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Add, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Or, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Or, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Or, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Or, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Or, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Or, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Or, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Or, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Or, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Adc, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Adc, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Adc, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Adc, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Adc, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Adc, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Adc, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Adc, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Adc, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sbb, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sbb, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sbb, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sbb, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sbb, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sbb, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sbb, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sbb, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sbb, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::And, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::And, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::And, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::And, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::And, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::And, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::And, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::And, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::And, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sub, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sub, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sub, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sub, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sub, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sub, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sub, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sub, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sub, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Xor, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Xor, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Xor, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Xor, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Xor, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Xor, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Xor, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Xor, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Xor, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmp, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmp, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmp, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmp, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmp, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmp, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmp, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmp, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Cmp, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Bt, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Bts, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Btr, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Btc, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Not, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Neg, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mul, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Imul, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Div, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Idiv, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Not, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Neg, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Mul, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Imul, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Div, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Idiv, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Inc, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Dec, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Inc, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Dec, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Rol, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Ror, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shl, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shr, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sar, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Rol, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Ror, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shl, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shr, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sar, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Rol, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Ror, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shl, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shr, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sar, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Rol, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Ror, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shl, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shr, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sar, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Rol, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Ror, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shl, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shr, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sar, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Rol, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Ror, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shl, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Shr, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, - Form { op: Op::Sar, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false }, +pub static FORMS: [Form; 363] = [ + Form { op: Op::Movsxd, encoding: Encoding::RegRm, size: OperandSize::Wide, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Push, encoding: Encoding::OpReg, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pop, encoding: Encoding::OpReg, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Push, encoding: Encoding::Imm, size: OperandSize::Quad, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Push, encoding: Encoding::Imm, size: OperandSize::Quad, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Push, encoding: Encoding::Rm, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pop, encoding: Encoding::Rm, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Imul2, encoding: Encoding::RegRmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Imul2, encoding: Encoding::RegRmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Imul2, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Jcc, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Jcc, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::Signed32, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmov, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Setcc, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Test, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Test, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Test, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Test, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Test, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Test, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Xchg, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Xchg, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mov, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mov, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mov, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mov, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Lea, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Nop, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: true, unaligned: false, lockable: false }, + Form { op: Op::Nop, encoding: Encoding::RmUnread, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cwde, encoding: Encoding::None, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cdq, encoding: Encoding::None, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mov, encoding: Encoding::OpRegImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mov, encoding: Encoding::OpRegImm, size: OperandSize::Variable, immediate: Immediate::Full, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mov, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mov, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Ret, encoding: Encoding::Imm, size: OperandSize::None, immediate: Immediate::Word, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Ret, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Leave, encoding: Encoding::None, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Call, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::Signed32, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Jmp, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::Signed32, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Jmp, encoding: Encoding::Rel, size: OperandSize::None, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Call, encoding: Encoding::Rm, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Jmp, encoding: Encoding::Rm, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Hlt, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmc, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Clc, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Stc, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Syscall, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cpuid, encoding: Encoding::None, size: OperandSize::None, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movzx, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 1, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movzx, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 2, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movsx, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 1, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movsx, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 2, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Bswap, encoding: Encoding::OpReg, size: OperandSize::Wide, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Bsf, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Bsr, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Popcnt, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Tzcnt, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Lzcnt, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Bt, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Bts, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Btr, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Btc, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmpxchg, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: true }, + Form { op: Op::Cmpxchg, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: true }, + Form { op: Op::Xadd, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: true }, + Form { op: Op::Xadd, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: true }, + Form { op: Op::Movaps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movaps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movaps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movaps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movups, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: true, lockable: false }, + Form { op: Op::Movups, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: true, lockable: false }, + Form { op: Op::Movups, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: true, lockable: false }, + Form { op: Op::Movups, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: true, lockable: false }, + Form { op: Op::Movdqa, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movdqa, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movdqu, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: true, lockable: false }, + Form { op: Op::Movdqu, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: true, lockable: false }, + Form { op: Op::Movntdq, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movntps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movntps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movss, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movsd, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movq, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movd, encoding: Encoding::XmmGpr, size: OperandSize::Wide, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movd, encoding: Encoding::GprXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movlps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movlps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movlps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movlps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movhps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movhps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movhps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movhps, encoding: Encoding::RmXmm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movmskps, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Movmskpd, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pmovmskb, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pand, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pand, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pand, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pandn, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pandn, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pandn, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Por, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Por, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Por, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pxor, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pxor, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pxor, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Punpcklbw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Punpcklwd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Punpckldq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Packsswb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pcmpgtb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pcmpgtw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pcmpgtd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Packuswb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Punpckhbw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Punpckhwd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Punpckhdq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Packssdw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Punpcklqdq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Punpckhqdq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pcmpeqb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pcmpeqw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pcmpeqd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Paddq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pmullw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psubusb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psubusw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pminub, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Paddusb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Paddusw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pmaxub, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pavgb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pavgw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pmulhuw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pmulhw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psubsb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psubsw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pminsw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Paddsb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Paddsw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pmaxsw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pmuludq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pmaddwd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psadbw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psubb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psubw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psubd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psubq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Paddb, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Paddw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Paddd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psrlw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psrlw, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psraw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psraw, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psllw, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psllw, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psrld, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psrld, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psrad, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psrad, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pslld, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pslld, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psrlq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psrlq, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psllq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psllq, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Psrldq, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pslldq, encoding: Encoding::RmImmXmm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pshufd, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pshufhw, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pshuflw, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shufps, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shufpd, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Punpckldq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Punpcklqdq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Punpckhdq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Punpckhqdq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pinsrw, encoding: Encoding::XmmGprImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 2, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Pextrw, encoding: Encoding::RegXmmImm, size: OperandSize::Wide, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: true, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Ldmxcsr, encoding: Encoding::Rm, size: OperandSize::None, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Stmxcsr, encoding: Encoding::Rm, size: OperandSize::None, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: true, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sqrtps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sqrtpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sqrtss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sqrtsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Addps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Addpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Addss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Addsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mulps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mulpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mulss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mulsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Subps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Subpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Subss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Subsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Minps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Minpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Minss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Minsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Divps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Divpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Divss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Divsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Maxps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Maxpd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Maxss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Maxsd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmpps, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmppd, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmpss, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmpsd, encoding: Encoding::XmmRmImm, size: OperandSize::Xmm, immediate: Immediate::Byte, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Ucomiss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Comiss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Ucomisd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Comisd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvtps2pd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvtpd2ps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvtss2sd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvtsd2ss, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvtdq2ps, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvtps2dq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvttps2dq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvttpd2dq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvtdq2pd, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvtpd2dq, encoding: Encoding::XmmRm, size: OperandSize::Xmm, immediate: Immediate::None, source: 16, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvtsi2ss, encoding: Encoding::XmmGpr, size: OperandSize::Wide, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvttss2si, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvtss2si, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvtsi2sd, encoding: Encoding::XmmGpr, size: OperandSize::Wide, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvttsd2si, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cvtsd2si, encoding: Encoding::RegXmm, size: OperandSize::Wide, immediate: Immediate::None, source: 8, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Add, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Add, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Add, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Add, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Add, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Add, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Add, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Add, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Add, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Or, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Or, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Or, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Or, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Or, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Or, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Or, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Or, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Or, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Adc, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Adc, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Adc, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Adc, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Adc, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Adc, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Adc, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Adc, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Adc, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sbb, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sbb, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sbb, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sbb, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sbb, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sbb, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sbb, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sbb, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sbb, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::And, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::And, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::And, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::And, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::And, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::And, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::And, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::And, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::And, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sub, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sub, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sub, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sub, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sub, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sub, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sub, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sub, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sub, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Xor, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Xor, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Xor, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Xor, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Xor, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Xor, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Xor, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Xor, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Xor, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmp, encoding: Encoding::RmReg, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmp, encoding: Encoding::RmReg, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmp, encoding: Encoding::RegRm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmp, encoding: Encoding::RegRm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmp, encoding: Encoding::AccImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmp, encoding: Encoding::AccImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmp, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmp, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedFull, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Cmp, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Bt, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Bts, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Btr, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Btc, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Not, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Neg, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mul, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Imul, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Div, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Idiv, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Not, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Neg, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Mul, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Imul, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Div, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Idiv, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Inc, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Dec, encoding: Encoding::Rm, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Inc, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Dec, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Rol, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Ror, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shl, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shr, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sar, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Rol, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Ror, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shl, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shr, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sar, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Rol, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Ror, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shl, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shr, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sar, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Rol, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Ror, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shl, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shr, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sar, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Rol, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Ror, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shl, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shr, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sar, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Rol, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Ror, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shl, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Shr, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, + Form { op: Op::Sar, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false }, ]; /// Form per ModRM digit; 65535 marks an unsupported digit. pub static GROUPS: [[u16; 8]; 22] = [ - [242, 251, 260, 269, 278, 287, 296, 305], - [243, 252, 261, 270, 279, 288, 297, 306], - [244, 253, 262, 271, 280, 289, 298, 307], + [247, 256, 265, 274, 283, 292, 301, 310], + [248, 257, 266, 275, 284, 293, 302, 311], + [249, 258, 267, 276, 285, 294, 303, 312], [6, 65535, 65535, 65535, 65535, 65535, 65535, 65535], - [328, 329, 65535, 65535, 330, 331, 65535, 332], [333, 334, 65535, 65535, 335, 336, 65535, 337], + [338, 339, 65535, 65535, 340, 341, 65535, 342], [33, 65535, 65535, 65535, 65535, 65535, 65535, 65535], [34, 65535, 65535, 65535, 65535, 65535, 65535, 65535], - [338, 339, 65535, 65535, 340, 341, 65535, 342], [343, 344, 65535, 65535, 345, 346, 65535, 347], [348, 349, 65535, 65535, 350, 351, 65535, 352], [353, 354, 65535, 65535, 355, 356, 65535, 357], - [18, 65535, 312, 313, 314, 315, 316, 317], - [19, 65535, 318, 319, 320, 321, 322, 323], - [324, 325, 65535, 65535, 65535, 65535, 65535, 65535], - [326, 327, 41, 65535, 42, 65535, 5, 65535], + [358, 359, 65535, 65535, 360, 361, 65535, 362], + [18, 65535, 317, 318, 319, 320, 321, 322], + [19, 65535, 323, 324, 325, 326, 327, 328], + [329, 330, 65535, 65535, 65535, 65535, 65535, 65535], + [331, 332, 41, 65535, 42, 65535, 5, 65535], [28, 65535, 65535, 65535, 65535, 65535, 65535, 65535], - [65535, 65535, 182, 183, 65535, 65535, 65535, 65535], - [65535, 65535, 65535, 65535, 308, 309, 310, 311], - [65535, 65535, 154, 65535, 156, 65535, 158, 65535], - [65535, 65535, 160, 65535, 162, 65535, 164, 65535], - [65535, 65535, 166, 169, 65535, 65535, 168, 170], + [65535, 65535, 187, 188, 65535, 65535, 65535, 65535], + [65535, 65535, 65535, 65535, 313, 314, 315, 316], + [65535, 65535, 159, 65535, 161, 65535, 163, 65535], + [65535, 65535, 165, 65535, 167, 65535, 169, 65535], + [65535, 65535, 171, 174, 65535, 65535, 173, 175], ]; pub static ONE_BYTE: [Entry; 256] = [ - Entry::Form(236), Entry::Form(237), Entry::Form(238), Entry::Form(239), - Entry::Form(240), Entry::Form(241), Entry::Unsupported, Entry::Unsupported, - Entry::Form(245), Entry::Form(246), Entry::Form(247), Entry::Form(248), - Entry::Form(249), Entry::Form(250), Entry::Unsupported, Entry::Unsupported, - Entry::Form(254), Entry::Form(255), Entry::Form(256), Entry::Form(257), - Entry::Form(258), Entry::Form(259), Entry::Unsupported, Entry::Unsupported, - Entry::Form(263), Entry::Form(264), Entry::Form(265), Entry::Form(266), - Entry::Form(267), Entry::Form(268), Entry::Unsupported, Entry::Unsupported, - Entry::Form(272), Entry::Form(273), Entry::Form(274), Entry::Form(275), - Entry::Form(276), Entry::Form(277), Entry::Unsupported, Entry::Unsupported, - Entry::Form(281), Entry::Form(282), Entry::Form(283), Entry::Form(284), - Entry::Form(285), Entry::Form(286), Entry::Unsupported, Entry::Unsupported, - Entry::Form(290), Entry::Form(291), Entry::Form(292), Entry::Form(293), - Entry::Form(294), Entry::Form(295), Entry::Unsupported, Entry::Unsupported, - Entry::Form(299), Entry::Form(300), Entry::Form(301), Entry::Form(302), - Entry::Form(303), Entry::Form(304), Entry::Unsupported, Entry::Unsupported, + Entry::Form(241), Entry::Form(242), Entry::Form(243), Entry::Form(244), + Entry::Form(245), Entry::Form(246), Entry::Unsupported, Entry::Unsupported, + Entry::Form(250), Entry::Form(251), Entry::Form(252), Entry::Form(253), + Entry::Form(254), Entry::Form(255), Entry::Unsupported, Entry::Unsupported, + Entry::Form(259), Entry::Form(260), Entry::Form(261), Entry::Form(262), + Entry::Form(263), Entry::Form(264), Entry::Unsupported, Entry::Unsupported, + Entry::Form(268), Entry::Form(269), Entry::Form(270), Entry::Form(271), + Entry::Form(272), Entry::Form(273), Entry::Unsupported, Entry::Unsupported, + Entry::Form(277), Entry::Form(278), Entry::Form(279), Entry::Form(280), + Entry::Form(281), Entry::Form(282), Entry::Unsupported, Entry::Unsupported, + Entry::Form(286), Entry::Form(287), Entry::Form(288), Entry::Form(289), + Entry::Form(290), Entry::Form(291), Entry::Unsupported, Entry::Unsupported, + Entry::Form(295), Entry::Form(296), Entry::Form(297), Entry::Form(298), + Entry::Form(299), Entry::Form(300), Entry::Unsupported, Entry::Unsupported, + Entry::Form(304), Entry::Form(305), Entry::Form(306), Entry::Form(307), + Entry::Form(308), Entry::Form(309), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, @@ -2240,14 +2272,14 @@ pub static TWO_BYTE: [Entry; 256] = [ Entry::Unsupported, Entry::Form(47), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Form(66), Entry::Form(67), Entry::Form(85), Entry::Form(87), - Entry::Form(176), Entry::Form(178), Entry::Form(89), Entry::Form(91), + Entry::Form(71), Entry::Form(72), Entry::Form(90), Entry::Form(92), + Entry::Form(181), Entry::Form(183), Entry::Form(94), Entry::Form(96), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Group(16), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Form(62), Entry::Form(63), Entry::Unsupported, Entry::Form(75), - Entry::Unsupported, Entry::Unsupported, Entry::Form(216), Entry::Form(217), + Entry::Form(67), Entry::Form(68), Entry::Unsupported, Entry::Form(80), + Entry::Unsupported, Entry::Unsupported, Entry::Form(221), Entry::Form(222), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, @@ -2256,10 +2288,10 @@ pub static TWO_BYTE: [Entry; 256] = [ Entry::Form(12), Entry::Form(12), Entry::Form(12), Entry::Form(12), Entry::Form(12), Entry::Form(12), Entry::Form(12), Entry::Form(12), Entry::Form(12), Entry::Form(12), Entry::Form(12), Entry::Form(12), - Entry::Form(93), Entry::Form(184), Entry::Unsupported, Entry::Unsupported, - Entry::Form(97), Entry::Form(100), Entry::Form(103), Entry::Form(106), - Entry::Form(188), Entry::Form(192), Entry::Form(220), Entry::Form(224), - Entry::Form(196), Entry::Form(200), Entry::Form(204), Entry::Form(208), + Entry::Form(98), Entry::Form(189), Entry::Unsupported, Entry::Unsupported, + Entry::Form(102), Entry::Form(105), Entry::Form(108), Entry::Form(111), + Entry::Form(193), Entry::Form(197), Entry::Form(225), Entry::Form(229), + Entry::Form(201), Entry::Form(205), Entry::Form(209), Entry::Form(213), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, @@ -2276,18 +2308,18 @@ pub static TWO_BYTE: [Entry; 256] = [ Entry::Form(13), Entry::Form(13), Entry::Form(13), Entry::Form(13), Entry::Form(13), Entry::Form(13), Entry::Form(13), Entry::Form(13), Entry::Form(13), Entry::Form(13), Entry::Form(13), Entry::Form(13), - Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Form(58), + Entry::Unsupported, Entry::Unsupported, Entry::Form(48), Entry::Form(59), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Form(59), - Entry::Unsupported, Entry::Unsupported, Entry::Group(17), Entry::Form(9), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Form(60), - Entry::Unsupported, Entry::Unsupported, Entry::Form(48), Entry::Form(49), - Entry::Unsupported, Entry::Unsupported, Entry::Group(18), Entry::Form(61), - Entry::Form(53), Entry::Form(54), Entry::Form(50), Entry::Form(51), - Entry::Unsupported, Entry::Unsupported, Entry::Form(212), Entry::Unsupported, - Entry::Unsupported, Entry::Unsupported, Entry::Form(174), Entry::Unsupported, - Entry::Form(52), Entry::Form(52), Entry::Form(52), Entry::Form(52), - Entry::Form(52), Entry::Form(52), Entry::Form(52), Entry::Form(52), + Entry::Unsupported, Entry::Unsupported, Entry::Group(17), Entry::Form(9), + Entry::Form(63), Entry::Form(64), Entry::Unsupported, Entry::Form(61), + Entry::Unsupported, Entry::Unsupported, Entry::Form(49), Entry::Form(50), + Entry::Unsupported, Entry::Unsupported, Entry::Group(18), Entry::Form(62), + Entry::Form(54), Entry::Form(55), Entry::Form(51), Entry::Form(52), + Entry::Form(65), Entry::Form(66), Entry::Form(217), Entry::Unsupported, + Entry::Unsupported, Entry::Unsupported, Entry::Form(179), Entry::Unsupported, + Entry::Form(53), Entry::Form(53), Entry::Form(53), Entry::Form(53), + Entry::Form(53), Entry::Form(53), Entry::Form(53), Entry::Form(53), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, @@ -2307,14 +2339,14 @@ pub static TWO_BYTE_66: [Entry; 256] = [ Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Form(68), Entry::Form(69), Entry::Form(86), Entry::Form(88), - Entry::Form(177), Entry::Form(179), Entry::Form(90), Entry::Form(92), + Entry::Form(73), Entry::Form(74), Entry::Form(91), Entry::Form(93), + Entry::Form(182), Entry::Form(184), Entry::Form(95), Entry::Form(97), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Form(64), Entry::Form(65), Entry::Unsupported, Entry::Form(76), - Entry::Unsupported, Entry::Unsupported, Entry::Form(218), Entry::Form(219), + Entry::Form(69), Entry::Form(70), Entry::Unsupported, Entry::Form(81), + Entry::Unsupported, Entry::Unsupported, Entry::Form(223), Entry::Form(224), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, @@ -2323,18 +2355,18 @@ pub static TWO_BYTE_66: [Entry; 256] = [ Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Form(94), Entry::Form(185), Entry::Unsupported, Entry::Unsupported, - Entry::Form(98), Entry::Form(101), Entry::Form(104), Entry::Form(107), - Entry::Form(189), Entry::Form(193), Entry::Form(221), Entry::Form(225), - Entry::Form(197), Entry::Form(201), Entry::Form(205), Entry::Form(209), - Entry::Form(108), Entry::Form(109), Entry::Form(110), Entry::Form(111), - Entry::Form(112), Entry::Form(113), Entry::Form(114), Entry::Form(115), - Entry::Form(116), Entry::Form(117), Entry::Form(118), Entry::Form(119), - Entry::Form(120), Entry::Form(121), Entry::Form(83), Entry::Form(70), - Entry::Form(171), Entry::Group(19), Entry::Group(20), Entry::Group(21), - Entry::Form(122), Entry::Form(123), Entry::Form(124), Entry::Unsupported, + Entry::Form(99), Entry::Form(190), Entry::Unsupported, Entry::Unsupported, + Entry::Form(103), Entry::Form(106), Entry::Form(109), Entry::Form(112), + Entry::Form(194), Entry::Form(198), Entry::Form(226), Entry::Form(230), + Entry::Form(202), Entry::Form(206), Entry::Form(210), Entry::Form(214), + Entry::Form(113), Entry::Form(114), Entry::Form(115), Entry::Form(116), + Entry::Form(117), Entry::Form(118), Entry::Form(119), Entry::Form(120), + Entry::Form(121), Entry::Form(122), Entry::Form(123), Entry::Form(124), + Entry::Form(125), Entry::Form(126), Entry::Form(88), Entry::Form(75), + Entry::Form(176), Entry::Group(19), Entry::Group(20), Entry::Group(21), + Entry::Form(127), Entry::Form(128), Entry::Form(129), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Unsupported, Entry::Form(84), Entry::Form(71), + Entry::Unsupported, Entry::Unsupported, Entry::Form(89), Entry::Form(76), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, @@ -2351,22 +2383,22 @@ pub static TWO_BYTE_66: [Entry; 256] = [ Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Unsupported, Entry::Form(213), Entry::Unsupported, - Entry::Form(180), Entry::Form(181), Entry::Form(175), Entry::Unsupported, + Entry::Unsupported, Entry::Unsupported, Entry::Form(218), Entry::Unsupported, + Entry::Form(185), Entry::Form(186), Entry::Form(180), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Form(153), Entry::Form(159), Entry::Form(165), - Entry::Form(125), Entry::Form(126), Entry::Form(82), Entry::Form(95), - Entry::Form(127), Entry::Form(128), Entry::Form(129), Entry::Form(96), - Entry::Form(130), Entry::Form(131), Entry::Form(132), Entry::Form(99), - Entry::Form(133), Entry::Form(155), Entry::Form(161), Entry::Form(134), - Entry::Form(135), Entry::Form(136), Entry::Form(227), Entry::Form(74), - Entry::Form(137), Entry::Form(138), Entry::Form(139), Entry::Form(102), - Entry::Form(140), Entry::Form(141), Entry::Form(142), Entry::Form(105), - Entry::Unsupported, Entry::Form(157), Entry::Form(163), Entry::Form(167), - Entry::Form(143), Entry::Form(144), Entry::Form(145), Entry::Unsupported, - Entry::Form(146), Entry::Form(147), Entry::Form(148), Entry::Form(149), - Entry::Form(150), Entry::Form(151), Entry::Form(152), Entry::Unsupported, + Entry::Unsupported, Entry::Form(158), Entry::Form(164), Entry::Form(170), + Entry::Form(130), Entry::Form(131), Entry::Form(87), Entry::Form(100), + Entry::Form(132), Entry::Form(133), Entry::Form(134), Entry::Form(101), + Entry::Form(135), Entry::Form(136), Entry::Form(137), Entry::Form(104), + Entry::Form(138), Entry::Form(160), Entry::Form(166), Entry::Form(139), + Entry::Form(140), Entry::Form(141), Entry::Form(232), Entry::Form(79), + Entry::Form(142), Entry::Form(143), Entry::Form(144), Entry::Form(107), + Entry::Form(145), Entry::Form(146), Entry::Form(147), Entry::Form(110), + Entry::Unsupported, Entry::Form(162), Entry::Form(168), Entry::Form(172), + Entry::Form(148), Entry::Form(149), Entry::Form(150), Entry::Unsupported, + Entry::Form(151), Entry::Form(152), Entry::Form(153), Entry::Form(154), + Entry::Form(155), Entry::Form(156), Entry::Form(157), Entry::Unsupported, ]; pub static TWO_BYTE_F3: [Entry; 256] = [ @@ -2374,14 +2406,14 @@ pub static TWO_BYTE_F3: [Entry; 256] = [ Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Form(77), Entry::Form(78), Entry::Unsupported, Entry::Unsupported, + Entry::Form(82), Entry::Form(83), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Unsupported, Entry::Form(230), Entry::Unsupported, - Entry::Form(231), Entry::Form(232), Entry::Unsupported, Entry::Unsupported, + Entry::Unsupported, Entry::Unsupported, Entry::Form(235), Entry::Unsupported, + Entry::Form(236), Entry::Form(237), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, @@ -2390,18 +2422,18 @@ pub static TWO_BYTE_F3: [Entry; 256] = [ Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Form(186), Entry::Unsupported, Entry::Unsupported, + Entry::Unsupported, Entry::Form(191), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Form(190), Entry::Form(194), Entry::Form(222), Entry::Form(226), - Entry::Form(198), Entry::Form(202), Entry::Form(206), Entry::Form(210), + Entry::Form(195), Entry::Form(199), Entry::Form(227), Entry::Form(231), + Entry::Form(203), Entry::Form(207), Entry::Form(211), Entry::Form(215), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Form(72), - Entry::Form(172), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, + Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Form(77), + Entry::Form(177), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Unsupported, Entry::Form(81), Entry::Form(73), + Entry::Unsupported, Entry::Unsupported, Entry::Form(86), Entry::Form(78), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, @@ -2416,9 +2448,9 @@ pub static TWO_BYTE_F3: [Entry; 256] = [ Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Form(55), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Form(56), Entry::Form(57), Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Unsupported, Entry::Form(214), Entry::Unsupported, + Entry::Form(56), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, + Entry::Form(57), Entry::Form(58), Entry::Unsupported, Entry::Unsupported, + Entry::Unsupported, Entry::Unsupported, Entry::Form(219), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, @@ -2427,7 +2459,7 @@ pub static TWO_BYTE_F3: [Entry; 256] = [ Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Unsupported, Entry::Form(228), Entry::Unsupported, + Entry::Unsupported, Entry::Unsupported, Entry::Form(233), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, @@ -2441,14 +2473,14 @@ pub static TWO_BYTE_F2: [Entry; 256] = [ Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Form(79), Entry::Form(80), Entry::Unsupported, Entry::Unsupported, + Entry::Form(84), Entry::Form(85), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Unsupported, Entry::Form(233), Entry::Unsupported, - Entry::Form(234), Entry::Form(235), Entry::Unsupported, Entry::Unsupported, + Entry::Unsupported, Entry::Unsupported, Entry::Form(238), Entry::Unsupported, + Entry::Form(239), Entry::Form(240), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, @@ -2457,15 +2489,15 @@ pub static TWO_BYTE_F2: [Entry; 256] = [ Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Form(187), Entry::Unsupported, Entry::Unsupported, + Entry::Unsupported, Entry::Form(192), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Form(191), Entry::Form(195), Entry::Form(223), Entry::Unsupported, - Entry::Form(199), Entry::Form(203), Entry::Form(207), Entry::Form(211), + Entry::Form(196), Entry::Form(200), Entry::Form(228), Entry::Unsupported, + Entry::Form(204), Entry::Form(208), Entry::Form(212), Entry::Form(216), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Form(173), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, + Entry::Form(178), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, @@ -2485,7 +2517,7 @@ pub static TWO_BYTE_F2: [Entry; 256] = [ Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Unsupported, Entry::Form(215), Entry::Unsupported, + Entry::Unsupported, Entry::Unsupported, Entry::Form(220), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, @@ -2494,7 +2526,7 @@ pub static TWO_BYTE_F2: [Entry; 256] = [ Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, - Entry::Unsupported, Entry::Unsupported, Entry::Form(229), Entry::Unsupported, + Entry::Unsupported, Entry::Unsupported, Entry::Form(234), Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, Entry::Unsupported, diff --git a/crates/loader/tests/cpu_features.rs b/crates/loader/tests/cpu_features.rs new file mode 100644 index 0000000..38cb5bf --- /dev/null +++ b/crates/loader/tests/cpu_features.rs @@ -0,0 +1,282 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +//! The guest CPUID contract (issue #130). +//! +//! CPUID reports a fixed synthetic processor. A feature bit is set only when +//! every instruction of that feature is implemented, so each bit that is set +//! is checked against instructions that run, and each bit software commonly +//! tests that is clear has a witness instruction of that feature which both +//! engines refuse. The witness must be removed before its bit can be set. +//! +//! Bit positions and the feature each instruction belongs to are from the +//! Intel SDM Vol. 2, CPUID and the instruction entries. Encodings were +//! assembled with `clang -target x86_64-apple-macos` and read with `objdump`. + +use xenora_loader::cpu::{ + CPUID_CMOV, CPUID_LONG_MODE, CPUID_LZCNT, CPUID_POPCNT, CpuState, ExitReason, Interpreter, + RFlags, cpuid, +}; +use xenora_loader::dbt::DbtEngine; +use xenora_loader::memory::{GuestMemory, MemoryPermissions}; +use xenora_loader::x86_decode::decode; + +const ENTRY: u64 = 0x1000; +const RAX: usize = 0; +const RCX: usize = 1; +const RDX: usize = 2; +const RBX: usize = 3; +const RSI: usize = 6; + +/// Index of a CPUID result, which come in the order EAX, EBX, ECX, EDX. +const EBX: usize = 1; +const ECX: usize = 2; +const EDX: usize = 3; + +fn image(code: &[u8]) -> GuestMemory { + let mut memory = GuestMemory::new(); + memory + .map_region_with_data(ENTRY, code.len(), MemoryPermissions::READ_EXECUTE, code) + .unwrap(); + memory +} + +/// Final state and exit reason from the interpreter, then from the DBT. +fn both(cpu: &CpuState, code: &[u8], budget: usize) -> [(&'static str, CpuState, ExitReason); 2] { + let mut memory = image(code); + let interpreted = Interpreter::new(cpu.clone(), &mut memory, budget).run(); + let mut memory = image(code); + let mut state = cpu.clone(); + let translated = DbtEngine::new(64 * 1024) + .unwrap() + .run(&mut state, &mut memory, budget); + [ + ( + "interpreter", + interpreted.final_state, + interpreted.exit_reason, + ), + ("DBT", translated.final_state, translated.exit_reason), + ] +} + +const SET: RFlags = RFlags { + cf: true, + zf: true, + sf: true, + of: true, + pf: true, + af: true, +}; + +#[test] +fn every_leaf_returns_its_documented_values() { + // (leaf, subleaf, [EAX, EBX, ECX, EDX]) + let leaves: &[(u32, u32, [u32; 4])] = &[ + // Highest basic leaf 1, and "Xeno", "uest", "ra g" as little-endian text. + (0, 0, [1, 0x6F6E_6558, 0x7473_6575, 0x6720_6172]), + // POPCNT is ECX bit 23 and CMOV is EDX bit 15. No signature. + (1, 0, [0, 0, 0x0080_0000, 0x0000_8000]), + (1, 0xFFFF_FFFF, [0, 0, 0x0080_0000, 0x0000_8000]), + // Highest extended leaf. + (0x8000_0000, 0, [0x8000_0001, 0, 0, 0]), + // LZCNT is ECX bit 5 and long mode is EDX bit 29. + (0x8000_0001, 0, [0, 0, 0x0000_0020, 0x2000_0000]), + (0x8000_0001, 7, [0, 0, 0x0000_0020, 0x2000_0000]), + // Everything else, above or between the highest leaves, is zeros. + (2, 0, [0; 4]), + (4, 0, [0; 4]), + (6, 0, [0; 4]), + (7, 0, [0; 4]), + (7, 1, [0; 4]), + (0xB, 0, [0; 4]), + (0xD, 1, [0; 4]), + (0x16, 0, [0; 4]), + (0x4000_0000, 0, [0; 4]), + (0x7FFF_FFFF, 0, [0; 4]), + (0x8000_0002, 0, [0; 4]), + (0x8000_0008, 0, [0; 4]), + (0xFFFF_FFFF, 0, [0; 4]), + ]; + for &(leaf, subleaf, wanted) in leaves { + // Only EAX and ECX select the leaf: the upper halves are noise. + let mut cpu = CpuState::new(ENTRY, 0); + for (index, register) in cpu.gpr.iter_mut().enumerate() { + *register = 0xA5A5_0000_1111_0000 + index as u64; + } + cpu.gpr[RAX] = 0xDEAD_BEEF_0000_0000 | u64::from(leaf); + cpu.gpr[RCX] = 0xFEED_FACE_0000_0000 | u64::from(subleaf); + cpu.flags = SET; + // Each result is a 32-bit register write, so it clears the upper half. + // CPUID changes no flag and no other register. + let mut expected = cpu.clone(); + expected.rip = ENTRY + 2; + for (register, value) in [RAX, RBX, RCX, RDX].into_iter().zip(wanted) { + expected.gpr[register] = u64::from(value); + } + for (engine, state, exit) in both(&cpu, &[0x0F, 0xA2], 1) { + let what = format!("leaf {leaf:#x} subleaf {subleaf:#x} on the {engine}"); + assert_eq!(exit, ExitReason::StepLimitExceeded, "{what}"); + assert_eq!(state, expected, "{what}"); + } + // The function a runtime service would read agrees with the instruction. + assert_eq!(cpuid(leaf, subleaf), wanted, "leaf {leaf:#x}"); + } + + let [_, ebx, ecx, edx] = cpuid(0, 0); + let vendor: Vec = [ebx, edx, ecx] + .into_iter() + .flat_map(u32::to_le_bytes) + .collect(); + assert_eq!(vendor, b"Xenora guest"); + assert_eq!( + (CPUID_POPCNT, CPUID_CMOV, CPUID_LZCNT, CPUID_LONG_MODE), + (1 << 23, 1 << 15, 1 << 5, 1 << 29) + ); +} + +#[test] +fn reported_features_have_all_their_instructions_in_the_fixtures() { + // `tests/x86_integer.rs` runs every line of this file through both engines + // against an independent reference. Here each reported feature must have + // its whole instruction set among those lines. + let fixture = include_str!("x86/integer.txt"); + let decodable = |text: &str| { + let line = fixture + .lines() + .find(|line| line.split_once(" | ").is_some_and(|(_, asm)| asm == text)) + .unwrap_or_else(|| panic!("no fixture for {text}")); + let code: Vec = line + .split_once(" | ") + .unwrap() + .0 + .split(' ') + .map(|byte| u8::from_str_radix(byte, 16).unwrap()) + .collect(); + decode(ENTRY, |at| { + code.get((at - ENTRY) as usize).copied().ok_or(()) + }) + .unwrap_or_else(|error| panic!("{text}: {error:?}")); + }; + let memory = |bits: u32| { + let width = match bits { + 16 => "word", + 32 => "dword", + _ => "qword", + }; + format!("{width} ptr [rsi + 4*rdi + 16]") + }; + // 16-, 32- and 64-bit destinations (RBX and R10) from a register and from memory. + let sizes = [ + (16, "bx", "r9w", "r10w"), + (32, "ebx", "r9d", "r10d"), + (64, "rbx", "r9", "r10"), + ]; + + assert_ne!(cpuid(1, 0)[EDX] & CPUID_CMOV, 0); + for condition in "o no b ae e ne be a s ns p np l ge le g".split(' ') { + for (bits, low, source, high) in sizes { + decodable(&format!("cmov{condition} {low}, {source}")); + decodable(&format!("cmov{condition} {high}, {}", memory(bits))); + } + } + for (feature, bit, name) in [ + (cpuid(1, 0)[ECX], CPUID_POPCNT, "popcnt"), + (cpuid(0x8000_0001, 0)[ECX], CPUID_LZCNT, "lzcnt"), + ] { + assert_ne!(feature & bit, 0, "{name}"); + for (bits, low, source, high) in sizes { + decodable(&format!("{name} {low}, {source}")); + decodable(&format!("{name} {high}, {}", memory(bits))); + } + } + // Long mode: 64-bit operands and the registers only it has. + assert_ne!(cpuid(0x8000_0001, 0)[EDX] & CPUID_LONG_MODE, 0); + decodable("add r9, r12"); + decodable("movabs r15, 0x8877665544332211"); +} + +#[test] +fn unreported_features_each_have_an_instruction_that_is_refused() { + // (feature, leaf, result register, bit, an instruction of that feature) + let witnesses: &[(&str, u32, usize, u32, &[u8])] = &[ + ("FPU", 1, EDX, 0, &[0xD9, 0xE8]), // fld1 + ("TSC", 1, EDX, 4, &[0x0F, 0x31]), // rdtsc + ("CX8", 1, EDX, 8, &[0x0F, 0xC7, 0x0E]), // cmpxchg8b [rsi] + ("CLFSH", 1, EDX, 19, &[0x0F, 0xAE, 0x3E]), // clflush [rsi] + ("MMX", 1, EDX, 23, &[0x0F, 0x77]), // emms + ("FXSR", 1, EDX, 24, &[0x0F, 0xAE, 0x06]), // fxsave [rsi] + ("SSE", 1, EDX, 25, &[0x0F, 0x52, 0xC1]), // rsqrtps xmm0, xmm1 + ("SSE2", 1, EDX, 26, &[0x0F, 0xAE, 0xF0]), // mfence + ("SSE3", 1, ECX, 0, &[0xF2, 0x0F, 0x7C, 0xC1]), // haddps xmm0, xmm1 + ( + "PCLMULQDQ", + 1, + ECX, + 1, + &[0x66, 0x0F, 0x3A, 0x44, 0xC1, 0x00], + ), // pclmulqdq xmm0, xmm1, 0 + ("SSSE3", 1, ECX, 9, &[0x66, 0x0F, 0x38, 0x00, 0xC1]), // pshufb xmm0, xmm1 + ("FMA", 1, ECX, 12, &[0xC4, 0xE2, 0x71, 0x98, 0xC2]), // vfmadd132ps xmm0, xmm1, xmm2 + ("CMPXCHG16B", 1, ECX, 13, &[0x48, 0x0F, 0xC7, 0x0E]), // cmpxchg16b [rsi] + ("SSE4.1", 1, ECX, 19, &[0x66, 0x0F, 0x38, 0x40, 0xC1]), // pmulld xmm0, xmm1 + ("SSE4.2", 1, ECX, 20, &[0xF2, 0x0F, 0x38, 0xF1, 0xC1]), // crc32 eax, ecx + ("MOVBE", 1, ECX, 22, &[0x0F, 0x38, 0xF0, 0x06]), // movbe eax, [rsi] + ("AESNI", 1, ECX, 25, &[0x66, 0x0F, 0x38, 0xDC, 0xC1]), // aesenc xmm0, xmm1 + ("XSAVE", 1, ECX, 26, &[0x0F, 0x01, 0xD0]), // xgetbv + ("AVX", 1, ECX, 28, &[0xC5, 0xF4, 0x58, 0xC2]), // vaddps ymm0, ymm1, ymm2 + ("F16C", 1, ECX, 29, &[0xC4, 0xE2, 0x79, 0x13, 0xC1]), // vcvtph2ps xmm0, xmm1 + ("RDRAND", 1, ECX, 30, &[0x0F, 0xC7, 0xF0]), // rdrand eax + ("BMI1", 7, EBX, 3, &[0xC4, 0xE2, 0x70, 0xF2, 0xC2]), // andn eax, ecx, edx + ("AVX2", 7, EBX, 5, &[0xC5, 0xF5, 0xFE, 0xC2]), // vpaddd ymm0, ymm1, ymm2 + ("BMI2", 7, EBX, 8, &[0xC4, 0xE2, 0x73, 0xF6, 0xC2]), // mulx eax, ecx, edx + ("RDSEED", 7, EBX, 18, &[0x0F, 0xC7, 0xF8]), // rdseed eax + ("ADX", 7, EBX, 19, &[0x66, 0x0F, 0x38, 0xF6, 0xC1]), // adcx eax, ecx + ("SHA", 7, EBX, 29, &[0x0F, 0x38, 0xC9, 0xC1]), // sha1msg1 xmm0, xmm1 + ("LAHF/SAHF", 0x8000_0001, ECX, 0, &[0x9F]), // lahf + ("PREFETCHW", 0x8000_0001, ECX, 8, &[0x0F, 0x0D, 0x0E]), // prefetchw [rsi] + ("SYSCALL/SYSRET", 0x8000_0001, EDX, 11, &[0x48, 0x0F, 0x07]), // sysretq + ("RDTSCP", 0x8000_0001, EDX, 27, &[0x0F, 0x01, 0xF9]), // rdtscp + ]; + for &(feature, leaf, register, bit, code) in witnesses { + assert_eq!( + cpuid(leaf, 0)[register] >> bit & 1, + 0, + "{feature} is reported" + ); + let mut padded = code.to_vec(); + padded.extend([0x90; 8]); + let mut cpu = CpuState::new(ENTRY, 0); + cpu.gpr[RSI] = ENTRY; + for (engine, state, exit) in both(&cpu, &padded, 1) { + assert!( + matches!(exit, ExitReason::IllegalInstruction(_)), + "{feature}: {code:02X?} ran on the {engine} ({exit:?}); report the feature only \ + once all of it is implemented" + ); + assert_eq!(state, cpu, "{feature} on the {engine}"); + } + } +} + +#[test] +fn a_guest_can_use_an_instruction_after_testing_its_feature_bit() { + // mov eax, 1 + // cpuid + // bt ecx, 23 ; POPCNT + // jnc done + // popcnt rax, rsi + // done: hlt + let code = [ + 0xB8, 0x01, 0x00, 0x00, 0x00, 0x0F, 0xA2, 0x0F, 0xBA, 0xE1, 0x17, 0x73, 0x05, 0xF3, 0x48, + 0x0F, 0xB8, 0xC6, 0xF4, + ]; + let mut cpu = CpuState::new(ENTRY, 0); + cpu.gpr[RSI] = 0xF0F0_0000_0000_0001; + for (engine, state, exit) in both(&cpu, &code, 16) { + assert_eq!(exit, ExitReason::Halt, "{engine}"); + // Nine bits are set in RSI. Leaf 1 leaves EAX zero, so a skipped + // POPCNT would show as 0. + assert_eq!(state.gpr[RAX], 9, "{engine}"); + assert_eq!(state.rip, ENTRY + code.len() as u64, "{engine}"); + } +} diff --git a/crates/loader/tests/cpu_known_answers.rs b/crates/loader/tests/cpu_known_answers.rs index 02367b8..ba1096d 100644 --- a/crates/loader/tests/cpu_known_answers.rs +++ b/crates/loader/tests/cpu_known_answers.rs @@ -2672,15 +2672,9 @@ const UNSUPPORTED: &[(&str, usize)] = &[ ("cmpxchg16b_not_equal", 0), ("cmpxchg16b_unaligned_is_gp", 0), ("cmpxchg16b_unaligned_without_lock_is_gp", 0), - ("cmpxchg32_equal", 0), - ("cmpxchg64_memory_equal_without_lock", 0), - ("cmpxchg64_memory_not_equal", 0), - ("cmpxchg64_memory_not_equal_without_lock", 0), - ("cmpxchg8_not_equal_loads_al", 0), ("cmpxchg8b_equal", 0), ("cmpxchg8b_equal_without_lock", 0), ("cmpxchg8b_not_equal", 0), - ("cmpxchg_mismatch_still_writes", 0), ("crc32c_byte_and_qword_forms_agree", 0), ("crc32c_check_string", 0), ("dpps_mask", 0), @@ -2689,8 +2683,6 @@ const UNSUPPORTED: &[(&str, usize)] = &[ ("fs_addr32_truncates_before_adding_base", 0), ("fs_rep_movsb_overrides_source_only", 0), ("fs_rep_movsb_overrides_source_only_df_clear", 0), - ("gs_lock_xadd", 0), - ("gs_xadd_without_lock", 0), ("haddps_hsubpd_addsubps", 0), ("insertps_zero_mask", 0), ("jecxz_tests_low_32_bits", 1), @@ -2783,12 +2775,6 @@ const UNSUPPORTED: &[(&str, usize)] = &[ ("shrd32_by8", 0), ("shrd64_by1_sign_change", 0), ("shrd64_cl64_is_count_zero", 0), - ("xadd32_reg_reg", 0), - ("xadd64_memory", 0), - ("xadd64_memory_without_lock", 0), - ("xadd64_same_register_doubles", 0), - ("xadd8_al_ah", 0), - ("xadd_readonly_page_keeps_register", 0), ("xchg_ax_r9w_preserves_both_uppers", 0), ("xchg_eax_ebx_clears_both_uppers", 0), ("xchg_rax_r8_is_not_nop", 0), diff --git a/crates/loader/tests/x86/assemble.py b/crates/loader/tests/x86/assemble.py index d8bd6fd..3d55e8f 100644 --- a/crates/loader/tests/x86/assemble.py +++ b/crates/loader/tests/x86/assemble.py @@ -84,9 +84,18 @@ def cases(): f"mov {mem(bits)}, {reg(2, bits)}", f"mov {reg(14, bits)}, 0x5a", f"mov {mem(bits)}, 0x5a", f"xchg {reg(3, bits)}, {reg(9, bits)}", f"xchg {mem(bits)}, {reg(2, bits)}"] + for op in ("xadd", "cmpxchg"): + for bits in (8, 16, 32, 64): + # Destination RAX always matches the accumulator; a register with + # itself keeps the sum. LOCK is valid only with a memory destination. + out += [f"{op} {reg(3, bits)}, {reg(1, bits)}", f"{op} {reg(9, bits)}, {reg(12, bits)}", + f"{op} {reg(0, bits)}, {reg(2, bits)}", f"{op} {reg(3, bits)}, {reg(3, bits)}", + f"{op} {mem(bits)}, {reg(2, bits)}", f"lock {op} {mem(bits)}, {reg(2, bits)}", + f"lock {op} {mem(bits)}, {reg(0, bits)}"] + out += [f"{op} ah, bl", f"{op} cl, dh", f"{op} {mem(8)}, ch"] out += ["mov ah, bl", "mov dl, ch", "mov bh, 0x21", "xchg ah, bl", "mov sil, dil", "movabs r15, 0x8877665544332211", "mov rcx, -2", "bswap ebx", "bswap r9", - "cbw", "cwde", "cdqe", "cwd", "cdq", "cqo", "clc", "stc", "cmc", "nop", + "cbw", "cwde", "cdqe", "cwd", "cdq", "cqo", "clc", "stc", "cmc", "nop", "cpuid", "nop dword ptr [rax + 8]", "pause", "push r9", "push rbx", "push -5", "push 0x12345678", f"push {mem(64)}", "pop rbx", "pop r12", f"pop {mem(64)}", "leave"] return list(dict.fromkeys(out)) @@ -163,7 +172,13 @@ def assemble(lines): subprocess.run(["clang", "-target", "x86_64-apple-macos", "-c", source, "-o", obj], check=True) # One line per instruction: objdump never wraps its raw bytes. listing = subprocess.run(["objdump", "-d", obj], check=True, capture_output=True, text=True).stdout - rows = [m.group(1).split() for m in re.finditer(r"^\s*[0-9a-f]+:\s((?:[0-9a-f]{2}\s)+)", listing, re.M)] + rows, prefix = [], [] + for match in re.finditer(r"^\s*[0-9a-f]+:\s((?:[0-9a-f]{2}\s)+)(.*)$", listing, re.M): + row = prefix + match.group(1).split() + # objdump lists a leading LOCK prefix on a row of its own. + prefix = row if match.group(2).strip() == "lock" else [] + if not prefix: + rows.append(row) if len(rows) != len(lines): sys.exit(f"{len(lines)} instructions assembled to {len(rows)} rows") return "".join(f"{' '.join(row)} | {line}\n" for row, line in zip(rows, lines)) diff --git a/crates/loader/tests/x86/integer.txt b/crates/loader/tests/x86/integer.txt index acb783f..c4c34ab 100644 --- a/crates/loader/tests/x86/integer.txt +++ b/crates/loader/tests/x86/integer.txt @@ -953,6 +953,68 @@ c7 44 be 10 5a 00 00 00 | mov dword ptr [rsi + 4*rdi + 16], 0x5a 48 c7 44 be 10 5a 00 00 00 | mov qword ptr [rsi + 4*rdi + 16], 0x5a 49 87 d9 | xchg rbx, r9 48 87 54 be 10 | xchg qword ptr [rsi + 4*rdi + 16], rdx +0f c0 cb | xadd bl, cl +45 0f c0 e1 | xadd r9b, r12b +0f c0 d0 | xadd al, dl +0f c0 db | xadd bl, bl +0f c0 54 be 10 | xadd byte ptr [rsi + 4*rdi + 16], dl +f0 0f c0 54 be 10 | lock xadd byte ptr [rsi + 4*rdi + 16], dl +f0 0f c0 44 be 10 | lock xadd byte ptr [rsi + 4*rdi + 16], al +66 0f c1 cb | xadd bx, cx +66 45 0f c1 e1 | xadd r9w, r12w +66 0f c1 d0 | xadd ax, dx +66 0f c1 db | xadd bx, bx +66 0f c1 54 be 10 | xadd word ptr [rsi + 4*rdi + 16], dx +66 f0 0f c1 54 be 10 | lock xadd word ptr [rsi + 4*rdi + 16], dx +66 f0 0f c1 44 be 10 | lock xadd word ptr [rsi + 4*rdi + 16], ax +0f c1 cb | xadd ebx, ecx +45 0f c1 e1 | xadd r9d, r12d +0f c1 d0 | xadd eax, edx +0f c1 db | xadd ebx, ebx +0f c1 54 be 10 | xadd dword ptr [rsi + 4*rdi + 16], edx +f0 0f c1 54 be 10 | lock xadd dword ptr [rsi + 4*rdi + 16], edx +f0 0f c1 44 be 10 | lock xadd dword ptr [rsi + 4*rdi + 16], eax +48 0f c1 cb | xadd rbx, rcx +4d 0f c1 e1 | xadd r9, r12 +48 0f c1 d0 | xadd rax, rdx +48 0f c1 db | xadd rbx, rbx +48 0f c1 54 be 10 | xadd qword ptr [rsi + 4*rdi + 16], rdx +f0 48 0f c1 54 be 10 | lock xadd qword ptr [rsi + 4*rdi + 16], rdx +f0 48 0f c1 44 be 10 | lock xadd qword ptr [rsi + 4*rdi + 16], rax +0f c0 dc | xadd ah, bl +0f c0 f1 | xadd cl, dh +0f c0 6c be 10 | xadd byte ptr [rsi + 4*rdi + 16], ch +0f b0 cb | cmpxchg bl, cl +45 0f b0 e1 | cmpxchg r9b, r12b +0f b0 d0 | cmpxchg al, dl +0f b0 db | cmpxchg bl, bl +0f b0 54 be 10 | cmpxchg byte ptr [rsi + 4*rdi + 16], dl +f0 0f b0 54 be 10 | lock cmpxchg byte ptr [rsi + 4*rdi + 16], dl +f0 0f b0 44 be 10 | lock cmpxchg byte ptr [rsi + 4*rdi + 16], al +66 0f b1 cb | cmpxchg bx, cx +66 45 0f b1 e1 | cmpxchg r9w, r12w +66 0f b1 d0 | cmpxchg ax, dx +66 0f b1 db | cmpxchg bx, bx +66 0f b1 54 be 10 | cmpxchg word ptr [rsi + 4*rdi + 16], dx +66 f0 0f b1 54 be 10 | lock cmpxchg word ptr [rsi + 4*rdi + 16], dx +66 f0 0f b1 44 be 10 | lock cmpxchg word ptr [rsi + 4*rdi + 16], ax +0f b1 cb | cmpxchg ebx, ecx +45 0f b1 e1 | cmpxchg r9d, r12d +0f b1 d0 | cmpxchg eax, edx +0f b1 db | cmpxchg ebx, ebx +0f b1 54 be 10 | cmpxchg dword ptr [rsi + 4*rdi + 16], edx +f0 0f b1 54 be 10 | lock cmpxchg dword ptr [rsi + 4*rdi + 16], edx +f0 0f b1 44 be 10 | lock cmpxchg dword ptr [rsi + 4*rdi + 16], eax +48 0f b1 cb | cmpxchg rbx, rcx +4d 0f b1 e1 | cmpxchg r9, r12 +48 0f b1 d0 | cmpxchg rax, rdx +48 0f b1 db | cmpxchg rbx, rbx +48 0f b1 54 be 10 | cmpxchg qword ptr [rsi + 4*rdi + 16], rdx +f0 48 0f b1 54 be 10 | lock cmpxchg qword ptr [rsi + 4*rdi + 16], rdx +f0 48 0f b1 44 be 10 | lock cmpxchg qword ptr [rsi + 4*rdi + 16], rax +0f b0 dc | cmpxchg ah, bl +0f b0 f1 | cmpxchg cl, dh +0f b0 6c be 10 | cmpxchg byte ptr [rsi + 4*rdi + 16], ch 88 dc | mov ah, bl 88 ea | mov dl, ch b7 21 | mov bh, 0x21 @@ -972,6 +1034,7 @@ f8 | clc f9 | stc f5 | cmc 90 | nop +0f a2 | cpuid 0f 1f 40 08 | nop dword ptr [rax + 8] f3 90 | pause 41 51 | push r9 diff --git a/crates/loader/tests/x86_atomic.rs b/crates/loader/tests/x86_atomic.rs new file mode 100644 index 0000000..6f4abce --- /dev/null +++ b/crates/loader/tests/x86_atomic.rs @@ -0,0 +1,376 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +//! XADD, CMPXCHG and the LOCK prefix (issue #198). +//! +//! Expected values follow the operation sections of the Intel SDM Vol. 2 for +//! XADD, CMPXCHG and LOCK, stated here as literal results. Encodings were +//! assembled with `clang -target x86_64-apple-macos` and read with `objdump`. +//! Nothing was compared with x86 hardware. +//! +//! Both engines run one guest instruction at a time on one host thread, so +//! these tests establish the single-thread results that any later guest +//! scheduler has to preserve. They say nothing about concurrent execution. + +use xenora_loader::cpu::{CpuState, ExitReason, Interpreter, RFlags}; +use xenora_loader::dbt::{DbtEngine, is_native}; +use xenora_loader::memory::{GuestMemory, MemoryPermissions}; +use xenora_loader::x86_decode::decode; + +const ENTRY: u64 = 0x1000; +/// Two writable pages. Nothing is mapped after them unless a test says so. +const DATA: u64 = 0x4000; +const PAGE: u64 = 0x1000; +const END: u64 = DATA + 2 * PAGE; + +const RAX: usize = 0; +const RCX: usize = 1; +const RDX: usize = 2; +const RBX: usize = 3; +const RSI: usize = 6; + +fn image(code: &[u8]) -> GuestMemory { + let mut memory = GuestMemory::new(); + memory + .map_region_with_data(ENTRY, code.len(), MemoryPermissions::READ_EXECUTE, code) + .unwrap(); + memory + .map_region(DATA, 2 * PAGE as usize, MemoryPermissions::READ_WRITE) + .unwrap(); + memory +} + +fn data(memory: &GuestMemory) -> Vec { + let mut out = vec![0; 2 * PAGE as usize]; + memory.read_bytes(DATA, &mut out).unwrap(); + out +} + +struct Run { + name: &'static str, + cpu: CpuState, + exit: ExitReason, + memory: GuestMemory, + /// Instructions the DBT ran on the shared semantics. + helpers: usize, +} + +/// The interpreter and the DBT, each from its own copy of `cpu` and `memory`. +fn both(cpu: &CpuState, memory: &GuestMemory, budget: usize) -> [Run; 2] { + let mut interpreted = memory.clone(); + let result = Interpreter::new(cpu.clone(), &mut interpreted, budget).run(); + let mut translated = memory.clone(); + let mut engine = DbtEngine::new(64 * 1024).unwrap(); + let mut state = cpu.clone(); + let native = engine.run(&mut state, &mut translated, budget); + [ + Run { + name: "interpreter", + cpu: result.final_state, + exit: result.exit_reason, + memory: interpreted, + helpers: 0, + }, + Run { + name: "DBT", + cpu: native.final_state, + exit: native.exit_reason, + memory: translated, + helpers: engine.metrics.interpreter_fallbacks, + }, + ] +} + +fn flags(cf: bool, zf: bool, sf: bool, of: bool, pf: bool, af: bool) -> RFlags { + RFlags { + cf, + zf, + sf, + of, + pf, + af, + } +} + +fn low(bits: u32) -> u64 { + u64::MAX >> (64 - bits) +} + +#[test] +fn lock_is_accepted_only_on_xadd_and_cmpxchg_with_a_memory_destination() { + let accepted: &[&[u8]] = &[ + &[0xF0, 0x0F, 0xC1, 0x0E], // lock xadd [rsi], ecx + &[0xF0, 0x0F, 0xB1, 0x0E], // lock cmpxchg [rsi], ecx + &[0x66, 0xF0, 0x0F, 0xC1, 0x0E], // lock xadd [rsi], cx, in LLVM's prefix order + &[0xF0, 0x66, 0x0F, 0xC1, 0x0E], // the same with LOCK first + &[0x65, 0xF0, 0x0F, 0xB0, 0x0E], // lock cmpxchg gs:[rsi], cl + &[0xF0, 0x48, 0x0F, 0xC1, 0x0E], // lock xadd [rsi], rcx + ]; + for code in accepted { + let lock = code.iter().position(|byte| *byte == 0xF0).unwrap(); + let mut unlocked = code.to_vec(); + unlocked.remove(lock); + let insn = decode(ENTRY, |at| { + code.get((at - ENTRY) as usize).copied().ok_or(()) + }) + .unwrap(); + assert!(insn.lock && !is_native(&insn), "{code:02X?}"); + assert_eq!(usize::from(insn.len), code.len(), "{code:02X?}"); + + // The accumulator matches the operand, so each exchange stores RCX. + let mut cpu = CpuState::new(ENTRY, 0); + cpu.gpr[RAX] = 0x2122_2324_2526_2728; + cpu.gpr[RCX] = 0x1112_1314_1516_1718; + cpu.gpr[RSI] = DATA + 0x40; + let mut memory = image(code); + memory + .write_u64(DATA + 0x40, 0x2122_2324_2526_2728) + .unwrap(); + let mut plain = image(&unlocked); + plain.write_u64(DATA + 0x40, 0x2122_2324_2526_2728).unwrap(); + + // LOCK changes no result here: only the instruction is a byte longer. + for (locked, wanted) in both(&cpu, &memory, 1).iter().zip(both(&cpu, &plain, 1)) { + assert_eq!(locked.exit, ExitReason::StepLimitExceeded, "{code:02X?}"); + assert_eq!(locked.cpu.rip, ENTRY + code.len() as u64, "{code:02X?}"); + let mut shifted = wanted.cpu.clone(); + shifted.rip += 1; + assert_eq!(locked.cpu, shifted, "{code:02X?} on the {}", locked.name); + assert_eq!(data(&locked.memory), data(&wanted.memory), "{code:02X?}"); + assert_ne!(data(&locked.memory), data(&memory), "{code:02X?}"); + } + } + + let rejected: &[&[u8]] = &[ + &[0xF0, 0x0F, 0xC1, 0xC8], // lock xadd eax, ecx: register destination + &[0xF0, 0x0F, 0xB1, 0xCB], // lock cmpxchg ebx, ecx: register destination + &[0xF0, 0x01, 0x0E], // lock add [rsi], ecx: outside the locked subset + &[0xF0, 0x87, 0x0E], // lock xchg [rsi], ecx: outside the locked subset + &[0xF0, 0x0F, 0xC7, 0x0E], // lock cmpxchg8b [rsi]: not implemented + &[0xF0, 0x8B, 0x06], // lock mov eax, [rsi]: never lockable + &[0xF0, 0x90], // lock nop + ]; + for code in rejected { + let mut padded = code.to_vec(); + padded.extend([0x90; 8]); + let mut cpu = CpuState::new(ENTRY, 0); + cpu.gpr[RSI] = DATA; + let memory = image(&padded); + for run in both(&cpu, &memory, 1) { + assert!( + matches!(run.exit, ExitReason::IllegalInstruction(_)), + "{code:02X?} on the {}: {:?}", + run.name, + run.exit + ); + assert_eq!(run.cpu, cpu, "{code:02X?}"); + assert_eq!(data(&run.memory), data(&memory), "{code:02X?}"); + } + } +} + +#[test] +fn compare_and_exchange_takes_each_branch_at_every_width() { + // Destination [rsi] or RBX, source RCX, accumulator RAX. + let forms: &[(&[u8], u32, bool)] = &[ + (&[0xF0, 0x0F, 0xB0, 0x0E], 8, true), // lock cmpxchg [rsi], cl + (&[0x66, 0xF0, 0x0F, 0xB1, 0x0E], 16, true), // lock cmpxchg [rsi], cx + (&[0xF0, 0x0F, 0xB1, 0x0E], 32, true), // lock cmpxchg [rsi], ecx + (&[0xF0, 0x48, 0x0F, 0xB1, 0x0E], 64, true), // lock cmpxchg [rsi], rcx + (&[0x0F, 0xB0, 0xCB], 8, false), // cmpxchg bl, cl + (&[0x66, 0x0F, 0xB1, 0xCB], 16, false), // cmpxchg bx, cx + (&[0x0F, 0xB1, 0xCB], 32, false), // cmpxchg ebx, ecx + (&[0x48, 0x0F, 0xB1, 0xCB], 64, false), // cmpxchg rbx, rcx + ]; + const ACCUMULATOR: u64 = 0x1111_2222_3333_4444; + const SOURCE: u64 = 0xAAAA_BBBB_CCCC_DDDD; + const ABOVE: u64 = 0x5555_6666_7777_8888; + for &(code, bits, in_memory) in forms { + let mask = low(bits); + for matches in [true, false] { + // The destination holds the accumulator's low bits, or differs in + // bit 0, under bits the operation must not read. + let old = (ABOVE & !mask) | ((ACCUMULATOR ^ u64::from(!matches)) & mask); + let mut cpu = CpuState::new(ENTRY, 0); + cpu.gpr[RAX] = ACCUMULATOR; + cpu.gpr[RCX] = SOURCE; + cpu.gpr[RBX] = old; + cpu.gpr[RSI] = DATA + 0x80; + // accumulator - destination is 0, or -1 when the destination is + // one more. Start from the opposite flags so each must be written. + let after = if matches { + flags(false, true, false, false, true, false) + } else { + flags(true, false, true, false, true, true) + }; + cpu.flags = flags( + !after.cf, !after.zf, !after.sf, !after.of, !after.pf, !after.af, + ); + let mut memory = image(code); + memory.write_u64(DATA + 0x80, old).unwrap(); + + // A match stores the source. A mismatch stores the old value back + // and loads it into the accumulator. An 8- or 16-bit register write + // keeps the bits above it, a 32-bit one clears them, and a memory + // write touches only its own bytes. + let stored = if matches { SOURCE & mask } else { old & mask }; + let merged = |before: u64, value: u64| match bits { + 32 => value, + _ => (before & !mask) | value, + }; + let mut wanted = cpu.clone(); + wanted.rip = ENTRY + code.len() as u64; + wanted.flags = after; + if !matches { + wanted.gpr[RAX] = merged(ACCUMULATOR, old & mask); + } + let wanted_memory = if in_memory { + (old & !mask) | stored + } else { + wanted.gpr[RBX] = merged(old, stored); + old + }; + + for run in both(&cpu, &memory, 1) { + let what = format!("{code:02X?} matches={matches} on the {}", run.name); + assert_eq!(run.exit, ExitReason::StepLimitExceeded, "{what}"); + assert_eq!(run.cpu, wanted, "{what}"); + assert_eq!( + run.memory.read_u64(DATA + 0x80).unwrap(), + wanted_memory, + "{what}" + ); + } + } + } +} + +#[test] +fn locked_operands_may_be_unaligned_and_span_two_regions() { + // No alignment is required of a locked operand (SDM Vol. 2, "LOCK"). The + // last address straddles the data and a second writable region after it. + let spanning = |code: &[u8]| { + let mut memory = image(code); + memory + .map_region(END, PAGE as usize, MemoryPermissions::READ_WRITE) + .unwrap(); + memory + }; + for at in [DATA + 1, DATA + 0x33, DATA + PAGE - 3, END - 8, END - 3] { + // lock xadd [rsi], rcx + let mut cpu = CpuState::new(ENTRY, 0); + cpu.gpr[RCX] = 0x0000_0001_0000_0003; + cpu.gpr[RSI] = at; + let mut memory = spanning(&[0xF0, 0x48, 0x0F, 0xC1, 0x0E]); + memory.write_u64(at, 0xFFFF_FFFF_FFFF_FFFE).unwrap(); + for run in both(&cpu, &memory, 1) { + assert_eq!(run.exit, ExitReason::StepLimitExceeded, "{at:#x}"); + assert_eq!(run.cpu.gpr[RCX], 0xFFFF_FFFF_FFFF_FFFE, "{at:#x}"); + assert_eq!( + run.memory.read_u64(at).unwrap(), + 0x0000_0001_0000_0001, + "{at:#x}" + ); + // 0xFFFF_FFFF_FFFF_FFFE + 0x0000_0001_0000_0003 carries out of bit + // 63 and bit 3; the sum is positive, nonzero and ends in 0x01. + assert_eq!( + run.cpu.flags, + flags(true, false, false, false, false, true), + "{at:#x}" + ); + } + + // lock cmpxchg [rsi], rcx, with a matching accumulator + let mut cpu = CpuState::new(ENTRY, 0); + cpu.gpr[RAX] = 0x8877_6655_4433_2211; + cpu.gpr[RCX] = 0x0102_0304_0506_0708; + cpu.gpr[RSI] = at; + let mut memory = spanning(&[0xF0, 0x48, 0x0F, 0xB1, 0x0E]); + memory.write_u64(at, 0x8877_6655_4433_2211).unwrap(); + for run in both(&cpu, &memory, 1) { + assert_eq!(run.exit, ExitReason::StepLimitExceeded, "{at:#x}"); + assert_eq!(run.cpu.gpr[RAX], 0x8877_6655_4433_2211, "{at:#x}"); + assert_eq!( + run.memory.read_u64(at).unwrap(), + 0x0102_0304_0506_0708, + "{at:#x}" + ); + } + } +} + +#[test] +fn a_fault_on_any_byte_of_the_operand_changes_nothing() { + let xadd: &[u8] = &[0xF0, 0x48, 0x0F, 0xC1, 0x0E]; // lock xadd [rsi], rcx + let cmpxchg: &[u8] = &[0xF0, 0x48, 0x0F, 0xB1, 0x0E]; // lock cmpxchg [rsi], rcx + // The last three bytes of writable memory, then five bytes that are + // unmapped or read-only. + let at = END - 3; + for code in [xadd, cmpxchg] { + for read_only_tail in [false, true] { + // Accumulators that match and that do not match the operand's + // writable bytes: a failed compare needs the write access too. + for accumulator in [0x0000_0000_00CC_BBAA_u64, 7] { + let mut memory = image(code); + memory.write_bytes(at, &[0xAA, 0xBB, 0xCC]).unwrap(); + if read_only_tail { + memory + .map_region(END, PAGE as usize, MemoryPermissions::READ_ONLY) + .unwrap(); + } + let mut cpu = CpuState::new(ENTRY, 0); + cpu.gpr[RAX] = accumulator; + cpu.gpr[RCX] = 0x1122_3344_5566_7788; + cpu.gpr[RSI] = at; + cpu.flags = flags(true, false, true, false, true, false); + for run in both(&cpu, &memory, 1) { + let what = format!( + "{code:02X?} tail read-only={read_only_tail} rax={accumulator:#x} on the {}", + run.name + ); + assert!( + matches!(run.exit, ExitReason::MemoryFault(_)), + "{what}: {:?}", + run.exit + ); + assert_eq!(run.cpu, cpu, "{what}"); + assert_eq!(data(&run.memory), data(&memory), "{what}"); + } + } + } + } +} + +#[test] +fn compare_and_swap_loop_retries_then_fetch_and_add_follows() { + // retry: lea rcx, [rax + 1] + // lock cmpxchg [rsi], rcx + // jne retry + // mov edx, 5 + // lock xadd [rsi], rdx + // hlt + let code = [ + 0x48, 0x8D, 0x48, 0x01, 0xF0, 0x48, 0x0F, 0xB1, 0x0E, 0x75, 0xF5, 0xBA, 0x05, 0x00, 0x00, + 0x00, 0xF0, 0x48, 0x0F, 0xC1, 0x16, 0xF4, + ]; + const COUNTER: u64 = DATA + 0x100; + let mut cpu = CpuState::new(ENTRY, 0); + // A stale expectation: the first exchange fails and reloads RAX, the + // second succeeds. + cpu.gpr[RAX] = 0xDEAD; + cpu.gpr[RSI] = COUNTER; + let mut memory = image(&code); + memory.write_u64(COUNTER, 41).unwrap(); + for run in both(&cpu, &memory, 64) { + assert_eq!(run.exit, ExitReason::Halt, "{}", run.name); + assert_eq!(run.cpu.gpr[RAX], 41, "{}", run.name); + assert_eq!(run.cpu.gpr[RCX], 42, "{}", run.name); + // XADD returns the value before its addition. + assert_eq!(run.cpu.gpr[RDX], 42, "{}", run.name); + assert_eq!(run.memory.read_u64(COUNTER).unwrap(), 47, "{}", run.name); + assert_eq!(run.cpu.rip, ENTRY + code.len() as u64, "{}", run.name); + // Two exchanges and one addition, none lowered to ARM64 yet. + if run.name == "DBT" { + assert_eq!(run.helpers, 3); + } + } +} diff --git a/crates/loader/tests/x86_integer.rs b/crates/loader/tests/x86_integer.rs index a31fd7b..66dbff7 100644 --- a/crates/loader/tests/x86_integer.rs +++ b/crates/loader/tests/x86_integer.rs @@ -305,6 +305,8 @@ enum Outcome { } fn reference(m: &mut Machine, text: &str) -> Outcome { + // LOCK changes no result on a machine that runs one instruction at a time. + let text = text.strip_prefix("lock ").unwrap_or(text); let (name, rest) = text.split_once(' ').unwrap_or((text, "")); let places: Vec = if rest.is_empty() || name == "lea" || name == "nop" { Vec::new() @@ -659,6 +661,28 @@ fn reference(m: &mut Machine, text: &str) -> Outcome { write(m, places[1], a); Outcome::Done(none) } + "xadd" => { + // TEMP := SRC + DEST; SRC := DEST; DEST := TEMP. + let (a, b) = (read(m, places[0], bits), read(m, places[1], bits)); + let sum = arithmetic(m, a, b, false, false, bits); + write(m, places[1], a); + write(m, places[0], sum); + Outcome::Done(none) + } + "cmpxchg" => { + // The accumulator is compared with DEST as CMP would. On a match + // DEST := SRC; otherwise accumulator := DEST and DEST := DEST. + let accumulator = read(m, rax(bits), bits); + let (destination, source) = (read(m, places[0], bits), read(m, places[1], bits)); + arithmetic(m, accumulator, destination, true, false, bits); + if accumulator == destination { + write(m, places[0], source); + } else { + write(m, rax(bits), destination); + write(m, places[0], destination); + } + Outcome::Done(none) + } "bswap" => { let value = read(m, places[0], bits); let bytes = bits / 8; @@ -705,6 +729,24 @@ fn reference(m: &mut Machine, text: &str) -> Outcome { Outcome::Done(none) } "nop" | "pause" => Outcome::Done(none), + "cpuid" => { + // Xenora's guest CPUID contract, restated: the vendor "Xenora guest" + // and the four features whose every instruction exists, CMOV and + // POPCNT in leaf 1, LZCNT and long mode in leaf 0x8000_0001. + let word = |text: &[u8; 4]| u32::from_le_bytes(*text); + let values = match m.gpr[RAX] as u32 { + 0 => [1, word(b"Xeno"), word(b"uest"), word(b"ra g")], + 1 => [0, 0, 1 << 23, 1 << 15], + 0x8000_0000 => [0x8000_0001, 0, 0, 0], + 0x8000_0001 => [0, 0, 1 << 5, 1 << 29], + _ => [0; 4], + }; + // EAX, EBX, ECX and EDX, each zero-extended. + for (index, value) in [0, 3, 1, 2].into_iter().zip(values) { + m.gpr[index] = u64::from(value); + } + Outcome::Done(none) + } "push" => { m.pushed = read(m, places[0], 64) as u64; m.gpr[4] -= 8; diff --git a/crates/loader/x86/instructions.toml b/crates/loader/x86/instructions.toml index 34bdfdc..fbd36f8 100644 --- a/crates/loader/x86/instructions.toml +++ b/crates/loader/x86/instructions.toml @@ -10,6 +10,9 @@ # decodable; a form counts as implemented only once its operation has semantics # and independent tests. Forms not listed here are rejected. # +# lock = true accepts the LOCK prefix (F0) when the ModRM operand is memory. +# Every other use of LOCK is rejected, as the architecture's #UD. +# # prefix is a mandatory prefix: "66", "f3" or "f2". SSE forms use size x (XMM) # and give the ModRM operand width in src: x = 16 bytes, q = 8, d = 4, w = 2. # A 16-byte memory operand must be aligned unless unaligned = true. @@ -48,6 +51,8 @@ movsx = { ref = "sdm MOVSX/MOVSXD" } movsxd = { ref = "sdm MOVSX/MOVSXD" } lea = { ref = "sdm LEA" } xchg = { ref = "sdm XCHG" } +xadd = { writes = "cf zf sf of pf af", ref = "sdm XADD" } +cmpxchg = { writes = "cf zf sf of pf af", ref = "sdm CMPXCHG" } bswap = { ref = "sdm BSWAP" } cwde = { ref = "sdm CBW/CWDE/CDQE" } cdq = { ref = "sdm CWD/CDQ/CQO" } @@ -85,6 +90,7 @@ syscall = { terminator = true, ref = "sdm SYSCALL" } clc = { writes = "cf", ref = "sdm CLC" } stc = { writes = "cf", ref = "sdm STC" } cmc = { reads = "cf", writes = "cf", ref = "sdm CMC" } +cpuid = { ref = "sdm CPUID" } # SSE and SSE2 moves and packed integer operations. None reads or writes RFLAGS. movaps = { ref = "sdm MOVAPS" } @@ -562,6 +568,13 @@ opcode = 0x05 enc = "none" size = "n" +[[form]] +op = "cpuid" +map = "0f" +opcode = 0xA2 +enc = "none" +size = "n" + [[form]] op = "movzx" map = "0f" @@ -674,6 +687,38 @@ enc = "rm_reg" size = "v" register_only = true +[[form]] +op = "cmpxchg" +map = "0f" +opcode = 0xB0 +enc = "rm_reg" +size = "b" +lock = true + +[[form]] +op = "cmpxchg" +map = "0f" +opcode = 0xB1 +enc = "rm_reg" +size = "v" +lock = true + +[[form]] +op = "xadd" +map = "0f" +opcode = 0xC0 +enc = "rm_reg" +size = "b" +lock = true + +[[form]] +op = "xadd" +map = "0f" +opcode = 0xC1 +enc = "rm_reg" +size = "v" +lock = true + # Groups whose digits select an operation: [opcode, size, immediate, encoding]. [[group]] map = "0f" diff --git a/crates/shader/src/lib.rs b/crates/shader/src/lib.rs index 014892e..ea585b5 100644 --- a/crates/shader/src/lib.rs +++ b/crates/shader/src/lib.rs @@ -10,7 +10,8 @@ pub use graphics::{PIXEL_ENTRY_POINT, VERTEX_ENTRY_POINT, compile_graphics}; pub use xenora_decoder::Architecture; use xenora_decoder::{ DecodeError, DecodedInstruction, Instruction, ScalarSource, ScalarUnaryOp, VectorAluOp, - VectorAluVop3Op, VectorBinary, VectorCompareOp, VectorLowering, VectorSource, VectorVcc, + VectorAluVop3Op, VectorBinary, VectorCompareOp, VectorLowering, VectorSource, VectorUnary, + VectorVcc, }; /// SGPR index of `vcc_lo`. @@ -92,6 +93,7 @@ enum Op { Load, Constant(u32), Binary(Binary, Value, Value), + Unary(VectorUnary, Value), MergeLanes { mask: u32, active: Value, @@ -140,6 +142,7 @@ impl Op { match self { Self::Load | Self::Constant(_) | Self::ScalarBranch { .. } => Vec::new(), Self::Binary(_, left, right) => vec![left, right], + Self::Unary(_, source) => vec![source], Self::MergeLanes { active, inactive, .. } => vec![active, inactive], @@ -164,6 +167,21 @@ impl Op { match self { Self::Load => format!("input[{index}]"), Self::Constant(value) => format!("0x{value:08x}u"), + Self::Unary(op, source) => { + let src = name(source); + // AMD guide 12.8: all three scans return -1 if no bit matches. + match op { + VectorUnary::Not => format!("~{src}"), + VectorUnary::ReverseBits => format!("reverse_bits({src})"), + VectorUnary::FindHighUnsigned => { + format!("{src} == 0u ? 0xffffffffu : clz({src})") + } + VectorUnary::FindLow => format!("{src} == 0u ? 0xffffffffu : ctz({src})"), + VectorUnary::FindHighSigned => format!( + "({src} == 0u || {src} == 0xffffffffu) ? 0xffffffffu : clz({src} ^ (0u - ({src} >> 31u)))" + ), + } + } Self::Binary(operator, left, right) => { let (left, right) = (name(left), name(right)); let (_, symbol) = operator.operator(); @@ -479,6 +497,19 @@ pub fn compile(architecture: Architecture, bytes: &[u8]) -> Result { + let mnemonic = match operator { + VectorUnary::Not => "not.b32", + VectorUnary::ReverseBits => "brev.b32", + VectorUnary::FindHighUnsigned => "ffbh.u32", + VectorUnary::FindLow => "ffbl.b32", + VectorUnary::FindHighSigned => "ffbh.i32", + }; + ( + format!("{dest} = {mnemonic} {source}"), + format!("uint {dest} = {};", operation.expression(&thread, "", "")), + ) + } Op::Binary(operator, left, right) => ( format!("{dest} = {} {left}, {right}", operator.operator().0), format!("uint {dest} = {};", operation.expression(&thread, "", "")), @@ -808,6 +839,25 @@ fn lift(decoded: &[DecodedInstruction], code_len: usize) -> Result, facts: &mut Vec<_>| { + Ok(match source { + VectorSource::Register(register) => read(register)?, + VectorSource::Scalar(register) if usize::from(register) == VCC_LO => { + match (lane_vcc, scalars[VCC_LO]) { + (Some(mask), _) => mask, + (None, Some(bits)) => constant(operations, facts, offset, bits), + (None, None) => { + return Err(error("vector ALU reads uninitialized VCC_LO")); + } + } + } + VectorSource::Scalar(register) => { + let bits = read_scalar(ScalarSource::Register(register))?; + constant(operations, facts, offset, bits) + } + VectorSource::Immediate(bits) => constant(operations, facts, offset, bits), + }) + }; // Scalar instructions and waits still execute when all lanes are inactive. if exec == 0 { match instruction.instruction { @@ -822,7 +872,9 @@ fn lift(decoded: &[DecodedInstruction], code_len: usize) -> Result continue, + | Instruction::VectorAlu { .. } + | Instruction::VectorUnary { .. } + | Instruction::VectorSwap { .. } => continue, _ => {} } } @@ -1126,27 +1178,7 @@ fn lift(decoded: &[DecodedInstruction], code_len: usize) -> Result { - let src0 = match src0 { - VectorSource::Register(register) => read(register)?, - VectorSource::Scalar(register) if usize::from(register) == VCC_LO => { - match (lane_vcc, scalars[VCC_LO]) { - (Some(mask), _) => mask, - (None, Some(bits)) => { - constant(&mut operations, &mut facts, offset, bits) - } - (None, None) => { - return Err(error("vector ALU reads uninitialized VCC_LO")); - } - } - } - VectorSource::Scalar(register) => { - let bits = read_scalar(ScalarSource::Register(register))?; - constant(&mut operations, &mut facts, offset, bits) - } - VectorSource::Immediate(bits) => { - constant(&mut operations, &mut facts, offset, bits) - } - }; + let src0 = read_vector(src0, &mut operations, &mut facts)?; let src1 = read(src1)?; let (left, right) = if op.swaps_sources() { (src1, src0) @@ -1199,6 +1231,35 @@ fn lift(decoded: &[DecodedInstruction], code_len: usize) -> Result { + let source = read_vector(src, &mut operations, &mut facts)?; + (Some(dst), Op::Unary(op.lowering(), source)) + } + Instruction::VectorSwap { dst, src, .. } => { + // Guide 12.8: capture both old values before updating either VGPR. + // read() also rejects v0 and registers with outstanding loads. + let old_dst = read(dst)?; + let old_src = read(src)?; + if dst != src { + registers[usize::from(dst)] = Some(merge_lanes( + &mut operations, + &mut facts, + offset, + exec, + old_src, + Some(old_dst), + )?); + registers[usize::from(src)] = Some(merge_lanes( + &mut operations, + &mut facts, + offset, + exec, + old_dst, + Some(old_src), + )?); + } + continue; + } Instruction::VectorAddF32 { dst, src0, src1 } => ( Some(dst), Op::Binary(Binary::FloatAdd, read(src0)?, read(src1)?), diff --git a/crates/shader/tests/compiler.rs b/crates/shader/tests/compiler.rs index 2958e00..7a24dcb 100644 --- a/crates/shader/tests/compiler.rs +++ b/crates/shader/tests/compiler.rs @@ -405,3 +405,17 @@ fn vector_vcc_fixture_matches_ir_and_msl_goldens() { include_str!("../../../fixtures/golden/vector-vcc.metal") ); } + +#[test] +fn vop1_integer_fixture_lowers_unary_and_masked_swap() { + let code = include_bytes!("../../../fixtures/rdna2/vector-unary.bin"); + let compiled = compile(Architecture::Gfx1030, code).unwrap(); + assert_eq!( + compiled.ir, + include_str!("../../../fixtures/golden/vector-unary.ir") + ); + assert_eq!( + compiled.msl, + include_str!("../../../fixtures/golden/vector-unary.metal") + ); +} diff --git a/docs/README.md b/docs/README.md index 7d55a93..5008656 100644 --- a/docs/README.md +++ b/docs/README.md @@ -25,6 +25,7 @@ either path. The [changelog](../CHANGELOG.md) records notable changes. - [Semantic coverage](shaders/semantic-coverage.md) — Generated per-family counts of identified, declared, decoded, lowered and verified gfx1030 forms. - [SOP2 scalar ALU](shaders/scalar-alu.md) — Supported scalar add, subtract and bitwise forms, their SCC rules and sources. - [Semantic registry](shaders/semantic-registry.md) — How to add an instruction form: registry fields, validation, generation and the independence rule. +- [VOP1 vector unary and swap](shaders/vector-unary.md) — Wave32 integer bit operations, register exchange, and operand limits. - [VOP2 select and carry](shaders/vector-vcc.md) — Wave32 lane selection, carry and borrow through the vector condition code. - [VOPC integer compares](shaders/vector-compare.md) — Wave32 compare forms, the VCC/EXEC contract, runtime `s_cbranch_vccz` and the Metal mapping. - [Metal Shading Language generation](shaders/msl.md) and [independent CPU reference](shaders/reference-interpreter.md) — Translation rules and separate CPU execution models. diff --git a/docs/assets/xenora-progress.svg b/docs/assets/xenora-progress.svg index c7efc2f..239bc12 100644 --- a/docs/assets/xenora-progress.svg +++ b/docs/assets/xenora-progress.svg @@ -1,17 +1,17 @@ Xenora · recorded progress -Decoded gfx1030 forms: 124 of 124. Accepted Metal forms · Apple M5: 18 of 124. Accepted guest milestones · X1–X4: 4 of 4 +Decoded gfx1030 forms: 130 of 130. Accepted Metal forms · Apple M5: 18 of 130. Accepted guest milestones · X1–X4: 4 of 4 RECORDED FIXTURE PROGRESS Decoded gfx1030 forms -124 / 124 +130 / 130 Accepted Metal forms · Apple M5 -18 / 124 +18 / 130 - + Accepted guest milestones · X1–X4 4 / 4 diff --git a/docs/cpu/instruction-registry.md b/docs/cpu/instruction-registry.md index f97c815..66063dc 100644 --- a/docs/cpu/instruction-registry.md +++ b/docs/cpu/instruction-registry.md @@ -45,6 +45,42 @@ XMM registers live in `CpuState::xmm`, lane 0 in the low bits, and MXCSR in `Cpu None of it has been compared with x86 hardware. +## Locked instructions + +XADD and CMPXCHG exist for 8-, 16-, 32- and 64-bit register and memory destinations. The LOCK prefix (F0) is accepted on exactly the forms the registry marks `lock = true`, and only when the destination is memory. Today those are the memory forms of XADD and CMPXCHG. LOCK anywhere else is an illegal instruction, as the Intel SDM (Vol. 2, "LOCK") specifies for a register destination or an instruction that cannot be locked. LOCK on the other instructions the SDM allows (ADD, ADC, AND, BTC, BTR, BTS, DEC, INC, NEG, NOT, OR, SBB, SUB, XOR and XCHG), CMPXCHG8B and CMPXCHG16B are not implemented and stay rejected. + +These rules hold for both engines and are what a guest scheduler has to preserve: + +- **Ordering.** Each engine runs one guest instruction at a time on one host thread, and an instruction either completes or changes nothing. A locked instruction is therefore indivisible and totally ordered with every other guest access, and LOCK changes no result: the locked and unlocked encodings leave identical state. A scheduler that switches guest threads only between instructions keeps this. One that runs guest threads on several host threads does not, and must first make each locked instruction atomic against every access to its operand, with x86's ordering rather than ARM64's weaker one. Nothing here provides or tests that. +- **Alignment.** A locked operand may have any alignment and may span two mapped regions. +- **Compare failure.** CMPXCHG compares the accumulator with the destination as CMP would and sets all six status flags from it. On a match it stores the source and leaves the accumulator alone. On a mismatch it loads the destination into the accumulator and stores the destination's old value back, so the destination is written either way and a mismatch on memory that cannot be written still faults. With a 32-bit register destination both stores clear the upper half of that register, following the SDM's operation text. +- **Faults.** If any byte of the operand cannot be read or written, the instruction faults before memory, registers or flags change. +- **Lowering.** The DBT runs these forms on the shared semantics. They are not lowered to ARM64 atomic instructions, which could only be judged against concurrent guest threads. + +The SDM cases for these forms in `tests/cpu_known_answers.rs` were written before this implementation, by another contributor. `tests/x86_atomic.rs` adds the LOCK rules, both compare outcomes at every width, unaligned operands and faults. None of it has been compared with x86 hardware, and nothing here establishes multi-thread behaviour. + +## Guest CPUID + +CPUID (`0F A2`) returns a fixed table that never reads the host. It describes a synthetic processor: the vendor string is `Xenora guest`, not Intel's or AMD's, and leaf 1 reports no family, model or stepping. + +| Leaf (EAX) | EAX | EBX | ECX | EDX | +| --- | --- | --- | --- | --- | +| 0 | 1, the highest basic leaf | `Xeno` | `uest` | `ra g` | +| 1 | 0 | 0 | POPCNT (bit 23) | CMOV (bit 15) | +| 0x8000_0000 | 0x8000_0001, the highest extended leaf | 0 | 0 | 0 | +| 0x8000_0001 | 0 | 0 | LZCNT (bit 5) | long mode (bit 29) | +| any other | 0 | 0 | 0 | 0 | + +A feature bit is set only when every instruction of that feature is implemented. That is stricter than "some of it works", and it has consequences: + +- SSE and SSE2 are not reported, although most of their instructions exist, because parts are still rejected: RSQRTPS and MFENCE, for example. BMI1 is not reported although TZCNT exists, because ANDN does not. The x87 FPU, MMX, FXSAVE, CMPXCHG8B, the time-stamp counter, LAHF and SYSRET are absent too. +- The table is therefore truthful about Xenora, not plausible as hardware: every real 64-bit processor reports the FPU and SSE2. A guest that tests a bit before using a feature avoids it; a guest that assumes SSE2 because it runs in 64-bit mode still gets every form that exists and an illegal-instruction exit for one that does not. +- A leaf that is not listed returns zeros, whatever the subleaf. Intel processors answer a leaf above the highest basic one with that leaf's data instead; software is expected to read the highest leaf first. + +`xenora_loader::cpu::cpuid` is the one copy of the table. A runtime service that reports processor features should read it rather than keep its own list. + +`tests/cpu_features.rs` pins every leaf in both engines. For each reported feature it requires the feature's whole instruction set among the fixtures that `tests/x86_integer.rs` executes. For each feature software commonly tests that is not reported, it holds one instruction of that feature that both engines must refuse. To report a new feature: implement all of its instructions, remove its witness, add its instruction list to the reported set, then set the bit. The pairing of instructions with feature bits follows the Intel SDM; nothing was compared with a processor. + ## Rejected on purpose -LOCK, F2 or F3 where it is neither PAUSE nor part of a declared form, F2 combined with F3, address-size overrides, an ignored segment override after FS or GS, 16-bit stack and branch forms, 16-bit BSWAP and MOVSXD, bit tests of memory by a register index, RCL, RCR, SHLD, SHRD, string instructions, MMX, the RCP and RSQRT approximations, SSE3 and later, VEX, atomics and fences. The DBT also refuses raw SYSCALL. +LOCK except as described above, F2 or F3 where it is neither PAUSE nor part of a declared form, F2 combined with F3, address-size overrides, an ignored segment override after FS or GS, 16-bit stack and branch forms, 16-bit BSWAP and MOVSXD, bit tests of memory by a register index, RCL, RCR, SHLD, SHRD, string instructions, MMX, the RCP and RSQRT approximations, SSE3 and later, VEX, CMPXCHG8B, CMPXCHG16B and fences. The DBT also refuses raw SYSCALL. diff --git a/docs/shaders/instruction-coverage.md b/docs/shaders/instruction-coverage.md index 81c4000..a1d4a4c 100644 --- a/docs/shaders/instruction-coverage.md +++ b/docs/shaders/instruction-coverage.md @@ -121,6 +121,12 @@ The wider LLVM operand matrix exercises decoding only. ABI means application bin | `v_ashrrev_i32_e32` | Two VGPR sources and one VGPR destination | `31FFFF01` | yes | yes | three-way passed | MSL signed right shift with a five-bit count | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending | | `s_cbranch_execz` | Nonnegative signed dword displacement | `BF880001` | yes | yes | three-way passed | resolved Wave32 EXEC_LO zero check | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending | | `s_cbranch_vccz` | Nonnegative signed dword displacement | `BF860001` | yes | yes | three-way passed | resolved Wave32 VCC_LO zero check, or a wave-uniform join select after a vector compare | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending | +| `v_not_b32_e32` | VOP1, Wave32; VGPR VDST with VGPR, normal SGPR, vcc_lo, inline integer or literal SRC0; bitwise complement | `7E046F01` | yes | yes | three-way passed | per-thread unary integer operation with a lane merge under partial EXEC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending | +| `v_bfrev_b32_e32` | VOP1, Wave32; VGPR VDST with VGPR, normal SGPR, vcc_lo, inline integer or literal SRC0; reverse bit order | `7E067101` | yes | yes | three-way passed | per-thread unary integer operation with a lane merge under partial EXEC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending | +| `v_ffbh_u32_e32` | VOP1, Wave32; VGPR VDST with VGPR, normal SGPR, vcc_lo, inline integer or literal SRC0; count leading zeros, or -1 for zero | `7E087302` | yes | yes | three-way passed | per-thread unary integer operation with a lane merge under partial EXEC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending | +| `v_ffbl_b32_e32` | VOP1, Wave32; VGPR VDST with VGPR, normal SGPR, vcc_lo, inline integer or literal SRC0; count trailing zeros, or -1 for zero | `7E0A7501` | yes | yes | three-way passed | per-thread unary integer operation with a lane merge under partial EXEC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending | +| `v_ffbh_i32_e32` | VOP1, Wave32; VGPR VDST with VGPR, normal SGPR, vcc_lo, inline integer or literal SRC0; count leading sign bits, or -1 if all bits match | `7E0C7702` | yes | yes | three-way passed | per-thread unary integer operation with a lane merge under partial EXEC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending | +| `v_swap_b32` | VOP1, Wave32; VGPR VDST and SRC0; exchange the old values of VDST and SRC0 | `7E02CB02` | yes | yes | three-way passed | per-thread exchange of both register values with lane merges under partial EXEC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending | | `v_mul_i32_i24_e32` | VOP2, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1 and VDST; inactive lanes keep VDST; D = low 32 bits of sext(S0[23:0]) * sext(S1[23:0]) | `120402C3` | yes | yes | three-way passed | per-thread typed integer template over the lane's own VGPRs; partial EXEC as a lane merge | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending | | `v_mul_hi_i32_i24_e32` | VOP2, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1 and VDST; inactive lanes keep VDST; D = bits 63:32 of sext(S0[23:0]) * sext(S1[23:0]) | `14060208` | yes | yes | three-way passed | per-thread typed integer template over the lane's own VGPRs; partial EXEC as a lane merge | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending | | `v_mul_u32_u24_e32` | VOP2, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1 and VDST; inactive lanes keep VDST; D = low 32 bits of S0[23:0] * S1[23:0] | `160802FF 00123456` | yes | yes | three-way passed | per-thread typed integer template over the lane's own VGPRs; partial EXEC as a lane merge | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending | diff --git a/docs/shaders/semantic-coverage.md b/docs/shaders/semantic-coverage.md index 3a26653..b11ed87 100644 --- a/docs/shaders/semantic-coverage.md +++ b/docs/shaders/semantic-coverage.md @@ -30,13 +30,13 @@ acceptance remain outside the verified count. All results concern synthetic fixt | SOPK | 27 | 17 | 16 | 17 | 17 | 17 | 1 | 1 | 5 | | SOPP | 36 | 6 | 0 | 6 | 6 | 6 | 4 | 4 | 0 | | VINTRP | 3 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | -| VOP1 | 81 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | +| VOP1 | 81 | 7 | 6 | 7 | 7 | 7 | 1 | 1 | 11 | | VOP2 | 47 | 24 | 22 | 24 | 24 | 24 | 7 | 7 | 11 | | VOP3 | 416 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 12 | | VOP3P | 29 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | VOP3SDST | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | VOPC | 190 | 16 | 16 | 16 | 16 | 16 | 0 | 0 | 7 | -| **Total** | 1465 | 124 | 112 | 128 | 124 | 124 | 18 | 18 | 65 | +| **Total** | 1465 | 130 | 118 | 134 | 130 | 130 | 18 | 18 | 76 | ## Unsupported operand variants @@ -50,6 +50,8 @@ The table counts distinct variant names per family across registry operand rules | SOPC | `sopc_scalar` | `src_exec`, `src_float_inline`, `src_m0`, `src_special`, `src_ttmp`, `src_vcc`, `two_literals` | | SOPK | `sopk_compare` | `dst_exec`, `dst_m0`, `dst_null`, `dst_ttmp`, `dst_vcc` | | SOPK | `sopk_sgpr` | `dst_exec`, `dst_m0`, `dst_null`, `dst_ttmp`, `dst_vcc` | +| VOP1 | `vop1_swap` | `src_exec`, `src_float_inline`, `src_inline`, `src_literal`, `src_m0`, `src_null`, `src_sgpr`, `src_special`, `src_ttmp`, `src_vcc` | +| VOP1 | `vop1_vgpr` | `src_exec`, `src_float_inline`, `src_m0`, `src_null`, `src_special`, `src_ttmp`, `src_vcc_hi` | | VOP2 | `vop2_vcc` | `src_exec`, `src_float_inline`, `src_m0`, `src_null`, `src_special`, `src_ttmp`, `src_vcc_hi` | | VOP2 | `vop2_vgpr` | `src_exec`, `src_float_inline`, `src_m0`, `src_null`, `src_special`, `src_ttmp`, `src_vcc_hi` | | VOP2 | `vop2_vgpr2` | `src_exec`, `src_float_inline`, `src_inline`, `src_literal`, `src_m0`, `src_null`, `src_sgpr`, `src_special`, `src_ttmp`, `src_vcc` | diff --git a/docs/shaders/semantic-registry.md b/docs/shaders/semantic-registry.md index c337f6d..b467482 100644 --- a/docs/shaders/semantic-registry.md +++ b/docs/shaders/semantic-registry.md @@ -119,8 +119,8 @@ error. | `shift_amount` | `lshl_add` only: the fixed left shift of S0 before the add | `1` to `4`; required for `lshl_add`, rejected elsewhere | | `shift_count_bits` | Shifts only: the low bits of the count source used as the count: S1, or S0 for a vector form with `source_order = "reversed"`. Scalar forms mask it in the generated evaluation, vector forms in their MSL template; the XML must list the count source as unsigned | `5` (log2 of `width`); required for shifts, rejected elsewhere | | `scc` | What the form writes to SCC | `carry_out`, `borrow`, `signed_overflow`, `nonzero`, `relation` (SOPC and SOPK compares only), `selected_src0` (min and max: S0 won the strict compare, so a tie gives 0), `unchanged` | -| `vcc`, `exec` | Implicit effect on VCC and EXEC | `unchanged`; `vcc` is `lane_mask` exactly for the VOPC compares and the three VOP2 carry forms (fully written VCC_LO, with inactive bits zero and VCC_HI unknown afterwards); `exec` must be `unchanged` (explicit destinations are covered by the operand rule) | -| `wave` | Wave sizes the form is valid in | `wave32` for the VOPC compares and the VCC-reading VOP2 forms in the Wave32 compute fixture ABI, `any` for other forms | +| `vcc`, `exec` | Implicit effect on VCC and EXEC | `vcc` is `lane_mask` for [VOPC compares](vector-compare.md) and the three [VOP2 carry forms](vector-vcc.md). These write all of VCC_LO, zero inactive lane bits and leave VCC_HI unknown. Other forms declare `vcc` as `unchanged`. All forms declare `exec` as `unchanged`. Operand rules cover explicit destinations. | +| `wave` | Wave sizes the form is valid in | `wave32` for VOPC compares, VOP1 integer forms and VCC-reading VOP2 forms in the Wave32 compute fixture ABI, `any` for other registry forms | | `operands` | Name of an `[operand_rules]` entry for the same family | e.g. `sop2_sgpr` | | `spec` | References `{ document, section, page }` | at least one `guide` reference with a page above 0 | | `verify` | Evidence the form needs before it counts as verified | `reference`, `independent`, `metal`, `llvm_encoding` | diff --git a/docs/shaders/vector-unary.md b/docs/shaders/vector-unary.md new file mode 100644 index 0000000..ad546a3 --- /dev/null +++ b/docs/shaders/vector-unary.md @@ -0,0 +1,38 @@ +# Wave32 vector unary integer operations and swap + +Xenora translates six gfx1030 VOP1 integer forms for the synthetic Wave32 compute +ABI. The AMD RDNA 2 ISA Reference Guide defines the operations in section 12.8, +the encoding in section 13.3.2, and the execution mask (EXEC) in section 3.3. + +| Form | Result in each active lane | +| --- | --- | +| `v_not_b32_e32` | Complement all 32 bits. | +| `v_bfrev_b32_e32` | Reverse the order of the 32 bits. | +| `v_ffbh_u32_e32` | Count leading zeros. Return all ones if the source is zero. | +| `v_ffbl_b32_e32` | Count trailing zeros. Return all ones if the source is zero. | +| `v_ffbh_i32_e32` | Count leading bits equal to the sign bit. Return all ones if all bits match. | +| `v_swap_b32` | Exchange the old values of two vector general-purpose registers (VGPRs). A register swapped with itself keeps its value. | + +The unary forms accept a VGPR, scalar register `s0`–`s105`, `vcc_lo` (the low +half of the vector condition code), inline integer `-16`–`64`, or a literal +word as SRC0. Swap requires a VGPR as SRC0 because it writes both operands. +Both operands of swap must be initialized when EXEC is nonzero. The compute +ABI reserves `v0` for indexing and requires waiting for buffer loads before +using or overwriting their destination. Inactive lanes retain their old +values. The six forms leave EXEC, VCC and the scalar condition code (SCC) +unchanged. + +The compiler emits per-thread Metal Shading Language for unary operations. +For swap it captures both old values in the intermediate representation before +updating either register binding. Under partial EXEC, each register receives +its own lane merge. + +The [guide-derived oracle](../../tests/validation/tests/vop1_integer.rs) checks +the 752 accepted cases' outputs against its expected values on each CPU +interpreter and, through the translator, on native Metal (Apple M5, API and +shader validation on: 752 cases in 613 programs). A CPU test checks that the +compiler accepts every case and refuses each of the 610 rejected programs at +the same instruction offset as the interpreters. The +[LLVM-assembled fixture](../../fixtures/rdna2/vector-unary.s) exercises all +six forms with a partial EXEC swap. Independent acceptance of the +translator is pending. Xbox hardware agreement is unknown. diff --git a/docs/status.toml b/docs/status.toml index d8c3e6b..05f1b61 100644 --- a/docs/status.toml +++ b/docs/status.toml @@ -1334,6 +1334,78 @@ recognized = true decoded = true llvm = "three-way passed" +[[instruction]] +form = "v_not_b32_e32" +encoding = "VOP1, Wave32; VGPR VDST with VGPR, normal SGPR, vcc_lo, inline integer or literal SRC0; bitwise complement" +representation = "`7E046F01`" +lowering = "per-thread unary integer operation with a lane merge under partial EXEC" +reference = "implemented" +cpu = "local known-answer test passed" +gpu = "local Apple M5 readback passed; acceptance pending" +recognized = true +decoded = true +llvm = "three-way passed" + +[[instruction]] +form = "v_bfrev_b32_e32" +encoding = "VOP1, Wave32; VGPR VDST with VGPR, normal SGPR, vcc_lo, inline integer or literal SRC0; reverse bit order" +representation = "`7E067101`" +lowering = "per-thread unary integer operation with a lane merge under partial EXEC" +reference = "implemented" +cpu = "local known-answer test passed" +gpu = "local Apple M5 readback passed; acceptance pending" +recognized = true +decoded = true +llvm = "three-way passed" + +[[instruction]] +form = "v_ffbh_u32_e32" +encoding = "VOP1, Wave32; VGPR VDST with VGPR, normal SGPR, vcc_lo, inline integer or literal SRC0; count leading zeros, or -1 for zero" +representation = "`7E087302`" +lowering = "per-thread unary integer operation with a lane merge under partial EXEC" +reference = "implemented" +cpu = "local known-answer test passed" +gpu = "local Apple M5 readback passed; acceptance pending" +recognized = true +decoded = true +llvm = "three-way passed" + +[[instruction]] +form = "v_ffbl_b32_e32" +encoding = "VOP1, Wave32; VGPR VDST with VGPR, normal SGPR, vcc_lo, inline integer or literal SRC0; count trailing zeros, or -1 for zero" +representation = "`7E0A7501`" +lowering = "per-thread unary integer operation with a lane merge under partial EXEC" +reference = "implemented" +cpu = "local known-answer test passed" +gpu = "local Apple M5 readback passed; acceptance pending" +recognized = true +decoded = true +llvm = "three-way passed" + +[[instruction]] +form = "v_ffbh_i32_e32" +encoding = "VOP1, Wave32; VGPR VDST with VGPR, normal SGPR, vcc_lo, inline integer or literal SRC0; count leading sign bits, or -1 if all bits match" +representation = "`7E0C7702`" +lowering = "per-thread unary integer operation with a lane merge under partial EXEC" +reference = "implemented" +cpu = "local known-answer test passed" +gpu = "local Apple M5 readback passed; acceptance pending" +recognized = true +decoded = true +llvm = "three-way passed" + +[[instruction]] +form = "v_swap_b32" +encoding = "VOP1, Wave32; VGPR VDST and SRC0; exchange the old values of VDST and SRC0" +representation = "`7E02CB02`" +lowering = "per-thread exchange of both register values with lane merges under partial EXEC" +reference = "implemented" +cpu = "local known-answer test passed" +gpu = "local Apple M5 readback passed; acceptance pending" +recognized = true +decoded = true +llvm = "three-way passed" + [[instruction]] form = "v_mul_i32_i24_e32" encoding = "VOP2, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1 and VDST; inactive lanes keep VDST; D = low 32 bits of sext(S0[23:0]) * sext(S1[23:0])" diff --git a/fixtures/golden/vector-unary.ir b/fixtures/golden/vector-unary.ir new file mode 100644 index 0000000..51d4800 --- /dev/null +++ b/fixtures/golden/vector-unary.ir @@ -0,0 +1,12 @@ +0000: t0 = load.u32 input[index] +000c: t1 = not.b32 t0 +0018: t2 = merge.lanes mask=0xaaaaaaaa, t1, t0 +0018: t3 = merge.lanes mask=0xaaaaaaaa, t0, t1 +0020: t4 = brev.b32 t2 +0024: t5 = ffbh.u32 t3 +0028: t6 = ffbl.b32 t2 +002c: t7 = ffbh.i32 t3 +0030: t8 = xor.b32 t4, t5 +0034: t9 = xor.b32 t6, t8 +0038: t10 = xor.b32 t7, t9 +003c: store.u32 output[index], t10 diff --git a/fixtures/golden/vector-unary.metal b/fixtures/golden/vector-unary.metal new file mode 100644 index 0000000..bf00db3 --- /dev/null +++ b/fixtures/golden/vector-unary.metal @@ -0,0 +1,19 @@ +#include +using namespace metal; +kernel void xenora_compute( + device const uint* input [[buffer(0)]], + device uint* output [[buffer(1)]], + uint index [[thread_position_in_grid]]) { + uint t0 = input[index]; + uint t1 = ~t0; + uint t2 = ((0xaaaaaaaau >> (index & 31u)) & 1u) != 0u ? t1 : t0; + uint t3 = ((0xaaaaaaaau >> (index & 31u)) & 1u) != 0u ? t0 : t1; + uint t4 = reverse_bits(t2); + uint t5 = t3 == 0u ? 0xffffffffu : clz(t3); + uint t6 = t2 == 0u ? 0xffffffffu : ctz(t2); + uint t7 = (t3 == 0u || t3 == 0xffffffffu) ? 0xffffffffu : clz(t3 ^ (0u - (t3 >> 31u))); + uint t8 = t4 ^ t5; + uint t9 = t6 ^ t8; + uint t10 = t7 ^ t9; + output[index] = t10; +} diff --git a/fixtures/rdna2/vector-unary.bin b/fixtures/rdna2/vector-unary.bin new file mode 100644 index 0000000..bb50de9 Binary files /dev/null and b/fixtures/rdna2/vector-unary.bin differ diff --git a/fixtures/rdna2/vector-unary.s b/fixtures/rdna2/vector-unary.s new file mode 100644 index 0000000..b2f8c19 --- /dev/null +++ b/fixtures/rdna2/vector-unary.s @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Wave32 VOP1 integer forms (AMD RDNA 2 ISA guide 12.8). +// Exchange the input and its complement in odd lanes, then use both values +// and all three bit scans to form the output. +.text +buffer_load_dword v1, v0, s[0:3], 0 idxen +s_waitcnt vmcnt(0) +v_not_b32_e32 v2, v1 +s_mov_b32 exec_lo, 0xaaaaaaaa +v_swap_b32 v1, v2 +s_mov_b32 exec_lo, -1 +v_bfrev_b32_e32 v3, v1 +v_ffbh_u32_e32 v4, v2 +v_ffbl_b32_e32 v5, v1 +v_ffbh_i32_e32 v6, v2 +v_xor_b32_e32 v7, v3, v4 +v_xor_b32_e32 v7, v5, v7 +v_xor_b32_e32 v7, v6, v7 +buffer_store_dword v7, v0, s[4:7], 0 idxen +s_waitcnt_vscnt null, 0 +s_endpgm diff --git a/scripts/assemble-fixture.sh b/scripts/assemble-fixture.sh index ceb62ce..7b40614 100755 --- a/scripts/assemble-fixture.sh +++ b/scripts/assemble-fixture.sh @@ -12,7 +12,7 @@ case "${1:-}" in esac for name in add bitwise-branch float-exact or shifts ashr \ - x9-constant-vs x9-constant-ps x9-varying-vs x9-varying-ps x9-transform-vs scalar-alu vector-compare scalar-logic scalar-compare scalar-unary scalar-arith scalar-immediate vector-integer vector-compare-ft vector-vcc; do + x9-constant-vs x9-constant-ps x9-varying-vs x9-varying-ps x9-transform-vs scalar-alu vector-compare scalar-logic scalar-compare scalar-unary scalar-arith scalar-immediate vector-integer vector-compare-ft vector-vcc vector-unary; do "$llvm_bin/llvm-mc" -triple=amdgcn-amd-amdhsa -mcpu=gfx1030 -mattr=+wavefrontsize32 \ -filetype=obj "fixtures/rdna2/$name.s" -o "$scratch/$name.o" "$llvm_bin/llvm-objcopy" -O binary --only-section=.text "$scratch/$name.o" "$scratch/$name.bin" diff --git a/scripts/test-gpu.sh b/scripts/test-gpu.sh index 381aac1..83feb41 100755 --- a/scripts/test-gpu.sh +++ b/scripts/test-gpu.sh @@ -56,5 +56,4 @@ cargo test --locked -p xenora-semantic-review --no-run # Oracles whose translator side has not landed are skipped by name until it does # (#215: the PR that translates the forms removes its skip). timeout 120s cargo test --locked -p xenora-semantic-review -- --ignored --nocapture --test-threads=1 \ - --skip vopc_wide_match_the_guide_on_native_metal \ - --skip vop1_integer_forms_match_the_guide_on_native_metal + --skip vopc_wide_match_the_guide_on_native_metal diff --git a/tests/validation/tests/vop1_integer.rs b/tests/validation/tests/vop1_integer.rs index 0db9e76..2b74669 100644 --- a/tests/validation/tests/vop1_integer.rs +++ b/tests/validation/tests/vop1_integer.rs @@ -843,10 +843,20 @@ fn other_vop1_opcodes_stay_unsupported() { } #[test] -#[ignore = "requires a native Metal device with API and shader validation, and the translator's VOP1 integer forms (skipped by scripts/test-gpu.sh until then)"] -fn vop1_integer_forms_match_the_guide_on_native_metal() { - assert_eq!(std::env::var("MTL_DEBUG_LAYER").as_deref(), Ok("1")); - assert_eq!(std::env::var("MTL_SHADER_VALIDATION").as_deref(), Ok("1")); +fn compiler_matches_the_vop1_integer_operand_domain() { + let cases = checked_cases(); + for case in &cases { + compile(Architecture::Gfx1030, &case.code) + .unwrap_or_else(|error| panic!("compiler rejected {}: {error:?}", case.label)); + } + check_compiler_rejections(); + eprintln!( + "vop1_integer: {} compiler cases and {REJECTIONS} rejections", + cases.len() + ); +} + +fn check_compiler_rejections() { for (label, code, offset) in rejections() { // Refused at the same word as by the interpreters, so a later failure // cannot stand in. @@ -857,7 +867,15 @@ fn vop1_integer_forms_match_the_guide_on_native_metal() { }; assert_eq!(at, offset, "compiler rejected {label} elsewhere"); } +} + +#[test] +#[ignore = "requires a native Metal device with API and shader validation"] +fn vop1_integer_forms_match_the_guide_on_native_metal() { + assert_eq!(std::env::var("MTL_DEBUG_LAYER").as_deref(), Ok("1")); + assert_eq!(std::env::var("MTL_SHADER_VALIDATION").as_deref(), Ok("1")); let cases = checked_cases(); + check_compiler_rejections(); let (failures, programs) = harness::check_metal(&cases); failures.assert_none("native Metal disagrees with the guide"); eprintln!( diff --git a/tests/x86_generator/test_generate_x86.py b/tests/x86_generator/test_generate_x86.py index 0323858..4accac8 100644 --- a/tests/x86_generator/test_generate_x86.py +++ b/tests/x86_generator/test_generate_x86.py @@ -67,6 +67,18 @@ class GenerateX86(unittest.TestCase): self.rejects(self.form('op = "movq"\nmap = "0f"\nprefix = "66"\nopcode = 0xF0\nenc = "xmm_rm"\nsize = "x"\nsrc = "q"\nunaligned = true'), "alignment applies") self.rejects(self.form('op = "nop"\nprefix = "66"\nopcode = 0xD7\nenc = "none"\nsize = "n"'), "map 0f") + def test_lock_needs_a_memory_destination(self): + # Not a form without ModRM, not one whose ModRM operand is the source, + # and not one that takes only a register. + message = "LOCK needs a memory destination" + self.rejects(self.form('op = "nop"\nopcode = 0xD7\nenc = "none"\nsize = "n"\nlock = true'), message) + self.rejects(self.form('op = "mov"\nopcode = 0xD7\nenc = "reg_rm"\nsize = "v"\nlock = true'), message) + self.rejects(self.form('op = "xadd"\nopcode = 0xD7\nenc = "rm_reg"\nsize = "v"\nregister_only = true\nlock = true'), message) + + def test_only_xadd_and_cmpxchg_are_lockable(self): + _, forms = generate_x86.load(REGISTRY) + self.assertEqual({form["op"] for form in forms if form.get("lock")}, {"cmpxchg", "xadd"}) + def test_unknown_vocabulary_is_rejected(self): self.rejects(self.form('op = "frob"\nopcode = 0xD7\nenc = "none"\nsize = "n"'), "unknown op") self.rejects(self.form('op = "nop"\nopcode = 0xD7\nenc = "none"\nsize = "z"'), "unknown size")