asmkit/x86/features/
3DNOW.rs1use crate::x86::assembler::*;
2use crate::x86::operands::*;
3use super::super::opcodes::*;
4use crate::core::emitter::*;
5use crate::core::operand::*;
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(_3DNOWRRI, op0.as_operand(), op1.as_operand(), op2.as_operand(), &NOREG);
29 }
30}
31
32impl<'a> _3dnowEmitter<Mm, Mem, Imm> for Assembler<'a> {
33 fn _3dnow(&mut self, op0: Mm, op1: Mem, op2: Imm) {
34 self.emit(_3DNOWRMI, op0.as_operand(), op1.as_operand(), op2.as_operand(), &NOREG);
35 }
36}
37
38pub trait FemmsEmitter {
50 fn femms(&mut self);
51}
52
53impl<'a> FemmsEmitter for Assembler<'a> {
54 fn femms(&mut self) {
55 self.emit(FEMMS, &NOREG, &NOREG, &NOREG, &NOREG);
56 }
57}
58
59
60impl<'a> Assembler<'a> {
61 #[inline]
74 pub fn _3dnow<A, B, C>(&mut self, op0: A, op1: B, op2: C)
75 where Assembler<'a>: _3dnowEmitter<A, B, C> {
76 <Self as _3dnowEmitter<A, B, C>>::_3dnow(self, op0, op1, op2);
77 }
78 #[inline]
90 pub fn femms(&mut self)
91 where Assembler<'a>: FemmsEmitter {
92 <Self as FemmsEmitter>::femms(self);
93 }
94}