From e095342c536ce282a80b010ddedcd43900b85f7b Mon Sep 17 00:00:00 2001
From: iximeow <me@iximeow.net>
Date: Sat, 3 Jul 2021 09:55:11 -0700
Subject: vbroadcastsd requires W

---
 src/shared/evex.in           | 9 +++------
 src/shared/generated_evex.in | 4 ++--
 2 files changed, 5 insertions(+), 8 deletions(-)

(limited to 'src')

diff --git a/src/shared/evex.in b/src/shared/evex.in
index f9574db..b9a77e8 100644
--- a/src/shared/evex.in
+++ b/src/shared/evex.in
@@ -4616,12 +4616,9 @@ pub(crate) fn read_evex_operands<T: Reader<<Arch as yaxpeax_arch::Arch>::Address
 
       set_reg_sizes(instruction, RegisterBank::X);
     }
-    generated::EVEXOperandCode::Gm_V_E_xmm_imm8_sae => {
-      if instruction.opcode == Opcode::VRNDSCALESD {
-        if instruction.prefixes.evex_unchecked().vex().w() {
-          return Err(DecodeError::InvalidOpcode);
-        }
-      }
+    generated::EVEXOperandCode::Gm_V_E_xmm_imm8_sae_W1 => {
+      ensure_W(instruction, 1)?;
+
       let modrm = read_modrm(words)?;
       set_rrr(instruction, modrm);
       let mem_oper = read_E_vex(words, instruction, modrm, RegisterBank::X)?;
diff --git a/src/shared/generated_evex.in b/src/shared/generated_evex.in
index 4f4c518..7f2d192 100644
--- a/src/shared/generated_evex.in
+++ b/src/shared/generated_evex.in
@@ -580,7 +580,7 @@ pub(crate) enum EVEXOperandCode {
   Gm_V_E_LL_sae_bcast,
   Gm_V_E_LL_sae_bcast_W0,
   Gm_V_E_LL_sae_bcast_W1,
-  Gm_V_E_xmm_imm8_sae,
+  Gm_V_E_xmm_imm8_sae_W1,
   Gm_V_E_xmm_sae,
   Gm_V_E_xmm_sae_W1,
   Gm_V_Ed_LL_bcast,
@@ -992,7 +992,7 @@ const EVEX_66_0f3a: [(u8, [(super::Opcode, EVEXOperandCode); 4]); 51] = [
   (0x08, [(super::Opcode::VRNDSCALEPS, EVEXOperandCode::Gm_E_LL_imm8_sae_W0), (super::Opcode::VRNDSCALEPS, EVEXOperandCode::Gm_E_LL_imm8_sae_W0), (super::Opcode::VRNDSCALEPS, EVEXOperandCode::Gm_E_LL_imm8_sae_W0), (super::Opcode::VRNDSCALEPS, EVEXOperandCode::Gm_E_LL_imm8_sae_W0)]),
   (0x09, [(super::Opcode::VRNDSCALEPD, EVEXOperandCode::Gm_E_LL_imm8_sae_W1), (super::Opcode::VRNDSCALEPD, EVEXOperandCode::Gm_E_LL_imm8_sae_W1), (super::Opcode::VRNDSCALEPD, EVEXOperandCode::Gm_E_LL_imm8_sae_W1), (super::Opcode::VRNDSCALEPD, EVEXOperandCode::Gm_E_LL_imm8_sae_W1)]),
   (0x0a, [(super::Opcode::VRNDSCALESS, EVEXOperandCode::Gm_V_Ed_xmm_imm8_sae), (super::Opcode::VRNDSCALESS, EVEXOperandCode::Gm_V_Ed_xmm_imm8_sae), (super::Opcode::VRNDSCALESS, EVEXOperandCode::Gm_V_Ed_xmm_imm8_sae), (super::Opcode::VRNDSCALESS, EVEXOperandCode::Gm_V_Ed_xmm_imm8_sae)]),// W0
-  (0x0b, [(super::Opcode::VRNDSCALESD, EVEXOperandCode::Gm_V_E_xmm_imm8_sae), (super::Opcode::VRNDSCALESD, EVEXOperandCode::Gm_V_E_xmm_imm8_sae), (super::Opcode::VRNDSCALESD, EVEXOperandCode::Gm_V_E_xmm_imm8_sae), (super::Opcode::VRNDSCALESD, EVEXOperandCode::Gm_V_E_xmm_imm8_sae)]),// W1
+  (0x0b, [(super::Opcode::VRNDSCALESD, EVEXOperandCode::Gm_V_E_xmm_imm8_sae_W1), (super::Opcode::VRNDSCALESD, EVEXOperandCode::Gm_V_E_xmm_imm8_sae_W1), (super::Opcode::VRNDSCALESD, EVEXOperandCode::Gm_V_E_xmm_imm8_sae_W1), (super::Opcode::VRNDSCALESD, EVEXOperandCode::Gm_V_E_xmm_imm8_sae_W1)]),// W1
   (0x0f, [(super::Opcode::VPALIGNR, EVEXOperandCode::Gm_V_E_LL_imm8), (super::Opcode::VPALIGNR, EVEXOperandCode::Gm_V_E_LL_imm8), (super::Opcode::VPALIGNR, EVEXOperandCode::Gm_V_E_LL_imm8), (super::Opcode::Invalid, EVEXOperandCode::Nothing)]),
   (0x14, [(super::Opcode::VPEXTRB, EVEXOperandCode::Ebd_G_xmm_imm8), (super::Opcode::Invalid, EVEXOperandCode::Nothing), (super::Opcode::Invalid, EVEXOperandCode::Nothing), (super::Opcode::Invalid, EVEXOperandCode::Nothing)]),
   (0x15, [(super::Opcode::VPEXTRW, EVEXOperandCode::Ewd_G_xmm_imm8), (super::Opcode::Invalid, EVEXOperandCode::Nothing), (super::Opcode::Invalid, EVEXOperandCode::Nothing), (super::Opcode::Invalid, EVEXOperandCode::Nothing)]),
-- 
cgit v1.1