From cd223378d238cead8a5210b4a6e10692799920bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Fri, 20 Dec 2024 16:42:22 +0000 Subject: [PATCH] Adds X86Instruction::mov_mmx(). --- src/x86.rs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/x86.rs b/src/x86.rs index 9ae32994..4f9efff5 100644 --- a/src/x86.rs +++ b/src/x86.rs @@ -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::*; @@ -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(