Skip to main content

asmkit/x86/features/
CLFLUSHOPT.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/// `CLFLUSHOPT`.
11///
12/// Supported operand variants:
13///
14/// ```text
15/// +---+----------+
16/// | # | Operands |
17/// +---+----------+
18/// | 1 | Mem      |
19/// +---+----------+
20/// ```
21pub trait ClflushoptEmitter<A> {
22    fn clflushopt(&mut self, op0: A);
23}
24
25impl<'a> ClflushoptEmitter<Mem> for Assembler<'a> {
26    fn clflushopt(&mut self, op0: Mem) {
27        self.emit(CLFLUSHOPTM, op0.as_operand(), &NOREG, &NOREG, &NOREG);
28    }
29}
30
31
32impl<'a> Assembler<'a> {
33    /// `CLFLUSHOPT`.
34    ///
35    /// Supported operand variants:
36    ///
37    /// ```text
38    /// +---+----------+
39    /// | # | Operands |
40    /// +---+----------+
41    /// | 1 | Mem      |
42    /// +---+----------+
43    /// ```
44    #[inline]
45    pub fn clflushopt<A>(&mut self, op0: A)
46    where Assembler<'a>: ClflushoptEmitter<A> {
47        <Self as ClflushoptEmitter<A>>::clflushopt(self, op0);
48    }
49}