use ::*;
use ::test::*;
#[test]
fn extended_regs() {
decode_helper(&vec![0x4C, 0x01, 0xC0], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Direct(Reg::R8)));
decode_helper(&vec![0x40, 0x00, 0xE0], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AL), Operand::Direct(Reg::SPL)));
decode_helper(&vec![0x40, 0x00, 0xE8], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AL), Operand::Direct(Reg::BPL)));
decode_helper(&vec![0x40, 0x00, 0xF0], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AL), Operand::Direct(Reg::SIL)));
decode_helper(&vec![0x40, 0x00, 0xF8], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AL), Operand::Direct(Reg::DIL)));
}
#[test]
fn operand_size_prefix() {
decode_helper(&vec![0xC5, 0xE9, 0x58, 0x08], Mode::Protected, &Instruction::new3(Mnemonic::VADDPD, Operand::Direct(Reg::XMM1),
Operand::Direct(Reg::XMM2), Operand::Indirect(Reg::EAX, Some(OperandSize::Xmmword), None))); }
#[test]
fn address_size_prefix() {
decode_helper(&vec![0x8B, 0x0F], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::CX), Operand::Indirect(Reg::BX, Some(OperandSize::Word), None)));
decode_helper(&vec![0x67, 0x8B, 0x0B], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::CX), Operand::Indirect(Reg::EBX, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8B, 0x0B], Mode::Protected, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::ECX), Operand::Indirect(Reg::EBX, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x67, 0x8B, 0x0F], Mode::Protected, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::ECX), Operand::Indirect(Reg::BX, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x48, 0x8B, 0x0B], Mode::Long, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::RCX), Operand::Indirect(Reg::RBX, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x67, 0x48, 0x8B, 0x0B], Mode::Long, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::RCX), Operand::Indirect(Reg::EBX, Some(OperandSize::Qword), None)));
}
#[test]
fn mod_rm_real_mod_0() {
decode_helper(&vec![0x8b, 0x00], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectScaledIndexed(Reg::BX, Reg::SI, RegScale::One, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x01], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectScaledIndexed(Reg::BX, Reg::DI, RegScale::One, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x02], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectScaledIndexed(Reg::BP, Reg::SI, RegScale::One, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x03], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectScaledIndexed(Reg::BP, Reg::DI, RegScale::One, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x04], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::Indirect(Reg::SI, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x05], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::Indirect(Reg::DI, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x06, 0x34, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::Memory(0x1234, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x07], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::Indirect(Reg::BX, Some(OperandSize::Word), None)));
}
#[test]
fn mod_rm_real_mod_1() {
decode_helper(&vec![0x8b, 0x40, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectScaledIndexedDisplaced(Reg::BX, Reg::SI, RegScale::One, 0x12, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x41, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectScaledIndexedDisplaced(Reg::BX, Reg::DI, RegScale::One, 0x12, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x42, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectScaledIndexedDisplaced(Reg::BP, Reg::SI, RegScale::One, 0x12, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x43, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectScaledIndexedDisplaced(Reg::BP, Reg::DI, RegScale::One, 0x12, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x44, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectDisplaced(Reg::SI, 0x12, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x45, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectDisplaced(Reg::DI, 0x12, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x46, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectDisplaced(Reg::BP, 0x12, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x47, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectDisplaced(Reg::BX, 0x12, Some(OperandSize::Word), None)));
}
#[test]
fn mod_rm_real_mod_2() {
decode_helper(&vec![0x8b, 0x80, 0x34, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectScaledIndexedDisplaced(Reg::BX, Reg::SI, RegScale::One, 0x1234, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x81, 0x34, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectScaledIndexedDisplaced(Reg::BX, Reg::DI, RegScale::One, 0x1234, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x82, 0x34, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectScaledIndexedDisplaced(Reg::BP, Reg::SI, RegScale::One, 0x1234, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x83, 0x34, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectScaledIndexedDisplaced(Reg::BP, Reg::DI, RegScale::One, 0x1234, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x84, 0x34, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectDisplaced(Reg::SI, 0x1234, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x85, 0x34, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectDisplaced(Reg::DI, 0x1234, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x86, 0x34, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectDisplaced(Reg::BP, 0x1234, Some(OperandSize::Word), None)));
decode_helper(&vec![0x8b, 0x87, 0x34, 0x12], Mode::Real, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AX), Operand::IndirectDisplaced(Reg::BX, 0x1234, Some(OperandSize::Word), None)));
}
#[test]
fn mod_rm_real_mod_3() {
decode_helper(&vec![0x01, 0xC0], Mode::Real, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AX), Operand::Direct(Reg::AX))); decode_helper(&vec![0x01, 0xD8], Mode::Real, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AX), Operand::Direct(Reg::BX))); decode_helper(&vec![0x01, 0xC8], Mode::Real, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AX), Operand::Direct(Reg::CX))); decode_helper(&vec![0x01, 0xD0], Mode::Real, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AX), Operand::Direct(Reg::DX))); decode_helper(&vec![0x01, 0xE0], Mode::Real, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AX), Operand::Direct(Reg::SP))); decode_helper(&vec![0x01, 0xE8], Mode::Real, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AX), Operand::Direct(Reg::BP))); decode_helper(&vec![0x01, 0xF0], Mode::Real, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AX), Operand::Direct(Reg::SI))); decode_helper(&vec![0x01, 0xF8], Mode::Real, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AX), Operand::Direct(Reg::DI))); }
#[test]
fn mod_rm_protected_mod_0() {
decode_helper(&vec![0x03, 0x00], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Indirect(Reg::EAX, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x01], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Indirect(Reg::ECX, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x02], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Indirect(Reg::EDX, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x03], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Indirect(Reg::EBX, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x04, 0x24], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Indirect(Reg::ESP, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x05, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Memory(0x12345678, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x06], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Indirect(Reg::ESI, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x07], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Indirect(Reg::EDI, Some(OperandSize::Dword), None)));
}
#[test]
fn mod_rm_protected_mod_1() {
decode_helper(&vec![0x03, 0x40, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::EAX, 0x12, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x41, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::ECX, 0x12, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x42, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::EDX, 0x12, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x43, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::EBX, 0x12, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x44, 0x24, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::ESP, 0x12, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x45, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::EBP, 0x12, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x46, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::ESI, 0x12, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x47, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::EDI, 0x12, Some(OperandSize::Dword), None)));
}
#[test]
fn mod_rm_protected_mod_2() {
decode_helper(&vec![0x03, 0x80, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::EAX, 0x12345678, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x81, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::ECX, 0x12345678, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x82, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::EDX, 0x12345678, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x83, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::EBX, 0x12345678, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x84, 0x24, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::ESP, 0x12345678, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x85, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::EBP, 0x12345678, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x86, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::ESI, 0x12345678, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x87, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::EDI, 0x12345678, Some(OperandSize::Dword), None)));
}
#[test]
fn mod_rm_protected_mod_3() {
decode_helper(&vec![0x01, 0xC0], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Direct(Reg::EAX))); decode_helper(&vec![0x01, 0xC8], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Direct(Reg::ECX))); decode_helper(&vec![0x01, 0xD0], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Direct(Reg::EDX))); decode_helper(&vec![0x01, 0xD8], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Direct(Reg::EBX))); decode_helper(&vec![0x01, 0xE0], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Direct(Reg::ESP))); decode_helper(&vec![0x01, 0xE8], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Direct(Reg::EBP))); decode_helper(&vec![0x01, 0xF0], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Direct(Reg::ESI))); decode_helper(&vec![0x01, 0xF8], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Direct(Reg::EDI))); }
#[test]
fn sib_protected_mod_0() {
decode_helper(&vec![0x03, 0x04, 0x58], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectScaledIndexed( Reg::EAX, Reg::EBX, RegScale::Two, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x04, 0x8D, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectScaledDisplaced(Reg::ECX, RegScale::Four, 0x12345678, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x04, 0x24], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Indirect(Reg::ESP, Some(OperandSize::Dword), None)));
}
#[test]
fn sib_protected_mod_1() {
decode_helper(&vec![0x03, 0x44, 0x58, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectScaledIndexedDisplaced(Reg::EAX, Reg::EBX, RegScale::Two, 0x12, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x41, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::ECX, 0x12, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x44, 0xFE, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectScaledIndexedDisplaced(Reg::ESI, Reg::EDI, RegScale::Eight, 0x12, Some(OperandSize::Dword), None)));
}
#[test]
fn sib_protected_mod_2() {
decode_helper(&vec![0x03, 0x84, 0x58, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectScaledIndexedDisplaced(Reg::EAX, Reg::EBX, RegScale::Two, 0x12345678, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x81, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectDisplaced(Reg::ECX, 0x12345678, Some(OperandSize::Dword), None)));
decode_helper(&vec![0x03, 0x84, 0xFE, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::IndirectScaledIndexedDisplaced(Reg::ESI, Reg::EDI, RegScale::Eight, 0x12345678, Some(OperandSize::Dword), None)));
}
#[test]
fn mod_rm_long_mod_0() {
decode_helper(&vec![0x48, 0x03, 0x00], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Indirect(Reg::RAX, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x01], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Indirect(Reg::RCX, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x02], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Indirect(Reg::RDX, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x03], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Indirect(Reg::RBX, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x04, 0x24], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Indirect(Reg::RSP, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x05, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Offset(0x12345678, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x06], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Indirect(Reg::RSI, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x07], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Indirect(Reg::RDI, Some(OperandSize::Qword), None)));
}
#[test]
fn mod_rm_long_mod_1() {
decode_helper(&vec![0x48, 0x03, 0x40, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RAX, 0x12, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x41, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RCX, 0x12, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x42, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RDX, 0x12, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x43, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RBX, 0x12, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x44, 0x24, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RSP, 0x12, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x45, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RBP, 0x12, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x46, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RSI, 0x12, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x47, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RDI, 0x12, Some(OperandSize::Qword), None)));
}
#[test]
fn mod_rm_long_mod_2() {
decode_helper(&vec![0x48, 0x03, 0x80, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RAX, 0x12345678, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x81, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RCX, 0x12345678, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x82, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RDX, 0x12345678, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x83, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RBX, 0x12345678, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x84, 0x24, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RSP, 0x12345678, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x85, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RBP, 0x12345678, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x86, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RSI, 0x12345678, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x87, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RDI, 0x12345678, Some(OperandSize::Qword), None)));
}
#[test]
fn mod_rm_long_mod_3() {
decode_helper(&vec![0x48, 0x01, 0xC0], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Direct(Reg::RAX))); decode_helper(&vec![0x48, 0x01, 0xC8], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Direct(Reg::RCX))); decode_helper(&vec![0x48, 0x01, 0xD0], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Direct(Reg::RDX))); decode_helper(&vec![0x48, 0x01, 0xD8], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Direct(Reg::RBX))); decode_helper(&vec![0x48, 0x01, 0xE0], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Direct(Reg::RSP))); decode_helper(&vec![0x48, 0x01, 0xE8], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Direct(Reg::RBP))); decode_helper(&vec![0x48, 0x01, 0xF0], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Direct(Reg::RSI))); decode_helper(&vec![0x48, 0x01, 0xF8], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Direct(Reg::RDI))); }
#[test]
fn sib_long_mod_0() {
decode_helper(&vec![0x48, 0x03, 0x04, 0x58], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectScaledIndexed(Reg::RAX, Reg::RBX, RegScale::Two, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x04, 0x24], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Indirect(Reg::RSP, Some(OperandSize::Qword), None)));
}
#[test]
fn sib_long_mod_1() {
decode_helper(&vec![0x48, 0x03, 0x44, 0x58, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectScaledIndexedDisplaced(Reg::RAX, Reg::RBX, RegScale::Two, 0x12, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x41, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RCX, 0x12, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x44, 0xFE, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectScaledIndexedDisplaced(Reg::RSI, Reg::RDI, RegScale::Eight, 0x12, Some(OperandSize::Qword), None)));
}
#[test]
fn sib_long_mod_2() {
decode_helper(&vec![0x48, 0x03, 0x84, 0x58, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectScaledIndexedDisplaced(Reg::RAX, Reg::RBX, RegScale::Two, 0x12345678, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x81, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectDisplaced(Reg::RCX, 0x12345678, Some(OperandSize::Qword), None)));
decode_helper(&vec![0x48, 0x03, 0x84, 0xFE, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::IndirectScaledIndexedDisplaced(Reg::RSI, Reg::RDI, RegScale::Eight, 0x12345678, Some(OperandSize::Qword), None)));
}
#[test]
fn addressing_mode_a() {
decode_helper(&vec![0xEA, 0xAB, 0x90, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new1(Mnemonic::JMP, Operand::MemoryAndSegment32(0x1234, 0x567890AB))); }
#[test]
fn addressing_mode_c() {
decode_helper(&vec![0x0F, 0x22, 0xE0], Mode::Protected, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::CR4), Operand::Direct(Reg::EAX))); }
#[test]
fn addressing_mode_d() {
decode_helper(&vec![0x0F, 0x23, 0xC0], Mode::Protected, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::DR0), Operand::Direct(Reg::EAX))); }
#[test]
fn addressing_mode_e() {
decode_helper(&vec![0x01, 0xD8], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Direct(Reg::EBX))); decode_helper(&vec![0x03, 0x03], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX),
Operand::Indirect(Reg::EBX, Some(OperandSize::Dword), None))); }
#[test]
fn addressing_mode_es() {
decode_helper(&vec![0xD8, 0x01], Mode::Protected, &Instruction::new1(Mnemonic::FADD, Operand::Indirect(Reg::ECX, Some(OperandSize::Dword), None))); }
#[test]
fn addressing_mode_est() {
decode_helper(&vec![0xD8, 0xC1], Mode::Protected, &Instruction::new2(Mnemonic::FADD, Operand::Direct(Reg::ST), Operand::Direct(Reg::ST1))); }
#[test]
fn addressing_mode_g() {
decode_helper(&vec![0x01, 0xCB], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EBX), Operand::Direct(Reg::ECX))); }
#[test]
fn addressing_mode_h() {
decode_helper(&vec![0x0F, 0x20, 0xE0], Mode::Protected, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::EAX), Operand::Direct(Reg::CR4))); }
#[test]
fn addressing_mode_i() {
decode_helper(&vec![0x04, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AL), Operand::Literal8(0x12))); decode_helper(&vec![0x66, 0x05, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AX), Operand::Literal16(0x1234))); decode_helper(&vec![0x05, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Literal32(0x12345678))); }
#[test]
fn addressing_mode_j() {
decode_helper(&vec![0xE9, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new1(Mnemonic::JMP, Operand::Offset(0x12345678, None, None))); }
#[test]
fn addressing_mode_m() {
decode_helper(&vec![0x62, 0x08], Mode::Protected, &Instruction::new2(Mnemonic::BOUND, Operand::Direct(Reg::ECX), Operand::Indirect(Reg::EAX, Some(OperandSize::Unsized), None))); }
#[test]
fn addressing_mode_n() {
decode_helper(&vec![0x0F, 0x71, 0xD5, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::PSRLW, Operand::Direct(Reg::MM5), Operand::Literal8(0x12))); }
#[test]
fn addressing_mode_o() {
decode_helper(&vec![0xA0, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::AL), Operand::Offset(0x12345678, Some(OperandSize::Byte), None))); }
#[test]
fn addressing_mode_p() {
decode_helper(&vec![0x0F, 0xD4, 0xCA], Mode::Protected, &Instruction::new2(Mnemonic::PADDQ, Operand::Direct(Reg::MM1), Operand::Direct(Reg::MM2))); }
#[test]
fn addressing_mode_q() {
decode_helper(&vec![0x0F, 0xD4, 0x08], Mode::Protected, &Instruction::new2(Mnemonic::PADDQ, Operand::Direct(Reg::MM1), Operand::Indirect(Reg::EAX, Some(OperandSize::Qword), None))); }
#[test]
fn addressing_mode_r() {
decode_helper(&vec![0x0F, 0x20, 0xC9], Mode::Protected, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::ECX), Operand::Direct(Reg::CR1))); }
#[test]
fn addressing_mode_s() {
decode_helper(&vec![0x8E, 0xD8], Mode::Protected, &Instruction::new2(Mnemonic::MOV, Operand::Direct(Reg::DS), Operand::Direct(Reg::AX))); }
#[test]
fn addressing_mode_u() {
decode_helper(&vec![0x66, 0x0F, 0x58, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::ADDPD, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2))); }
#[test]
fn addressing_mode_v() {
decode_helper(&vec![0x0F, 0x58, 0xDD], Mode::Long, &Instruction::new2(Mnemonic::ADDPS, Operand::Direct(Reg::XMM3), Operand::Direct(Reg::XMM5))); }
#[test]
fn addressing_mode_w() {
decode_helper(&vec![0x66, 0x0F, 0x5C, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::SUBPD, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2))); decode_helper(&vec![0x66, 0x0F, 0x5C, 0x08], Mode::Long, &Instruction::new2(Mnemonic::SUBPD, Operand::Direct(Reg::XMM1), Operand::Indirect(Reg::RAX, Some(OperandSize::Xmmword), None))); }
#[test]
fn addressing_mode_z() {
decode_helper(&vec![0x41], Mode::Protected, &Instruction::new1(Mnemonic::INC, Operand::Direct(Reg::ECX))); }
#[test]
fn addressing_mode_avx_vex() {
decode_helper(&vec![0xC5, 0xE9, 0x58, 0xCB], Mode::Long, &Instruction::new3(Mnemonic::VADDPD, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2), Operand::Direct(Reg::XMM3))); }
#[test]
fn addressing_mode_avx_mem_rm() {
decode_helper(&vec![0xC5, 0xE9, 0x58, 0x08], Mode::Protected, &Instruction::new3(Mnemonic::VADDPD, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2),
Operand::Indirect(Reg::EAX, Some(OperandSize::Xmmword), None))); }
#[test]
fn addressing_mode_avx_reg() {
decode_helper(&vec![0xC5, 0xE9, 0x58, 0xCB], Mode::Long, &Instruction::new3(Mnemonic::VADDPD, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2), Operand::Direct(Reg::XMM3))); }
#[test]
fn addressing_mode_avx_rm() {
decode_helper(&vec![0xC5, 0xD9, 0x58, 0xDD], Mode::Long, &Instruction::new3(Mnemonic::VADDPD, Operand::Direct(Reg::XMM3), Operand::Direct(Reg::XMM4), Operand::Direct(Reg::XMM5))); }
#[test]
fn addressing_mode_masked_reg() {
decode_helper(&vec![0x62, 0xF1, 0xED, 0x0A, 0x58, 0xCB], Mode::Protected,
&Instruction {
mnemonic: Mnemonic::VADDPD,
operand1: Some(Operand::Direct(Reg::XMM1)),
operand2: Some(Operand::Direct(Reg::XMM2)),
operand3: Some(Operand::Direct(Reg::XMM3)),
mask: Some(MaskReg::K2),
merge_mode: Some(MergeMode::Merge),
.. Default::default()
}); }
#[test]
fn addressing_mode_avx_mem_bcast32_rm() {
decode_helper(&vec![0x62, 0xF1, 0x6C, 0x18, 0x5E, 0x08], Mode::Protected,
&Instruction {
mnemonic: Mnemonic::VDIVPS,
operand1: Some(Operand::Direct(Reg::XMM1)),
operand2: Some(Operand::Direct(Reg::XMM2)),
operand3: Some(Operand::Indirect(Reg::EAX, Some(OperandSize::Dword), None)),
broadcast: Some(BroadcastMode::Broadcast1To4),
.. Default::default()
}); }
#[test]
fn addressing_mode_avx_mem_bcast64_rm() {
decode_helper(&vec![0x62, 0xF1, 0xED, 0x18, 0x5E, 0x08], Mode::Protected,
&Instruction {
mnemonic: Mnemonic::VDIVPD,
operand1: Some(Operand::Direct(Reg::XMM1)),
operand2: Some(Operand::Direct(Reg::XMM2)),
operand3: Some(Operand::Indirect(Reg::EAX, Some(OperandSize::Qword), None)),
broadcast: Some(BroadcastMode::Broadcast1To2),
.. Default::default()
}); }
#[test]
fn addressing_mode_avx_imm8() {
decode_helper(&vec![0xC4, 0xE3, 0x69, 0x4B, 0xCB, 0x40], Mode::Long,
&Instruction {
mnemonic: Mnemonic::VBLENDVPD,
operand1: Some(Operand::Direct(Reg::XMM1)),
operand2: Some(Operand::Direct(Reg::XMM2)),
operand3: Some(Operand::Direct(Reg::XMM3)),
operand4: Some(Operand::Direct(Reg::XMM4)),
.. Default::default()
}); }
#[test]
fn addressing_mode_avx_dest_mem_rm() {
decode_helper(&vec![0x62, 0xF1, 0x7C, 0x2B, 0x29, 0x18], Mode::Protected,
&Instruction {
mnemonic: Mnemonic::VMOVAPS,
operand1: Some(Operand::Indirect(Reg::EAX, Some(OperandSize::Ymmword), None)),
operand2: Some(Operand::Direct(Reg::YMM3)),
mask: Some(MaskReg::K3),
merge_mode: Some(MergeMode::Merge),
.. Default::default()
}); }
#[test]
fn addressing_mode_avx_reg_masked_rm() {
decode_helper(&vec![0x62, 0xF1, 0xFF, 0x0D, 0x10, 0x10], Mode::Protected,
&Instruction {
mnemonic: Mnemonic::VMOVSD,
operand1: Some(Operand::Direct(Reg::XMM2)),
operand2: Some(Operand::Indirect(Reg::EAX, Some(OperandSize::Qword), None)),
mask: Some(MaskReg::K5),
merge_mode: Some(MergeMode::Merge),
.. Default::default()
}); }
#[test]
fn addressing_mode_masked_mask_reg() {
decode_helper(&vec![0x62, 0xF1, 0x6D, 0x2B, 0x74, 0xD3], Mode::Long,
&Instruction {
mnemonic: Mnemonic::VPCMPEQB,
operand1: Some(Operand::Direct(Reg::K2)),
operand2: Some(Operand::Direct(Reg::YMM2)),
operand3: Some(Operand::Direct(Reg::YMM3)),
mask: Some(MaskReg::K3),
merge_mode: Some(MergeMode::Merge),
.. Default::default()
}); }
#[test]
fn addressing_mode_mask_reg() {
decode_helper(&vec![0xC5, 0xE5, 0x4A, 0xD4], Mode::Protected,
&Instruction {
mnemonic: Mnemonic::KADDB,
operand1: Some(Operand::Direct(Reg::K2)),
operand2: Some(Operand::Direct(Reg::K3)),
operand3: Some(Operand::Direct(Reg::K4)),
.. Default::default()
}); }
#[test]
fn addressing_mode_mask_rm() {
decode_helper(&vec![0xC5, 0xDD, 0x4A, 0xDD], Mode::Long,
&Instruction {
mnemonic: Mnemonic::KADDB,
operand1: Some(Operand::Direct(Reg::K3)),
operand2: Some(Operand::Direct(Reg::K4)),
operand3: Some(Operand::Direct(Reg::K5)),
.. Default::default()
}); }
#[test]
fn addressing_mode_mask_vex() {
decode_helper(&vec![0xC5, 0xD5, 0x4A, 0xE6], Mode::Long, &Instruction::new3(Mnemonic::KADDB, Operand::Direct(Reg::K4), Operand::Direct(Reg::K5), Operand::Direct(Reg::K6))); }
#[test]
fn addressing_mode_mask_mem_rm() {
decode_helper(&vec![0xC5, 0xF9, 0x90, 0x30], Mode::Protected, &Instruction::new2(Mnemonic::KMOVB, Operand::Direct(Reg::K6), Operand::Indirect(Reg::EAX, Some(OperandSize::Byte), None))); }
#[test]
fn addressing_mode_general_vex() {
decode_helper(&vec![0xC4, 0xE2, 0x63, 0xF6, 0xC1], Mode::Protected, &Instruction::new3(Mnemonic::MULX, Operand::Direct(Reg::EAX), Operand::Direct(Reg::EBX), Operand::Direct(Reg::ECX))); }
#[test]
fn addressing_mode_general_rm() {
decode_helper(&vec![0xC5, 0xFB, 0x92, 0xC8], Mode::Protected, &Instruction::new2(Mnemonic::KMOVD, Operand::Direct(Reg::K1), Operand::Direct(Reg::EAX))); }
#[test]
fn addressing_mode_bound_reg() {
decode_helper(&vec![0xF3, 0x0F, 0x1A, 0xC8], Mode::Protected, &Instruction::new2(Mnemonic::BNDCL, Operand::Direct(Reg::BND1), Operand::Direct(Reg::EAX))); }
#[test]
fn addressing_mode_bound_mem_rm() {
decode_helper(&vec![0xF3, 0x0F, 0x1A, 0xC8], Mode::Protected, &Instruction::new2(Mnemonic::BNDCL, Operand::Direct(Reg::BND1), Operand::Direct(Reg::EAX))); decode_helper(&vec![0xF3, 0x0F, 0x1A, 0x08], Mode::Protected, &Instruction::new2(Mnemonic::BNDCL, Operand::Direct(Reg::BND1), Operand::Indirect(Reg::EAX, Some(OperandSize::Dword), None))); }
#[test]
fn operand_type_a() {
decode_helper(&vec![0x66, 0x62, 0x00], Mode::Protected, &Instruction::new2(Mnemonic::BOUND, Operand::Direct(Reg::AX), Operand::Indirect(Reg::EAX, Some(OperandSize::Unsized), None))); decode_helper(&vec![0x62, 0x00], Mode::Protected, &Instruction::new2(Mnemonic::BOUND, Operand::Direct(Reg::EAX), Operand::Indirect(Reg::EAX, Some(OperandSize::Unsized), None))); }
#[test]
fn operand_type_b() {
decode_helper(&vec![0xC4, 0xE3, 0x79, 0x32, 0xCA, 0x05], Mode::Protected, &Instruction::new3(Mnemonic::KSHIFTLB, Operand::Direct(Reg::K1), Operand::Direct(Reg::K2), Operand::Literal8(5))); }
#[test]
fn operand_type_bcd() {
decode_helper(&vec![0xDF, 0x20], Mode::Protected, &Instruction::new1(Mnemonic::FBLD, Operand::Indirect(Reg::EAX, Some(OperandSize::Tbyte), None))); }
#[test]
fn operand_type_bs() {
decode_helper(&vec![0x6B, 0xC3, 0x12], Mode::Protected, &Instruction::new3(Mnemonic::IMUL, Operand::Direct(Reg::EAX), Operand::Direct(Reg::EBX), Operand::Literal8(0x12))); }
#[test]
fn operand_type_bss() {
decode_helper(&vec![0x6A, 0x12], Mode::Protected, &Instruction::new1(Mnemonic::PUSH, Operand::Literal8(0x12))); }
#[test]
fn operand_type_d() {
decode_helper(&vec![0x0F, 0x6E, 0xD0], Mode::Protected, &Instruction::new2(Mnemonic::MOVD, Operand::Direct(Reg::MM2), Operand::Direct(Reg::EAX))); }
#[test]
fn operand_type_di() {
decode_helper(&vec![0xDA, 0x00], Mode::Protected, &Instruction::new1(Mnemonic::FIADD, Operand::Indirect(Reg::EAX, Some(OperandSize::Dword), None))); }
#[test]
fn operand_type_dq() {
decode_helper(&vec![0x66, 0x0F, 0x38, 0x00, 0x08], Mode::Protected, &Instruction::new2(Mnemonic::PSHUFB, Operand::Direct(Reg::XMM1), Operand::Indirect(Reg::EAX, Some(OperandSize::Xmmword), None))); decode_helper(&vec![0x66, 0x0F, 0x38, 0x00, 0xCA], Mode::Protected, &Instruction::new2(Mnemonic::PSHUFB, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2))); }
#[test]
fn operand_type_dqp() {
decode_helper(&vec![0xF2, 0x48, 0x0F, 0x38, 0xF0, 0xC0], Mode::Long, &Instruction::new2(Mnemonic::CRC32, Operand::Direct(Reg::RAX), Operand::Direct(Reg::AL))); decode_helper(&vec![0xF2, 0x0F, 0x38, 0xF0, 0xC0], Mode::Protected, &Instruction::new2(Mnemonic::CRC32, Operand::Direct(Reg::EAX), Operand::Direct(Reg::AL))); }
#[test]
fn operand_type_dr() {
decode_helper(&vec![0xDC, 0x00], Mode::Protected, &Instruction::new1(Mnemonic::FADD, Operand::Indirect(Reg::EAX, Some(OperandSize::Qword), None))); }
#[test]
fn operand_type_ds() {
decode_helper(&vec![0xE8, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new1(Mnemonic::CALL, Operand::Offset(0x12345678, None, None))); }
#[test]
fn operand_type_er() {
decode_helper(&vec![0xDB, 0x28], Mode::Protected, &Instruction::new1(Mnemonic::FLD, Operand::Indirect(Reg::EAX, Some(OperandSize::Tbyte), None))); }
#[test]
fn operand_type_p() {
decode_helper(&vec![0x9A, 0xAB, 0x89, 0x67, 0x45, 0x23, 0x01], Mode::Protected, &Instruction::new1(Mnemonic::CALL, Operand::MemoryAndSegment32(0x0123, 0x456789AB))); decode_helper(&vec![0x66, 0x9A, 0x67, 0x45, 0x23, 0x01], Mode::Protected, &Instruction::new1(Mnemonic::CALL, Operand::MemoryAndSegment16(0x0123, 0x4567))); decode_helper(&vec![0x9A, 0x67, 0x45, 0x23, 0x01], Mode::Real, &Instruction::new1(Mnemonic::CALL, Operand::MemoryAndSegment16(0x0123, 0x4567))); }
#[test]
fn operand_type_pi() {
decode_helper(&vec![0x0F, 0x2A, 0xCA], Mode::Protected, &Instruction::new2(Mnemonic::CVTPI2PS, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::MM2))); }
#[test]
fn operand_type_pd() {
decode_helper(&vec![0x66, 0x0F, 0x58, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::ADDPD, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2))); decode_helper(&vec![0x66, 0x0F, 0x58, 0x08], Mode::Long, &Instruction::new2(Mnemonic::ADDPD, Operand::Direct(Reg::XMM1), Operand::Indirect(Reg::RAX, Some(OperandSize::Xmmword), None))); }
#[test]
fn operand_type_ps() {
decode_helper(&vec![0x0F, 0x58, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::ADDPS, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2))); decode_helper(&vec![0x0F, 0x58, 0x08], Mode::Long, &Instruction::new2(Mnemonic::ADDPS, Operand::Direct(Reg::XMM1), Operand::Indirect(Reg::RAX, Some(OperandSize::Xmmword), None))); }
#[test]
fn operand_type_psq() {
decode_helper(&vec![0x0F, 0x2C, 0xCA], Mode::Protected, &Instruction::new2(Mnemonic::CVTTPS2PI, Operand::Direct(Reg::MM1), Operand::Direct(Reg::XMM2))); decode_helper(&vec![0x0F, 0x2C, 0x08], Mode::Protected, &Instruction::new2(Mnemonic::CVTTPS2PI, Operand::Direct(Reg::MM1), Operand::Indirect(Reg::EAX, Some(OperandSize::Qword), None))); }
#[test]
fn operand_type_ptp() {
decode_helper(&vec![0xFF, 0x10], Mode::Protected, &Instruction::new1(Mnemonic::CALL, Operand::Indirect(Reg::EAX, Some(OperandSize::Dword), None))); decode_helper(&vec![0xFF, 0x18], Mode::Protected, &Instruction::new1(Mnemonic::CALL, Operand::Indirect(Reg::EAX, Some(OperandSize::Fword), None)));
decode_helper(&vec![0x48, 0xFF, 0x18], Mode::Long, &Instruction::new1(Mnemonic::CALL, Operand::Indirect(Reg::RAX, Some(OperandSize::Tbyte), None))); }
#[test]
fn operand_type_q() {
decode_helper(&vec![0xFF, 0x20], Mode::Long, &Instruction::new1(Mnemonic::JMP, Operand::Indirect(Reg::RAX, Some(OperandSize::Qword), None))); }
#[test]
fn operand_type_qp() {
decode_helper(&vec![0x48, 0xCF], Mode::Long, &Instruction::new0(Mnemonic::IRETQ)); }
#[test]
fn operand_type_sd() {
decode_helper(&vec![0xF2, 0x0F, 0x58, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::ADDSD, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2))); decode_helper(&vec![0xF2, 0x0F, 0x58, 0x08], Mode::Long, &Instruction::new2(Mnemonic::ADDSD, Operand::Direct(Reg::XMM1), Operand::Indirect(Reg::RAX, Some(OperandSize::Qword), None))); }
#[test]
fn operand_type_ss() {
decode_helper(&vec![0xF3, 0x0F, 0x58, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::ADDSS, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2))); decode_helper(&vec![0xF3, 0x0F, 0x58, 0x08], Mode::Long, &Instruction::new2(Mnemonic::ADDSS, Operand::Direct(Reg::XMM1), Operand::Indirect(Reg::RAX, Some(OperandSize::Dword), None))); }
#[test]
fn operand_type_v() {
decode_helper(&vec![0x40], Mode::Real, &Instruction::new1(Mnemonic::INC, Operand::Direct(Reg::AX))); decode_helper(&vec![0x66, 0x40], Mode::Real, &Instruction::new1(Mnemonic::INC, Operand::Direct(Reg::EAX))); decode_helper(&vec![0x66, 0x40], Mode::Protected, &Instruction::new1(Mnemonic::INC, Operand::Direct(Reg::AX))); decode_helper(&vec![0x40], Mode::Protected, &Instruction::new1(Mnemonic::INC, Operand::Direct(Reg::EAX))); }
#[test]
fn operand_type_vds() {
decode_helper(&vec![0x05, 0x34, 0x12], Mode::Real, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AX), Operand::Literal16(0x1234))); decode_helper(&vec![0x66, 0x05, 0x78, 0x56, 0x34, 0x12], Mode::Real, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Literal32(0x12345678))); decode_helper(&vec![0x66, 0x05, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::AX), Operand::Literal16(0x1234))); decode_helper(&vec![0x05, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Literal32(0x12345678))); decode_helper(&vec![0x05, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EAX), Operand::Literal32(0x12345678))); decode_helper(&vec![0x48, 0x05, 0x78, 0x56, 0x34, 0x12], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RAX), Operand::Literal32(0x12345678))); }
#[test]
fn operand_type_vq() {
decode_helper(&vec![0x66, 0x50], Mode::Long, &Instruction::new1(Mnemonic::PUSH, Operand::Direct(Reg::AX))); decode_helper(&vec![0x50], Mode::Long, &Instruction::new1(Mnemonic::PUSH, Operand::Direct(Reg::RAX))); }
#[test]
fn operand_type_vqp() {
decode_helper(&vec![0x66, 0x01, 0xC3], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::BX), Operand::Direct(Reg::AX))); decode_helper(&vec![0x01, 0xC3], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::EBX), Operand::Direct(Reg::EAX))); decode_helper(&vec![0x48, 0x01, 0xC3], Mode::Long, &Instruction::new2(Mnemonic::ADD, Operand::Direct(Reg::RBX), Operand::Direct(Reg::RAX))); }
#[test]
fn operand_type_vs() {
decode_helper(&vec![0x66, 0x68, 0x34, 0x12], Mode::Protected, &Instruction::new1(Mnemonic::PUSH, Operand::Literal16(0x1234))); decode_helper(&vec![0x68, 0x78, 0x56, 0x34, 0x12], Mode::Protected, &Instruction::new1(Mnemonic::PUSH, Operand::Literal32(0x12345678))); }
#[test]
fn operand_type_w() {
decode_helper(&vec![0xC8, 0x05, 0x00, 0x06], Mode::Real, &Instruction::new2(Mnemonic::ENTER, Operand::Literal16(0x5), Operand::Literal8(0x06))); decode_helper(&vec![0xC8, 0x05, 0x00, 0x06], Mode::Protected, &Instruction::new2(Mnemonic::ENTER, Operand::Literal16(0x5), Operand::Literal8(0x06))); decode_helper(&vec![0xC8, 0x05, 0x00, 0x06], Mode::Long, &Instruction::new2(Mnemonic::ENTER, Operand::Literal16(0x5), Operand::Literal8(0x06))); }
#[test]
fn operand_type_xmm() {
decode_helper(&vec![0xC5, 0xE9, 0x58, 0xCB], Mode::Long, &Instruction::new3(Mnemonic::VADDPD, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2), Operand::Direct(Reg::XMM3))); decode_helper(&vec![0xC5, 0xE9, 0x58, 0x08], Mode::Long, &Instruction::new3(Mnemonic::VADDPD, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2),
Operand::Indirect(Reg::RAX, Some(OperandSize::Xmmword), None))); }
#[test]
fn operand_type_ymm() {
decode_helper(&vec![0xC5, 0xED, 0x58, 0xCB], Mode::Long, &Instruction::new3(Mnemonic::VADDPD, Operand::Direct(Reg::YMM1), Operand::Direct(Reg::YMM2), Operand::Direct(Reg::YMM3))); decode_helper(&vec![0xC5, 0xED, 0x58, 0x08], Mode::Long, &Instruction::new3(Mnemonic::VADDPD, Operand::Direct(Reg::YMM1), Operand::Direct(Reg::YMM2),
Operand::Indirect(Reg::RAX, Some(OperandSize::Ymmword), None))); }
#[test]
fn operand_type_zmm() {
decode_helper(&vec![0x62, 0xF1, 0xED, 0x48, 0x58, 0xCB], Mode::Long, &Instruction::new3(Mnemonic::VADDPD, Operand::Direct(Reg::ZMM1), Operand::Direct(Reg::ZMM2), Operand::Direct(Reg::ZMM3))); decode_helper(&vec![0x62, 0xF1, 0xED, 0x48, 0x58, 0x08], Mode::Long, &Instruction::new3(Mnemonic::VADDPD, Operand::Direct(Reg::ZMM1), Operand::Direct(Reg::ZMM2),
Operand::Indirect(Reg::RAX, Some(OperandSize::Zmmword), None))); }
#[test]
fn operand_type_xmm_or_ymm() {
decode_helper(&vec![0xC5, 0xE9, 0x58, 0xCB], Mode::Long, &Instruction::new3(Mnemonic::VADDPD, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2), Operand::Direct(Reg::XMM3))); decode_helper(&vec![0xC5, 0xED, 0x58, 0xCB], Mode::Long, &Instruction::new3(Mnemonic::VADDPD, Operand::Direct(Reg::YMM1), Operand::Direct(Reg::YMM2), Operand::Direct(Reg::YMM3))); }
#[test]
fn operand_type_xmm_or_ymm_or_mem_or_mem64() {
decode_helper(&vec![0xC5, 0xF9, 0x5A, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::VCVTPD2PS, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2))); decode_helper(&vec![0xC5, 0xF9, 0x5A, 0x08], Mode::Long, &Instruction::new2(Mnemonic::VCVTPD2PS, Operand::Direct(Reg::XMM1), Operand::Indirect(Reg::RAX, Some(OperandSize::Xmmword), None))); decode_helper(&vec![0x62, 0xF1, 0xFD, 0x18, 0x5A, 0x08], Mode::Long, &Instruction {
mnemonic: Mnemonic::VCVTPD2PS,
operand1: Some(Operand::Direct(Reg::XMM1)),
operand2: Some(Operand::Indirect(Reg::RAX, Some(OperandSize::Qword), None)),
broadcast: Some(BroadcastMode::Broadcast1To2),
.. Default::default()
}); decode_helper(&vec![0x62, 0xF1, 0xFD, 0x38, 0x5A, 0x08], Mode::Long, &Instruction {
mnemonic: Mnemonic::VCVTPD2PS,
operand1: Some(Operand::Direct(Reg::XMM1)),
operand2: Some(Operand::Indirect(Reg::RAX, Some(OperandSize::Qword), None)),
broadcast: Some(BroadcastMode::Broadcast1To4),
.. Default::default()
}); }
#[test]
fn operand_type_xmm_or_mem32() {
decode_helper(&vec![0xC5, 0xEA, 0x5A, 0xCB], Mode::Long, &Instruction::new3(Mnemonic::VCVTSS2SD, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2), Operand::Direct(Reg::XMM3))); decode_helper(&vec![0xC5, 0xEA, 0x5A, 0x08], Mode::Long, &Instruction::new3(Mnemonic::VCVTSS2SD, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2),
Operand::Indirect(Reg::RAX, Some(OperandSize::Dword), None))); }
#[test]
fn operand_type_xmm_or_mem64() {
decode_helper(&vec![0x0F, 0x5A, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::CVTPS2PD, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::XMM2))); decode_helper(&vec![0x0F, 0x5A, 0x08], Mode::Long, &Instruction::new2(Mnemonic::CVTPS2PD, Operand::Direct(Reg::XMM1), Operand::Indirect(Reg::RAX, Some(OperandSize::Qword), None))); }
#[test]
fn operand_type_ymm_or_mem_or_mem32() {
decode_helper(&vec![0x62, 0xF1, 0x7C, 0x48, 0x5A, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::VCVTPS2PD, Operand::Direct(Reg::ZMM1), Operand::Direct(Reg::YMM2))); decode_helper(&vec![0x62, 0xF1, 0x7C, 0x48, 0x5A, 0x08], Mode::Long, &Instruction::new2(Mnemonic::VCVTPS2PD, Operand::Direct(Reg::ZMM1), Operand::Indirect(Reg::RAX, Some(OperandSize::Ymmword), None))); decode_helper(&vec![0x62, 0xF1, 0x7C, 0x58, 0x5A, 0x08], Mode::Long, &Instruction {
mnemonic: Mnemonic::VCVTPS2PD,
operand1: Some(Operand::Direct(Reg::ZMM1)),
operand2: Some(Operand::Indirect(Reg::RAX, Some(OperandSize::Dword), None)),
broadcast: Some(BroadcastMode::Broadcast1To8),
.. Default::default()
}); }
#[test]
fn operand_type_ymm_or_mem_or_mem64() {
decode_helper(&vec![0xC5, 0xFF, 0xE6, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::VCVTPD2DQ, Operand::Direct(Reg::XMM1), Operand::Direct(Reg::YMM2))); decode_helper(&vec![0xC5, 0xFF, 0xE6, 0x08], Mode::Long, &Instruction::new2(Mnemonic::VCVTPD2DQ, Operand::Direct(Reg::XMM1), Operand::Indirect(Reg::RAX, Some(OperandSize::Ymmword), None))); decode_helper(&vec![0x62, 0xF1, 0xFF, 0x38, 0xE6, 0x08], Mode::Long, &Instruction {
mnemonic: Mnemonic::VCVTPD2DQ,
operand1: Some(Operand::Direct(Reg::XMM1)),
operand2: Some(Operand::Indirect(Reg::RAX, Some(OperandSize::Qword), None)),
broadcast: Some(BroadcastMode::Broadcast1To4),
.. Default::default()
}); }
#[test]
fn operand_type_zmm_or_mem_or_mem64() {
decode_helper(&vec![0x62, 0xF1, 0xFD, 0x48, 0x5A, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::VCVTPD2PS, Operand::Direct(Reg::YMM1), Operand::Direct(Reg::ZMM2))); decode_helper(&vec![0x62, 0xF1, 0xFD, 0x48, 0x5A, 0x08], Mode::Long, &Instruction::new2(Mnemonic::VCVTPD2PS, Operand::Direct(Reg::YMM1),
Operand::Indirect(Reg::RAX, Some(OperandSize::Zmmword), None))); decode_helper(&vec![0x62, 0xF1, 0xFD, 0x58, 0x5A, 0x08], Mode::Long, &Instruction {
mnemonic: Mnemonic::VCVTPD2PS,
operand1: Some(Operand::Direct(Reg::YMM1)),
operand2: Some(Operand::Indirect(Reg::RAX, Some(OperandSize::Qword), None)),
broadcast: Some(BroadcastMode::Broadcast1To8),
.. Default::default()
}); }
#[test]
fn operand_type_avx() {
decode_helper(&vec![0x62, 0xF1, 0xED, 0x0A, 0x58, 0xCB], Mode::Long, &Instruction {
mnemonic: Mnemonic::VADDPD,
operand1: Some(Operand::Direct(Reg::XMM1)),
operand2: Some(Operand::Direct(Reg::XMM2)),
operand3: Some(Operand::Direct(Reg::XMM3)),
mask: Some(MaskReg::K2),
merge_mode: Some(MergeMode::Merge),
.. Default::default()
}); decode_helper(&vec![0x62, 0xF1, 0xED, 0x2A, 0x58, 0xCB], Mode::Long, &Instruction {
mnemonic: Mnemonic::VADDPD,
operand1: Some(Operand::Direct(Reg::YMM1)),
operand2: Some(Operand::Direct(Reg::YMM2)),
operand3: Some(Operand::Direct(Reg::YMM3)),
mask: Some(MaskReg::K2),
merge_mode: Some(MergeMode::Merge),
.. Default::default()
}); decode_helper(&vec![0x62, 0xF1, 0xED, 0x4A, 0x58, 0xCB], Mode::Long, &Instruction {
mnemonic: Mnemonic::VADDPD,
operand1: Some(Operand::Direct(Reg::ZMM1)),
operand2: Some(Operand::Direct(Reg::ZMM2)),
operand3: Some(Operand::Direct(Reg::ZMM3)),
mask: Some(MaskReg::K2),
merge_mode: Some(MergeMode::Merge),
.. Default::default()
}); }
#[test]
fn operand_type_mask_reg() {
decode_helper(&vec![0x62, 0xF1, 0xED, 0x28, 0xC2, 0xDB, 0x05], Mode::Long, &Instruction::new4(Mnemonic::VCMPPD, Operand::Direct(Reg::K3), Operand::Direct(Reg::YMM2), Operand::Direct(Reg::YMM3), Operand::Literal8(5))); }
#[test]
fn operand_type_mask_or_mem_8() {
decode_helper(&vec![0xC5, 0xF9, 0x90, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::KMOVB, Operand::Direct(Reg::K1), Operand::Direct(Reg::K2))); decode_helper(&vec![0xC5, 0xF9, 0x90, 0x08], Mode::Long, &Instruction::new2(Mnemonic::KMOVB, Operand::Direct(Reg::K1), Operand::Indirect(Reg::RAX, Some(OperandSize::Byte), None))); }
#[test]
fn operand_type_mask_or_mem_16() {
decode_helper(&vec![0xC5, 0xF8, 0x90, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::KMOVW, Operand::Direct(Reg::K1), Operand::Direct(Reg::K2))); decode_helper(&vec![0xC5, 0xF8, 0x90, 0x08], Mode::Long, &Instruction::new2(Mnemonic::KMOVW, Operand::Direct(Reg::K1), Operand::Indirect(Reg::RAX, Some(OperandSize::Word), None))); }
#[test]
fn operand_type_mask_or_mem_32() {
decode_helper(&vec![0xC4, 0xE1, 0xF9, 0x90, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::KMOVD, Operand::Direct(Reg::K1), Operand::Direct(Reg::K2))); decode_helper(&vec![0xC4, 0xE1, 0xF9, 0x90, 0x08], Mode::Long, &Instruction::new2(Mnemonic::KMOVD, Operand::Direct(Reg::K1), Operand::Indirect(Reg::RAX, Some(OperandSize::Dword), None))); }
#[test]
fn operand_type_mask_or_mem_64() {
decode_helper(&vec![0xC4, 0xE1, 0xF8, 0x90, 0xCA], Mode::Long, &Instruction::new2(Mnemonic::KMOVQ, Operand::Direct(Reg::K1), Operand::Direct(Reg::K2))); decode_helper(&vec![0xC4, 0xE1, 0xF8, 0x90, 0x08], Mode::Long, &Instruction::new2(Mnemonic::KMOVQ, Operand::Direct(Reg::K1), Operand::Indirect(Reg::RAX, Some(OperandSize::Qword), None))); }
#[test]
fn operand_type_bound() {
decode_helper(&vec![0xF3, 0x0F, 0x1A, 0xC8], Mode::Protected, &Instruction::new2(Mnemonic::BNDCL, Operand::Direct(Reg::BND1), Operand::Direct(Reg::EAX))); }
#[test]
fn operand_type_bound_or_mem() {
decode_helper(&vec![0x66, 0x0F, 0x1A, 0xCA], Mode::Protected, &Instruction::new2(Mnemonic::BNDMOV, Operand::Direct(Reg::BND1), Operand::Direct(Reg::BND2))); decode_helper(&vec![0x66, 0x0F, 0x1A, 0x08], Mode::Protected, &Instruction::new2(Mnemonic::BNDMOV, Operand::Direct(Reg::BND1), Operand::Indirect(Reg::EAX, Some(OperandSize::Qword), None))); }
#[test]
fn operand_type_unsized_memory() {
decode_helper(&vec![0x8D, 0x03], Mode::Protected, &Instruction::new2(Mnemonic::LEA, Operand::Direct(Reg::EAX), Operand::Indirect(Reg::EBX, Some(OperandSize::Unsized), None))); }
#[test]
fn operand_type_fpu_register() {
decode_helper(&vec![0xD8, 0xC2], Mode::Protected, &Instruction::new2(Mnemonic::FADD, Operand::Direct(Reg::ST), Operand::Direct(Reg::ST2))); }