use crate::*;
const ALIGNED_ADDR: u64 = 0x3000;
#[test]
fn test_pcmpestrm_equal_any_bitmask() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00, 0x66, 0x0f, 0x6f, 0x48, 0x10, 0xb8, 0x03, 0x00, 0x00, 0x00, 0xba, 0x05, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x00, 0xf4, ]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0xFF, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x62, 0x79, 0x63, 0x7a, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_zero_length_first() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x00, 0x00, 0x00, 0x00, 0xba, 0x03, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x00,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x79, 0x7a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_zero_length_second() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x03, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x00,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x79, 0x7a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_equal_any_bytemask() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x03, 0x00, 0x00, 0x00, 0xba, 0x06, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x40,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x62, 0x79, 0x63, 0x7a, 0x64, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_uwords_bytemask() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x02, 0x00, 0x00, 0x00, 0xba, 0x03, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x41,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x34, 0x12, 0x78, 0x56, 0xFF, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12, 0xFF, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_ranges_bitmask() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x02, 0x00, 0x00, 0x00, 0xba, 0x08, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x04,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x7a, 0xFF, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x31, 0x32, 0x33, 0xFF, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_ranges_bytemask() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x02, 0x00, 0x00, 0x00, 0xba, 0x09, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x44,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x30, 0x39, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x63, 0x31, 0x32, 0x33, 0x78, 0x79, 0x7a, 0xFF, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_ranges_multiple() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x04, 0x00, 0x00, 0x00, 0xba, 0x0a, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x04,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x7a, 0x30, 0x39, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x54, 0x65, 0x73, 0x74, 0x31, 0x32, 0x33, 0x21, 0x40, 0x23, 0xFF, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_equal_each_match() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x04, 0x00, 0x00, 0x00, 0xba, 0x04, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x08,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_equal_each_mismatch() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x04, 0x00, 0x00, 0x00, 0xba, 0x04, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x48,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x58, 0x64, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_equal_each_different_lengths() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x05, 0x00, 0x00, 0x00, 0xba, 0x03, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x08,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0x65, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x63, 0xFF, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_equal_ordered_substring() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x02, 0x00, 0x00, 0x00, 0xba, 0x06, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x0c,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x63, 0x64, 0xFF, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_equal_ordered_bytemask() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x02, 0x00, 0x00, 0x00, 0xba, 0x07, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x4c,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x61, 0x62, 0x78, 0x61, 0x62, 0x78, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_negative_polarity() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x05, 0x00, 0x00, 0x00, 0xba, 0x05, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x10,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x65, 0x69, 0x6f, 0x75, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x62, 0x63, 0x64, 0x66, 0x67, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_negative_bytemask() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x03, 0x00, 0x00, 0x00, 0xba, 0x06, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x50,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x61, 0x79, 0x63, 0x7a, 0x64, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_negative_ranges() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x02, 0x00, 0x00, 0x00, 0xba, 0x06, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x14,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x30, 0x39, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x31, 0x32, 0x33, 0x61, 0x62, 0x63, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_msb() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x02, 0x00, 0x00, 0x00, 0xba, 0x07, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x20,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x61, 0x78, 0x62, 0x78, 0x61, 0x78, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_msb_bytemask() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x02, 0x00, 0x00, 0x00, 0xba, 0x07, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x60,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x61, 0x78, 0x62, 0x78, 0x61, 0x78, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_xmm8_xmm9() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x44, 0x0f, 0x6f, 0x00, 0x66, 0x44, 0x0f, 0x6f, 0x48, 0x10, 0xb8, 0x03, 0x00, 0x00, 0x00, 0xba, 0x03, 0x00, 0x00, 0x00, 0x66, 0x45, 0x0f, 0x3a, 0x60, 0xc1, 0x00, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x62, 0x79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_xmm10_xmm11() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x44, 0x0f, 0x6f, 0x10, 0x66, 0x44, 0x0f, 0x6f, 0x58, 0x10, 0xb8, 0x02, 0x00, 0x00, 0x00,
0xba, 0x04, 0x00, 0x00, 0x00,
0x66, 0x45, 0x0f, 0x3a, 0x60, 0xd3, 0x0c, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x61, 0x62, 0x79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_xmm12_xmm13() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x44, 0x0f, 0x6f, 0x20, 0x66, 0x44, 0x0f, 0x6f, 0x68, 0x10, 0xb8, 0x02, 0x00, 0x00, 0x00,
0xba, 0x03, 0x00, 0x00, 0x00,
0x66, 0x45, 0x0f, 0x3a, 0x60, 0xe5, 0x44, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x30, 0x39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x35, 0x62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_xmm14_xmm15() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x44, 0x0f, 0x6f, 0x30, 0x66, 0x44, 0x0f, 0x6f, 0x78, 0x10, 0xb8, 0x03, 0x00, 0x00, 0x00,
0xba, 0x03, 0x00, 0x00, 0x00,
0x66, 0x45, 0x0f, 0x3a, 0x60, 0xf7, 0x48, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_memory_operand() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x00,
0xba, 0x03, 0x00, 0x00, 0x00,
0x66, 0x0f, 0x3a, 0x60, 0x40, 0x10, 0x00, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x62, 0x79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_xmm2_xmm3() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x10, 0x66, 0x0f, 0x6f, 0x58, 0x10, 0xb8, 0x02, 0x00, 0x00, 0x00,
0xba, 0x02, 0x00, 0x00, 0x00,
0x66, 0x0f, 0x3a, 0x60, 0xd3, 0x00, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_xmm4_xmm5() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x20, 0x66, 0x0f, 0x6f, 0x68, 0x10, 0xb8, 0x03, 0x00, 0x00, 0x00,
0xba, 0x03, 0x00, 0x00, 0x00,
0x66, 0x0f, 0x3a, 0x60, 0xe5, 0x08, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_xmm6_xmm7() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x30, 0x66, 0x0f, 0x6f, 0x78, 0x10, 0xb8, 0x02, 0x00, 0x00, 0x00,
0xba, 0x04, 0x00, 0x00, 0x00,
0x66, 0x0f, 0x3a, 0x60, 0xf7, 0x0c, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x61, 0x62, 0x79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_full_16_bytes() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x10, 0x00, 0x00, 0x00, 0xba, 0x10, 0x00, 0x00, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x40,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61]; let data2: [u8; 16] = [0x62, 0x61, 0x62, 0x61, 0x62, 0x61, 0x62, 0x61,
0x62, 0x61, 0x62, 0x61, 0x62, 0x61, 0x62, 0x61];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_sequence() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x03, 0x00, 0x00, 0x00,
0xba, 0x03, 0x00, 0x00, 0x00,
0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x00, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x40, 0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x08, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x62, 0x79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpestrm_varying_lengths() {
let mut emu = emu64();
let code = [0x48, 0xb8];
let mut full_code = code.to_vec();
full_code.extend_from_slice(&ALIGNED_ADDR.to_le_bytes());
full_code.extend_from_slice(&[
0x66, 0x0f, 0x6f, 0x00,
0x66, 0x0f, 0x6f, 0x48, 0x10,
0xb8, 0x01, 0x00, 0x00, 0x00, 0xba, 0x01, 0x00, 0x00, 0x00,
0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x00,
0xb8, 0x05, 0x00, 0x00, 0x00, 0xba, 0x05, 0x00, 0x00, 0x00,
0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x00,
0xb8, 0x10, 0x00, 0x00, 0x00, 0xba, 0x10, 0x00, 0x00, 0x00,
0x66, 0x0f, 0x3a, 0x60, 0xc1, 0x00,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70];
let data2: [u8; 16] = [0x71, 0x62, 0x72, 0x63, 0x73, 0x74, 0x75, 0x76,
0x77, 0x78, 0x79, 0x7a, 0x61, 0x62, 0x63, 0x64];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}