use crate::*;
const ALIGNED_ADDR: u64 = 0x3000;
#[test]
fn test_pcmpistrm_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, 0x66, 0x0f, 0x3a, 0x62, 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, 0x62, 0x79, 0x63, 0x7a, 0x64, 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_pcmpistrm_equal_any_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, 0x62, 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_pcmpistrm_equal_any_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, 0x62, 0xc1, 0x00,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x61, 0x61, 0x00, 0, 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_pcmpistrm_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, 0x62, 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] = [0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12, 0x00, 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_pcmpistrm_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,
0x66, 0x0f, 0x3a, 0x62, 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] = [0x78, 0x62, 0x79, 0x63, 0x7a, 0x64, 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_pcmpistrm_equal_any_wordmask() {
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, 0x62, 0xc1, 0x41,
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] = [0xCD, 0xAB, 0x78, 0x56, 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_pcmpistrm_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,
0x66, 0x0f, 0x3a, 0x62, 0xc1, 0x04,
0xf4,
]);
emu.load_code_bytes(&full_code);
let data1: [u8; 16] = [0x61, 0x7a, 0x00, 0, 0, 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_pcmpistrm_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,
0x66, 0x0f, 0x3a, 0x62, 0xc1, 0x44,
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_pcmpistrm_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, 0x62, 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_pcmpistrm_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, 0x62, 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_pcmpistrm_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, 0x62, 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_pcmpistrm_equal_each_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,
0x66, 0x0f, 0x3a, 0x62, 0xc1, 0x48,
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_pcmpistrm_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, 0x62, 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_pcmpistrm_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,
0x66, 0x0f, 0x3a, 0x62, 0xc1, 0x4c,
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_pcmpistrm_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, 0x62, 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_pcmpistrm_negative_polarity_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,
0x66, 0x0f, 0x3a, 0x62, 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_pcmpistrm_negative_polarity_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,
0x66, 0x0f, 0x3a, 0x62, 0xc1, 0x50,
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, 0x61, 0x79, 0x63, 0x7a, 0x64, 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_pcmpistrm_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, 0x62, 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_pcmpistrm_msb_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,
0x66, 0x0f, 0x3a, 0x62, 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_pcmpistrm_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,
0x66, 0x0f, 0x3a, 0x62, 0xc1, 0x60,
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_pcmpistrm_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, 0x62, 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, 0x80, 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_pcmpistrm_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, 0x62, 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_pcmpistrm_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, 0x62, 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_pcmpistrm_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, 0x62, 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_pcmpistrm_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, 0x62, 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_pcmpistrm_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, 0x62, 0xe5, 0x44, 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_pcmpistrm_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, 0x62, 0xf7, 0x48, 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_pcmpistrm_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, 0x62, 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_pcmpistrm_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, 0x62, 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_pcmpistrm_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, 0x62, 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_pcmpistrm_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, 0x62, 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_pcmpistrm_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, 0x62, 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_pcmpistrm_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, 0x62, 0xc1, 0x00, 0x66, 0x0f, 0x3a, 0x62, 0xc1, 0x40, 0x66, 0x0f, 0x3a, 0x62, 0xc1, 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] = [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_pcmpistrm_combined_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, 0x62, 0xc1, 0x00, 0x66, 0x0f, 0x3a, 0x62, 0xc1, 0x04, 0x66, 0x0f, 0x3a, 0x62, 0xc1, 0x08, 0x66, 0x0f, 0x3a, 0x62, 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_pcmpistrm_boundary_values() {
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, 0x62, 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_pcmpistrm_alternating_patterns() {
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, 0x62, 0xc1, 0x40,
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, 0x78, 0x62, 0x79, 0x61, 0x7a, 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();
}