aboutsummaryrefslogtreecommitdiff
path: root/src/protected_mode/vex.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2026-04-30 15:47:43 +0000
committeriximeow <me@iximeow.net>2026-05-25 00:59:27 +0000
commit1652c236ee3441c89f294fda93faefadb10874e7 (patch)
treec848f28659d99981e9a2b56afaaa95cee7b204b9 /src/protected_mode/vex.rs
parentabc0978c7d4d331fe047fdcf1acf221754327fd2 (diff)
more general avx improvements
Diffstat (limited to 'src/protected_mode/vex.rs')
-rw-r--r--src/protected_mode/vex.rs108
1 files changed, 72 insertions, 36 deletions
diff --git a/src/protected_mode/vex.rs b/src/protected_mode/vex.rs
index 9144fef..1ba9c66 100644
--- a/src/protected_mode/vex.rs
+++ b/src/protected_mode/vex.rs
@@ -1964,7 +1964,11 @@ fn read_vex_instruction<
} else {
VEXOperandCode::G_E_xyLmm
}),
- 0x13 => (Opcode::VCVTPH2PS, VEXOperandCode::G_E_xyLmm),
+ 0x13 => (Opcode::VCVTPH2PS, if instruction.prefixes.vex_unchecked().w() {
+ return Err(DecodeError::InvalidOpcode);
+ } else {
+ VEXOperandCode::G_E_xyLmm
+ }),
0x16 => (Opcode::VPERMPS, if L {
if instruction.prefixes.vex_unchecked().w() {
return Err(DecodeError::InvalidOpcode);
@@ -1989,14 +1993,18 @@ fn read_vex_instruction<
(Opcode::VBROADCASTSD, if L {
VEXOperandCode::G_ymm_E_xmm
} else {
- VEXOperandCode::G_E_xmm
+ return Err(DecodeError::InvalidOpcode);
})
}
- 0x1A => (Opcode::VBROADCASTF128, if L {
- VEXOperandCode::G_ymm_M_xmm
- } else {
+ 0x1A => if instruction.prefixes.vex_unchecked().w() {
return Err(DecodeError::InvalidOpcode);
- }),
+ } else {
+ (Opcode::VBROADCASTF128, if L {
+ VEXOperandCode::G_ymm_M_xmm
+ } else {
+ return Err(DecodeError::InvalidOpcode);
+ })
+ },
0x1C => (Opcode::VPABSB, VEXOperandCode::G_E_xyLmm),
0x1D => (Opcode::VPABSW, VEXOperandCode::G_E_xyLmm),
0x1E => (Opcode::VPABSD, VEXOperandCode::G_E_xyLmm),
@@ -2038,26 +2046,42 @@ fn read_vex_instruction<
VEXOperandCode::G_M_xmm
}),
0x2B => (Opcode::VPACKUSDW, VEXOperandCode::G_V_E_xyLmm),
- 0x2C => (Opcode::VMASKMOVPS, if L {
- VEXOperandCode::G_V_M_ymm
+ 0x2C => if instruction.prefixes.vex_unchecked().w() {
+ return Err(DecodeError::InvalidOpcode);
} else {
- VEXOperandCode::G_V_M_xmm
- }),
- 0x2D => (Opcode::VMASKMOVPD, if L {
- VEXOperandCode::G_V_M_ymm
+ (Opcode::VMASKMOVPS, if L {
+ VEXOperandCode::G_V_M_ymm
+ } else {
+ VEXOperandCode::G_V_M_xmm
+ })
+ },
+ 0x2D => if instruction.prefixes.vex_unchecked().w() {
+ return Err(DecodeError::InvalidOpcode);
} else {
- VEXOperandCode::G_V_M_xmm
- }),
- 0x2E => (Opcode::VMASKMOVPS, if L {
- VEXOperandCode::M_V_G_ymm
+ (Opcode::VMASKMOVPD, if L {
+ VEXOperandCode::G_V_M_ymm
+ } else {
+ VEXOperandCode::G_V_M_xmm
+ })
+ },
+ 0x2E => if instruction.prefixes.vex_unchecked().w() {
+ return Err(DecodeError::InvalidOpcode);
} else {
- VEXOperandCode::M_V_G_xmm
- }),
- 0x2F => (Opcode::VMASKMOVPD, if L {
- VEXOperandCode::M_V_G_ymm
+ (Opcode::VMASKMOVPS, if L {
+ VEXOperandCode::M_V_G_ymm
+ } else {
+ VEXOperandCode::M_V_G_xmm
+ })
+ },
+ 0x2F => if instruction.prefixes.vex_unchecked().w() {
+ return Err(DecodeError::InvalidOpcode);
} else {
- VEXOperandCode::M_V_G_xmm
- }),
+ (Opcode::VMASKMOVPD, if L {
+ VEXOperandCode::M_V_G_ymm
+ } else {
+ VEXOperandCode::M_V_G_xmm
+ })
+ },
0x30 => (Opcode::VPMOVZXBW, if L {
VEXOperandCode::G_ymm_E_xmm
} else {
@@ -2088,11 +2112,15 @@ fn read_vex_instruction<
} else {
VEXOperandCode::G_E_xmm
}),
- 0x36 => (Opcode::VPERMD, if L {
- VEXOperandCode::G_V_E_ymm
- } else {
+ 0x36 => if instruction.prefixes.vex_unchecked().w() {
return Err(DecodeError::InvalidOpcode);
- }),
+ } else {
+ (Opcode::VPERMD, if L {
+ VEXOperandCode::G_V_E_ymm
+ } else {
+ return Err(DecodeError::InvalidOpcode);
+ })
+ },
0x37 => (Opcode::VPCMPGTQ, VEXOperandCode::G_V_E_xyLmm),
0x38 => (Opcode::VPMINSB, VEXOperandCode::G_V_E_xyLmm),
0x39 => (Opcode::VPMINSD, VEXOperandCode::G_V_E_xyLmm),
@@ -2129,8 +2157,16 @@ fn read_vex_instruction<
} else {
(Opcode::VPSLLVD, VEXOperandCode::G_V_E_xyLmm)
},
- 0x58 => (Opcode::VPBROADCASTD, VEXOperandCode::G_E_xyLmm),
- 0x59 => (Opcode::VPBROADCASTQ, VEXOperandCode::G_E_xyLmm),
+ 0x58 => if instruction.prefixes.vex_unchecked().w() {
+ return Err(DecodeError::InvalidOpcode);
+ } else {
+ (Opcode::VPBROADCASTD, VEXOperandCode::G_E_xyLmm)
+ },
+ 0x59 => if instruction.prefixes.vex_unchecked().w() {
+ return Err(DecodeError::InvalidOpcode);
+ } else {
+ (Opcode::VPBROADCASTQ, VEXOperandCode::G_E_xyLmm)
+ },
0x5A => (Opcode::VBROADCASTI128, if L {
if instruction.prefixes.vex_unchecked().w() {
return Err(DecodeError::InvalidOpcode);
@@ -2139,16 +2175,16 @@ fn read_vex_instruction<
} else {
return Err(DecodeError::InvalidOpcode);
}),
- 0x78 => (Opcode::VPBROADCASTB, if L {
- VEXOperandCode::G_E_ymm
+ 0x78 => if instruction.prefixes.vex_unchecked().w() {
+ return Err(DecodeError::InvalidOpcode);
} else {
- VEXOperandCode::G_E_ymm
- }),
- 0x79 => (Opcode::VPBROADCASTW, if L {
- VEXOperandCode::G_E_ymm
+ (Opcode::VPBROADCASTB, VEXOperandCode::G_E_xyLmm)
+ },
+ 0x79 => if instruction.prefixes.vex_unchecked().w() {
+ return Err(DecodeError::InvalidOpcode);
} else {
- VEXOperandCode::G_E_ymm
- }),
+ (Opcode::VPBROADCASTW, VEXOperandCode::G_E_xyLmm)
+ },
0x8C => {
if instruction.prefixes.vex_unchecked().w() {
(Opcode::VPMASKMOVQ, if L {