Skip to main content

asmkit/x86/features/
AVX512_VPOPCNTDQ.rs

1use super::super::opcodes::*;
2use crate::core::emitter::*;
3use crate::core::operand::*;
4use crate::x86::assembler::*;
5use crate::x86::operands::*;
6
7/// A dummy operand that represents no register. Here just for simplicity.
8const NOREG: Operand = Operand::new();
9
10/// `VPOPCNTD`.
11///
12/// Supported operand variants:
13///
14/// ```text
15/// +---+----------+
16/// | # | Operands |
17/// +---+----------+
18/// | 1 | Xmm, Mem |
19/// | 2 | Xmm, Xmm |
20/// | 3 | Ymm, Mem |
21/// | 4 | Ymm, Ymm |
22/// | 5 | Zmm, Mem |
23/// | 6 | Zmm, Zmm |
24/// +---+----------+
25/// ```
26pub trait VpopcntdEmitter<A, B> {
27    fn vpopcntd(&mut self, op0: A, op1: B);
28}
29
30impl<'a> VpopcntdEmitter<Xmm, Xmm> for Assembler<'a> {
31    fn vpopcntd(&mut self, op0: Xmm, op1: Xmm) {
32        self.emit(
33            VPOPCNTD128RR,
34            op0.as_operand(),
35            op1.as_operand(),
36            &NOREG,
37            &NOREG,
38        );
39    }
40}
41
42impl<'a> VpopcntdEmitter<Xmm, Mem> for Assembler<'a> {
43    fn vpopcntd(&mut self, op0: Xmm, op1: Mem) {
44        self.emit(
45            VPOPCNTD128RM,
46            op0.as_operand(),
47            op1.as_operand(),
48            &NOREG,
49            &NOREG,
50        );
51    }
52}
53
54impl<'a> VpopcntdEmitter<Ymm, Ymm> for Assembler<'a> {
55    fn vpopcntd(&mut self, op0: Ymm, op1: Ymm) {
56        self.emit(
57            VPOPCNTD256RR,
58            op0.as_operand(),
59            op1.as_operand(),
60            &NOREG,
61            &NOREG,
62        );
63    }
64}
65
66impl<'a> VpopcntdEmitter<Ymm, Mem> for Assembler<'a> {
67    fn vpopcntd(&mut self, op0: Ymm, op1: Mem) {
68        self.emit(
69            VPOPCNTD256RM,
70            op0.as_operand(),
71            op1.as_operand(),
72            &NOREG,
73            &NOREG,
74        );
75    }
76}
77
78impl<'a> VpopcntdEmitter<Zmm, Zmm> for Assembler<'a> {
79    fn vpopcntd(&mut self, op0: Zmm, op1: Zmm) {
80        self.emit(
81            VPOPCNTD512RR,
82            op0.as_operand(),
83            op1.as_operand(),
84            &NOREG,
85            &NOREG,
86        );
87    }
88}
89
90impl<'a> VpopcntdEmitter<Zmm, Mem> for Assembler<'a> {
91    fn vpopcntd(&mut self, op0: Zmm, op1: Mem) {
92        self.emit(
93            VPOPCNTD512RM,
94            op0.as_operand(),
95            op1.as_operand(),
96            &NOREG,
97            &NOREG,
98        );
99    }
100}
101
102/// `VPOPCNTD_MASK`.
103///
104/// Supported operand variants:
105///
106/// ```text
107/// +---+----------+
108/// | # | Operands |
109/// +---+----------+
110/// | 1 | Xmm, Mem |
111/// | 2 | Xmm, Xmm |
112/// | 3 | Ymm, Mem |
113/// | 4 | Ymm, Ymm |
114/// | 5 | Zmm, Mem |
115/// | 6 | Zmm, Zmm |
116/// +---+----------+
117/// ```
118pub trait VpopcntdMaskEmitter<A, B> {
119    fn vpopcntd_mask(&mut self, op0: A, op1: B);
120}
121
122impl<'a> VpopcntdMaskEmitter<Xmm, Xmm> for Assembler<'a> {
123    fn vpopcntd_mask(&mut self, op0: Xmm, op1: Xmm) {
124        self.emit(
125            VPOPCNTD128RR_MASK,
126            op0.as_operand(),
127            op1.as_operand(),
128            &NOREG,
129            &NOREG,
130        );
131    }
132}
133
134impl<'a> VpopcntdMaskEmitter<Xmm, Mem> for Assembler<'a> {
135    fn vpopcntd_mask(&mut self, op0: Xmm, op1: Mem) {
136        self.emit(
137            VPOPCNTD128RM_MASK,
138            op0.as_operand(),
139            op1.as_operand(),
140            &NOREG,
141            &NOREG,
142        );
143    }
144}
145
146impl<'a> VpopcntdMaskEmitter<Ymm, Ymm> for Assembler<'a> {
147    fn vpopcntd_mask(&mut self, op0: Ymm, op1: Ymm) {
148        self.emit(
149            VPOPCNTD256RR_MASK,
150            op0.as_operand(),
151            op1.as_operand(),
152            &NOREG,
153            &NOREG,
154        );
155    }
156}
157
158impl<'a> VpopcntdMaskEmitter<Ymm, Mem> for Assembler<'a> {
159    fn vpopcntd_mask(&mut self, op0: Ymm, op1: Mem) {
160        self.emit(
161            VPOPCNTD256RM_MASK,
162            op0.as_operand(),
163            op1.as_operand(),
164            &NOREG,
165            &NOREG,
166        );
167    }
168}
169
170impl<'a> VpopcntdMaskEmitter<Zmm, Zmm> for Assembler<'a> {
171    fn vpopcntd_mask(&mut self, op0: Zmm, op1: Zmm) {
172        self.emit(
173            VPOPCNTD512RR_MASK,
174            op0.as_operand(),
175            op1.as_operand(),
176            &NOREG,
177            &NOREG,
178        );
179    }
180}
181
182impl<'a> VpopcntdMaskEmitter<Zmm, Mem> for Assembler<'a> {
183    fn vpopcntd_mask(&mut self, op0: Zmm, op1: Mem) {
184        self.emit(
185            VPOPCNTD512RM_MASK,
186            op0.as_operand(),
187            op1.as_operand(),
188            &NOREG,
189            &NOREG,
190        );
191    }
192}
193
194/// `VPOPCNTD_MASKZ`.
195///
196/// Supported operand variants:
197///
198/// ```text
199/// +---+----------+
200/// | # | Operands |
201/// +---+----------+
202/// | 1 | Xmm, Mem |
203/// | 2 | Xmm, Xmm |
204/// | 3 | Ymm, Mem |
205/// | 4 | Ymm, Ymm |
206/// | 5 | Zmm, Mem |
207/// | 6 | Zmm, Zmm |
208/// +---+----------+
209/// ```
210pub trait VpopcntdMaskzEmitter<A, B> {
211    fn vpopcntd_maskz(&mut self, op0: A, op1: B);
212}
213
214impl<'a> VpopcntdMaskzEmitter<Xmm, Xmm> for Assembler<'a> {
215    fn vpopcntd_maskz(&mut self, op0: Xmm, op1: Xmm) {
216        self.emit(
217            VPOPCNTD128RR_MASKZ,
218            op0.as_operand(),
219            op1.as_operand(),
220            &NOREG,
221            &NOREG,
222        );
223    }
224}
225
226impl<'a> VpopcntdMaskzEmitter<Xmm, Mem> for Assembler<'a> {
227    fn vpopcntd_maskz(&mut self, op0: Xmm, op1: Mem) {
228        self.emit(
229            VPOPCNTD128RM_MASKZ,
230            op0.as_operand(),
231            op1.as_operand(),
232            &NOREG,
233            &NOREG,
234        );
235    }
236}
237
238impl<'a> VpopcntdMaskzEmitter<Ymm, Ymm> for Assembler<'a> {
239    fn vpopcntd_maskz(&mut self, op0: Ymm, op1: Ymm) {
240        self.emit(
241            VPOPCNTD256RR_MASKZ,
242            op0.as_operand(),
243            op1.as_operand(),
244            &NOREG,
245            &NOREG,
246        );
247    }
248}
249
250impl<'a> VpopcntdMaskzEmitter<Ymm, Mem> for Assembler<'a> {
251    fn vpopcntd_maskz(&mut self, op0: Ymm, op1: Mem) {
252        self.emit(
253            VPOPCNTD256RM_MASKZ,
254            op0.as_operand(),
255            op1.as_operand(),
256            &NOREG,
257            &NOREG,
258        );
259    }
260}
261
262impl<'a> VpopcntdMaskzEmitter<Zmm, Zmm> for Assembler<'a> {
263    fn vpopcntd_maskz(&mut self, op0: Zmm, op1: Zmm) {
264        self.emit(
265            VPOPCNTD512RR_MASKZ,
266            op0.as_operand(),
267            op1.as_operand(),
268            &NOREG,
269            &NOREG,
270        );
271    }
272}
273
274impl<'a> VpopcntdMaskzEmitter<Zmm, Mem> for Assembler<'a> {
275    fn vpopcntd_maskz(&mut self, op0: Zmm, op1: Mem) {
276        self.emit(
277            VPOPCNTD512RM_MASKZ,
278            op0.as_operand(),
279            op1.as_operand(),
280            &NOREG,
281            &NOREG,
282        );
283    }
284}
285
286/// `VPOPCNTQ`.
287///
288/// Supported operand variants:
289///
290/// ```text
291/// +---+----------+
292/// | # | Operands |
293/// +---+----------+
294/// | 1 | Xmm, Mem |
295/// | 2 | Xmm, Xmm |
296/// | 3 | Ymm, Mem |
297/// | 4 | Ymm, Ymm |
298/// | 5 | Zmm, Mem |
299/// | 6 | Zmm, Zmm |
300/// +---+----------+
301/// ```
302pub trait VpopcntqEmitter<A, B> {
303    fn vpopcntq(&mut self, op0: A, op1: B);
304}
305
306impl<'a> VpopcntqEmitter<Xmm, Xmm> for Assembler<'a> {
307    fn vpopcntq(&mut self, op0: Xmm, op1: Xmm) {
308        self.emit(
309            VPOPCNTQ128RR,
310            op0.as_operand(),
311            op1.as_operand(),
312            &NOREG,
313            &NOREG,
314        );
315    }
316}
317
318impl<'a> VpopcntqEmitter<Xmm, Mem> for Assembler<'a> {
319    fn vpopcntq(&mut self, op0: Xmm, op1: Mem) {
320        self.emit(
321            VPOPCNTQ128RM,
322            op0.as_operand(),
323            op1.as_operand(),
324            &NOREG,
325            &NOREG,
326        );
327    }
328}
329
330impl<'a> VpopcntqEmitter<Ymm, Ymm> for Assembler<'a> {
331    fn vpopcntq(&mut self, op0: Ymm, op1: Ymm) {
332        self.emit(
333            VPOPCNTQ256RR,
334            op0.as_operand(),
335            op1.as_operand(),
336            &NOREG,
337            &NOREG,
338        );
339    }
340}
341
342impl<'a> VpopcntqEmitter<Ymm, Mem> for Assembler<'a> {
343    fn vpopcntq(&mut self, op0: Ymm, op1: Mem) {
344        self.emit(
345            VPOPCNTQ256RM,
346            op0.as_operand(),
347            op1.as_operand(),
348            &NOREG,
349            &NOREG,
350        );
351    }
352}
353
354impl<'a> VpopcntqEmitter<Zmm, Zmm> for Assembler<'a> {
355    fn vpopcntq(&mut self, op0: Zmm, op1: Zmm) {
356        self.emit(
357            VPOPCNTQ512RR,
358            op0.as_operand(),
359            op1.as_operand(),
360            &NOREG,
361            &NOREG,
362        );
363    }
364}
365
366impl<'a> VpopcntqEmitter<Zmm, Mem> for Assembler<'a> {
367    fn vpopcntq(&mut self, op0: Zmm, op1: Mem) {
368        self.emit(
369            VPOPCNTQ512RM,
370            op0.as_operand(),
371            op1.as_operand(),
372            &NOREG,
373            &NOREG,
374        );
375    }
376}
377
378/// `VPOPCNTQ_MASK`.
379///
380/// Supported operand variants:
381///
382/// ```text
383/// +---+----------+
384/// | # | Operands |
385/// +---+----------+
386/// | 1 | Xmm, Mem |
387/// | 2 | Xmm, Xmm |
388/// | 3 | Ymm, Mem |
389/// | 4 | Ymm, Ymm |
390/// | 5 | Zmm, Mem |
391/// | 6 | Zmm, Zmm |
392/// +---+----------+
393/// ```
394pub trait VpopcntqMaskEmitter<A, B> {
395    fn vpopcntq_mask(&mut self, op0: A, op1: B);
396}
397
398impl<'a> VpopcntqMaskEmitter<Xmm, Xmm> for Assembler<'a> {
399    fn vpopcntq_mask(&mut self, op0: Xmm, op1: Xmm) {
400        self.emit(
401            VPOPCNTQ128RR_MASK,
402            op0.as_operand(),
403            op1.as_operand(),
404            &NOREG,
405            &NOREG,
406        );
407    }
408}
409
410impl<'a> VpopcntqMaskEmitter<Xmm, Mem> for Assembler<'a> {
411    fn vpopcntq_mask(&mut self, op0: Xmm, op1: Mem) {
412        self.emit(
413            VPOPCNTQ128RM_MASK,
414            op0.as_operand(),
415            op1.as_operand(),
416            &NOREG,
417            &NOREG,
418        );
419    }
420}
421
422impl<'a> VpopcntqMaskEmitter<Ymm, Ymm> for Assembler<'a> {
423    fn vpopcntq_mask(&mut self, op0: Ymm, op1: Ymm) {
424        self.emit(
425            VPOPCNTQ256RR_MASK,
426            op0.as_operand(),
427            op1.as_operand(),
428            &NOREG,
429            &NOREG,
430        );
431    }
432}
433
434impl<'a> VpopcntqMaskEmitter<Ymm, Mem> for Assembler<'a> {
435    fn vpopcntq_mask(&mut self, op0: Ymm, op1: Mem) {
436        self.emit(
437            VPOPCNTQ256RM_MASK,
438            op0.as_operand(),
439            op1.as_operand(),
440            &NOREG,
441            &NOREG,
442        );
443    }
444}
445
446impl<'a> VpopcntqMaskEmitter<Zmm, Zmm> for Assembler<'a> {
447    fn vpopcntq_mask(&mut self, op0: Zmm, op1: Zmm) {
448        self.emit(
449            VPOPCNTQ512RR_MASK,
450            op0.as_operand(),
451            op1.as_operand(),
452            &NOREG,
453            &NOREG,
454        );
455    }
456}
457
458impl<'a> VpopcntqMaskEmitter<Zmm, Mem> for Assembler<'a> {
459    fn vpopcntq_mask(&mut self, op0: Zmm, op1: Mem) {
460        self.emit(
461            VPOPCNTQ512RM_MASK,
462            op0.as_operand(),
463            op1.as_operand(),
464            &NOREG,
465            &NOREG,
466        );
467    }
468}
469
470/// `VPOPCNTQ_MASKZ`.
471///
472/// Supported operand variants:
473///
474/// ```text
475/// +---+----------+
476/// | # | Operands |
477/// +---+----------+
478/// | 1 | Xmm, Mem |
479/// | 2 | Xmm, Xmm |
480/// | 3 | Ymm, Mem |
481/// | 4 | Ymm, Ymm |
482/// | 5 | Zmm, Mem |
483/// | 6 | Zmm, Zmm |
484/// +---+----------+
485/// ```
486pub trait VpopcntqMaskzEmitter<A, B> {
487    fn vpopcntq_maskz(&mut self, op0: A, op1: B);
488}
489
490impl<'a> VpopcntqMaskzEmitter<Xmm, Xmm> for Assembler<'a> {
491    fn vpopcntq_maskz(&mut self, op0: Xmm, op1: Xmm) {
492        self.emit(
493            VPOPCNTQ128RR_MASKZ,
494            op0.as_operand(),
495            op1.as_operand(),
496            &NOREG,
497            &NOREG,
498        );
499    }
500}
501
502impl<'a> VpopcntqMaskzEmitter<Xmm, Mem> for Assembler<'a> {
503    fn vpopcntq_maskz(&mut self, op0: Xmm, op1: Mem) {
504        self.emit(
505            VPOPCNTQ128RM_MASKZ,
506            op0.as_operand(),
507            op1.as_operand(),
508            &NOREG,
509            &NOREG,
510        );
511    }
512}
513
514impl<'a> VpopcntqMaskzEmitter<Ymm, Ymm> for Assembler<'a> {
515    fn vpopcntq_maskz(&mut self, op0: Ymm, op1: Ymm) {
516        self.emit(
517            VPOPCNTQ256RR_MASKZ,
518            op0.as_operand(),
519            op1.as_operand(),
520            &NOREG,
521            &NOREG,
522        );
523    }
524}
525
526impl<'a> VpopcntqMaskzEmitter<Ymm, Mem> for Assembler<'a> {
527    fn vpopcntq_maskz(&mut self, op0: Ymm, op1: Mem) {
528        self.emit(
529            VPOPCNTQ256RM_MASKZ,
530            op0.as_operand(),
531            op1.as_operand(),
532            &NOREG,
533            &NOREG,
534        );
535    }
536}
537
538impl<'a> VpopcntqMaskzEmitter<Zmm, Zmm> for Assembler<'a> {
539    fn vpopcntq_maskz(&mut self, op0: Zmm, op1: Zmm) {
540        self.emit(
541            VPOPCNTQ512RR_MASKZ,
542            op0.as_operand(),
543            op1.as_operand(),
544            &NOREG,
545            &NOREG,
546        );
547    }
548}
549
550impl<'a> VpopcntqMaskzEmitter<Zmm, Mem> for Assembler<'a> {
551    fn vpopcntq_maskz(&mut self, op0: Zmm, op1: Mem) {
552        self.emit(
553            VPOPCNTQ512RM_MASKZ,
554            op0.as_operand(),
555            op1.as_operand(),
556            &NOREG,
557            &NOREG,
558        );
559    }
560}
561
562impl<'a> Assembler<'a> {
563    /// `VPOPCNTD`.
564    ///
565    /// Supported operand variants:
566    ///
567    /// ```text
568    /// +---+----------+
569    /// | # | Operands |
570    /// +---+----------+
571    /// | 1 | Xmm, Mem |
572    /// | 2 | Xmm, Xmm |
573    /// | 3 | Ymm, Mem |
574    /// | 4 | Ymm, Ymm |
575    /// | 5 | Zmm, Mem |
576    /// | 6 | Zmm, Zmm |
577    /// +---+----------+
578    /// ```
579    #[inline]
580    pub fn vpopcntd<A, B>(&mut self, op0: A, op1: B)
581    where
582        Assembler<'a>: VpopcntdEmitter<A, B>,
583    {
584        <Self as VpopcntdEmitter<A, B>>::vpopcntd(self, op0, op1);
585    }
586    /// `VPOPCNTD_MASK`.
587    ///
588    /// Supported operand variants:
589    ///
590    /// ```text
591    /// +---+----------+
592    /// | # | Operands |
593    /// +---+----------+
594    /// | 1 | Xmm, Mem |
595    /// | 2 | Xmm, Xmm |
596    /// | 3 | Ymm, Mem |
597    /// | 4 | Ymm, Ymm |
598    /// | 5 | Zmm, Mem |
599    /// | 6 | Zmm, Zmm |
600    /// +---+----------+
601    /// ```
602    #[inline]
603    pub fn vpopcntd_mask<A, B>(&mut self, op0: A, op1: B)
604    where
605        Assembler<'a>: VpopcntdMaskEmitter<A, B>,
606    {
607        <Self as VpopcntdMaskEmitter<A, B>>::vpopcntd_mask(self, op0, op1);
608    }
609    /// `VPOPCNTD_MASKZ`.
610    ///
611    /// Supported operand variants:
612    ///
613    /// ```text
614    /// +---+----------+
615    /// | # | Operands |
616    /// +---+----------+
617    /// | 1 | Xmm, Mem |
618    /// | 2 | Xmm, Xmm |
619    /// | 3 | Ymm, Mem |
620    /// | 4 | Ymm, Ymm |
621    /// | 5 | Zmm, Mem |
622    /// | 6 | Zmm, Zmm |
623    /// +---+----------+
624    /// ```
625    #[inline]
626    pub fn vpopcntd_maskz<A, B>(&mut self, op0: A, op1: B)
627    where
628        Assembler<'a>: VpopcntdMaskzEmitter<A, B>,
629    {
630        <Self as VpopcntdMaskzEmitter<A, B>>::vpopcntd_maskz(self, op0, op1);
631    }
632    /// `VPOPCNTQ`.
633    ///
634    /// Supported operand variants:
635    ///
636    /// ```text
637    /// +---+----------+
638    /// | # | Operands |
639    /// +---+----------+
640    /// | 1 | Xmm, Mem |
641    /// | 2 | Xmm, Xmm |
642    /// | 3 | Ymm, Mem |
643    /// | 4 | Ymm, Ymm |
644    /// | 5 | Zmm, Mem |
645    /// | 6 | Zmm, Zmm |
646    /// +---+----------+
647    /// ```
648    #[inline]
649    pub fn vpopcntq<A, B>(&mut self, op0: A, op1: B)
650    where
651        Assembler<'a>: VpopcntqEmitter<A, B>,
652    {
653        <Self as VpopcntqEmitter<A, B>>::vpopcntq(self, op0, op1);
654    }
655    /// `VPOPCNTQ_MASK`.
656    ///
657    /// Supported operand variants:
658    ///
659    /// ```text
660    /// +---+----------+
661    /// | # | Operands |
662    /// +---+----------+
663    /// | 1 | Xmm, Mem |
664    /// | 2 | Xmm, Xmm |
665    /// | 3 | Ymm, Mem |
666    /// | 4 | Ymm, Ymm |
667    /// | 5 | Zmm, Mem |
668    /// | 6 | Zmm, Zmm |
669    /// +---+----------+
670    /// ```
671    #[inline]
672    pub fn vpopcntq_mask<A, B>(&mut self, op0: A, op1: B)
673    where
674        Assembler<'a>: VpopcntqMaskEmitter<A, B>,
675    {
676        <Self as VpopcntqMaskEmitter<A, B>>::vpopcntq_mask(self, op0, op1);
677    }
678    /// `VPOPCNTQ_MASKZ`.
679    ///
680    /// Supported operand variants:
681    ///
682    /// ```text
683    /// +---+----------+
684    /// | # | Operands |
685    /// +---+----------+
686    /// | 1 | Xmm, Mem |
687    /// | 2 | Xmm, Xmm |
688    /// | 3 | Ymm, Mem |
689    /// | 4 | Ymm, Ymm |
690    /// | 5 | Zmm, Mem |
691    /// | 6 | Zmm, Zmm |
692    /// +---+----------+
693    /// ```
694    #[inline]
695    pub fn vpopcntq_maskz<A, B>(&mut self, op0: A, op1: B)
696    where
697        Assembler<'a>: VpopcntqMaskzEmitter<A, B>,
698    {
699        <Self as VpopcntqMaskzEmitter<A, B>>::vpopcntq_maskz(self, op0, op1);
700    }
701}