From 1e230284c3bdeb5d3e71b5e058481ca0bf4d578e Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 27 Jun 2021 01:19:52 -0700 Subject: all tests now passing for long mode --- src/long_mode/evex.rs | 2 +- src/long_mode/mod.rs | 21 ++- src/shared/evex.in | 351 ++++++++++++++++++++++++++------------------------ test/long_mode/mod.rs | 6 +- 4 files changed, 204 insertions(+), 176 deletions(-) diff --git a/src/long_mode/evex.rs b/src/long_mode/evex.rs index da90d29..adfd014 100644 --- a/src/long_mode/evex.rs +++ b/src/long_mode/evex.rs @@ -1,6 +1,6 @@ // use crate::long_mode::{OperandSpec, DecodeError, RegSpec, RegisterBank, Instruction, Opcode}; use crate::long_mode::{DecodeError, RegSpec, RegisterBank, Instruction, Opcode}; -use crate::long_mode::{read_modrm, read_E_xmm, read_E_ymm, read_E_zmm, read_imm_unsigned}; +use crate::long_mode::{read_modrm, read_E_vex, read_imm_unsigned}; include!("../shared/generated_evex.in"); include!("../shared/evex.in"); diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index 60a18c5..e0dff7c 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -4317,6 +4317,8 @@ impl PrefixVex { fn w(&self) -> bool { (self.bits & 0x08) == 0x08 } #[inline] fn l(&self) -> bool { (self.bits & 0x10) == 0x10 } + #[inline] + fn compressed_disp(&self) -> bool { (self.bits & 0x20) == 0x20 } } #[derive(Debug, Copy, Clone)] @@ -4403,6 +4405,15 @@ impl Prefixes { } #[inline] + fn apply_compressed_disp(&mut self, state: bool) { + if state { + self.rex.bits |= 0x20; + } else { + self.rex.bits &= 0xdf; + } + } + + #[inline] fn rex_from(&mut self, bits: u8) { self.rex.bits = bits; } @@ -5427,11 +5438,15 @@ pub(self) fn read_E_ymm>(bytes_iter: &mut T, instr: &mut In } } #[allow(non_snake_case)] -pub(self) fn read_E_zmm>(bytes_iter: &mut T, instr: &mut Instruction, modrm: u8, length: &mut u8) -> Result { +pub(self) fn read_E_vex>(bytes_iter: &mut T, instr: &mut Instruction, modrm: u8, length: &mut u8, bank: RegisterBank) -> Result { if modrm >= 0b11000000 { - read_modrm_reg(instr, modrm, RegisterBank::Z) + read_modrm_reg(instr, modrm, bank) } else { - read_M(bytes_iter, instr, modrm, length) + let res = read_M(bytes_iter, instr, modrm, length)?; + if (modrm & 0b01_000_000) == 0b01_000_000 { + instr.prefixes.apply_compressed_disp(true); + } + Ok(res) } } diff --git a/src/shared/evex.in b/src/shared/evex.in index e997cf0..2151d47 100644 --- a/src/shared/evex.in +++ b/src/shared/evex.in @@ -57,6 +57,10 @@ pub(crate) fn read_evex>(bytes: &mut T, instruction: &mut I let (opcode, operand_code) = table[entry].1[index_lower]; instruction.opcode = opcode; read_evex_operands(bytes, instruction, operand_code, &mut length)?; + if instruction.prefixes.evex_unchecked().vex().compressed_disp() { + instruction.disp *= instruction.mem_size as u64; + instruction.prefixes.apply_compressed_disp(false); + } // TODO: apply rp and bp? } else { return Err(DecodeError::InvalidOpcode); @@ -65,6 +69,14 @@ pub(crate) fn read_evex>(bytes: &mut T, instruction: &mut I Ok(()) } +fn deny_broadcast(inst: &Instruction) -> Result<(), DecodeError> { + if inst.prefixes.evex_unchecked().broadcast() { + Err(DecodeError::InvalidOperand) + } else { + Ok(()) + } +} + fn deny_z(inst: &Instruction) -> Result<(), DecodeError> { if inst.prefixes.evex_unchecked().merge() { Err(DecodeError::InvalidOperand) @@ -168,7 +180,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -217,7 +229,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -248,7 +260,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -274,7 +286,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -306,7 +318,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -365,7 +377,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -443,7 +455,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; @@ -479,7 +491,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; @@ -511,7 +523,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; @@ -545,7 +557,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { return Err(DecodeError::InvalidOperand); } @@ -563,7 +575,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; instruction.vex_reg.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } else { @@ -590,7 +602,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; instruction.vex_reg.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.modrm_mmm.bank = bank; instruction.mem_size = 0; @@ -624,7 +636,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; instruction.vex_reg.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.modrm_mmm.bank = bank; instruction.mem_size = 0; @@ -645,7 +657,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; instruction.vex_reg.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.modrm_mmm.bank = RegisterBank::D; instruction.mem_size = 0; @@ -667,7 +679,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { return Err(DecodeError::InvalidOperand); } @@ -689,7 +701,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -705,7 +717,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; if mem_oper == OperandSpec::RegMMM { return Err(DecodeError::InvalidOperand); } @@ -724,7 +736,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; if mem_oper == OperandSpec::RegMMM { return Err(DecodeError::InvalidOperand); } @@ -743,7 +755,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = mem_oper.masked(); instruction.operands[1] = OperandSpec::RegRRR; instruction.operand_count = 2; @@ -760,7 +772,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::X; // in specific support of vcomisd/vucomisd @@ -782,7 +794,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::X; // in specific support of vcomisd/vucomisd @@ -807,7 +819,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -834,7 +846,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -871,7 +883,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; instruction.imm = read_imm_unsigned(bytes, 1, length)?; @@ -905,7 +917,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -932,7 +944,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -969,7 +981,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -998,7 +1010,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -1027,7 +1039,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -1053,7 +1065,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -1075,7 +1087,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; instruction.operand_count = 3; @@ -1102,7 +1114,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; instruction.operand_count = 3; @@ -1133,7 +1145,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; instruction.operand_count = 3; @@ -1169,7 +1181,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -1233,7 +1245,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -1252,7 +1264,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.imm = read_imm_unsigned(bytes, 1, length)?; @@ -1272,7 +1284,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.imm = read_imm_unsigned(bytes, 1, length)?; @@ -1298,7 +1310,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[1] = mem_oper; instruction.imm = read_imm_unsigned(bytes, 1, length)?; instruction.operands[2] = OperandSpec::ImmU8; @@ -1330,7 +1342,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -1359,7 +1371,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if instruction.prefixes.evex_unchecked().broadcast() { instruction.operands[0] = OperandSpec::RegRRR_maskmerge_sae_noround; } else { @@ -1392,7 +1404,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if instruction.prefixes.evex_unchecked().broadcast() { instruction.operands[0] = OperandSpec::RegRRR_maskmerge_sae; } else { @@ -1422,7 +1434,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if instruction.prefixes.evex_unchecked().broadcast() { if instruction.opcode == Opcode::VMINSS || instruction.opcode == Opcode::VMAXSS { instruction.operands[0] = OperandSpec::RegRRR_maskmerge_sae_noround; @@ -1453,7 +1465,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { if instruction.prefixes.evex_unchecked().broadcast() { // sae sets this to `vcvtps2ph ymm, zmm, imm8` @@ -1486,7 +1498,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { if instruction.prefixes.evex_unchecked().broadcast() { // sae sets this to `vcvtps2ph ymm, zmm, imm8` @@ -1520,7 +1532,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::Z; - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; if mem_oper == OperandSpec::RegMMM { if instruction.prefixes.evex_unchecked().broadcast() { instruction.operands[0] = OperandSpec::RegMMM_maskmerge_sae_noround; @@ -1553,7 +1565,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::Z; instruction.vex_reg.bank = RegisterBank::Z; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } else { @@ -1579,7 +1591,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::Y; instruction.vex_reg.bank = RegisterBank::Y; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } else { @@ -1607,7 +1619,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::Z; instruction.vex_reg.bank = RegisterBank::Z; - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.mem_size = 32; instruction.operands[0] = OperandSpec::RegRRR.masked(); instruction.operands[1] = OperandSpec::RegVex; @@ -1631,7 +1643,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::Z; - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.mem_size = 32; instruction.operands[0] = mem_oper.masked(); instruction.operands[1] = OperandSpec::RegRRR; @@ -1645,7 +1657,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Z; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -1662,7 +1674,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Y; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -1679,7 +1691,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::X; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -1696,7 +1708,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Z; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -1713,7 +1725,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Y; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -1730,7 +1742,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::X; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -1747,7 +1759,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.modrm_rrr.bank = RegisterBank::Z; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -1764,7 +1776,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.modrm_rrr.bank = RegisterBank::Z; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -1782,7 +1794,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Y; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -1799,7 +1811,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Y; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -1816,7 +1828,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::X; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -1833,7 +1845,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::X; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -1851,7 +1863,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.modrm_rrr.bank = RegisterBank::Z; instruction.mem_size = 32; instruction.operands[0] = mem_oper.masked(); @@ -1865,7 +1877,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Z; instruction.mem_size = 16; instruction.operands[0] = mem_oper.masked(); @@ -1879,7 +1891,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Y; instruction.mem_size = 16; instruction.operands[0] = mem_oper.masked(); @@ -1893,7 +1905,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Z; instruction.mem_size = 8; instruction.operands[0] = mem_oper.masked(); @@ -1907,7 +1919,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::X; instruction.mem_size = 8; instruction.operands[0] = mem_oper.masked(); @@ -1921,7 +1933,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Y; instruction.mem_size = 4; instruction.operands[0] = mem_oper.masked(); @@ -1935,7 +1947,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::X; instruction.mem_size = 4; instruction.operands[0] = mem_oper.masked(); @@ -1949,7 +1961,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::X; instruction.mem_size = 2; instruction.operands[0] = mem_oper.masked(); @@ -1963,7 +1975,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Y; instruction.mem_size = 8; instruction.operands[0] = mem_oper.masked(); @@ -1977,7 +1989,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::X; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -1995,7 +2007,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Y; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -2020,7 +2032,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Z; if mem_oper == OperandSpec::RegMMM { return Err(DecodeError::InvalidOperand); @@ -2045,7 +2057,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Z; if mem_oper == OperandSpec::RegMMM { return Err(DecodeError::InvalidOperand); @@ -2070,7 +2082,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Y; if mem_oper == OperandSpec::RegMMM { return Err(DecodeError::InvalidOperand); @@ -2091,7 +2103,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Z; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -2112,7 +2124,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Y; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -2130,7 +2142,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::Z; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -2162,7 +2174,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio } else { instruction.modrm_rrr.bank = RegisterBank::Y; } - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.mem_size = 16; instruction.operands[0] = mem_oper.masked(); instruction.operands[1] = OperandSpec::RegRRR; @@ -2182,7 +2194,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); set_reg_sizes_from_ll(instruction)?; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.mem_size = 16; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; @@ -2198,7 +2210,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); set_reg_sizes_from_ll(instruction)?; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.mem_size = 16; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; @@ -2212,7 +2224,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); set_reg_sizes_from_ll(instruction)?; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.mem_size = 16; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; @@ -2233,7 +2245,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); set_reg_sizes_from_ll(instruction)?; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.mem_size = 16; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; @@ -2247,7 +2259,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::D; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.modrm_mmm.bank = RegisterBank::X; @@ -2268,7 +2280,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.modrm_mmm.bank = RegisterBank::D; @@ -2291,7 +2303,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -2311,7 +2323,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; @@ -2331,7 +2343,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper != OperandSpec::RegMMM { instruction.mem_size = 8; @@ -2348,7 +2360,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if instruction.prefixes.evex_unchecked().vex().w() { instruction.opcode = Opcode::VMOVQ; @@ -2376,7 +2388,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if instruction.prefixes.evex_unchecked().vex().w() { instruction.opcode = Opcode::VMOVQ; @@ -2417,7 +2429,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -2443,7 +2455,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -2469,7 +2481,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -2511,7 +2523,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -2539,7 +2551,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -2570,7 +2582,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -2594,7 +2606,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -2618,7 +2630,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -2641,7 +2653,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -2661,7 +2673,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -2681,7 +2693,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -2697,7 +2709,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -2739,7 +2751,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { if instruction.prefixes.evex_unchecked().broadcast() { return Err(DecodeError::InvalidOpcode); @@ -2767,7 +2779,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { if instruction.prefixes.evex_unchecked().broadcast() { return Err(DecodeError::InvalidOpcode); @@ -2791,7 +2803,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { if instruction.prefixes.evex_unchecked().broadcast() { return Err(DecodeError::InvalidOpcode); @@ -2822,7 +2834,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -2850,7 +2862,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -2879,7 +2891,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -2903,7 +2915,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -2927,7 +2939,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -2951,7 +2963,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -2975,7 +2987,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -3003,7 +3015,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -3029,7 +3041,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio instruction.modrm_rrr.bank = RegisterBank::D; } - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR; if instruction.prefixes.evex_unchecked().broadcast() { @@ -3078,7 +3090,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -3135,7 +3147,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -3161,7 +3173,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -3184,7 +3196,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -3197,6 +3209,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio } generated::EVEXOperandCode::Gm_V_E_LL => { check_mask_reg(instruction)?; + deny_broadcast(instruction)?; let sz = regs_size(instruction); @@ -3216,7 +3229,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -3237,7 +3250,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -3270,7 +3283,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -3293,7 +3306,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } else { @@ -3327,7 +3340,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } else { @@ -3373,7 +3386,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -3406,7 +3419,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } else { @@ -3456,7 +3469,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -3495,7 +3508,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -3547,7 +3560,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { instruction.mem_size = 0; } @@ -3601,7 +3614,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio apply_broadcast(instruction, item_size, sz); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegVex_maskmerge; instruction.operands[1] = mem_oper; instruction.imm = read_imm_unsigned(bytes, 1, length)?; @@ -3636,7 +3649,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -3673,7 +3686,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -3697,7 +3710,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -3721,7 +3734,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -3738,7 +3751,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -3755,7 +3768,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -3775,7 +3788,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -3792,7 +3805,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_zmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Z)?; instruction.modrm_rrr.bank = RegisterBank::Y; instruction.operands[1] = mem_oper; if instruction.prefixes.evex_unchecked().broadcast() { @@ -3815,7 +3828,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_ymm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Y)?; instruction.modrm_rrr.bank = RegisterBank::X; instruction.operands[1] = mem_oper; if instruction.prefixes.evex_unchecked().broadcast() { @@ -3840,7 +3853,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.modrm_rrr.bank = RegisterBank::X; instruction.operands[1] = mem_oper; if instruction.prefixes.evex_unchecked().broadcast() { @@ -3876,7 +3889,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -3956,7 +3969,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -4016,7 +4029,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -4080,7 +4093,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -4151,7 +4164,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -4216,7 +4229,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_zmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Z)?; instruction.modrm_rrr.bank = RegisterBank::Y; if instruction.prefixes.evex_unchecked().broadcast() { instruction.operands[0] = OperandSpec::RegRRR_maskmerge_sae; @@ -4236,7 +4249,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; @@ -4272,7 +4285,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; instruction.operands[1] = OperandSpec::RegVex; @@ -4308,7 +4321,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_zmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::Z)?; instruction.operands[1] = mem_oper; instruction.operand_count = 2; @@ -4347,7 +4360,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if instruction.prefixes.evex_unchecked().broadcast() { instruction.operands[0] = OperandSpec::RegRRR_maskmerge_sae; } else { @@ -4365,7 +4378,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if instruction.prefixes.evex_unchecked().broadcast() { instruction.operands[0] = OperandSpec::RegRRR_maskmerge_sae; } else { @@ -4388,7 +4401,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = mem_oper; instruction.operands[1] = OperandSpec::RegRRR; instruction.imm = read_imm_unsigned(bytes, 1, length)?; @@ -4419,7 +4432,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; instruction.vex_reg.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -4457,7 +4470,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = mem_oper; instruction.operands[1] = OperandSpec::RegRRR; instruction.imm = read_imm_unsigned(bytes, 1, length)?; @@ -4477,7 +4490,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = mem_oper; instruction.operands[1] = OperandSpec::RegRRR; instruction.imm = read_imm_unsigned(bytes, 1, length)?; @@ -4497,7 +4510,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::X; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = mem_oper; instruction.operands[1] = OperandSpec::RegRRR; instruction.imm = read_imm_unsigned(bytes, 1, length)?; @@ -4515,7 +4528,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; let item_size = if instruction.prefixes.evex_unchecked().vex().w() { if instruction.opcode == Opcode::VRANGESS { @@ -4561,7 +4574,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio generated::EVEXOperandCode::Gm_V_E_xmm_imm8_sae => { let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if let OperandSpec::RegMMM = mem_oper { /* no mem size */ } else{ @@ -4587,7 +4600,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio set_rrr(instruction, modrm); instruction.modrm_rrr.bank = RegisterBank::Z; instruction.vex_reg.bank = RegisterBank::Z; - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if let OperandSpec::RegMMM = mem_oper { return Err(DecodeError::InvalidOperand); } else{ @@ -4605,7 +4618,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if mem_oper == OperandSpec::RegMMM { return Err(DecodeError::InvalidOperand); } @@ -4622,7 +4635,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; if mem_oper == OperandSpec::RegMMM { instruction.operands[1] = OperandSpec::RegVex; @@ -4644,7 +4657,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = mem_oper.masked(); if mem_oper == OperandSpec::RegMMM { instruction.operands[1] = OperandSpec::RegVex; @@ -4666,7 +4679,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR_maskmerge; if mem_oper == OperandSpec::RegMMM { instruction.operands[1] = OperandSpec::RegVex; @@ -4688,7 +4701,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = mem_oper.masked(); if mem_oper == OperandSpec::RegMMM { instruction.operands[1] = OperandSpec::RegVex; @@ -4710,7 +4723,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if instruction.prefixes.evex_unchecked().broadcast() && mem_oper == OperandSpec::RegMMM { if !instruction.prefixes.evex_unchecked().vex().w() && instruction.opcode == Opcode::VCVTSI2SD { instruction.operands[0] = OperandSpec::RegRRR; @@ -4747,7 +4760,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if instruction.prefixes.evex_unchecked().broadcast() { instruction.operands[0] = OperandSpec::RegRRR_maskmerge_sae_noround; } else { @@ -4774,7 +4787,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; if instruction.prefixes.evex_unchecked().broadcast() { instruction.operands[0] = OperandSpec::RegRRR_maskmerge_sae; } else { @@ -4802,7 +4815,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -4827,7 +4840,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = OperandSpec::RegRRR; instruction.operands[1] = OperandSpec::RegVex; instruction.operands[2] = mem_oper; @@ -4852,7 +4865,7 @@ pub(crate) fn read_evex_operands>(bytes: &mut T, instructio let modrm = read_modrm(bytes, length)?; set_rrr(instruction, modrm); - let mem_oper = read_E_xmm(bytes, instruction, modrm, length)?; + let mem_oper = read_E_vex(bytes, instruction, modrm, length, RegisterBank::X)?; instruction.operands[0] = mem_oper; instruction.operands[1] = OperandSpec::RegRRR; instruction.operand_count = 2; diff --git a/test/long_mode/mod.rs b/test/long_mode/mod.rs index a3ad3a3..289ab77 100644 --- a/test/long_mode/mod.rs +++ b/test/long_mode/mod.rs @@ -1402,9 +1402,9 @@ fn test_misc() { #[test] fn evex() { - test_display(&[0x62, 0xf2, 0x7d, 0x48, 0x2a, 0x44, 0x40, 0x01], "vmovntdqa zmm0, zmmword [rax + rax*2 + 0x40]"); - test_display(&[0x62, 0xf2, 0x7d, 0x08, 0x2a, 0x44, 0x40, 0x01], "vmovntdqa xmm0, xmmword [rax + rax*2 + 0x10]"); - test_display(&[0x62, 0xf2, 0x7d, 0x1d, 0x66, 0x50, 0x01, 0x11], "vfpclassps"); + test_display(&[0x62, 0xf2, 0x7d, 0x48, 0x2a, 0x44, 0x40, 0x01], "vmovntdqa zmm0, zmmword [rax + rax * 2 + 0x40]"); + test_display(&[0x62, 0xf2, 0x7d, 0x08, 0x2a, 0x44, 0x40, 0x01], "vmovntdqa xmm0, xmmword [rax + rax * 2 + 0x10]"); + test_invalid(&[0x62, 0xf2, 0x7d, 0x1d, 0x66, 0x50, 0x01, 0x11]); } #[test] -- cgit v1.1