1use 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 AesdecEmitter<A, B> {
23 fn aesdec(&mut self, op0: A, op1: B);
24}
25
26impl<'a> AesdecEmitter<Xmm, Xmm> for Assembler<'a> {
27 fn aesdec(&mut self, op0: Xmm, op1: Xmm) {
28 self.emit(AESDECRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
29 }
30}
31
32impl<'a> AesdecEmitter<Xmm, Mem> for Assembler<'a> {
33 fn aesdec(&mut self, op0: Xmm, op1: Mem) {
34 self.emit(AESDECRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
35 }
36}
37
38pub trait AesdeclastEmitter<A, B> {
51 fn aesdeclast(&mut self, op0: A, op1: B);
52}
53
54impl<'a> AesdeclastEmitter<Xmm, Xmm> for Assembler<'a> {
55 fn aesdeclast(&mut self, op0: Xmm, op1: Xmm) {
56 self.emit(
57 AESDECLASTRR,
58 op0.as_operand(),
59 op1.as_operand(),
60 &NOREG,
61 &NOREG,
62 );
63 }
64}
65
66impl<'a> AesdeclastEmitter<Xmm, Mem> for Assembler<'a> {
67 fn aesdeclast(&mut self, op0: Xmm, op1: Mem) {
68 self.emit(
69 AESDECLASTRM,
70 op0.as_operand(),
71 op1.as_operand(),
72 &NOREG,
73 &NOREG,
74 );
75 }
76}
77
78pub trait AesencEmitter<A, B> {
91 fn aesenc(&mut self, op0: A, op1: B);
92}
93
94impl<'a> AesencEmitter<Xmm, Xmm> for Assembler<'a> {
95 fn aesenc(&mut self, op0: Xmm, op1: Xmm) {
96 self.emit(AESENCRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
97 }
98}
99
100impl<'a> AesencEmitter<Xmm, Mem> for Assembler<'a> {
101 fn aesenc(&mut self, op0: Xmm, op1: Mem) {
102 self.emit(AESENCRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
103 }
104}
105
106pub trait AesenclastEmitter<A, B> {
119 fn aesenclast(&mut self, op0: A, op1: B);
120}
121
122impl<'a> AesenclastEmitter<Xmm, Xmm> for Assembler<'a> {
123 fn aesenclast(&mut self, op0: Xmm, op1: Xmm) {
124 self.emit(
125 AESENCLASTRR,
126 op0.as_operand(),
127 op1.as_operand(),
128 &NOREG,
129 &NOREG,
130 );
131 }
132}
133
134impl<'a> AesenclastEmitter<Xmm, Mem> for Assembler<'a> {
135 fn aesenclast(&mut self, op0: Xmm, op1: Mem) {
136 self.emit(
137 AESENCLASTRM,
138 op0.as_operand(),
139 op1.as_operand(),
140 &NOREG,
141 &NOREG,
142 );
143 }
144}
145
146pub trait AesimcEmitter<A, B> {
159 fn aesimc(&mut self, op0: A, op1: B);
160}
161
162impl<'a> AesimcEmitter<Xmm, Xmm> for Assembler<'a> {
163 fn aesimc(&mut self, op0: Xmm, op1: Xmm) {
164 self.emit(AESIMCRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
165 }
166}
167
168impl<'a> AesimcEmitter<Xmm, Mem> for Assembler<'a> {
169 fn aesimc(&mut self, op0: Xmm, op1: Mem) {
170 self.emit(AESIMCRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
171 }
172}
173
174pub trait AeskeygenassistEmitter<A, B, C> {
187 fn aeskeygenassist(&mut self, op0: A, op1: B, op2: C);
188}
189
190impl<'a> AeskeygenassistEmitter<Xmm, Xmm, Imm> for Assembler<'a> {
191 fn aeskeygenassist(&mut self, op0: Xmm, op1: Xmm, op2: Imm) {
192 self.emit(
193 AESKEYGENASSISTRRI,
194 op0.as_operand(),
195 op1.as_operand(),
196 op2.as_operand(),
197 &NOREG,
198 );
199 }
200}
201
202impl<'a> AeskeygenassistEmitter<Xmm, Mem, Imm> for Assembler<'a> {
203 fn aeskeygenassist(&mut self, op0: Xmm, op1: Mem, op2: Imm) {
204 self.emit(
205 AESKEYGENASSISTRMI,
206 op0.as_operand(),
207 op1.as_operand(),
208 op2.as_operand(),
209 &NOREG,
210 );
211 }
212}
213
214impl<'a> Assembler<'a> {
215 #[inline]
228 pub fn aesdec<A, B>(&mut self, op0: A, op1: B)
229 where
230 Assembler<'a>: AesdecEmitter<A, B>,
231 {
232 <Self as AesdecEmitter<A, B>>::aesdec(self, op0, op1);
233 }
234 #[inline]
247 pub fn aesdeclast<A, B>(&mut self, op0: A, op1: B)
248 where
249 Assembler<'a>: AesdeclastEmitter<A, B>,
250 {
251 <Self as AesdeclastEmitter<A, B>>::aesdeclast(self, op0, op1);
252 }
253 #[inline]
266 pub fn aesenc<A, B>(&mut self, op0: A, op1: B)
267 where
268 Assembler<'a>: AesencEmitter<A, B>,
269 {
270 <Self as AesencEmitter<A, B>>::aesenc(self, op0, op1);
271 }
272 #[inline]
285 pub fn aesenclast<A, B>(&mut self, op0: A, op1: B)
286 where
287 Assembler<'a>: AesenclastEmitter<A, B>,
288 {
289 <Self as AesenclastEmitter<A, B>>::aesenclast(self, op0, op1);
290 }
291 #[inline]
304 pub fn aesimc<A, B>(&mut self, op0: A, op1: B)
305 where
306 Assembler<'a>: AesimcEmitter<A, B>,
307 {
308 <Self as AesimcEmitter<A, B>>::aesimc(self, op0, op1);
309 }
310 #[inline]
323 pub fn aeskeygenassist<A, B, C>(&mut self, op0: A, op1: B, op2: C)
324 where
325 Assembler<'a>: AeskeygenassistEmitter<A, B, C>,
326 {
327 <Self as AeskeygenassistEmitter<A, B, C>>::aeskeygenassist(self, op0, op1, op2);
328 }
329}