asmkit/x86/features/
3DNOW.rs1use super::super::opcodes::*;
2use crate::core::emitter::*;
3use crate::core::operand::*;
4use crate::x86::assembler::*;
5use crate::x86::operands::*;
6
7const NOREG: Operand = Operand::new();
9
10pub trait _3dnowEmitter<A, B, C> {
23 fn _3dnow(&mut self, op0: A, op1: B, op2: C);
24}
25
26impl<'a> _3dnowEmitter<Mm, Mm, Imm> for Assembler<'a> {
27 fn _3dnow(&mut self, op0: Mm, op1: Mm, op2: Imm) {
28 self.emit(
29 _3DNOWRRI,
30 op0.as_operand(),
31 op1.as_operand(),
32 op2.as_operand(),
33 &NOREG,
34 );
35 }
36}
37
38impl<'a> _3dnowEmitter<Mm, Mem, Imm> for Assembler<'a> {
39 fn _3dnow(&mut self, op0: Mm, op1: Mem, op2: Imm) {
40 self.emit(
41 _3DNOWRMI,
42 op0.as_operand(),
43 op1.as_operand(),
44 op2.as_operand(),
45 &NOREG,
46 );
47 }
48}
49
50pub trait FemmsEmitter {
62 fn femms(&mut self);
63}
64
65impl<'a> FemmsEmitter for Assembler<'a> {
66 fn femms(&mut self) {
67 self.emit(FEMMS, &NOREG, &NOREG, &NOREG, &NOREG);
68 }
69}
70
71impl<'a> Assembler<'a> {
72 #[inline]
85 pub fn _3dnow<A, B, C>(&mut self, op0: A, op1: B, op2: C)
86 where
87 Assembler<'a>: _3dnowEmitter<A, B, C>,
88 {
89 <Self as _3dnowEmitter<A, B, C>>::_3dnow(self, op0, op1, op2);
90 }
91 #[inline]
103 pub fn femms(&mut self)
104 where
105 Assembler<'a>: FemmsEmitter,
106 {
107 <Self as FemmsEmitter>::femms(self);
108 }
109}