use crate::*;
const ALIGNED_ADDR: u64 = 0x3000;
#[test]
fn test_pcmpistri_equal_any_ubytes_match_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, 0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x00, 0xf4, ]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x63, 0x61, 0x62, 0x63, 0x00, 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_pcmpistri_equal_any_ubytes_no_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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x00,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x79, 0x7a, 0x00, 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_pcmpistri_equal_any_ubytes_all_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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x00,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x61, 0x61, 0x61, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x61, 0x61, 0x61, 0x00, 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_pcmpistri_equal_any_uwords() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x01,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x34, 0x12, 0x78, 0x56, 0x00, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 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_pcmpistri_ranges_ubytes() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x04,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x7a, 0x41, 0x5a, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x31, 0x32, 0x33, 0x00, 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_pcmpistri_ranges_digits() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x04,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x30, 0x39, 0x00, 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, 0x00, 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_pcmpistri_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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x08,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0x00, 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_pcmpistri_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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x08,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x58, 0x64, 0x00, 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_pcmpistri_equal_each_partial() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x08,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x00, 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_pcmpistri_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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x0c,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x63, 0x64, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x00, 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_pcmpistri_equal_ordered_no_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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x0c,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x78, 0x79, 0x7a, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x00, 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_pcmpistri_equal_ordered_at_start() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x0c,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x00, 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_pcmpistri_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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x10,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x65, 0x69, 0x6f, 0x75, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x62, 0x63, 0x64, 0x66, 0x67, 0x00, 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_pcmpistri_negative_polarity_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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x14,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x30, 0x39, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x31, 0x32, 0x33, 0x61, 0x62, 0x63, 0x00, 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_pcmpistri_most_significant_index() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x20,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x61, 0x78, 0x62, 0x78, 0x61, 0x78, 0x00, 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_pcmpistri_msb_equal_ordered() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x2c,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x61, 0x62, 0x78, 0x61, 0x62, 0x78, 0x00, 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_pcmpistri_signed_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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x02,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x01, 0xFF, 0x7F, 0x80, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x05, 0xFF, 0x03, 0x00, 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_pcmpistri_signed_words() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x03,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x34, 0x12, 0x00, 0x80, 0x00, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x56, 0x78, 0x00, 0x80, 0x00, 0x00, 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_pcmpistri_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, 0x66, 0x0f, 0x3a, 0x63, 0x40, 0x10, 0x00, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x62, 0x79, 0x00, 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_pcmpistri_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, 0x66, 0x45, 0x0f, 0x3a, 0x63, 0xc1, 0x00, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x62, 0x63, 0x00, 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_pcmpistri_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, 0x66, 0x45, 0x0f, 0x3a, 0x63, 0xd3, 0x0c, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x61, 0x62, 0x79, 0x00, 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_pcmpistri_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, 0x66, 0x45, 0x0f, 0x3a, 0x63, 0xe5, 0x04, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x30, 0x39, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x35, 0x62, 0x00, 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_pcmpistri_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, 0x66, 0x45, 0x0f, 0x3a, 0x63, 0xf7, 0x08, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x63, 0x00, 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_pcmpistri_empty_strings() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x00,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
let data2: [u8; 16] = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
emu.maps.write_bytes_slice(ALIGNED_ADDR, &data1);
emu.maps.write_bytes_slice(ALIGNED_ADDR + 0x10, &data2);
emu.run(None).unwrap();
}
#[test]
fn test_pcmpistri_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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x00,
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_pcmpistri_override_bit() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x40,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x62, 0x63, 0x64, 0x00, 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_pcmpistri_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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x00, 0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x08, 0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x0c, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x62, 0x79, 0x00, 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_pcmpistri_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, 0x66, 0x0f, 0x3a, 0x63, 0xd3, 0x00, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x61, 0x00, 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_pcmpistri_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, 0x66, 0x0f, 0x3a, 0x63, 0xe5, 0x08, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x63, 0x00, 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_pcmpistri_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, 0x66, 0x0f, 0x3a, 0x63, 0xf7, 0x0c, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x61, 0x62, 0x79, 0x00, 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_pcmpistri_control_0x18() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x18,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x61, 0x62, 0x58, 0x00, 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_pcmpistri_control_0x1c() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x1c,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x79, 0x7a, 0x61, 0x62, 0x00, 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_pcmpistri_control_0x30() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x30,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x62, 0x78, 0x79, 0x7a, 0x00, 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_pcmpistri_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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x04,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x7a, 0x30, 0x39, 0x00, 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, 0x00, 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_pcmpistri_case_insensitive_pattern() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x04,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x41, 0x5a, 0x61, 0x7a, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x31, 0x32, 0x33, 0x21, 0x40, 0x23, 0x00, 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_pcmpistri_boundary_characters() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x00,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x00, 0xFF, 0x7F, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x01, 0x80, 0x02, 0x00, 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_pcmpistri_xmm0_xmm1_various_modes() {
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,
0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x00, 0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x04, 0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x08, 0x66, 0x0f, 0x3a, 0x63, 0xc1, 0x0c, 0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x62, 0x63, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let data2: [u8; 16] = [0x78, 0x62, 0x79, 0x00, 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();
}