asmkit/x86/features/
SSE4A.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 SseExtrqEmitter<A, B> {
23 fn sse_extrq(&mut self, op0: A, op1: B);
24}
25
26impl<'a> SseExtrqEmitter<Xmm, Imm> for Assembler<'a> {
27 fn sse_extrq(&mut self, op0: Xmm, op1: Imm) {
28 self.emit(SSE_EXTRQRI, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
29 }
30}
31
32impl<'a> SseExtrqEmitter<Xmm, Xmm> for Assembler<'a> {
33 fn sse_extrq(&mut self, op0: Xmm, op1: Xmm) {
34 self.emit(SSE_EXTRQRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
35 }
36}
37
38pub trait SseInsertqEmitter_2<A, B> {
50 fn sse_insertq_2(&mut self, op0: A, op1: B);
51}
52
53impl<'a> SseInsertqEmitter_2<Xmm, Xmm> for Assembler<'a> {
54 fn sse_insertq_2(&mut self, op0: Xmm, op1: Xmm) {
55 self.emit(SSE_INSERTQRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
56 }
57}
58
59pub trait SseInsertqEmitter_3<A, B, C> {
71 fn sse_insertq_3(&mut self, op0: A, op1: B, op2: C);
72}
73
74impl<'a> SseInsertqEmitter_3<Xmm, Xmm, Imm> for Assembler<'a> {
75 fn sse_insertq_3(&mut self, op0: Xmm, op1: Xmm, op2: Imm) {
76 self.emit(SSE_INSERTQRRI, op0.as_operand(), op1.as_operand(), op2.as_operand(), &NOREG);
77 }
78}
79
80
81impl<'a> Assembler<'a> {
82 #[inline]
95 pub fn sse_extrq<A, B>(&mut self, op0: A, op1: B)
96 where Assembler<'a>: SseExtrqEmitter<A, B> {
97 <Self as SseExtrqEmitter<A, B>>::sse_extrq(self, op0, op1);
98 }
99 #[inline]
111 pub fn sse_insertq_2<A, B>(&mut self, op0: A, op1: B)
112 where Assembler<'a>: SseInsertqEmitter_2<A, B> {
113 <Self as SseInsertqEmitter_2<A, B>>::sse_insertq_2(self, op0, op1);
114 }
115 #[inline]
127 pub fn sse_insertq_3<A, B, C>(&mut self, op0: A, op1: B, op2: C)
128 where Assembler<'a>: SseInsertqEmitter_3<A, B, C> {
129 <Self as SseInsertqEmitter_3<A, B, C>>::sse_insertq_3(self, op0, op1, op2);
130 }
131}