asmkit/x86/features/
MOVBE.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 MovbeEmitter<A, B> {
27 fn movbe(&mut self, op0: A, op1: B);
28}
29
30impl<'a> MovbeEmitter<Gpw, Mem> for Assembler<'a> {
31 fn movbe(&mut self, op0: Gpw, op1: Mem) {
32 self.emit(
33 MOVBE16RM,
34 op0.as_operand(),
35 op1.as_operand(),
36 &NOREG,
37 &NOREG,
38 );
39 }
40}
41
42impl<'a> MovbeEmitter<Gpd, Mem> for Assembler<'a> {
43 fn movbe(&mut self, op0: Gpd, op1: Mem) {
44 self.emit(
45 MOVBE32RM,
46 op0.as_operand(),
47 op1.as_operand(),
48 &NOREG,
49 &NOREG,
50 );
51 }
52}
53
54impl<'a> MovbeEmitter<Gpq, Mem> for Assembler<'a> {
55 fn movbe(&mut self, op0: Gpq, op1: Mem) {
56 self.emit(
57 MOVBE64RM,
58 op0.as_operand(),
59 op1.as_operand(),
60 &NOREG,
61 &NOREG,
62 );
63 }
64}
65
66impl<'a> MovbeEmitter<Mem, Gpw> for Assembler<'a> {
67 fn movbe(&mut self, op0: Mem, op1: Gpw) {
68 self.emit(
69 MOVBE16MR,
70 op0.as_operand(),
71 op1.as_operand(),
72 &NOREG,
73 &NOREG,
74 );
75 }
76}
77
78impl<'a> MovbeEmitter<Mem, Gpd> for Assembler<'a> {
79 fn movbe(&mut self, op0: Mem, op1: Gpd) {
80 self.emit(
81 MOVBE32MR,
82 op0.as_operand(),
83 op1.as_operand(),
84 &NOREG,
85 &NOREG,
86 );
87 }
88}
89
90impl<'a> MovbeEmitter<Mem, Gpq> for Assembler<'a> {
91 fn movbe(&mut self, op0: Mem, op1: Gpq) {
92 self.emit(
93 MOVBE64MR,
94 op0.as_operand(),
95 op1.as_operand(),
96 &NOREG,
97 &NOREG,
98 );
99 }
100}
101
102impl<'a> Assembler<'a> {
103 #[inline]
120 pub fn movbe<A, B>(&mut self, op0: A, op1: B)
121 where
122 Assembler<'a>: MovbeEmitter<A, B>,
123 {
124 <Self as MovbeEmitter<A, B>>::movbe(self, op0, op1);
125 }
126}