asmkit/x86/features/SSSE3.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/// `MMX_PABSB` (PABSB).
11/// PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). PABSB operates on signed bytes, PABSW operates on signed 16-bit words, and PABSD operates on signed 32-bit integers.
12///
13///
14/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PABSB%3APABSW%3APABSD%3APABSQ.html).
15///
16/// Supported operand variants:
17///
18/// ```text
19/// +---+----------+
20/// | # | Operands |
21/// +---+----------+
22/// | 1 | Mm, Mem |
23/// | 2 | Mm, Mm |
24/// +---+----------+
25/// ```
26pub trait MmxPabsbEmitter<A, B> {
27 fn mmx_pabsb(&mut self, op0: A, op1: B);
28}
29
30impl<'a> MmxPabsbEmitter<Mm, Mm> for Assembler<'a> {
31 fn mmx_pabsb(&mut self, op0: Mm, op1: Mm) {
32 self.emit(MMX_PABSBRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
33 }
34}
35
36impl<'a> MmxPabsbEmitter<Mm, Mem> for Assembler<'a> {
37 fn mmx_pabsb(&mut self, op0: Mm, op1: Mem) {
38 self.emit(MMX_PABSBRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
39 }
40}
41
42/// `MMX_PABSD` (PABSD).
43/// PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). PABSB operates on signed bytes, PABSW operates on signed 16-bit words, and PABSD operates on signed 32-bit integers.
44///
45///
46/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PABSB%3APABSW%3APABSD%3APABSQ.html).
47///
48/// Supported operand variants:
49///
50/// ```text
51/// +---+----------+
52/// | # | Operands |
53/// +---+----------+
54/// | 1 | Mm, Mem |
55/// | 2 | Mm, Mm |
56/// +---+----------+
57/// ```
58pub trait MmxPabsdEmitter<A, B> {
59 fn mmx_pabsd(&mut self, op0: A, op1: B);
60}
61
62impl<'a> MmxPabsdEmitter<Mm, Mm> for Assembler<'a> {
63 fn mmx_pabsd(&mut self, op0: Mm, op1: Mm) {
64 self.emit(MMX_PABSDRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
65 }
66}
67
68impl<'a> MmxPabsdEmitter<Mm, Mem> for Assembler<'a> {
69 fn mmx_pabsd(&mut self, op0: Mm, op1: Mem) {
70 self.emit(MMX_PABSDRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
71 }
72}
73
74/// `MMX_PABSW` (PABSW).
75/// PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). PABSB operates on signed bytes, PABSW operates on signed 16-bit words, and PABSD operates on signed 32-bit integers.
76///
77///
78/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PABSB%3APABSW%3APABSD%3APABSQ.html).
79///
80/// Supported operand variants:
81///
82/// ```text
83/// +---+----------+
84/// | # | Operands |
85/// +---+----------+
86/// | 1 | Mm, Mem |
87/// | 2 | Mm, Mm |
88/// +---+----------+
89/// ```
90pub trait MmxPabswEmitter<A, B> {
91 fn mmx_pabsw(&mut self, op0: A, op1: B);
92}
93
94impl<'a> MmxPabswEmitter<Mm, Mm> for Assembler<'a> {
95 fn mmx_pabsw(&mut self, op0: Mm, op1: Mm) {
96 self.emit(MMX_PABSWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
97 }
98}
99
100impl<'a> MmxPabswEmitter<Mm, Mem> for Assembler<'a> {
101 fn mmx_pabsw(&mut self, op0: Mm, op1: Mem) {
102 self.emit(MMX_PABSWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
103 }
104}
105
106/// `MMX_PALIGNR` (PALIGNR).
107/// (V)PALIGNR concatenates the destination operand (the first operand) and the source operand (the second operand) into an intermediate composite, shifts the composite at byte granularity to the right by a constant immediate, and extracts the right-aligned result into the destination. The first and the second operands can be an MMX, XMM or a YMM register. The immediate value is considered unsigned. Immediate shift counts larger than the 2L (i.e., 32 for 128-bit operands, or 16 for 64-bit operands) produce a zero result. Both operands can be MMX registers, XMM registers or YMM registers. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
108///
109///
110/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PALIGNR.html).
111///
112/// Supported operand variants:
113///
114/// ```text
115/// +---+--------------+
116/// | # | Operands |
117/// +---+--------------+
118/// | 1 | Mm, Mem, Imm |
119/// | 2 | Mm, Mm, Imm |
120/// +---+--------------+
121/// ```
122pub trait MmxPalignrEmitter<A, B, C> {
123 fn mmx_palignr(&mut self, op0: A, op1: B, op2: C);
124}
125
126impl<'a> MmxPalignrEmitter<Mm, Mm, Imm> for Assembler<'a> {
127 fn mmx_palignr(&mut self, op0: Mm, op1: Mm, op2: Imm) {
128 self.emit(MMX_PALIGNRRRI, op0.as_operand(), op1.as_operand(), op2.as_operand(), &NOREG);
129 }
130}
131
132impl<'a> MmxPalignrEmitter<Mm, Mem, Imm> for Assembler<'a> {
133 fn mmx_palignr(&mut self, op0: Mm, op1: Mem, op2: Imm) {
134 self.emit(MMX_PALIGNRRMI, op0.as_operand(), op1.as_operand(), op2.as_operand(), &NOREG);
135 }
136}
137
138/// `MMX_PHADDD` (PHADDD).
139/// (V)PHADDW adds two adjacent 16-bit signed integers horizontally from the source and destination operands and packs the 16-bit signed results to the destination operand (first operand). (V)PHADDD adds two adjacent 32-bit signed integers horizontally from the source and destination operands and packs the 32-bit signed results to the destination operand (first operand). When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
140///
141///
142/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHADDW%3APHADDD.html).
143///
144/// Supported operand variants:
145///
146/// ```text
147/// +---+----------+
148/// | # | Operands |
149/// +---+----------+
150/// | 1 | Mm, Mem |
151/// | 2 | Mm, Mm |
152/// +---+----------+
153/// ```
154pub trait MmxPhadddEmitter<A, B> {
155 fn mmx_phaddd(&mut self, op0: A, op1: B);
156}
157
158impl<'a> MmxPhadddEmitter<Mm, Mm> for Assembler<'a> {
159 fn mmx_phaddd(&mut self, op0: Mm, op1: Mm) {
160 self.emit(MMX_PHADDDRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
161 }
162}
163
164impl<'a> MmxPhadddEmitter<Mm, Mem> for Assembler<'a> {
165 fn mmx_phaddd(&mut self, op0: Mm, op1: Mem) {
166 self.emit(MMX_PHADDDRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
167 }
168}
169
170/// `MMX_PHADDSW` (PHADDSW).
171/// (V)PHADDSW adds two adjacent signed 16-bit integers horizontally from the source and destination operands and saturates the signed results; packs the signed, saturated 16-bit results to the destination operand (first operand) When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
172///
173///
174/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHADDSW.html).
175///
176/// Supported operand variants:
177///
178/// ```text
179/// +---+----------+
180/// | # | Operands |
181/// +---+----------+
182/// | 1 | Mm, Mem |
183/// | 2 | Mm, Mm |
184/// +---+----------+
185/// ```
186pub trait MmxPhaddswEmitter<A, B> {
187 fn mmx_phaddsw(&mut self, op0: A, op1: B);
188}
189
190impl<'a> MmxPhaddswEmitter<Mm, Mm> for Assembler<'a> {
191 fn mmx_phaddsw(&mut self, op0: Mm, op1: Mm) {
192 self.emit(MMX_PHADDSWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
193 }
194}
195
196impl<'a> MmxPhaddswEmitter<Mm, Mem> for Assembler<'a> {
197 fn mmx_phaddsw(&mut self, op0: Mm, op1: Mem) {
198 self.emit(MMX_PHADDSWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
199 }
200}
201
202/// `MMX_PHADDW` (PHADDW).
203/// (V)PHADDW adds two adjacent 16-bit signed integers horizontally from the source and destination operands and packs the 16-bit signed results to the destination operand (first operand). (V)PHADDD adds two adjacent 32-bit signed integers horizontally from the source and destination operands and packs the 32-bit signed results to the destination operand (first operand). When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
204///
205///
206/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHADDW%3APHADDD.html).
207///
208/// Supported operand variants:
209///
210/// ```text
211/// +---+----------+
212/// | # | Operands |
213/// +---+----------+
214/// | 1 | Mm, Mem |
215/// | 2 | Mm, Mm |
216/// +---+----------+
217/// ```
218pub trait MmxPhaddwEmitter<A, B> {
219 fn mmx_phaddw(&mut self, op0: A, op1: B);
220}
221
222impl<'a> MmxPhaddwEmitter<Mm, Mm> for Assembler<'a> {
223 fn mmx_phaddw(&mut self, op0: Mm, op1: Mm) {
224 self.emit(MMX_PHADDWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
225 }
226}
227
228impl<'a> MmxPhaddwEmitter<Mm, Mem> for Assembler<'a> {
229 fn mmx_phaddw(&mut self, op0: Mm, op1: Mem) {
230 self.emit(MMX_PHADDWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
231 }
232}
233
234/// `MMX_PHSUBD` (PHSUBD).
235/// (V)PHSUBW performs horizontal subtraction on each adjacent pair of 16-bit signed integers by subtracting the most significant word from the least significant word of each pair in the source and destination operands, and packs the signed 16-bit results to the destination operand (first operand). (V)PHSUBD performs horizontal subtraction on each adjacent pair of 32-bit signed integers by subtracting the most significant doubleword from the least significant doubleword of each pair, and packs the signed 32-bit result to the destination operand. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
236///
237///
238/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHSUBW%3APHSUBD.html).
239///
240/// Supported operand variants:
241///
242/// ```text
243/// +---+----------+
244/// | # | Operands |
245/// +---+----------+
246/// | 1 | Mm, Mem |
247/// | 2 | Mm, Mm |
248/// +---+----------+
249/// ```
250pub trait MmxPhsubdEmitter<A, B> {
251 fn mmx_phsubd(&mut self, op0: A, op1: B);
252}
253
254impl<'a> MmxPhsubdEmitter<Mm, Mm> for Assembler<'a> {
255 fn mmx_phsubd(&mut self, op0: Mm, op1: Mm) {
256 self.emit(MMX_PHSUBDRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
257 }
258}
259
260impl<'a> MmxPhsubdEmitter<Mm, Mem> for Assembler<'a> {
261 fn mmx_phsubd(&mut self, op0: Mm, op1: Mem) {
262 self.emit(MMX_PHSUBDRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
263 }
264}
265
266/// `MMX_PHSUBSW` (PHSUBSW).
267/// (V)PHSUBSW performs horizontal subtraction on each adjacent pair of 16-bit signed integers by subtracting the most significant word from the least significant word of each pair in the source and destination operands. The signed, saturated 16-bit results are packed to the destination operand (first operand). When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
268///
269///
270/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHSUBSW.html).
271///
272/// Supported operand variants:
273///
274/// ```text
275/// +---+----------+
276/// | # | Operands |
277/// +---+----------+
278/// | 1 | Mm, Mem |
279/// | 2 | Mm, Mm |
280/// +---+----------+
281/// ```
282pub trait MmxPhsubswEmitter<A, B> {
283 fn mmx_phsubsw(&mut self, op0: A, op1: B);
284}
285
286impl<'a> MmxPhsubswEmitter<Mm, Mm> for Assembler<'a> {
287 fn mmx_phsubsw(&mut self, op0: Mm, op1: Mm) {
288 self.emit(MMX_PHSUBSWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
289 }
290}
291
292impl<'a> MmxPhsubswEmitter<Mm, Mem> for Assembler<'a> {
293 fn mmx_phsubsw(&mut self, op0: Mm, op1: Mem) {
294 self.emit(MMX_PHSUBSWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
295 }
296}
297
298/// `MMX_PHSUBW` (PHSUBW).
299/// (V)PHSUBW performs horizontal subtraction on each adjacent pair of 16-bit signed integers by subtracting the most significant word from the least significant word of each pair in the source and destination operands, and packs the signed 16-bit results to the destination operand (first operand). (V)PHSUBD performs horizontal subtraction on each adjacent pair of 32-bit signed integers by subtracting the most significant doubleword from the least significant doubleword of each pair, and packs the signed 32-bit result to the destination operand. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
300///
301///
302/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHSUBW%3APHSUBD.html).
303///
304/// Supported operand variants:
305///
306/// ```text
307/// +---+----------+
308/// | # | Operands |
309/// +---+----------+
310/// | 1 | Mm, Mem |
311/// | 2 | Mm, Mm |
312/// +---+----------+
313/// ```
314pub trait MmxPhsubwEmitter<A, B> {
315 fn mmx_phsubw(&mut self, op0: A, op1: B);
316}
317
318impl<'a> MmxPhsubwEmitter<Mm, Mm> for Assembler<'a> {
319 fn mmx_phsubw(&mut self, op0: Mm, op1: Mm) {
320 self.emit(MMX_PHSUBWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
321 }
322}
323
324impl<'a> MmxPhsubwEmitter<Mm, Mem> for Assembler<'a> {
325 fn mmx_phsubw(&mut self, op0: Mm, op1: Mem) {
326 self.emit(MMX_PHSUBWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
327 }
328}
329
330/// `MMX_PMADDUBSW` (PMADDUBSW).
331/// (V)PMADDUBSW multiplies vertically each unsigned byte of the destination operand (first operand) with the corresponding signed byte of the source operand (second operand), producing intermediate signed 16-bit integers. Each adjacent pair of signed words is added and the saturated result is packed to the destination operand. For example, the lowest-order bytes (bits 7-0) in the source and destination operands are multiplied and the intermediate signed word result is added with the corresponding intermediate result from the 2nd lowest-order bytes (bits 15-8) of the operands; the sign-saturated result is stored in the lowest word of the destination register (15-0). The same operation is performed on the other pairs of adjacent bytes. Both operands can be MMX register or XMM registers. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
332///
333///
334/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PMADDUBSW.html).
335///
336/// Supported operand variants:
337///
338/// ```text
339/// +---+----------+
340/// | # | Operands |
341/// +---+----------+
342/// | 1 | Mm, Mem |
343/// | 2 | Mm, Mm |
344/// +---+----------+
345/// ```
346pub trait MmxPmaddubswEmitter<A, B> {
347 fn mmx_pmaddubsw(&mut self, op0: A, op1: B);
348}
349
350impl<'a> MmxPmaddubswEmitter<Mm, Mm> for Assembler<'a> {
351 fn mmx_pmaddubsw(&mut self, op0: Mm, op1: Mm) {
352 self.emit(MMX_PMADDUBSWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
353 }
354}
355
356impl<'a> MmxPmaddubswEmitter<Mm, Mem> for Assembler<'a> {
357 fn mmx_pmaddubsw(&mut self, op0: Mm, op1: Mem) {
358 self.emit(MMX_PMADDUBSWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
359 }
360}
361
362/// `MMX_PMULHRSW` (PMULHRSW).
363/// PMULHRSW multiplies vertically each signed 16-bit integer from the destination operand (first operand) with the corresponding signed 16-bit integer of the source operand (second operand), producing intermediate, signed 32-bit integers. Each intermediate 32-bit integer is truncated to the 18 most significant bits. Rounding is always performed by adding 1 to the least significant bit of the 18-bit intermediate result. The final result is obtained by selecting the 16 bits immediately to the right of the most significant bit of each 18-bit intermediate result and packed to the destination operand.
364///
365///
366/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PMULHRSW.html).
367///
368/// Supported operand variants:
369///
370/// ```text
371/// +---+----------+
372/// | # | Operands |
373/// +---+----------+
374/// | 1 | Mm, Mem |
375/// | 2 | Mm, Mm |
376/// +---+----------+
377/// ```
378pub trait MmxPmulhrswEmitter<A, B> {
379 fn mmx_pmulhrsw(&mut self, op0: A, op1: B);
380}
381
382impl<'a> MmxPmulhrswEmitter<Mm, Mm> for Assembler<'a> {
383 fn mmx_pmulhrsw(&mut self, op0: Mm, op1: Mm) {
384 self.emit(MMX_PMULHRSWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
385 }
386}
387
388impl<'a> MmxPmulhrswEmitter<Mm, Mem> for Assembler<'a> {
389 fn mmx_pmulhrsw(&mut self, op0: Mm, op1: Mem) {
390 self.emit(MMX_PMULHRSWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
391 }
392}
393
394/// `MMX_PSHUFB` (PSHUFB).
395/// PSHUFB performs in-place shuffles of bytes in the destination operand (the first operand) according to the shuffle control mask in the source operand (the second operand). The instruction permutes the data in the destination operand, leaving the shuffle mask unaffected. If the most significant bit (bit[7]) of each byte of the shuffle control mask is set, then constant zero is written in the result byte. Each byte in the shuffle control mask forms an index to permute the corresponding byte in the destination operand. The value of each index is the least significant 4 bits (128-bit operation) or 3 bits (64-bit operation) of the shuffle control byte. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
396///
397///
398/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSHUFB.html).
399///
400/// Supported operand variants:
401///
402/// ```text
403/// +---+----------+
404/// | # | Operands |
405/// +---+----------+
406/// | 1 | Mm, Mem |
407/// | 2 | Mm, Mm |
408/// +---+----------+
409/// ```
410pub trait MmxPshufbEmitter<A, B> {
411 fn mmx_pshufb(&mut self, op0: A, op1: B);
412}
413
414impl<'a> MmxPshufbEmitter<Mm, Mm> for Assembler<'a> {
415 fn mmx_pshufb(&mut self, op0: Mm, op1: Mm) {
416 self.emit(MMX_PSHUFBRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
417 }
418}
419
420impl<'a> MmxPshufbEmitter<Mm, Mem> for Assembler<'a> {
421 fn mmx_pshufb(&mut self, op0: Mm, op1: Mem) {
422 self.emit(MMX_PSHUFBRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
423 }
424}
425
426/// `MMX_PSIGNB` (PSIGNB).
427/// (V)PSIGNB/(V)PSIGNW/(V)PSIGND negates each data element of the destination operand (the first operand) if the signed integer value of the corresponding data element in the source operand (the second operand) is less than zero. If the signed integer value of a data element in the source operand is positive, the corresponding data element in the destination operand is unchanged. If a data element in the source operand is zero, the corresponding data element in the destination operand is set to zero.
428///
429///
430/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSIGNB%3APSIGNW%3APSIGND.html).
431///
432/// Supported operand variants:
433///
434/// ```text
435/// +---+----------+
436/// | # | Operands |
437/// +---+----------+
438/// | 1 | Mm, Mem |
439/// | 2 | Mm, Mm |
440/// +---+----------+
441/// ```
442pub trait MmxPsignbEmitter<A, B> {
443 fn mmx_psignb(&mut self, op0: A, op1: B);
444}
445
446impl<'a> MmxPsignbEmitter<Mm, Mm> for Assembler<'a> {
447 fn mmx_psignb(&mut self, op0: Mm, op1: Mm) {
448 self.emit(MMX_PSIGNBRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
449 }
450}
451
452impl<'a> MmxPsignbEmitter<Mm, Mem> for Assembler<'a> {
453 fn mmx_psignb(&mut self, op0: Mm, op1: Mem) {
454 self.emit(MMX_PSIGNBRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
455 }
456}
457
458/// `MMX_PSIGND` (PSIGND).
459/// (V)PSIGNB/(V)PSIGNW/(V)PSIGND negates each data element of the destination operand (the first operand) if the signed integer value of the corresponding data element in the source operand (the second operand) is less than zero. If the signed integer value of a data element in the source operand is positive, the corresponding data element in the destination operand is unchanged. If a data element in the source operand is zero, the corresponding data element in the destination operand is set to zero.
460///
461///
462/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSIGNB%3APSIGNW%3APSIGND.html).
463///
464/// Supported operand variants:
465///
466/// ```text
467/// +---+----------+
468/// | # | Operands |
469/// +---+----------+
470/// | 1 | Mm, Mem |
471/// | 2 | Mm, Mm |
472/// +---+----------+
473/// ```
474pub trait MmxPsigndEmitter<A, B> {
475 fn mmx_psignd(&mut self, op0: A, op1: B);
476}
477
478impl<'a> MmxPsigndEmitter<Mm, Mm> for Assembler<'a> {
479 fn mmx_psignd(&mut self, op0: Mm, op1: Mm) {
480 self.emit(MMX_PSIGNDRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
481 }
482}
483
484impl<'a> MmxPsigndEmitter<Mm, Mem> for Assembler<'a> {
485 fn mmx_psignd(&mut self, op0: Mm, op1: Mem) {
486 self.emit(MMX_PSIGNDRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
487 }
488}
489
490/// `MMX_PSIGNW` (PSIGNW).
491/// (V)PSIGNB/(V)PSIGNW/(V)PSIGND negates each data element of the destination operand (the first operand) if the signed integer value of the corresponding data element in the source operand (the second operand) is less than zero. If the signed integer value of a data element in the source operand is positive, the corresponding data element in the destination operand is unchanged. If a data element in the source operand is zero, the corresponding data element in the destination operand is set to zero.
492///
493///
494/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSIGNB%3APSIGNW%3APSIGND.html).
495///
496/// Supported operand variants:
497///
498/// ```text
499/// +---+----------+
500/// | # | Operands |
501/// +---+----------+
502/// | 1 | Mm, Mem |
503/// | 2 | Mm, Mm |
504/// +---+----------+
505/// ```
506pub trait MmxPsignwEmitter<A, B> {
507 fn mmx_psignw(&mut self, op0: A, op1: B);
508}
509
510impl<'a> MmxPsignwEmitter<Mm, Mm> for Assembler<'a> {
511 fn mmx_psignw(&mut self, op0: Mm, op1: Mm) {
512 self.emit(MMX_PSIGNWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
513 }
514}
515
516impl<'a> MmxPsignwEmitter<Mm, Mem> for Assembler<'a> {
517 fn mmx_psignw(&mut self, op0: Mm, op1: Mem) {
518 self.emit(MMX_PSIGNWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
519 }
520}
521
522/// `SSE_PABSB` (PABSB).
523/// PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). PABSB operates on signed bytes, PABSW operates on signed 16-bit words, and PABSD operates on signed 32-bit integers.
524///
525///
526/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PABSB%3APABSW%3APABSD%3APABSQ.html).
527///
528/// Supported operand variants:
529///
530/// ```text
531/// +---+----------+
532/// | # | Operands |
533/// +---+----------+
534/// | 1 | Xmm, Mem |
535/// | 2 | Xmm, Xmm |
536/// +---+----------+
537/// ```
538pub trait SsePabsbEmitter<A, B> {
539 fn sse_pabsb(&mut self, op0: A, op1: B);
540}
541
542impl<'a> SsePabsbEmitter<Xmm, Xmm> for Assembler<'a> {
543 fn sse_pabsb(&mut self, op0: Xmm, op1: Xmm) {
544 self.emit(SSE_PABSBRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
545 }
546}
547
548impl<'a> SsePabsbEmitter<Xmm, Mem> for Assembler<'a> {
549 fn sse_pabsb(&mut self, op0: Xmm, op1: Mem) {
550 self.emit(SSE_PABSBRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
551 }
552}
553
554/// `SSE_PABSD` (PABSD).
555/// PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). PABSB operates on signed bytes, PABSW operates on signed 16-bit words, and PABSD operates on signed 32-bit integers.
556///
557///
558/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PABSB%3APABSW%3APABSD%3APABSQ.html).
559///
560/// Supported operand variants:
561///
562/// ```text
563/// +---+----------+
564/// | # | Operands |
565/// +---+----------+
566/// | 1 | Xmm, Mem |
567/// | 2 | Xmm, Xmm |
568/// +---+----------+
569/// ```
570pub trait SsePabsdEmitter<A, B> {
571 fn sse_pabsd(&mut self, op0: A, op1: B);
572}
573
574impl<'a> SsePabsdEmitter<Xmm, Xmm> for Assembler<'a> {
575 fn sse_pabsd(&mut self, op0: Xmm, op1: Xmm) {
576 self.emit(SSE_PABSDRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
577 }
578}
579
580impl<'a> SsePabsdEmitter<Xmm, Mem> for Assembler<'a> {
581 fn sse_pabsd(&mut self, op0: Xmm, op1: Mem) {
582 self.emit(SSE_PABSDRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
583 }
584}
585
586/// `SSE_PABSW` (PABSW).
587/// PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). PABSB operates on signed bytes, PABSW operates on signed 16-bit words, and PABSD operates on signed 32-bit integers.
588///
589///
590/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PABSB%3APABSW%3APABSD%3APABSQ.html).
591///
592/// Supported operand variants:
593///
594/// ```text
595/// +---+----------+
596/// | # | Operands |
597/// +---+----------+
598/// | 1 | Xmm, Mem |
599/// | 2 | Xmm, Xmm |
600/// +---+----------+
601/// ```
602pub trait SsePabswEmitter<A, B> {
603 fn sse_pabsw(&mut self, op0: A, op1: B);
604}
605
606impl<'a> SsePabswEmitter<Xmm, Xmm> for Assembler<'a> {
607 fn sse_pabsw(&mut self, op0: Xmm, op1: Xmm) {
608 self.emit(SSE_PABSWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
609 }
610}
611
612impl<'a> SsePabswEmitter<Xmm, Mem> for Assembler<'a> {
613 fn sse_pabsw(&mut self, op0: Xmm, op1: Mem) {
614 self.emit(SSE_PABSWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
615 }
616}
617
618/// `SSE_PALIGNR` (PALIGNR).
619/// (V)PALIGNR concatenates the destination operand (the first operand) and the source operand (the second operand) into an intermediate composite, shifts the composite at byte granularity to the right by a constant immediate, and extracts the right-aligned result into the destination. The first and the second operands can be an MMX, XMM or a YMM register. The immediate value is considered unsigned. Immediate shift counts larger than the 2L (i.e., 32 for 128-bit operands, or 16 for 64-bit operands) produce a zero result. Both operands can be MMX registers, XMM registers or YMM registers. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
620///
621///
622/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PALIGNR.html).
623///
624/// Supported operand variants:
625///
626/// ```text
627/// +---+---------------+
628/// | # | Operands |
629/// +---+---------------+
630/// | 1 | Xmm, Mem, Imm |
631/// | 2 | Xmm, Xmm, Imm |
632/// +---+---------------+
633/// ```
634pub trait SsePalignrEmitter<A, B, C> {
635 fn sse_palignr(&mut self, op0: A, op1: B, op2: C);
636}
637
638impl<'a> SsePalignrEmitter<Xmm, Xmm, Imm> for Assembler<'a> {
639 fn sse_palignr(&mut self, op0: Xmm, op1: Xmm, op2: Imm) {
640 self.emit(SSE_PALIGNRRRI, op0.as_operand(), op1.as_operand(), op2.as_operand(), &NOREG);
641 }
642}
643
644impl<'a> SsePalignrEmitter<Xmm, Mem, Imm> for Assembler<'a> {
645 fn sse_palignr(&mut self, op0: Xmm, op1: Mem, op2: Imm) {
646 self.emit(SSE_PALIGNRRMI, op0.as_operand(), op1.as_operand(), op2.as_operand(), &NOREG);
647 }
648}
649
650/// `SSE_PHADDD` (PHADDD).
651/// (V)PHADDW adds two adjacent 16-bit signed integers horizontally from the source and destination operands and packs the 16-bit signed results to the destination operand (first operand). (V)PHADDD adds two adjacent 32-bit signed integers horizontally from the source and destination operands and packs the 32-bit signed results to the destination operand (first operand). When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
652///
653///
654/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHADDW%3APHADDD.html).
655///
656/// Supported operand variants:
657///
658/// ```text
659/// +---+----------+
660/// | # | Operands |
661/// +---+----------+
662/// | 1 | Xmm, Mem |
663/// | 2 | Xmm, Xmm |
664/// +---+----------+
665/// ```
666pub trait SsePhadddEmitter<A, B> {
667 fn sse_phaddd(&mut self, op0: A, op1: B);
668}
669
670impl<'a> SsePhadddEmitter<Xmm, Xmm> for Assembler<'a> {
671 fn sse_phaddd(&mut self, op0: Xmm, op1: Xmm) {
672 self.emit(SSE_PHADDDRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
673 }
674}
675
676impl<'a> SsePhadddEmitter<Xmm, Mem> for Assembler<'a> {
677 fn sse_phaddd(&mut self, op0: Xmm, op1: Mem) {
678 self.emit(SSE_PHADDDRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
679 }
680}
681
682/// `SSE_PHADDSW` (PHADDSW).
683/// (V)PHADDSW adds two adjacent signed 16-bit integers horizontally from the source and destination operands and saturates the signed results; packs the signed, saturated 16-bit results to the destination operand (first operand) When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
684///
685///
686/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHADDSW.html).
687///
688/// Supported operand variants:
689///
690/// ```text
691/// +---+----------+
692/// | # | Operands |
693/// +---+----------+
694/// | 1 | Xmm, Mem |
695/// | 2 | Xmm, Xmm |
696/// +---+----------+
697/// ```
698pub trait SsePhaddswEmitter<A, B> {
699 fn sse_phaddsw(&mut self, op0: A, op1: B);
700}
701
702impl<'a> SsePhaddswEmitter<Xmm, Xmm> for Assembler<'a> {
703 fn sse_phaddsw(&mut self, op0: Xmm, op1: Xmm) {
704 self.emit(SSE_PHADDSWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
705 }
706}
707
708impl<'a> SsePhaddswEmitter<Xmm, Mem> for Assembler<'a> {
709 fn sse_phaddsw(&mut self, op0: Xmm, op1: Mem) {
710 self.emit(SSE_PHADDSWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
711 }
712}
713
714/// `SSE_PHADDW` (PHADDW).
715/// (V)PHADDW adds two adjacent 16-bit signed integers horizontally from the source and destination operands and packs the 16-bit signed results to the destination operand (first operand). (V)PHADDD adds two adjacent 32-bit signed integers horizontally from the source and destination operands and packs the 32-bit signed results to the destination operand (first operand). When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
716///
717///
718/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHADDW%3APHADDD.html).
719///
720/// Supported operand variants:
721///
722/// ```text
723/// +---+----------+
724/// | # | Operands |
725/// +---+----------+
726/// | 1 | Xmm, Mem |
727/// | 2 | Xmm, Xmm |
728/// +---+----------+
729/// ```
730pub trait SsePhaddwEmitter<A, B> {
731 fn sse_phaddw(&mut self, op0: A, op1: B);
732}
733
734impl<'a> SsePhaddwEmitter<Xmm, Xmm> for Assembler<'a> {
735 fn sse_phaddw(&mut self, op0: Xmm, op1: Xmm) {
736 self.emit(SSE_PHADDWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
737 }
738}
739
740impl<'a> SsePhaddwEmitter<Xmm, Mem> for Assembler<'a> {
741 fn sse_phaddw(&mut self, op0: Xmm, op1: Mem) {
742 self.emit(SSE_PHADDWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
743 }
744}
745
746/// `SSE_PHSUBD` (PHSUBD).
747/// (V)PHSUBW performs horizontal subtraction on each adjacent pair of 16-bit signed integers by subtracting the most significant word from the least significant word of each pair in the source and destination operands, and packs the signed 16-bit results to the destination operand (first operand). (V)PHSUBD performs horizontal subtraction on each adjacent pair of 32-bit signed integers by subtracting the most significant doubleword from the least significant doubleword of each pair, and packs the signed 32-bit result to the destination operand. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
748///
749///
750/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHSUBW%3APHSUBD.html).
751///
752/// Supported operand variants:
753///
754/// ```text
755/// +---+----------+
756/// | # | Operands |
757/// +---+----------+
758/// | 1 | Xmm, Mem |
759/// | 2 | Xmm, Xmm |
760/// +---+----------+
761/// ```
762pub trait SsePhsubdEmitter<A, B> {
763 fn sse_phsubd(&mut self, op0: A, op1: B);
764}
765
766impl<'a> SsePhsubdEmitter<Xmm, Xmm> for Assembler<'a> {
767 fn sse_phsubd(&mut self, op0: Xmm, op1: Xmm) {
768 self.emit(SSE_PHSUBDRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
769 }
770}
771
772impl<'a> SsePhsubdEmitter<Xmm, Mem> for Assembler<'a> {
773 fn sse_phsubd(&mut self, op0: Xmm, op1: Mem) {
774 self.emit(SSE_PHSUBDRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
775 }
776}
777
778/// `SSE_PHSUBSW` (PHSUBSW).
779/// (V)PHSUBSW performs horizontal subtraction on each adjacent pair of 16-bit signed integers by subtracting the most significant word from the least significant word of each pair in the source and destination operands. The signed, saturated 16-bit results are packed to the destination operand (first operand). When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
780///
781///
782/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHSUBSW.html).
783///
784/// Supported operand variants:
785///
786/// ```text
787/// +---+----------+
788/// | # | Operands |
789/// +---+----------+
790/// | 1 | Xmm, Mem |
791/// | 2 | Xmm, Xmm |
792/// +---+----------+
793/// ```
794pub trait SsePhsubswEmitter<A, B> {
795 fn sse_phsubsw(&mut self, op0: A, op1: B);
796}
797
798impl<'a> SsePhsubswEmitter<Xmm, Xmm> for Assembler<'a> {
799 fn sse_phsubsw(&mut self, op0: Xmm, op1: Xmm) {
800 self.emit(SSE_PHSUBSWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
801 }
802}
803
804impl<'a> SsePhsubswEmitter<Xmm, Mem> for Assembler<'a> {
805 fn sse_phsubsw(&mut self, op0: Xmm, op1: Mem) {
806 self.emit(SSE_PHSUBSWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
807 }
808}
809
810/// `SSE_PHSUBW` (PHSUBW).
811/// (V)PHSUBW performs horizontal subtraction on each adjacent pair of 16-bit signed integers by subtracting the most significant word from the least significant word of each pair in the source and destination operands, and packs the signed 16-bit results to the destination operand (first operand). (V)PHSUBD performs horizontal subtraction on each adjacent pair of 32-bit signed integers by subtracting the most significant doubleword from the least significant doubleword of each pair, and packs the signed 32-bit result to the destination operand. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
812///
813///
814/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHSUBW%3APHSUBD.html).
815///
816/// Supported operand variants:
817///
818/// ```text
819/// +---+----------+
820/// | # | Operands |
821/// +---+----------+
822/// | 1 | Xmm, Mem |
823/// | 2 | Xmm, Xmm |
824/// +---+----------+
825/// ```
826pub trait SsePhsubwEmitter<A, B> {
827 fn sse_phsubw(&mut self, op0: A, op1: B);
828}
829
830impl<'a> SsePhsubwEmitter<Xmm, Xmm> for Assembler<'a> {
831 fn sse_phsubw(&mut self, op0: Xmm, op1: Xmm) {
832 self.emit(SSE_PHSUBWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
833 }
834}
835
836impl<'a> SsePhsubwEmitter<Xmm, Mem> for Assembler<'a> {
837 fn sse_phsubw(&mut self, op0: Xmm, op1: Mem) {
838 self.emit(SSE_PHSUBWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
839 }
840}
841
842/// `SSE_PMADDUBSW` (PMADDUBSW).
843/// (V)PMADDUBSW multiplies vertically each unsigned byte of the destination operand (first operand) with the corresponding signed byte of the source operand (second operand), producing intermediate signed 16-bit integers. Each adjacent pair of signed words is added and the saturated result is packed to the destination operand. For example, the lowest-order bytes (bits 7-0) in the source and destination operands are multiplied and the intermediate signed word result is added with the corresponding intermediate result from the 2nd lowest-order bytes (bits 15-8) of the operands; the sign-saturated result is stored in the lowest word of the destination register (15-0). The same operation is performed on the other pairs of adjacent bytes. Both operands can be MMX register or XMM registers. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
844///
845///
846/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PMADDUBSW.html).
847///
848/// Supported operand variants:
849///
850/// ```text
851/// +---+----------+
852/// | # | Operands |
853/// +---+----------+
854/// | 1 | Xmm, Mem |
855/// | 2 | Xmm, Xmm |
856/// +---+----------+
857/// ```
858pub trait SsePmaddubswEmitter<A, B> {
859 fn sse_pmaddubsw(&mut self, op0: A, op1: B);
860}
861
862impl<'a> SsePmaddubswEmitter<Xmm, Xmm> for Assembler<'a> {
863 fn sse_pmaddubsw(&mut self, op0: Xmm, op1: Xmm) {
864 self.emit(SSE_PMADDUBSWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
865 }
866}
867
868impl<'a> SsePmaddubswEmitter<Xmm, Mem> for Assembler<'a> {
869 fn sse_pmaddubsw(&mut self, op0: Xmm, op1: Mem) {
870 self.emit(SSE_PMADDUBSWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
871 }
872}
873
874/// `SSE_PMULHRSW` (PMULHRSW).
875/// PMULHRSW multiplies vertically each signed 16-bit integer from the destination operand (first operand) with the corresponding signed 16-bit integer of the source operand (second operand), producing intermediate, signed 32-bit integers. Each intermediate 32-bit integer is truncated to the 18 most significant bits. Rounding is always performed by adding 1 to the least significant bit of the 18-bit intermediate result. The final result is obtained by selecting the 16 bits immediately to the right of the most significant bit of each 18-bit intermediate result and packed to the destination operand.
876///
877///
878/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PMULHRSW.html).
879///
880/// Supported operand variants:
881///
882/// ```text
883/// +---+----------+
884/// | # | Operands |
885/// +---+----------+
886/// | 1 | Xmm, Mem |
887/// | 2 | Xmm, Xmm |
888/// +---+----------+
889/// ```
890pub trait SsePmulhrswEmitter<A, B> {
891 fn sse_pmulhrsw(&mut self, op0: A, op1: B);
892}
893
894impl<'a> SsePmulhrswEmitter<Xmm, Xmm> for Assembler<'a> {
895 fn sse_pmulhrsw(&mut self, op0: Xmm, op1: Xmm) {
896 self.emit(SSE_PMULHRSWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
897 }
898}
899
900impl<'a> SsePmulhrswEmitter<Xmm, Mem> for Assembler<'a> {
901 fn sse_pmulhrsw(&mut self, op0: Xmm, op1: Mem) {
902 self.emit(SSE_PMULHRSWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
903 }
904}
905
906/// `SSE_PSHUFB` (PSHUFB).
907/// PSHUFB performs in-place shuffles of bytes in the destination operand (the first operand) according to the shuffle control mask in the source operand (the second operand). The instruction permutes the data in the destination operand, leaving the shuffle mask unaffected. If the most significant bit (bit[7]) of each byte of the shuffle control mask is set, then constant zero is written in the result byte. Each byte in the shuffle control mask forms an index to permute the corresponding byte in the destination operand. The value of each index is the least significant 4 bits (128-bit operation) or 3 bits (64-bit operation) of the shuffle control byte. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
908///
909///
910/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSHUFB.html).
911///
912/// Supported operand variants:
913///
914/// ```text
915/// +---+----------+
916/// | # | Operands |
917/// +---+----------+
918/// | 1 | Xmm, Mem |
919/// | 2 | Xmm, Xmm |
920/// +---+----------+
921/// ```
922pub trait SsePshufbEmitter<A, B> {
923 fn sse_pshufb(&mut self, op0: A, op1: B);
924}
925
926impl<'a> SsePshufbEmitter<Xmm, Xmm> for Assembler<'a> {
927 fn sse_pshufb(&mut self, op0: Xmm, op1: Xmm) {
928 self.emit(SSE_PSHUFBRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
929 }
930}
931
932impl<'a> SsePshufbEmitter<Xmm, Mem> for Assembler<'a> {
933 fn sse_pshufb(&mut self, op0: Xmm, op1: Mem) {
934 self.emit(SSE_PSHUFBRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
935 }
936}
937
938/// `SSE_PSIGNB` (PSIGNB).
939/// (V)PSIGNB/(V)PSIGNW/(V)PSIGND negates each data element of the destination operand (the first operand) if the signed integer value of the corresponding data element in the source operand (the second operand) is less than zero. If the signed integer value of a data element in the source operand is positive, the corresponding data element in the destination operand is unchanged. If a data element in the source operand is zero, the corresponding data element in the destination operand is set to zero.
940///
941///
942/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSIGNB%3APSIGNW%3APSIGND.html).
943///
944/// Supported operand variants:
945///
946/// ```text
947/// +---+----------+
948/// | # | Operands |
949/// +---+----------+
950/// | 1 | Xmm, Mem |
951/// | 2 | Xmm, Xmm |
952/// +---+----------+
953/// ```
954pub trait SsePsignbEmitter<A, B> {
955 fn sse_psignb(&mut self, op0: A, op1: B);
956}
957
958impl<'a> SsePsignbEmitter<Xmm, Xmm> for Assembler<'a> {
959 fn sse_psignb(&mut self, op0: Xmm, op1: Xmm) {
960 self.emit(SSE_PSIGNBRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
961 }
962}
963
964impl<'a> SsePsignbEmitter<Xmm, Mem> for Assembler<'a> {
965 fn sse_psignb(&mut self, op0: Xmm, op1: Mem) {
966 self.emit(SSE_PSIGNBRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
967 }
968}
969
970/// `SSE_PSIGND` (PSIGND).
971/// (V)PSIGNB/(V)PSIGNW/(V)PSIGND negates each data element of the destination operand (the first operand) if the signed integer value of the corresponding data element in the source operand (the second operand) is less than zero. If the signed integer value of a data element in the source operand is positive, the corresponding data element in the destination operand is unchanged. If a data element in the source operand is zero, the corresponding data element in the destination operand is set to zero.
972///
973///
974/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSIGNB%3APSIGNW%3APSIGND.html).
975///
976/// Supported operand variants:
977///
978/// ```text
979/// +---+----------+
980/// | # | Operands |
981/// +---+----------+
982/// | 1 | Xmm, Mem |
983/// | 2 | Xmm, Xmm |
984/// +---+----------+
985/// ```
986pub trait SsePsigndEmitter<A, B> {
987 fn sse_psignd(&mut self, op0: A, op1: B);
988}
989
990impl<'a> SsePsigndEmitter<Xmm, Xmm> for Assembler<'a> {
991 fn sse_psignd(&mut self, op0: Xmm, op1: Xmm) {
992 self.emit(SSE_PSIGNDRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
993 }
994}
995
996impl<'a> SsePsigndEmitter<Xmm, Mem> for Assembler<'a> {
997 fn sse_psignd(&mut self, op0: Xmm, op1: Mem) {
998 self.emit(SSE_PSIGNDRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
999 }
1000}
1001
1002/// `SSE_PSIGNW` (PSIGNW).
1003/// (V)PSIGNB/(V)PSIGNW/(V)PSIGND negates each data element of the destination operand (the first operand) if the signed integer value of the corresponding data element in the source operand (the second operand) is less than zero. If the signed integer value of a data element in the source operand is positive, the corresponding data element in the destination operand is unchanged. If a data element in the source operand is zero, the corresponding data element in the destination operand is set to zero.
1004///
1005///
1006/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSIGNB%3APSIGNW%3APSIGND.html).
1007///
1008/// Supported operand variants:
1009///
1010/// ```text
1011/// +---+----------+
1012/// | # | Operands |
1013/// +---+----------+
1014/// | 1 | Xmm, Mem |
1015/// | 2 | Xmm, Xmm |
1016/// +---+----------+
1017/// ```
1018pub trait SsePsignwEmitter<A, B> {
1019 fn sse_psignw(&mut self, op0: A, op1: B);
1020}
1021
1022impl<'a> SsePsignwEmitter<Xmm, Xmm> for Assembler<'a> {
1023 fn sse_psignw(&mut self, op0: Xmm, op1: Xmm) {
1024 self.emit(SSE_PSIGNWRR, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
1025 }
1026}
1027
1028impl<'a> SsePsignwEmitter<Xmm, Mem> for Assembler<'a> {
1029 fn sse_psignw(&mut self, op0: Xmm, op1: Mem) {
1030 self.emit(SSE_PSIGNWRM, op0.as_operand(), op1.as_operand(), &NOREG, &NOREG);
1031 }
1032}
1033
1034
1035impl<'a> Assembler<'a> {
1036 /// `MMX_PABSB` (PABSB).
1037 /// PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). PABSB operates on signed bytes, PABSW operates on signed 16-bit words, and PABSD operates on signed 32-bit integers.
1038 ///
1039 ///
1040 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PABSB%3APABSW%3APABSD%3APABSQ.html).
1041 ///
1042 /// Supported operand variants:
1043 ///
1044 /// ```text
1045 /// +---+----------+
1046 /// | # | Operands |
1047 /// +---+----------+
1048 /// | 1 | Mm, Mem |
1049 /// | 2 | Mm, Mm |
1050 /// +---+----------+
1051 /// ```
1052 #[inline]
1053 pub fn mmx_pabsb<A, B>(&mut self, op0: A, op1: B)
1054 where Assembler<'a>: MmxPabsbEmitter<A, B> {
1055 <Self as MmxPabsbEmitter<A, B>>::mmx_pabsb(self, op0, op1);
1056 }
1057 /// `MMX_PABSD` (PABSD).
1058 /// PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). PABSB operates on signed bytes, PABSW operates on signed 16-bit words, and PABSD operates on signed 32-bit integers.
1059 ///
1060 ///
1061 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PABSB%3APABSW%3APABSD%3APABSQ.html).
1062 ///
1063 /// Supported operand variants:
1064 ///
1065 /// ```text
1066 /// +---+----------+
1067 /// | # | Operands |
1068 /// +---+----------+
1069 /// | 1 | Mm, Mem |
1070 /// | 2 | Mm, Mm |
1071 /// +---+----------+
1072 /// ```
1073 #[inline]
1074 pub fn mmx_pabsd<A, B>(&mut self, op0: A, op1: B)
1075 where Assembler<'a>: MmxPabsdEmitter<A, B> {
1076 <Self as MmxPabsdEmitter<A, B>>::mmx_pabsd(self, op0, op1);
1077 }
1078 /// `MMX_PABSW` (PABSW).
1079 /// PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). PABSB operates on signed bytes, PABSW operates on signed 16-bit words, and PABSD operates on signed 32-bit integers.
1080 ///
1081 ///
1082 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PABSB%3APABSW%3APABSD%3APABSQ.html).
1083 ///
1084 /// Supported operand variants:
1085 ///
1086 /// ```text
1087 /// +---+----------+
1088 /// | # | Operands |
1089 /// +---+----------+
1090 /// | 1 | Mm, Mem |
1091 /// | 2 | Mm, Mm |
1092 /// +---+----------+
1093 /// ```
1094 #[inline]
1095 pub fn mmx_pabsw<A, B>(&mut self, op0: A, op1: B)
1096 where Assembler<'a>: MmxPabswEmitter<A, B> {
1097 <Self as MmxPabswEmitter<A, B>>::mmx_pabsw(self, op0, op1);
1098 }
1099 /// `MMX_PALIGNR` (PALIGNR).
1100 /// (V)PALIGNR concatenates the destination operand (the first operand) and the source operand (the second operand) into an intermediate composite, shifts the composite at byte granularity to the right by a constant immediate, and extracts the right-aligned result into the destination. The first and the second operands can be an MMX, XMM or a YMM register. The immediate value is considered unsigned. Immediate shift counts larger than the 2L (i.e., 32 for 128-bit operands, or 16 for 64-bit operands) produce a zero result. Both operands can be MMX registers, XMM registers or YMM registers. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1101 ///
1102 ///
1103 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PALIGNR.html).
1104 ///
1105 /// Supported operand variants:
1106 ///
1107 /// ```text
1108 /// +---+--------------+
1109 /// | # | Operands |
1110 /// +---+--------------+
1111 /// | 1 | Mm, Mem, Imm |
1112 /// | 2 | Mm, Mm, Imm |
1113 /// +---+--------------+
1114 /// ```
1115 #[inline]
1116 pub fn mmx_palignr<A, B, C>(&mut self, op0: A, op1: B, op2: C)
1117 where Assembler<'a>: MmxPalignrEmitter<A, B, C> {
1118 <Self as MmxPalignrEmitter<A, B, C>>::mmx_palignr(self, op0, op1, op2);
1119 }
1120 /// `MMX_PHADDD` (PHADDD).
1121 /// (V)PHADDW adds two adjacent 16-bit signed integers horizontally from the source and destination operands and packs the 16-bit signed results to the destination operand (first operand). (V)PHADDD adds two adjacent 32-bit signed integers horizontally from the source and destination operands and packs the 32-bit signed results to the destination operand (first operand). When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1122 ///
1123 ///
1124 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHADDW%3APHADDD.html).
1125 ///
1126 /// Supported operand variants:
1127 ///
1128 /// ```text
1129 /// +---+----------+
1130 /// | # | Operands |
1131 /// +---+----------+
1132 /// | 1 | Mm, Mem |
1133 /// | 2 | Mm, Mm |
1134 /// +---+----------+
1135 /// ```
1136 #[inline]
1137 pub fn mmx_phaddd<A, B>(&mut self, op0: A, op1: B)
1138 where Assembler<'a>: MmxPhadddEmitter<A, B> {
1139 <Self as MmxPhadddEmitter<A, B>>::mmx_phaddd(self, op0, op1);
1140 }
1141 /// `MMX_PHADDSW` (PHADDSW).
1142 /// (V)PHADDSW adds two adjacent signed 16-bit integers horizontally from the source and destination operands and saturates the signed results; packs the signed, saturated 16-bit results to the destination operand (first operand) When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1143 ///
1144 ///
1145 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHADDSW.html).
1146 ///
1147 /// Supported operand variants:
1148 ///
1149 /// ```text
1150 /// +---+----------+
1151 /// | # | Operands |
1152 /// +---+----------+
1153 /// | 1 | Mm, Mem |
1154 /// | 2 | Mm, Mm |
1155 /// +---+----------+
1156 /// ```
1157 #[inline]
1158 pub fn mmx_phaddsw<A, B>(&mut self, op0: A, op1: B)
1159 where Assembler<'a>: MmxPhaddswEmitter<A, B> {
1160 <Self as MmxPhaddswEmitter<A, B>>::mmx_phaddsw(self, op0, op1);
1161 }
1162 /// `MMX_PHADDW` (PHADDW).
1163 /// (V)PHADDW adds two adjacent 16-bit signed integers horizontally from the source and destination operands and packs the 16-bit signed results to the destination operand (first operand). (V)PHADDD adds two adjacent 32-bit signed integers horizontally from the source and destination operands and packs the 32-bit signed results to the destination operand (first operand). When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1164 ///
1165 ///
1166 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHADDW%3APHADDD.html).
1167 ///
1168 /// Supported operand variants:
1169 ///
1170 /// ```text
1171 /// +---+----------+
1172 /// | # | Operands |
1173 /// +---+----------+
1174 /// | 1 | Mm, Mem |
1175 /// | 2 | Mm, Mm |
1176 /// +---+----------+
1177 /// ```
1178 #[inline]
1179 pub fn mmx_phaddw<A, B>(&mut self, op0: A, op1: B)
1180 where Assembler<'a>: MmxPhaddwEmitter<A, B> {
1181 <Self as MmxPhaddwEmitter<A, B>>::mmx_phaddw(self, op0, op1);
1182 }
1183 /// `MMX_PHSUBD` (PHSUBD).
1184 /// (V)PHSUBW performs horizontal subtraction on each adjacent pair of 16-bit signed integers by subtracting the most significant word from the least significant word of each pair in the source and destination operands, and packs the signed 16-bit results to the destination operand (first operand). (V)PHSUBD performs horizontal subtraction on each adjacent pair of 32-bit signed integers by subtracting the most significant doubleword from the least significant doubleword of each pair, and packs the signed 32-bit result to the destination operand. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1185 ///
1186 ///
1187 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHSUBW%3APHSUBD.html).
1188 ///
1189 /// Supported operand variants:
1190 ///
1191 /// ```text
1192 /// +---+----------+
1193 /// | # | Operands |
1194 /// +---+----------+
1195 /// | 1 | Mm, Mem |
1196 /// | 2 | Mm, Mm |
1197 /// +---+----------+
1198 /// ```
1199 #[inline]
1200 pub fn mmx_phsubd<A, B>(&mut self, op0: A, op1: B)
1201 where Assembler<'a>: MmxPhsubdEmitter<A, B> {
1202 <Self as MmxPhsubdEmitter<A, B>>::mmx_phsubd(self, op0, op1);
1203 }
1204 /// `MMX_PHSUBSW` (PHSUBSW).
1205 /// (V)PHSUBSW performs horizontal subtraction on each adjacent pair of 16-bit signed integers by subtracting the most significant word from the least significant word of each pair in the source and destination operands. The signed, saturated 16-bit results are packed to the destination operand (first operand). When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1206 ///
1207 ///
1208 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHSUBSW.html).
1209 ///
1210 /// Supported operand variants:
1211 ///
1212 /// ```text
1213 /// +---+----------+
1214 /// | # | Operands |
1215 /// +---+----------+
1216 /// | 1 | Mm, Mem |
1217 /// | 2 | Mm, Mm |
1218 /// +---+----------+
1219 /// ```
1220 #[inline]
1221 pub fn mmx_phsubsw<A, B>(&mut self, op0: A, op1: B)
1222 where Assembler<'a>: MmxPhsubswEmitter<A, B> {
1223 <Self as MmxPhsubswEmitter<A, B>>::mmx_phsubsw(self, op0, op1);
1224 }
1225 /// `MMX_PHSUBW` (PHSUBW).
1226 /// (V)PHSUBW performs horizontal subtraction on each adjacent pair of 16-bit signed integers by subtracting the most significant word from the least significant word of each pair in the source and destination operands, and packs the signed 16-bit results to the destination operand (first operand). (V)PHSUBD performs horizontal subtraction on each adjacent pair of 32-bit signed integers by subtracting the most significant doubleword from the least significant doubleword of each pair, and packs the signed 32-bit result to the destination operand. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1227 ///
1228 ///
1229 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHSUBW%3APHSUBD.html).
1230 ///
1231 /// Supported operand variants:
1232 ///
1233 /// ```text
1234 /// +---+----------+
1235 /// | # | Operands |
1236 /// +---+----------+
1237 /// | 1 | Mm, Mem |
1238 /// | 2 | Mm, Mm |
1239 /// +---+----------+
1240 /// ```
1241 #[inline]
1242 pub fn mmx_phsubw<A, B>(&mut self, op0: A, op1: B)
1243 where Assembler<'a>: MmxPhsubwEmitter<A, B> {
1244 <Self as MmxPhsubwEmitter<A, B>>::mmx_phsubw(self, op0, op1);
1245 }
1246 /// `MMX_PMADDUBSW` (PMADDUBSW).
1247 /// (V)PMADDUBSW multiplies vertically each unsigned byte of the destination operand (first operand) with the corresponding signed byte of the source operand (second operand), producing intermediate signed 16-bit integers. Each adjacent pair of signed words is added and the saturated result is packed to the destination operand. For example, the lowest-order bytes (bits 7-0) in the source and destination operands are multiplied and the intermediate signed word result is added with the corresponding intermediate result from the 2nd lowest-order bytes (bits 15-8) of the operands; the sign-saturated result is stored in the lowest word of the destination register (15-0). The same operation is performed on the other pairs of adjacent bytes. Both operands can be MMX register or XMM registers. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1248 ///
1249 ///
1250 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PMADDUBSW.html).
1251 ///
1252 /// Supported operand variants:
1253 ///
1254 /// ```text
1255 /// +---+----------+
1256 /// | # | Operands |
1257 /// +---+----------+
1258 /// | 1 | Mm, Mem |
1259 /// | 2 | Mm, Mm |
1260 /// +---+----------+
1261 /// ```
1262 #[inline]
1263 pub fn mmx_pmaddubsw<A, B>(&mut self, op0: A, op1: B)
1264 where Assembler<'a>: MmxPmaddubswEmitter<A, B> {
1265 <Self as MmxPmaddubswEmitter<A, B>>::mmx_pmaddubsw(self, op0, op1);
1266 }
1267 /// `MMX_PMULHRSW` (PMULHRSW).
1268 /// PMULHRSW multiplies vertically each signed 16-bit integer from the destination operand (first operand) with the corresponding signed 16-bit integer of the source operand (second operand), producing intermediate, signed 32-bit integers. Each intermediate 32-bit integer is truncated to the 18 most significant bits. Rounding is always performed by adding 1 to the least significant bit of the 18-bit intermediate result. The final result is obtained by selecting the 16 bits immediately to the right of the most significant bit of each 18-bit intermediate result and packed to the destination operand.
1269 ///
1270 ///
1271 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PMULHRSW.html).
1272 ///
1273 /// Supported operand variants:
1274 ///
1275 /// ```text
1276 /// +---+----------+
1277 /// | # | Operands |
1278 /// +---+----------+
1279 /// | 1 | Mm, Mem |
1280 /// | 2 | Mm, Mm |
1281 /// +---+----------+
1282 /// ```
1283 #[inline]
1284 pub fn mmx_pmulhrsw<A, B>(&mut self, op0: A, op1: B)
1285 where Assembler<'a>: MmxPmulhrswEmitter<A, B> {
1286 <Self as MmxPmulhrswEmitter<A, B>>::mmx_pmulhrsw(self, op0, op1);
1287 }
1288 /// `MMX_PSHUFB` (PSHUFB).
1289 /// PSHUFB performs in-place shuffles of bytes in the destination operand (the first operand) according to the shuffle control mask in the source operand (the second operand). The instruction permutes the data in the destination operand, leaving the shuffle mask unaffected. If the most significant bit (bit[7]) of each byte of the shuffle control mask is set, then constant zero is written in the result byte. Each byte in the shuffle control mask forms an index to permute the corresponding byte in the destination operand. The value of each index is the least significant 4 bits (128-bit operation) or 3 bits (64-bit operation) of the shuffle control byte. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1290 ///
1291 ///
1292 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSHUFB.html).
1293 ///
1294 /// Supported operand variants:
1295 ///
1296 /// ```text
1297 /// +---+----------+
1298 /// | # | Operands |
1299 /// +---+----------+
1300 /// | 1 | Mm, Mem |
1301 /// | 2 | Mm, Mm |
1302 /// +---+----------+
1303 /// ```
1304 #[inline]
1305 pub fn mmx_pshufb<A, B>(&mut self, op0: A, op1: B)
1306 where Assembler<'a>: MmxPshufbEmitter<A, B> {
1307 <Self as MmxPshufbEmitter<A, B>>::mmx_pshufb(self, op0, op1);
1308 }
1309 /// `MMX_PSIGNB` (PSIGNB).
1310 /// (V)PSIGNB/(V)PSIGNW/(V)PSIGND negates each data element of the destination operand (the first operand) if the signed integer value of the corresponding data element in the source operand (the second operand) is less than zero. If the signed integer value of a data element in the source operand is positive, the corresponding data element in the destination operand is unchanged. If a data element in the source operand is zero, the corresponding data element in the destination operand is set to zero.
1311 ///
1312 ///
1313 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSIGNB%3APSIGNW%3APSIGND.html).
1314 ///
1315 /// Supported operand variants:
1316 ///
1317 /// ```text
1318 /// +---+----------+
1319 /// | # | Operands |
1320 /// +---+----------+
1321 /// | 1 | Mm, Mem |
1322 /// | 2 | Mm, Mm |
1323 /// +---+----------+
1324 /// ```
1325 #[inline]
1326 pub fn mmx_psignb<A, B>(&mut self, op0: A, op1: B)
1327 where Assembler<'a>: MmxPsignbEmitter<A, B> {
1328 <Self as MmxPsignbEmitter<A, B>>::mmx_psignb(self, op0, op1);
1329 }
1330 /// `MMX_PSIGND` (PSIGND).
1331 /// (V)PSIGNB/(V)PSIGNW/(V)PSIGND negates each data element of the destination operand (the first operand) if the signed integer value of the corresponding data element in the source operand (the second operand) is less than zero. If the signed integer value of a data element in the source operand is positive, the corresponding data element in the destination operand is unchanged. If a data element in the source operand is zero, the corresponding data element in the destination operand is set to zero.
1332 ///
1333 ///
1334 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSIGNB%3APSIGNW%3APSIGND.html).
1335 ///
1336 /// Supported operand variants:
1337 ///
1338 /// ```text
1339 /// +---+----------+
1340 /// | # | Operands |
1341 /// +---+----------+
1342 /// | 1 | Mm, Mem |
1343 /// | 2 | Mm, Mm |
1344 /// +---+----------+
1345 /// ```
1346 #[inline]
1347 pub fn mmx_psignd<A, B>(&mut self, op0: A, op1: B)
1348 where Assembler<'a>: MmxPsigndEmitter<A, B> {
1349 <Self as MmxPsigndEmitter<A, B>>::mmx_psignd(self, op0, op1);
1350 }
1351 /// `MMX_PSIGNW` (PSIGNW).
1352 /// (V)PSIGNB/(V)PSIGNW/(V)PSIGND negates each data element of the destination operand (the first operand) if the signed integer value of the corresponding data element in the source operand (the second operand) is less than zero. If the signed integer value of a data element in the source operand is positive, the corresponding data element in the destination operand is unchanged. If a data element in the source operand is zero, the corresponding data element in the destination operand is set to zero.
1353 ///
1354 ///
1355 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSIGNB%3APSIGNW%3APSIGND.html).
1356 ///
1357 /// Supported operand variants:
1358 ///
1359 /// ```text
1360 /// +---+----------+
1361 /// | # | Operands |
1362 /// +---+----------+
1363 /// | 1 | Mm, Mem |
1364 /// | 2 | Mm, Mm |
1365 /// +---+----------+
1366 /// ```
1367 #[inline]
1368 pub fn mmx_psignw<A, B>(&mut self, op0: A, op1: B)
1369 where Assembler<'a>: MmxPsignwEmitter<A, B> {
1370 <Self as MmxPsignwEmitter<A, B>>::mmx_psignw(self, op0, op1);
1371 }
1372 /// `SSE_PABSB` (PABSB).
1373 /// PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). PABSB operates on signed bytes, PABSW operates on signed 16-bit words, and PABSD operates on signed 32-bit integers.
1374 ///
1375 ///
1376 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PABSB%3APABSW%3APABSD%3APABSQ.html).
1377 ///
1378 /// Supported operand variants:
1379 ///
1380 /// ```text
1381 /// +---+----------+
1382 /// | # | Operands |
1383 /// +---+----------+
1384 /// | 1 | Xmm, Mem |
1385 /// | 2 | Xmm, Xmm |
1386 /// +---+----------+
1387 /// ```
1388 #[inline]
1389 pub fn sse_pabsb<A, B>(&mut self, op0: A, op1: B)
1390 where Assembler<'a>: SsePabsbEmitter<A, B> {
1391 <Self as SsePabsbEmitter<A, B>>::sse_pabsb(self, op0, op1);
1392 }
1393 /// `SSE_PABSD` (PABSD).
1394 /// PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). PABSB operates on signed bytes, PABSW operates on signed 16-bit words, and PABSD operates on signed 32-bit integers.
1395 ///
1396 ///
1397 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PABSB%3APABSW%3APABSD%3APABSQ.html).
1398 ///
1399 /// Supported operand variants:
1400 ///
1401 /// ```text
1402 /// +---+----------+
1403 /// | # | Operands |
1404 /// +---+----------+
1405 /// | 1 | Xmm, Mem |
1406 /// | 2 | Xmm, Xmm |
1407 /// +---+----------+
1408 /// ```
1409 #[inline]
1410 pub fn sse_pabsd<A, B>(&mut self, op0: A, op1: B)
1411 where Assembler<'a>: SsePabsdEmitter<A, B> {
1412 <Self as SsePabsdEmitter<A, B>>::sse_pabsd(self, op0, op1);
1413 }
1414 /// `SSE_PABSW` (PABSW).
1415 /// PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). PABSB operates on signed bytes, PABSW operates on signed 16-bit words, and PABSD operates on signed 32-bit integers.
1416 ///
1417 ///
1418 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PABSB%3APABSW%3APABSD%3APABSQ.html).
1419 ///
1420 /// Supported operand variants:
1421 ///
1422 /// ```text
1423 /// +---+----------+
1424 /// | # | Operands |
1425 /// +---+----------+
1426 /// | 1 | Xmm, Mem |
1427 /// | 2 | Xmm, Xmm |
1428 /// +---+----------+
1429 /// ```
1430 #[inline]
1431 pub fn sse_pabsw<A, B>(&mut self, op0: A, op1: B)
1432 where Assembler<'a>: SsePabswEmitter<A, B> {
1433 <Self as SsePabswEmitter<A, B>>::sse_pabsw(self, op0, op1);
1434 }
1435 /// `SSE_PALIGNR` (PALIGNR).
1436 /// (V)PALIGNR concatenates the destination operand (the first operand) and the source operand (the second operand) into an intermediate composite, shifts the composite at byte granularity to the right by a constant immediate, and extracts the right-aligned result into the destination. The first and the second operands can be an MMX, XMM or a YMM register. The immediate value is considered unsigned. Immediate shift counts larger than the 2L (i.e., 32 for 128-bit operands, or 16 for 64-bit operands) produce a zero result. Both operands can be MMX registers, XMM registers or YMM registers. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1437 ///
1438 ///
1439 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PALIGNR.html).
1440 ///
1441 /// Supported operand variants:
1442 ///
1443 /// ```text
1444 /// +---+---------------+
1445 /// | # | Operands |
1446 /// +---+---------------+
1447 /// | 1 | Xmm, Mem, Imm |
1448 /// | 2 | Xmm, Xmm, Imm |
1449 /// +---+---------------+
1450 /// ```
1451 #[inline]
1452 pub fn sse_palignr<A, B, C>(&mut self, op0: A, op1: B, op2: C)
1453 where Assembler<'a>: SsePalignrEmitter<A, B, C> {
1454 <Self as SsePalignrEmitter<A, B, C>>::sse_palignr(self, op0, op1, op2);
1455 }
1456 /// `SSE_PHADDD` (PHADDD).
1457 /// (V)PHADDW adds two adjacent 16-bit signed integers horizontally from the source and destination operands and packs the 16-bit signed results to the destination operand (first operand). (V)PHADDD adds two adjacent 32-bit signed integers horizontally from the source and destination operands and packs the 32-bit signed results to the destination operand (first operand). When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1458 ///
1459 ///
1460 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHADDW%3APHADDD.html).
1461 ///
1462 /// Supported operand variants:
1463 ///
1464 /// ```text
1465 /// +---+----------+
1466 /// | # | Operands |
1467 /// +---+----------+
1468 /// | 1 | Xmm, Mem |
1469 /// | 2 | Xmm, Xmm |
1470 /// +---+----------+
1471 /// ```
1472 #[inline]
1473 pub fn sse_phaddd<A, B>(&mut self, op0: A, op1: B)
1474 where Assembler<'a>: SsePhadddEmitter<A, B> {
1475 <Self as SsePhadddEmitter<A, B>>::sse_phaddd(self, op0, op1);
1476 }
1477 /// `SSE_PHADDSW` (PHADDSW).
1478 /// (V)PHADDSW adds two adjacent signed 16-bit integers horizontally from the source and destination operands and saturates the signed results; packs the signed, saturated 16-bit results to the destination operand (first operand) When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1479 ///
1480 ///
1481 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHADDSW.html).
1482 ///
1483 /// Supported operand variants:
1484 ///
1485 /// ```text
1486 /// +---+----------+
1487 /// | # | Operands |
1488 /// +---+----------+
1489 /// | 1 | Xmm, Mem |
1490 /// | 2 | Xmm, Xmm |
1491 /// +---+----------+
1492 /// ```
1493 #[inline]
1494 pub fn sse_phaddsw<A, B>(&mut self, op0: A, op1: B)
1495 where Assembler<'a>: SsePhaddswEmitter<A, B> {
1496 <Self as SsePhaddswEmitter<A, B>>::sse_phaddsw(self, op0, op1);
1497 }
1498 /// `SSE_PHADDW` (PHADDW).
1499 /// (V)PHADDW adds two adjacent 16-bit signed integers horizontally from the source and destination operands and packs the 16-bit signed results to the destination operand (first operand). (V)PHADDD adds two adjacent 32-bit signed integers horizontally from the source and destination operands and packs the 32-bit signed results to the destination operand (first operand). When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1500 ///
1501 ///
1502 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHADDW%3APHADDD.html).
1503 ///
1504 /// Supported operand variants:
1505 ///
1506 /// ```text
1507 /// +---+----------+
1508 /// | # | Operands |
1509 /// +---+----------+
1510 /// | 1 | Xmm, Mem |
1511 /// | 2 | Xmm, Xmm |
1512 /// +---+----------+
1513 /// ```
1514 #[inline]
1515 pub fn sse_phaddw<A, B>(&mut self, op0: A, op1: B)
1516 where Assembler<'a>: SsePhaddwEmitter<A, B> {
1517 <Self as SsePhaddwEmitter<A, B>>::sse_phaddw(self, op0, op1);
1518 }
1519 /// `SSE_PHSUBD` (PHSUBD).
1520 /// (V)PHSUBW performs horizontal subtraction on each adjacent pair of 16-bit signed integers by subtracting the most significant word from the least significant word of each pair in the source and destination operands, and packs the signed 16-bit results to the destination operand (first operand). (V)PHSUBD performs horizontal subtraction on each adjacent pair of 32-bit signed integers by subtracting the most significant doubleword from the least significant doubleword of each pair, and packs the signed 32-bit result to the destination operand. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1521 ///
1522 ///
1523 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHSUBW%3APHSUBD.html).
1524 ///
1525 /// Supported operand variants:
1526 ///
1527 /// ```text
1528 /// +---+----------+
1529 /// | # | Operands |
1530 /// +---+----------+
1531 /// | 1 | Xmm, Mem |
1532 /// | 2 | Xmm, Xmm |
1533 /// +---+----------+
1534 /// ```
1535 #[inline]
1536 pub fn sse_phsubd<A, B>(&mut self, op0: A, op1: B)
1537 where Assembler<'a>: SsePhsubdEmitter<A, B> {
1538 <Self as SsePhsubdEmitter<A, B>>::sse_phsubd(self, op0, op1);
1539 }
1540 /// `SSE_PHSUBSW` (PHSUBSW).
1541 /// (V)PHSUBSW performs horizontal subtraction on each adjacent pair of 16-bit signed integers by subtracting the most significant word from the least significant word of each pair in the source and destination operands. The signed, saturated 16-bit results are packed to the destination operand (first operand). When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1542 ///
1543 ///
1544 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHSUBSW.html).
1545 ///
1546 /// Supported operand variants:
1547 ///
1548 /// ```text
1549 /// +---+----------+
1550 /// | # | Operands |
1551 /// +---+----------+
1552 /// | 1 | Xmm, Mem |
1553 /// | 2 | Xmm, Xmm |
1554 /// +---+----------+
1555 /// ```
1556 #[inline]
1557 pub fn sse_phsubsw<A, B>(&mut self, op0: A, op1: B)
1558 where Assembler<'a>: SsePhsubswEmitter<A, B> {
1559 <Self as SsePhsubswEmitter<A, B>>::sse_phsubsw(self, op0, op1);
1560 }
1561 /// `SSE_PHSUBW` (PHSUBW).
1562 /// (V)PHSUBW performs horizontal subtraction on each adjacent pair of 16-bit signed integers by subtracting the most significant word from the least significant word of each pair in the source and destination operands, and packs the signed 16-bit results to the destination operand (first operand). (V)PHSUBD performs horizontal subtraction on each adjacent pair of 32-bit signed integers by subtracting the most significant doubleword from the least significant doubleword of each pair, and packs the signed 32-bit result to the destination operand. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1563 ///
1564 ///
1565 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PHSUBW%3APHSUBD.html).
1566 ///
1567 /// Supported operand variants:
1568 ///
1569 /// ```text
1570 /// +---+----------+
1571 /// | # | Operands |
1572 /// +---+----------+
1573 /// | 1 | Xmm, Mem |
1574 /// | 2 | Xmm, Xmm |
1575 /// +---+----------+
1576 /// ```
1577 #[inline]
1578 pub fn sse_phsubw<A, B>(&mut self, op0: A, op1: B)
1579 where Assembler<'a>: SsePhsubwEmitter<A, B> {
1580 <Self as SsePhsubwEmitter<A, B>>::sse_phsubw(self, op0, op1);
1581 }
1582 /// `SSE_PMADDUBSW` (PMADDUBSW).
1583 /// (V)PMADDUBSW multiplies vertically each unsigned byte of the destination operand (first operand) with the corresponding signed byte of the source operand (second operand), producing intermediate signed 16-bit integers. Each adjacent pair of signed words is added and the saturated result is packed to the destination operand. For example, the lowest-order bytes (bits 7-0) in the source and destination operands are multiplied and the intermediate signed word result is added with the corresponding intermediate result from the 2nd lowest-order bytes (bits 15-8) of the operands; the sign-saturated result is stored in the lowest word of the destination register (15-0). The same operation is performed on the other pairs of adjacent bytes. Both operands can be MMX register or XMM registers. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1584 ///
1585 ///
1586 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PMADDUBSW.html).
1587 ///
1588 /// Supported operand variants:
1589 ///
1590 /// ```text
1591 /// +---+----------+
1592 /// | # | Operands |
1593 /// +---+----------+
1594 /// | 1 | Xmm, Mem |
1595 /// | 2 | Xmm, Xmm |
1596 /// +---+----------+
1597 /// ```
1598 #[inline]
1599 pub fn sse_pmaddubsw<A, B>(&mut self, op0: A, op1: B)
1600 where Assembler<'a>: SsePmaddubswEmitter<A, B> {
1601 <Self as SsePmaddubswEmitter<A, B>>::sse_pmaddubsw(self, op0, op1);
1602 }
1603 /// `SSE_PMULHRSW` (PMULHRSW).
1604 /// PMULHRSW multiplies vertically each signed 16-bit integer from the destination operand (first operand) with the corresponding signed 16-bit integer of the source operand (second operand), producing intermediate, signed 32-bit integers. Each intermediate 32-bit integer is truncated to the 18 most significant bits. Rounding is always performed by adding 1 to the least significant bit of the 18-bit intermediate result. The final result is obtained by selecting the 16 bits immediately to the right of the most significant bit of each 18-bit intermediate result and packed to the destination operand.
1605 ///
1606 ///
1607 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PMULHRSW.html).
1608 ///
1609 /// Supported operand variants:
1610 ///
1611 /// ```text
1612 /// +---+----------+
1613 /// | # | Operands |
1614 /// +---+----------+
1615 /// | 1 | Xmm, Mem |
1616 /// | 2 | Xmm, Xmm |
1617 /// +---+----------+
1618 /// ```
1619 #[inline]
1620 pub fn sse_pmulhrsw<A, B>(&mut self, op0: A, op1: B)
1621 where Assembler<'a>: SsePmulhrswEmitter<A, B> {
1622 <Self as SsePmulhrswEmitter<A, B>>::sse_pmulhrsw(self, op0, op1);
1623 }
1624 /// `SSE_PSHUFB` (PSHUFB).
1625 /// PSHUFB performs in-place shuffles of bytes in the destination operand (the first operand) according to the shuffle control mask in the source operand (the second operand). The instruction permutes the data in the destination operand, leaving the shuffle mask unaffected. If the most significant bit (bit[7]) of each byte of the shuffle control mask is set, then constant zero is written in the result byte. Each byte in the shuffle control mask forms an index to permute the corresponding byte in the destination operand. The value of each index is the least significant 4 bits (128-bit operation) or 3 bits (64-bit operation) of the shuffle control byte. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.
1626 ///
1627 ///
1628 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSHUFB.html).
1629 ///
1630 /// Supported operand variants:
1631 ///
1632 /// ```text
1633 /// +---+----------+
1634 /// | # | Operands |
1635 /// +---+----------+
1636 /// | 1 | Xmm, Mem |
1637 /// | 2 | Xmm, Xmm |
1638 /// +---+----------+
1639 /// ```
1640 #[inline]
1641 pub fn sse_pshufb<A, B>(&mut self, op0: A, op1: B)
1642 where Assembler<'a>: SsePshufbEmitter<A, B> {
1643 <Self as SsePshufbEmitter<A, B>>::sse_pshufb(self, op0, op1);
1644 }
1645 /// `SSE_PSIGNB` (PSIGNB).
1646 /// (V)PSIGNB/(V)PSIGNW/(V)PSIGND negates each data element of the destination operand (the first operand) if the signed integer value of the corresponding data element in the source operand (the second operand) is less than zero. If the signed integer value of a data element in the source operand is positive, the corresponding data element in the destination operand is unchanged. If a data element in the source operand is zero, the corresponding data element in the destination operand is set to zero.
1647 ///
1648 ///
1649 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSIGNB%3APSIGNW%3APSIGND.html).
1650 ///
1651 /// Supported operand variants:
1652 ///
1653 /// ```text
1654 /// +---+----------+
1655 /// | # | Operands |
1656 /// +---+----------+
1657 /// | 1 | Xmm, Mem |
1658 /// | 2 | Xmm, Xmm |
1659 /// +---+----------+
1660 /// ```
1661 #[inline]
1662 pub fn sse_psignb<A, B>(&mut self, op0: A, op1: B)
1663 where Assembler<'a>: SsePsignbEmitter<A, B> {
1664 <Self as SsePsignbEmitter<A, B>>::sse_psignb(self, op0, op1);
1665 }
1666 /// `SSE_PSIGND` (PSIGND).
1667 /// (V)PSIGNB/(V)PSIGNW/(V)PSIGND negates each data element of the destination operand (the first operand) if the signed integer value of the corresponding data element in the source operand (the second operand) is less than zero. If the signed integer value of a data element in the source operand is positive, the corresponding data element in the destination operand is unchanged. If a data element in the source operand is zero, the corresponding data element in the destination operand is set to zero.
1668 ///
1669 ///
1670 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSIGNB%3APSIGNW%3APSIGND.html).
1671 ///
1672 /// Supported operand variants:
1673 ///
1674 /// ```text
1675 /// +---+----------+
1676 /// | # | Operands |
1677 /// +---+----------+
1678 /// | 1 | Xmm, Mem |
1679 /// | 2 | Xmm, Xmm |
1680 /// +---+----------+
1681 /// ```
1682 #[inline]
1683 pub fn sse_psignd<A, B>(&mut self, op0: A, op1: B)
1684 where Assembler<'a>: SsePsigndEmitter<A, B> {
1685 <Self as SsePsigndEmitter<A, B>>::sse_psignd(self, op0, op1);
1686 }
1687 /// `SSE_PSIGNW` (PSIGNW).
1688 /// (V)PSIGNB/(V)PSIGNW/(V)PSIGND negates each data element of the destination operand (the first operand) if the signed integer value of the corresponding data element in the source operand (the second operand) is less than zero. If the signed integer value of a data element in the source operand is positive, the corresponding data element in the destination operand is unchanged. If a data element in the source operand is zero, the corresponding data element in the destination operand is set to zero.
1689 ///
1690 ///
1691 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/PSIGNB%3APSIGNW%3APSIGND.html).
1692 ///
1693 /// Supported operand variants:
1694 ///
1695 /// ```text
1696 /// +---+----------+
1697 /// | # | Operands |
1698 /// +---+----------+
1699 /// | 1 | Xmm, Mem |
1700 /// | 2 | Xmm, Xmm |
1701 /// +---+----------+
1702 /// ```
1703 #[inline]
1704 pub fn sse_psignw<A, B>(&mut self, op0: A, op1: B)
1705 where Assembler<'a>: SsePsignwEmitter<A, B> {
1706 <Self as SsePsignwEmitter<A, B>>::sse_psignw(self, op0, op1);
1707 }
1708}