Skip to main content

asmkit/x86/features/
AESKLE.rs

1use crate::x86::assembler::*;
2use crate::x86::operands::*;
3use super::super::opcodes::*;
4use crate::core::emitter::*;
5use crate::core::operand::*;
6
7/// A dummy operand that represents no register. Here just for simplicity.
8const NOREG: Operand = Operand::new();
9
10/// `AESDEC128KL`.
11///
12/// Supported operand variants:
13///
14/// ```text
15/// +---+----------+
16/// | # | Operands |
17/// +---+----------+
18/// | 1 | Xmm, Mem |
19/// +---+----------+
20/// ```
21pub trait Aesdec128klEmitter<A, B> {
22    fn aesdec128kl(&mut self, op0: A, op1: B);
23}
24
25impl<'a> Aesdec128klEmitter<Xmm, Mem> for Assembler<'a> {
26    fn aesdec128kl(&mut self, op0: Xmm, op1: Mem) {
27        self.emit(AESDEC128KLRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
28    }
29}
30
31/// `AESDEC256KL`.
32///
33/// Supported operand variants:
34///
35/// ```text
36/// +---+----------+
37/// | # | Operands |
38/// +---+----------+
39/// | 1 | Xmm, Mem |
40/// +---+----------+
41/// ```
42pub trait Aesdec256klEmitter<A, B> {
43    fn aesdec256kl(&mut self, op0: A, op1: B);
44}
45
46impl<'a> Aesdec256klEmitter<Xmm, Mem> for Assembler<'a> {
47    fn aesdec256kl(&mut self, op0: Xmm, op1: Mem) {
48        self.emit(AESDEC256KLRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
49    }
50}
51
52/// `AESDECWIDE128KL`.
53///
54/// Supported operand variants:
55///
56/// ```text
57/// +---+----------+
58/// | # | Operands |
59/// +---+----------+
60/// | 1 | Mem      |
61/// +---+----------+
62/// ```
63pub trait Aesdecwide128klEmitter<A> {
64    fn aesdecwide128kl(&mut self, op0: A);
65}
66
67impl<'a> Aesdecwide128klEmitter<Mem> for Assembler<'a> {
68    fn aesdecwide128kl(&mut self, op0: Mem) {
69        self.emit(AESDECWIDE128KLM, op0.as_operand(), &NOREG, &NOREG, &NOREG);
70    }
71}
72
73/// `AESDECWIDE256KL`.
74///
75/// Supported operand variants:
76///
77/// ```text
78/// +---+----------+
79/// | # | Operands |
80/// +---+----------+
81/// | 1 | Mem      |
82/// +---+----------+
83/// ```
84pub trait Aesdecwide256klEmitter<A> {
85    fn aesdecwide256kl(&mut self, op0: A);
86}
87
88impl<'a> Aesdecwide256klEmitter<Mem> for Assembler<'a> {
89    fn aesdecwide256kl(&mut self, op0: Mem) {
90        self.emit(AESDECWIDE256KLM, op0.as_operand(), &NOREG, &NOREG, &NOREG);
91    }
92}
93
94/// `AESENC128KL`.
95///
96/// Supported operand variants:
97///
98/// ```text
99/// +---+----------+
100/// | # | Operands |
101/// +---+----------+
102/// | 1 | Xmm, Mem |
103/// +---+----------+
104/// ```
105pub trait Aesenc128klEmitter<A, B> {
106    fn aesenc128kl(&mut self, op0: A, op1: B);
107}
108
109impl<'a> Aesenc128klEmitter<Xmm, Mem> for Assembler<'a> {
110    fn aesenc128kl(&mut self, op0: Xmm, op1: Mem) {
111        self.emit(AESENC128KLRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
112    }
113}
114
115/// `AESENC256KL`.
116///
117/// Supported operand variants:
118///
119/// ```text
120/// +---+----------+
121/// | # | Operands |
122/// +---+----------+
123/// | 1 | Xmm, Mem |
124/// +---+----------+
125/// ```
126pub trait Aesenc256klEmitter<A, B> {
127    fn aesenc256kl(&mut self, op0: A, op1: B);
128}
129
130impl<'a> Aesenc256klEmitter<Xmm, Mem> for Assembler<'a> {
131    fn aesenc256kl(&mut self, op0: Xmm, op1: Mem) {
132        self.emit(AESENC256KLRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
133    }
134}
135
136/// `AESENCWIDE128KL`.
137///
138/// Supported operand variants:
139///
140/// ```text
141/// +---+----------+
142/// | # | Operands |
143/// +---+----------+
144/// | 1 | Mem      |
145/// +---+----------+
146/// ```
147pub trait Aesencwide128klEmitter<A> {
148    fn aesencwide128kl(&mut self, op0: A);
149}
150
151impl<'a> Aesencwide128klEmitter<Mem> for Assembler<'a> {
152    fn aesencwide128kl(&mut self, op0: Mem) {
153        self.emit(AESENCWIDE128KLM, op0.as_operand(), &NOREG, &NOREG, &NOREG);
154    }
155}
156
157/// `AESENCWIDE256KL`.
158///
159/// Supported operand variants:
160///
161/// ```text
162/// +---+----------+
163/// | # | Operands |
164/// +---+----------+
165/// | 1 | Mem      |
166/// +---+----------+
167/// ```
168pub trait Aesencwide256klEmitter<A> {
169    fn aesencwide256kl(&mut self, op0: A);
170}
171
172impl<'a> Aesencwide256klEmitter<Mem> for Assembler<'a> {
173    fn aesencwide256kl(&mut self, op0: Mem) {
174        self.emit(AESENCWIDE256KLM, op0.as_operand(), &NOREG, &NOREG, &NOREG);
175    }
176}
177
178/// `ENCODEKEY128`.
179///
180/// Supported operand variants:
181///
182/// ```text
183/// +---+----------+
184/// | # | Operands |
185/// +---+----------+
186/// | 1 | Gpd, Gpd |
187/// +---+----------+
188/// ```
189pub trait Encodekey128Emitter<A, B> {
190    fn encodekey128(&mut self, op0: A, op1: B);
191}
192
193impl<'a> Encodekey128Emitter<Gpd, Gpd> for Assembler<'a> {
194    fn encodekey128(&mut self, op0: Gpd, op1: Gpd) {
195        self.emit(ENCODEKEY128RR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
196    }
197}
198
199/// `ENCODEKEY256`.
200///
201/// Supported operand variants:
202///
203/// ```text
204/// +---+----------+
205/// | # | Operands |
206/// +---+----------+
207/// | 1 | Gpd, Gpd |
208/// +---+----------+
209/// ```
210pub trait Encodekey256Emitter<A, B> {
211    fn encodekey256(&mut self, op0: A, op1: B);
212}
213
214impl<'a> Encodekey256Emitter<Gpd, Gpd> for Assembler<'a> {
215    fn encodekey256(&mut self, op0: Gpd, op1: Gpd) {
216        self.emit(ENCODEKEY256RR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
217    }
218}
219
220/// `LOADIWKEY`.
221///
222/// Supported operand variants:
223///
224/// ```text
225/// +---+----------+
226/// | # | Operands |
227/// +---+----------+
228/// | 1 | Xmm, Xmm |
229/// +---+----------+
230/// ```
231pub trait LoadiwkeyEmitter<A, B> {
232    fn loadiwkey(&mut self, op0: A, op1: B);
233}
234
235impl<'a> LoadiwkeyEmitter<Xmm, Xmm> for Assembler<'a> {
236    fn loadiwkey(&mut self, op0: Xmm, op1: Xmm) {
237        self.emit(LOADIWKEYRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
238    }
239}
240
241
242impl<'a> Assembler<'a> {
243    /// `AESDEC128KL`.
244    ///
245    /// Supported operand variants:
246    ///
247    /// ```text
248    /// +---+----------+
249    /// | # | Operands |
250    /// +---+----------+
251    /// | 1 | Xmm, Mem |
252    /// +---+----------+
253    /// ```
254    #[inline]
255    pub fn aesdec128kl<A, B>(&mut self, op0: A, op1: B)
256    where Assembler<'a>: Aesdec128klEmitter<A, B> {
257        <Self as Aesdec128klEmitter<A, B>>::aesdec128kl(self, op0, op1);
258    }
259    /// `AESDEC256KL`.
260    ///
261    /// Supported operand variants:
262    ///
263    /// ```text
264    /// +---+----------+
265    /// | # | Operands |
266    /// +---+----------+
267    /// | 1 | Xmm, Mem |
268    /// +---+----------+
269    /// ```
270    #[inline]
271    pub fn aesdec256kl<A, B>(&mut self, op0: A, op1: B)
272    where Assembler<'a>: Aesdec256klEmitter<A, B> {
273        <Self as Aesdec256klEmitter<A, B>>::aesdec256kl(self, op0, op1);
274    }
275    /// `AESDECWIDE128KL`.
276    ///
277    /// Supported operand variants:
278    ///
279    /// ```text
280    /// +---+----------+
281    /// | # | Operands |
282    /// +---+----------+
283    /// | 1 | Mem      |
284    /// +---+----------+
285    /// ```
286    #[inline]
287    pub fn aesdecwide128kl<A>(&mut self, op0: A)
288    where Assembler<'a>: Aesdecwide128klEmitter<A> {
289        <Self as Aesdecwide128klEmitter<A>>::aesdecwide128kl(self, op0);
290    }
291    /// `AESDECWIDE256KL`.
292    ///
293    /// Supported operand variants:
294    ///
295    /// ```text
296    /// +---+----------+
297    /// | # | Operands |
298    /// +---+----------+
299    /// | 1 | Mem      |
300    /// +---+----------+
301    /// ```
302    #[inline]
303    pub fn aesdecwide256kl<A>(&mut self, op0: A)
304    where Assembler<'a>: Aesdecwide256klEmitter<A> {
305        <Self as Aesdecwide256klEmitter<A>>::aesdecwide256kl(self, op0);
306    }
307    /// `AESENC128KL`.
308    ///
309    /// Supported operand variants:
310    ///
311    /// ```text
312    /// +---+----------+
313    /// | # | Operands |
314    /// +---+----------+
315    /// | 1 | Xmm, Mem |
316    /// +---+----------+
317    /// ```
318    #[inline]
319    pub fn aesenc128kl<A, B>(&mut self, op0: A, op1: B)
320    where Assembler<'a>: Aesenc128klEmitter<A, B> {
321        <Self as Aesenc128klEmitter<A, B>>::aesenc128kl(self, op0, op1);
322    }
323    /// `AESENC256KL`.
324    ///
325    /// Supported operand variants:
326    ///
327    /// ```text
328    /// +---+----------+
329    /// | # | Operands |
330    /// +---+----------+
331    /// | 1 | Xmm, Mem |
332    /// +---+----------+
333    /// ```
334    #[inline]
335    pub fn aesenc256kl<A, B>(&mut self, op0: A, op1: B)
336    where Assembler<'a>: Aesenc256klEmitter<A, B> {
337        <Self as Aesenc256klEmitter<A, B>>::aesenc256kl(self, op0, op1);
338    }
339    /// `AESENCWIDE128KL`.
340    ///
341    /// Supported operand variants:
342    ///
343    /// ```text
344    /// +---+----------+
345    /// | # | Operands |
346    /// +---+----------+
347    /// | 1 | Mem      |
348    /// +---+----------+
349    /// ```
350    #[inline]
351    pub fn aesencwide128kl<A>(&mut self, op0: A)
352    where Assembler<'a>: Aesencwide128klEmitter<A> {
353        <Self as Aesencwide128klEmitter<A>>::aesencwide128kl(self, op0);
354    }
355    /// `AESENCWIDE256KL`.
356    ///
357    /// Supported operand variants:
358    ///
359    /// ```text
360    /// +---+----------+
361    /// | # | Operands |
362    /// +---+----------+
363    /// | 1 | Mem      |
364    /// +---+----------+
365    /// ```
366    #[inline]
367    pub fn aesencwide256kl<A>(&mut self, op0: A)
368    where Assembler<'a>: Aesencwide256klEmitter<A> {
369        <Self as Aesencwide256klEmitter<A>>::aesencwide256kl(self, op0);
370    }
371    /// `ENCODEKEY128`.
372    ///
373    /// Supported operand variants:
374    ///
375    /// ```text
376    /// +---+----------+
377    /// | # | Operands |
378    /// +---+----------+
379    /// | 1 | Gpd, Gpd |
380    /// +---+----------+
381    /// ```
382    #[inline]
383    pub fn encodekey128<A, B>(&mut self, op0: A, op1: B)
384    where Assembler<'a>: Encodekey128Emitter<A, B> {
385        <Self as Encodekey128Emitter<A, B>>::encodekey128(self, op0, op1);
386    }
387    /// `ENCODEKEY256`.
388    ///
389    /// Supported operand variants:
390    ///
391    /// ```text
392    /// +---+----------+
393    /// | # | Operands |
394    /// +---+----------+
395    /// | 1 | Gpd, Gpd |
396    /// +---+----------+
397    /// ```
398    #[inline]
399    pub fn encodekey256<A, B>(&mut self, op0: A, op1: B)
400    where Assembler<'a>: Encodekey256Emitter<A, B> {
401        <Self as Encodekey256Emitter<A, B>>::encodekey256(self, op0, op1);
402    }
403    /// `LOADIWKEY`.
404    ///
405    /// Supported operand variants:
406    ///
407    /// ```text
408    /// +---+----------+
409    /// | # | Operands |
410    /// +---+----------+
411    /// | 1 | Xmm, Xmm |
412    /// +---+----------+
413    /// ```
414    #[inline]
415    pub fn loadiwkey<A, B>(&mut self, op0: A, op1: B)
416    where Assembler<'a>: LoadiwkeyEmitter<A, B> {
417        <Self as LoadiwkeyEmitter<A, B>>::loadiwkey(self, op0, op1);
418    }
419}