aboutsummaryrefslogtreecommitdiff
path: root/test/protected_mode/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'test/protected_mode/mod.rs')
-rw-r--r--test/protected_mode/mod.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/protected_mode/mod.rs b/test/protected_mode/mod.rs
index c42ea73..4bd5fc5 100644
--- a/test/protected_mode/mod.rs
+++ b/test/protected_mode/mod.rs
@@ -1388,6 +1388,12 @@ fn test_vex() {
test_invalid_under(&InstDecoder::minimal(), bytes);
}
+ fn test_instr_vex_f16c(bytes: &[u8], text: &'static str) {
+ test_display_under(&InstDecoder::minimal().with_avx().with_f16c(), bytes, text);
+ test_display_under(&InstDecoder::default(), bytes, text);
+ test_invalid_under(&InstDecoder::minimal(), bytes);
+ }
+
#[allow(dead_code)]
fn test_instr_invalid(bytes: &[u8]) {
test_invalid_under(&InstDecoder::minimal().with_avx(), bytes);
@@ -1562,6 +1568,8 @@ fn test_vex() {
test_instr(&[0xc4, 0b110_00010, 0b0_1111_001, 0x0f, 0b11_001_010], "vtestpd xmm1, xmm2");
test_instr(&[0xc4, 0b110_00010, 0b0_1111_101, 0x0f, 0b11_001_010], "vtestpd ymm1, ymm2");
test_invalid(&[0xc4, 0b110_00010, 0b1_1111_101, 0x0f, 0b11_001_010]);
+ test_instr_vex_f16c(&[0xc4, 0b111_00010, 0b0_1111_001, 0x13, 0b11_001_010], "vcvtph2ps xmm1, xmm2");
+ test_invalid(&[0xc4, 0b111_00010, 0b1_1111_001, 0x13, 0b11_001_010]);
test_instr(&[0xc4, 0b110_00010, 0b0_1111_101, 0x16, 0b11_001_010], "vpermps ymm1, ymm0, ymm2");
@@ -1582,6 +1590,7 @@ fn test_vex() {
test_invalid(&[0xc4, 0b110_00010, 0b0_0111_101, 0x19, 0b00_001_010]);
test_invalid(&[0xc4, 0b110_00010, 0b1_0111_101, 0x19, 0b00_001_010]);
test_instr(&[0xc4, 0b110_00010, 0b0_1111_101, 0x1a, 0b00_001_010], "vbroadcastf128 ymm1, xmmword [edx]");
+ test_invalid(&[0xc4, 0b110_00010, 0b1_1111_101, 0x1a, 0b00_001_010]); // vex.w=1 is invalid
test_invalid(&[0xc4, 0b110_00010, 0b1_0111_101, 0x1a, 0b00_001_010]);
test_invalid(&[0xc4, 0b110_00010, 0b1_0111_001, 0x1a, 0b00_001_010]);
test_instr(&[0xc4, 0b110_00010, 0b0_1111_101, 0x5a, 0b00_001_010], "vbroadcasti128 ymm1, xmmword [edx]");
@@ -1593,6 +1602,7 @@ fn test_vex() {
test_instr(&[0xc4, 0b110_00010, 0b0_1111_101, 0x18, 0b00_001_010], "vbroadcastss ymm1, dword [edx]");
test_invalid(&[0xc4, 0b110_00010, 0b1_0111_001, 0x18, 0b11_001_010]);
test_invalid(&[0xc4, 0b110_00010, 0b1_0111_101, 0x18, 0b11_001_010]);
+ test_invalid(&[0xc4, 0b110_00010, 0b0_1111_001, 0x19, 0b11_001_010]); // "vbroadcastsd xmm, xmm" is not legal (L!=0)
test_avx2(&[0xc4, 0b110_00010, 0b0_1111_101, 0x19, 0b11_001_010], "vbroadcastsd ymm1, xmm2");
test_instr(&[0xc4, 0b110_00010, 0b0_1111_101, 0x19, 0b00_001_010], "vbroadcastsd ymm1, qword [edx]");
test_invalid(&[0xc4, 0b110_00010, 0b1_1111_101, 0x19, 0b11_001_010]);
@@ -1644,6 +1654,19 @@ fn test_vex() {
test_avx2(&[0xc4, 0b110_00010, 0b0_0111_101, 0x2b, 0b11_001_010], "vpackusdw ymm1, ymm0, ymm2");
test_avx2(&[0xc4, 0b110_00010, 0b0_0111_101, 0x2b, 0b00_001_010], "vpackusdw ymm1, ymm0, ymmword [edx]");
+ test_instr(&[0xc4, 0b110_00010, 0b0_0111_001, 0x2c, 0b00_001_010], "vmaskmovps xmm1, xmm0, xmmword [edx]");
+ test_invalid(&[0xc4, 0b110_00010, 0b0_0111_101, 0x2c, 0b11_001_010]);
+ test_avx2(&[0xc4, 0b110_00010, 0b0_0111_101, 0x2c, 0b00_001_010], "vmaskmovps ymm1, ymm0, ymmword [edx]");
+ test_instr(&[0xc4, 0b110_00010, 0b0_0111_001, 0x2d, 0b00_001_010], "vmaskmovpd xmm1, xmm0, xmmword [edx]");
+ test_invalid(&[0xc4, 0b110_00010, 0b0_0111_101, 0x2d, 0b11_001_010]);
+ test_avx2(&[0xc4, 0b110_00010, 0b0_0111_101, 0x2d, 0b00_001_010], "vmaskmovpd ymm1, ymm0, ymmword [edx]");
+ test_instr(&[0xc4, 0b110_00010, 0b0_0111_001, 0x2e, 0b00_001_010], "vmaskmovps xmmword [edx], xmm0, xmm1");
+ test_invalid(&[0xc4, 0b110_00010, 0b0_0111_101, 0x2e, 0b11_001_010]);
+ test_avx2(&[0xc4, 0b110_00010, 0b0_0111_101, 0x2e, 0b00_001_010], "vmaskmovps ymmword [edx], ymm0, ymm1");
+ test_instr(&[0xc4, 0b110_00010, 0b0_0111_001, 0x2f, 0b00_001_010], "vmaskmovpd xmmword [edx], xmm0, xmm1");
+ test_invalid(&[0xc4, 0b110_00010, 0b0_0111_101, 0x2f, 0b11_001_010]);
+ test_avx2(&[0xc4, 0b110_00010, 0b0_0111_101, 0x2f, 0b00_001_010], "vmaskmovpd ymmword [edx], ymm0, ymm1");
+
test_instr(&[0xc4, 0b110_00010, 0b0_1111_001, 0x30, 0b11_001_010], "vpmovzxbw xmm1, xmm2");
test_instr(&[0xc4, 0b110_00010, 0b0_1111_101, 0x30, 0b11_001_010], "vpmovzxbw ymm1, xmm2");
test_instr(&[0xc4, 0b110_00010, 0b0_1111_001, 0x31, 0b11_001_010], "vpmovzxbd xmm1, xmm2");
@@ -1672,6 +1695,7 @@ fn test_vex() {
test_invalid(&[0xc4, 0b110_00010, 0b0_0111_001, 0x36, 0b11_001_010]);
test_avx2(&[0xc4, 0b110_00010, 0b0_0111_101, 0x36, 0b11_001_010], "vpermd ymm1, ymm0, ymm2");
+ test_invalid(&[0xc4, 0b110_00010, 0b1_1111_101, 0x36, 0b11_001_010]);
test_instr(&[0xc4, 0b110_00010, 0b0_0111_001, 0x37, 0b11_001_010], "vpcmpgtq xmm1, xmm0, xmm2");
test_avx2(&[0xc4, 0b110_00010, 0b0_0111_101, 0x37, 0b11_001_010], "vpcmpgtq ymm1, ymm0, ymm2");
test_instr(&[0xc4, 0b110_00010, 0b0_0111_001, 0x38, 0b11_001_010], "vpminsb xmm1, xmm0, xmm2");
@@ -1723,6 +1747,20 @@ fn test_vex() {
test_avx2(&[0xc4, 0b110_00010, 0b1_1111_001, 0x47, 0b11_001_010], "vpsllvq xmm1, xmm0, xmm2");
test_avx2(&[0xc4, 0b110_00010, 0b1_1111_101, 0x47, 0b11_001_010], "vpsllvq ymm1, ymm0, ymm2");
+ test_avx2(&[0xc4, 0b111_00010, 0b0_1111_001, 0x58, 0b11_000_001], "vpbroadcastd xmm0, xmm1");
+ test_avx2(&[0xc4, 0b111_00010, 0b0_1111_101, 0x58, 0b11_000_001], "vpbroadcastd ymm0, ymm1");
+ test_invalid(&[0xc4, 0b111_00010, 0b1_1111_001, 0x58, 0b11_000_001]);
+ test_avx2(&[0xc4, 0b111_00010, 0b0_1111_001, 0x59, 0b11_000_001], "vpbroadcastq xmm0, xmm1");
+ test_avx2(&[0xc4, 0b111_00010, 0b0_1111_101, 0x59, 0b11_000_001], "vpbroadcastq ymm0, ymm1");
+ test_invalid(&[0xc4, 0b111_00010, 0b1_1111_001, 0x59, 0b11_000_001]);
+
+ test_avx2(&[0xc4, 0b111_00010, 0b0_1111_001, 0x78, 0b11_000_001], "vpbroadcastb xmm0, xmm1");
+ test_avx2(&[0xc4, 0b111_00010, 0b0_1111_101, 0x78, 0b11_000_001], "vpbroadcastb ymm0, ymm1");
+ test_invalid(&[0xc4, 0b111_00010, 0b1_1111_001, 0x78, 0b11_000_001]);
+ test_avx2(&[0xc4, 0b111_00010, 0b0_1111_001, 0x79, 0b11_000_001], "vpbroadcastw xmm0, xmm1");
+ test_avx2(&[0xc4, 0b111_00010, 0b0_1111_101, 0x79, 0b11_000_001], "vpbroadcastw ymm0, ymm1");
+ test_invalid(&[0xc4, 0b111_00010, 0b1_1111_001, 0x79, 0b11_000_001]);
+
test_avx2(&[0xc4, 0b110_00010, 0b0_1111_001, 0x8c, 0b00_001_010], "vpmaskmovd xmm1, xmm0, xmmword [edx]");
test_avx2(&[0xc4, 0b110_00010, 0b0_1111_101, 0x8c, 0b00_001_010], "vpmaskmovd ymm1, ymm0, ymmword [edx]");
test_invalid(&[0xc4, 0b110_00010, 0b0_1111_001, 0x8c, 0b11_001_010]);