Skip to content

Commit

Permalink
Adds X86Instruction::mov_mmx().
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Dec 24, 2024
1 parent 6e4acb3 commit cd22337
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ pub enum X86Register {
R13 = 13,
R14 = 14,
R15 = 15,
MM0 = 16,
MM1 = 17,
MM2 = 18,
MM3 = 19,
MM4 = 20,
MM5 = 21,
MM6 = 22,
MM7 = 23,
}
use X86Register::*;

Expand Down Expand Up @@ -266,6 +274,35 @@ impl X86Instruction {
}
}

/// Move to / from / between MMX (float mantissa)
#[allow(dead_code)]
#[inline]
pub const fn mov_mmx(size: OperandSize, source: X86Register, destination: X86Register) -> Self {
exclude_operand_sizes!(
size,
OperandSize::S0 | OperandSize::S8 | OperandSize::S16 | OperandSize::S32
);
if (destination as u8) & 16 != 0 {
Self {
size,
opcode_escape_sequence: 1,
opcode: if (source as u8) & 16 != 0 { 0x6F } else { 0x6E },
first_operand: (destination as u8) & 0xF,
second_operand: (source as u8) & 0xF,
..Self::DEFAULT
}
} else {
Self {
size,
opcode_escape_sequence: 1,
opcode: 0x7E,
first_operand: (source as u8) & 0xF,
second_operand: (destination as u8) & 0xF,
..Self::DEFAULT
}
}
}

/// Conditionally move source to destination
#[inline]
pub const fn cmov(
Expand Down

0 comments on commit cd22337

Please sign in to comment.