iced_x86/code_asm/
reg.rs

1// SPDX-License-Identifier: MIT
2// Copyright (C) 2018-present iced project and contributors
3
4// ⚠️This file was generated by GENERATOR!🦹‍♂️
5
6use crate::code_asm::op_state::CodeAsmOpState;
7use crate::Register;
8
9/// All 8-bit general purpose registers.
10///
11/// This type is *not* part of the public API! It's an implementation detail.
12/// The register identifiers, however, *are* part of the public API.
13///
14/// To use the registers, you must import everything from the module:
15///
16/// ```
17/// # #![allow(unused_imports)]
18/// use iced_x86::code_asm::*;
19/// ```
20///
21/// or import them from this module:
22///
23/// ```
24/// # #![allow(unused_imports)]
25/// use iced_x86::code_asm::registers::*;
26/// ```
27///
28/// or import only these registers:
29///
30/// ```
31/// # #![allow(unused_imports)]
32/// use iced_x86::code_asm::registers::gpr8::*;
33/// ```
34#[derive(Debug, Copy, Clone, Eq, PartialEq)]
35#[rustfmt::skip]
36#[repr(transparent)]
37pub struct AsmRegister8 {
38	register: Register,
39}
40
41#[rustfmt::skip]
42impl AsmRegister8 {
43	#[must_use]
44	#[inline]
45	pub(crate) const fn new(register: Register) -> Self {
46		Self { register }
47	}
48
49	#[must_use]
50	#[inline]
51	pub(crate) fn register(&self) -> Register {
52		self.register
53	}
54}
55
56#[rustfmt::skip]
57impl From<AsmRegister8> for Register {
58	#[inline]
59	fn from(reg: AsmRegister8) -> Self {
60		reg.register
61	}
62}
63
64/// All 16-bit general purpose registers.
65///
66/// This type is *not* part of the public API! It's an implementation detail.
67/// The register identifiers, however, *are* part of the public API.
68///
69/// To use the registers, you must import everything from the module:
70///
71/// ```
72/// # #![allow(unused_imports)]
73/// use iced_x86::code_asm::*;
74/// ```
75///
76/// or import them from this module:
77///
78/// ```
79/// # #![allow(unused_imports)]
80/// use iced_x86::code_asm::registers::*;
81/// ```
82///
83/// or import only these registers:
84///
85/// ```
86/// # #![allow(unused_imports)]
87/// use iced_x86::code_asm::registers::gpr16::*;
88/// ```
89#[derive(Debug, Copy, Clone, Eq, PartialEq)]
90#[rustfmt::skip]
91#[repr(transparent)]
92pub struct AsmRegister16 {
93	register: Register,
94}
95
96#[rustfmt::skip]
97impl AsmRegister16 {
98	#[must_use]
99	#[inline]
100	pub(crate) const fn new(register: Register) -> Self {
101		Self { register }
102	}
103
104	#[must_use]
105	#[inline]
106	pub(crate) fn register(&self) -> Register {
107		self.register
108	}
109}
110
111#[rustfmt::skip]
112impl From<AsmRegister16> for Register {
113	#[inline]
114	fn from(reg: AsmRegister16) -> Self {
115		reg.register
116	}
117}
118
119/// All 32-bit general purpose registers.
120///
121/// This type is *not* part of the public API! It's an implementation detail.
122/// The register identifiers, however, *are* part of the public API.
123///
124/// To use the registers, you must import everything from the module:
125///
126/// ```
127/// # #![allow(unused_imports)]
128/// use iced_x86::code_asm::*;
129/// ```
130///
131/// or import them from this module:
132///
133/// ```
134/// # #![allow(unused_imports)]
135/// use iced_x86::code_asm::registers::*;
136/// ```
137///
138/// or import only these registers:
139///
140/// ```
141/// # #![allow(unused_imports)]
142/// use iced_x86::code_asm::registers::gpr32::*;
143/// ```
144#[derive(Debug, Copy, Clone, Eq, PartialEq)]
145#[rustfmt::skip]
146pub struct AsmRegister32 {
147	register: Register,
148	state: CodeAsmOpState,
149}
150
151#[rustfmt::skip]
152impl AsmRegister32 {
153	#[must_use]
154	#[inline]
155	pub(crate) const fn new(register: Register) -> Self {
156		Self { register, state: CodeAsmOpState::new() }
157	}
158
159	#[must_use]
160	#[inline]
161	pub(crate) fn register(&self) -> Register {
162		self.register
163	}
164
165	#[must_use]
166	#[inline]
167	pub(crate) fn state(&self) -> CodeAsmOpState {
168		self.state
169	}
170
171	/// Adds a `{k1}` opmask register
172	#[must_use]
173	#[inline]
174	pub fn k1(mut self) -> Self {
175		self.state.set_k1();
176		self
177	}
178
179	/// Adds a `{k2}` opmask register
180	#[must_use]
181	#[inline]
182	pub fn k2(mut self) -> Self {
183		self.state.set_k2();
184		self
185	}
186
187	/// Adds a `{k3}` opmask register
188	#[must_use]
189	#[inline]
190	pub fn k3(mut self) -> Self {
191		self.state.set_k3();
192		self
193	}
194
195	/// Adds a `{k4}` opmask register
196	#[must_use]
197	#[inline]
198	pub fn k4(mut self) -> Self {
199		self.state.set_k4();
200		self
201	}
202
203	/// Adds a `{k5}` opmask register
204	#[must_use]
205	#[inline]
206	pub fn k5(mut self) -> Self {
207		self.state.set_k5();
208		self
209	}
210
211	/// Adds a `{k6}` opmask register
212	#[must_use]
213	#[inline]
214	pub fn k6(mut self) -> Self {
215		self.state.set_k6();
216		self
217	}
218
219	/// Adds a `{k7}` opmask register
220	#[must_use]
221	#[inline]
222	pub fn k7(mut self) -> Self {
223		self.state.set_k7();
224		self
225	}
226
227	/// Enables zeroing masking `{z}`
228	#[must_use]
229	#[inline]
230	pub fn z(mut self) -> Self {
231		self.state.set_zeroing_masking();
232		self
233	}
234
235	/// Enables suppress all exceptions `{sae}`
236	#[must_use]
237	#[inline]
238	pub fn sae(mut self) -> Self {
239		self.state.set_suppress_all_exceptions();
240		self
241	}
242
243	/// Round to nearest (even)
244	#[must_use]
245	#[inline]
246	pub fn rn_sae(mut self) -> Self {
247		self.state.rn_sae();
248		self
249	}
250
251	/// Round down (toward -inf)
252	#[must_use]
253	#[inline]
254	pub fn rd_sae(mut self) -> Self {
255		self.state.rd_sae();
256		self
257	}
258
259	/// Round up (toward +inf)
260	#[must_use]
261	#[inline]
262	pub fn ru_sae(mut self) -> Self {
263		self.state.ru_sae();
264		self
265	}
266
267	/// Round toward zero (truncate)
268	#[must_use]
269	#[inline]
270	pub fn rz_sae(mut self) -> Self {
271		self.state.rz_sae();
272		self
273	}
274}
275
276#[rustfmt::skip]
277impl From<AsmRegister32> for Register {
278	#[inline]
279	fn from(reg: AsmRegister32) -> Self {
280		reg.register
281	}
282}
283
284/// All 64-bit general purpose registers.
285///
286/// This type is *not* part of the public API! It's an implementation detail.
287/// The register identifiers, however, *are* part of the public API.
288///
289/// To use the registers, you must import everything from the module:
290///
291/// ```
292/// # #![allow(unused_imports)]
293/// use iced_x86::code_asm::*;
294/// ```
295///
296/// or import them from this module:
297///
298/// ```
299/// # #![allow(unused_imports)]
300/// use iced_x86::code_asm::registers::*;
301/// ```
302///
303/// or import only these registers:
304///
305/// ```
306/// # #![allow(unused_imports)]
307/// use iced_x86::code_asm::registers::gpr64::*;
308/// ```
309#[derive(Debug, Copy, Clone, Eq, PartialEq)]
310#[rustfmt::skip]
311pub struct AsmRegister64 {
312	register: Register,
313	state: CodeAsmOpState,
314}
315
316#[rustfmt::skip]
317impl AsmRegister64 {
318	#[must_use]
319	#[inline]
320	pub(crate) const fn new(register: Register) -> Self {
321		Self { register, state: CodeAsmOpState::new() }
322	}
323
324	#[must_use]
325	#[inline]
326	pub(crate) fn register(&self) -> Register {
327		self.register
328	}
329
330	#[must_use]
331	#[inline]
332	pub(crate) fn state(&self) -> CodeAsmOpState {
333		self.state
334	}
335
336	/// Adds a `{k1}` opmask register
337	#[must_use]
338	#[inline]
339	pub fn k1(mut self) -> Self {
340		self.state.set_k1();
341		self
342	}
343
344	/// Adds a `{k2}` opmask register
345	#[must_use]
346	#[inline]
347	pub fn k2(mut self) -> Self {
348		self.state.set_k2();
349		self
350	}
351
352	/// Adds a `{k3}` opmask register
353	#[must_use]
354	#[inline]
355	pub fn k3(mut self) -> Self {
356		self.state.set_k3();
357		self
358	}
359
360	/// Adds a `{k4}` opmask register
361	#[must_use]
362	#[inline]
363	pub fn k4(mut self) -> Self {
364		self.state.set_k4();
365		self
366	}
367
368	/// Adds a `{k5}` opmask register
369	#[must_use]
370	#[inline]
371	pub fn k5(mut self) -> Self {
372		self.state.set_k5();
373		self
374	}
375
376	/// Adds a `{k6}` opmask register
377	#[must_use]
378	#[inline]
379	pub fn k6(mut self) -> Self {
380		self.state.set_k6();
381		self
382	}
383
384	/// Adds a `{k7}` opmask register
385	#[must_use]
386	#[inline]
387	pub fn k7(mut self) -> Self {
388		self.state.set_k7();
389		self
390	}
391
392	/// Enables zeroing masking `{z}`
393	#[must_use]
394	#[inline]
395	pub fn z(mut self) -> Self {
396		self.state.set_zeroing_masking();
397		self
398	}
399
400	/// Enables suppress all exceptions `{sae}`
401	#[must_use]
402	#[inline]
403	pub fn sae(mut self) -> Self {
404		self.state.set_suppress_all_exceptions();
405		self
406	}
407
408	/// Round to nearest (even)
409	#[must_use]
410	#[inline]
411	pub fn rn_sae(mut self) -> Self {
412		self.state.rn_sae();
413		self
414	}
415
416	/// Round down (toward -inf)
417	#[must_use]
418	#[inline]
419	pub fn rd_sae(mut self) -> Self {
420		self.state.rd_sae();
421		self
422	}
423
424	/// Round up (toward +inf)
425	#[must_use]
426	#[inline]
427	pub fn ru_sae(mut self) -> Self {
428		self.state.ru_sae();
429		self
430	}
431
432	/// Round toward zero (truncate)
433	#[must_use]
434	#[inline]
435	pub fn rz_sae(mut self) -> Self {
436		self.state.rz_sae();
437		self
438	}
439}
440
441#[rustfmt::skip]
442impl From<AsmRegister64> for Register {
443	#[inline]
444	fn from(reg: AsmRegister64) -> Self {
445		reg.register
446	}
447}
448
449/// All segment registers.
450///
451/// This type is *not* part of the public API! It's an implementation detail.
452/// The register identifiers, however, *are* part of the public API.
453///
454/// To use the registers, you must import everything from the module:
455///
456/// ```
457/// # #![allow(unused_imports)]
458/// use iced_x86::code_asm::*;
459/// ```
460///
461/// or import them from this module:
462///
463/// ```
464/// # #![allow(unused_imports)]
465/// use iced_x86::code_asm::registers::*;
466/// ```
467///
468/// or import only these registers:
469///
470/// ```
471/// # #![allow(unused_imports)]
472/// use iced_x86::code_asm::registers::segment::*;
473/// ```
474#[derive(Debug, Copy, Clone, Eq, PartialEq)]
475#[rustfmt::skip]
476#[repr(transparent)]
477pub struct AsmRegisterSegment {
478	register: Register,
479}
480
481#[rustfmt::skip]
482impl AsmRegisterSegment {
483	#[must_use]
484	#[inline]
485	pub(crate) const fn new(register: Register) -> Self {
486		Self { register }
487	}
488
489	#[must_use]
490	#[inline]
491	pub(crate) fn register(&self) -> Register {
492		self.register
493	}
494}
495
496#[rustfmt::skip]
497impl From<AsmRegisterSegment> for Register {
498	#[inline]
499	fn from(reg: AsmRegisterSegment) -> Self {
500		reg.register
501	}
502}
503
504/// All control registers.
505///
506/// This type is *not* part of the public API! It's an implementation detail.
507/// The register identifiers, however, *are* part of the public API.
508///
509/// To use the registers, you must import everything from the module:
510///
511/// ```
512/// # #![allow(unused_imports)]
513/// use iced_x86::code_asm::*;
514/// ```
515///
516/// or import them from this module:
517///
518/// ```
519/// # #![allow(unused_imports)]
520/// use iced_x86::code_asm::registers::*;
521/// ```
522///
523/// or import only these registers:
524///
525/// ```
526/// # #![allow(unused_imports)]
527/// use iced_x86::code_asm::registers::cr::*;
528/// ```
529#[derive(Debug, Copy, Clone, Eq, PartialEq)]
530#[rustfmt::skip]
531#[repr(transparent)]
532pub struct AsmRegisterCr {
533	register: Register,
534}
535
536#[rustfmt::skip]
537impl AsmRegisterCr {
538	#[must_use]
539	#[inline]
540	pub(crate) const fn new(register: Register) -> Self {
541		Self { register }
542	}
543
544	#[must_use]
545	#[inline]
546	pub(crate) fn register(&self) -> Register {
547		self.register
548	}
549}
550
551#[rustfmt::skip]
552impl From<AsmRegisterCr> for Register {
553	#[inline]
554	fn from(reg: AsmRegisterCr) -> Self {
555		reg.register
556	}
557}
558
559/// All debug registers.
560///
561/// This type is *not* part of the public API! It's an implementation detail.
562/// The register identifiers, however, *are* part of the public API.
563///
564/// To use the registers, you must import everything from the module:
565///
566/// ```
567/// # #![allow(unused_imports)]
568/// use iced_x86::code_asm::*;
569/// ```
570///
571/// or import them from this module:
572///
573/// ```
574/// # #![allow(unused_imports)]
575/// use iced_x86::code_asm::registers::*;
576/// ```
577///
578/// or import only these registers:
579///
580/// ```
581/// # #![allow(unused_imports)]
582/// use iced_x86::code_asm::registers::dr::*;
583/// ```
584#[derive(Debug, Copy, Clone, Eq, PartialEq)]
585#[rustfmt::skip]
586#[repr(transparent)]
587pub struct AsmRegisterDr {
588	register: Register,
589}
590
591#[rustfmt::skip]
592impl AsmRegisterDr {
593	#[must_use]
594	#[inline]
595	pub(crate) const fn new(register: Register) -> Self {
596		Self { register }
597	}
598
599	#[must_use]
600	#[inline]
601	pub(crate) fn register(&self) -> Register {
602		self.register
603	}
604}
605
606#[rustfmt::skip]
607impl From<AsmRegisterDr> for Register {
608	#[inline]
609	fn from(reg: AsmRegisterDr) -> Self {
610		reg.register
611	}
612}
613
614/// All test registers.
615///
616/// This type is *not* part of the public API! It's an implementation detail.
617/// The register identifiers, however, *are* part of the public API.
618///
619/// To use the registers, you must import everything from the module:
620///
621/// ```
622/// # #![allow(unused_imports)]
623/// use iced_x86::code_asm::*;
624/// ```
625///
626/// or import them from this module:
627///
628/// ```
629/// # #![allow(unused_imports)]
630/// use iced_x86::code_asm::registers::*;
631/// ```
632///
633/// or import only these registers:
634///
635/// ```
636/// # #![allow(unused_imports)]
637/// use iced_x86::code_asm::registers::tr::*;
638/// ```
639#[derive(Debug, Copy, Clone, Eq, PartialEq)]
640#[rustfmt::skip]
641#[repr(transparent)]
642pub struct AsmRegisterTr {
643	register: Register,
644}
645
646#[rustfmt::skip]
647impl AsmRegisterTr {
648	#[must_use]
649	#[inline]
650	pub(crate) const fn new(register: Register) -> Self {
651		Self { register }
652	}
653
654	#[must_use]
655	#[inline]
656	pub(crate) fn register(&self) -> Register {
657		self.register
658	}
659}
660
661#[rustfmt::skip]
662impl From<AsmRegisterTr> for Register {
663	#[inline]
664	fn from(reg: AsmRegisterTr) -> Self {
665		reg.register
666	}
667}
668
669/// All FPU registers.
670///
671/// This type is *not* part of the public API! It's an implementation detail.
672/// The register identifiers, however, *are* part of the public API.
673///
674/// To use the registers, you must import everything from the module:
675///
676/// ```
677/// # #![allow(unused_imports)]
678/// use iced_x86::code_asm::*;
679/// ```
680///
681/// or import them from this module:
682///
683/// ```
684/// # #![allow(unused_imports)]
685/// use iced_x86::code_asm::registers::*;
686/// ```
687///
688/// or import only these registers:
689///
690/// ```
691/// # #![allow(unused_imports)]
692/// use iced_x86::code_asm::registers::st::*;
693/// ```
694#[derive(Debug, Copy, Clone, Eq, PartialEq)]
695#[rustfmt::skip]
696#[repr(transparent)]
697pub struct AsmRegisterSt {
698	register: Register,
699}
700
701#[rustfmt::skip]
702impl AsmRegisterSt {
703	#[must_use]
704	#[inline]
705	pub(crate) const fn new(register: Register) -> Self {
706		Self { register }
707	}
708
709	#[must_use]
710	#[inline]
711	pub(crate) fn register(&self) -> Register {
712		self.register
713	}
714}
715
716#[rustfmt::skip]
717impl From<AsmRegisterSt> for Register {
718	#[inline]
719	fn from(reg: AsmRegisterSt) -> Self {
720		reg.register
721	}
722}
723
724/// All MMX registers.
725///
726/// This type is *not* part of the public API! It's an implementation detail.
727/// The register identifiers, however, *are* part of the public API.
728///
729/// To use the registers, you must import everything from the module:
730///
731/// ```
732/// # #![allow(unused_imports)]
733/// use iced_x86::code_asm::*;
734/// ```
735///
736/// or import them from this module:
737///
738/// ```
739/// # #![allow(unused_imports)]
740/// use iced_x86::code_asm::registers::*;
741/// ```
742///
743/// or import only these registers:
744///
745/// ```
746/// # #![allow(unused_imports)]
747/// use iced_x86::code_asm::registers::mm::*;
748/// ```
749#[derive(Debug, Copy, Clone, Eq, PartialEq)]
750#[rustfmt::skip]
751#[repr(transparent)]
752pub struct AsmRegisterMm {
753	register: Register,
754}
755
756#[rustfmt::skip]
757impl AsmRegisterMm {
758	#[must_use]
759	#[inline]
760	pub(crate) const fn new(register: Register) -> Self {
761		Self { register }
762	}
763
764	#[must_use]
765	#[inline]
766	pub(crate) fn register(&self) -> Register {
767		self.register
768	}
769}
770
771#[rustfmt::skip]
772impl From<AsmRegisterMm> for Register {
773	#[inline]
774	fn from(reg: AsmRegisterMm) -> Self {
775		reg.register
776	}
777}
778
779/// All 128-bit vector registers (XMM).
780///
781/// This type is *not* part of the public API! It's an implementation detail.
782/// The register identifiers, however, *are* part of the public API.
783///
784/// To use the registers, you must import everything from the module:
785///
786/// ```
787/// # #![allow(unused_imports)]
788/// use iced_x86::code_asm::*;
789/// ```
790///
791/// or import them from this module:
792///
793/// ```
794/// # #![allow(unused_imports)]
795/// use iced_x86::code_asm::registers::*;
796/// ```
797///
798/// or import only these registers:
799///
800/// ```
801/// # #![allow(unused_imports)]
802/// use iced_x86::code_asm::registers::xmm::*;
803/// ```
804#[derive(Debug, Copy, Clone, Eq, PartialEq)]
805#[rustfmt::skip]
806pub struct AsmRegisterXmm {
807	register: Register,
808	state: CodeAsmOpState,
809}
810
811#[rustfmt::skip]
812impl AsmRegisterXmm {
813	#[must_use]
814	#[inline]
815	pub(crate) const fn new(register: Register) -> Self {
816		Self { register, state: CodeAsmOpState::new() }
817	}
818
819	#[must_use]
820	#[inline]
821	pub(crate) fn register(&self) -> Register {
822		self.register
823	}
824
825	#[must_use]
826	#[inline]
827	pub(crate) fn state(&self) -> CodeAsmOpState {
828		self.state
829	}
830
831	/// Adds a `{k1}` opmask register
832	#[must_use]
833	#[inline]
834	pub fn k1(mut self) -> Self {
835		self.state.set_k1();
836		self
837	}
838
839	/// Adds a `{k2}` opmask register
840	#[must_use]
841	#[inline]
842	pub fn k2(mut self) -> Self {
843		self.state.set_k2();
844		self
845	}
846
847	/// Adds a `{k3}` opmask register
848	#[must_use]
849	#[inline]
850	pub fn k3(mut self) -> Self {
851		self.state.set_k3();
852		self
853	}
854
855	/// Adds a `{k4}` opmask register
856	#[must_use]
857	#[inline]
858	pub fn k4(mut self) -> Self {
859		self.state.set_k4();
860		self
861	}
862
863	/// Adds a `{k5}` opmask register
864	#[must_use]
865	#[inline]
866	pub fn k5(mut self) -> Self {
867		self.state.set_k5();
868		self
869	}
870
871	/// Adds a `{k6}` opmask register
872	#[must_use]
873	#[inline]
874	pub fn k6(mut self) -> Self {
875		self.state.set_k6();
876		self
877	}
878
879	/// Adds a `{k7}` opmask register
880	#[must_use]
881	#[inline]
882	pub fn k7(mut self) -> Self {
883		self.state.set_k7();
884		self
885	}
886
887	/// Enables zeroing masking `{z}`
888	#[must_use]
889	#[inline]
890	pub fn z(mut self) -> Self {
891		self.state.set_zeroing_masking();
892		self
893	}
894
895	/// Enables suppress all exceptions `{sae}`
896	#[must_use]
897	#[inline]
898	pub fn sae(mut self) -> Self {
899		self.state.set_suppress_all_exceptions();
900		self
901	}
902
903	/// Round to nearest (even)
904	#[must_use]
905	#[inline]
906	pub fn rn_sae(mut self) -> Self {
907		self.state.rn_sae();
908		self
909	}
910
911	/// Round down (toward -inf)
912	#[must_use]
913	#[inline]
914	pub fn rd_sae(mut self) -> Self {
915		self.state.rd_sae();
916		self
917	}
918
919	/// Round up (toward +inf)
920	#[must_use]
921	#[inline]
922	pub fn ru_sae(mut self) -> Self {
923		self.state.ru_sae();
924		self
925	}
926
927	/// Round toward zero (truncate)
928	#[must_use]
929	#[inline]
930	pub fn rz_sae(mut self) -> Self {
931		self.state.rz_sae();
932		self
933	}
934}
935
936#[rustfmt::skip]
937impl From<AsmRegisterXmm> for Register {
938	#[inline]
939	fn from(reg: AsmRegisterXmm) -> Self {
940		reg.register
941	}
942}
943
944/// All 256-bit vector registers (YMM).
945///
946/// This type is *not* part of the public API! It's an implementation detail.
947/// The register identifiers, however, *are* part of the public API.
948///
949/// To use the registers, you must import everything from the module:
950///
951/// ```
952/// # #![allow(unused_imports)]
953/// use iced_x86::code_asm::*;
954/// ```
955///
956/// or import them from this module:
957///
958/// ```
959/// # #![allow(unused_imports)]
960/// use iced_x86::code_asm::registers::*;
961/// ```
962///
963/// or import only these registers:
964///
965/// ```
966/// # #![allow(unused_imports)]
967/// use iced_x86::code_asm::registers::ymm::*;
968/// ```
969#[derive(Debug, Copy, Clone, Eq, PartialEq)]
970#[rustfmt::skip]
971pub struct AsmRegisterYmm {
972	register: Register,
973	state: CodeAsmOpState,
974}
975
976#[rustfmt::skip]
977impl AsmRegisterYmm {
978	#[must_use]
979	#[inline]
980	pub(crate) const fn new(register: Register) -> Self {
981		Self { register, state: CodeAsmOpState::new() }
982	}
983
984	#[must_use]
985	#[inline]
986	pub(crate) fn register(&self) -> Register {
987		self.register
988	}
989
990	#[must_use]
991	#[inline]
992	pub(crate) fn state(&self) -> CodeAsmOpState {
993		self.state
994	}
995
996	/// Adds a `{k1}` opmask register
997	#[must_use]
998	#[inline]
999	pub fn k1(mut self) -> Self {
1000		self.state.set_k1();
1001		self
1002	}
1003
1004	/// Adds a `{k2}` opmask register
1005	#[must_use]
1006	#[inline]
1007	pub fn k2(mut self) -> Self {
1008		self.state.set_k2();
1009		self
1010	}
1011
1012	/// Adds a `{k3}` opmask register
1013	#[must_use]
1014	#[inline]
1015	pub fn k3(mut self) -> Self {
1016		self.state.set_k3();
1017		self
1018	}
1019
1020	/// Adds a `{k4}` opmask register
1021	#[must_use]
1022	#[inline]
1023	pub fn k4(mut self) -> Self {
1024		self.state.set_k4();
1025		self
1026	}
1027
1028	/// Adds a `{k5}` opmask register
1029	#[must_use]
1030	#[inline]
1031	pub fn k5(mut self) -> Self {
1032		self.state.set_k5();
1033		self
1034	}
1035
1036	/// Adds a `{k6}` opmask register
1037	#[must_use]
1038	#[inline]
1039	pub fn k6(mut self) -> Self {
1040		self.state.set_k6();
1041		self
1042	}
1043
1044	/// Adds a `{k7}` opmask register
1045	#[must_use]
1046	#[inline]
1047	pub fn k7(mut self) -> Self {
1048		self.state.set_k7();
1049		self
1050	}
1051
1052	/// Enables zeroing masking `{z}`
1053	#[must_use]
1054	#[inline]
1055	pub fn z(mut self) -> Self {
1056		self.state.set_zeroing_masking();
1057		self
1058	}
1059
1060	/// Enables suppress all exceptions `{sae}`
1061	#[must_use]
1062	#[inline]
1063	pub fn sae(mut self) -> Self {
1064		self.state.set_suppress_all_exceptions();
1065		self
1066	}
1067
1068	/// Round to nearest (even)
1069	#[must_use]
1070	#[inline]
1071	pub fn rn_sae(mut self) -> Self {
1072		self.state.rn_sae();
1073		self
1074	}
1075
1076	/// Round down (toward -inf)
1077	#[must_use]
1078	#[inline]
1079	pub fn rd_sae(mut self) -> Self {
1080		self.state.rd_sae();
1081		self
1082	}
1083
1084	/// Round up (toward +inf)
1085	#[must_use]
1086	#[inline]
1087	pub fn ru_sae(mut self) -> Self {
1088		self.state.ru_sae();
1089		self
1090	}
1091
1092	/// Round toward zero (truncate)
1093	#[must_use]
1094	#[inline]
1095	pub fn rz_sae(mut self) -> Self {
1096		self.state.rz_sae();
1097		self
1098	}
1099}
1100
1101#[rustfmt::skip]
1102impl From<AsmRegisterYmm> for Register {
1103	#[inline]
1104	fn from(reg: AsmRegisterYmm) -> Self {
1105		reg.register
1106	}
1107}
1108
1109/// All 512-bit vector registers (ZMM).
1110///
1111/// This type is *not* part of the public API! It's an implementation detail.
1112/// The register identifiers, however, *are* part of the public API.
1113///
1114/// To use the registers, you must import everything from the module:
1115///
1116/// ```
1117/// # #![allow(unused_imports)]
1118/// use iced_x86::code_asm::*;
1119/// ```
1120///
1121/// or import them from this module:
1122///
1123/// ```
1124/// # #![allow(unused_imports)]
1125/// use iced_x86::code_asm::registers::*;
1126/// ```
1127///
1128/// or import only these registers:
1129///
1130/// ```
1131/// # #![allow(unused_imports)]
1132/// use iced_x86::code_asm::registers::zmm::*;
1133/// ```
1134#[derive(Debug, Copy, Clone, Eq, PartialEq)]
1135#[rustfmt::skip]
1136pub struct AsmRegisterZmm {
1137	register: Register,
1138	state: CodeAsmOpState,
1139}
1140
1141#[rustfmt::skip]
1142impl AsmRegisterZmm {
1143	#[must_use]
1144	#[inline]
1145	pub(crate) const fn new(register: Register) -> Self {
1146		Self { register, state: CodeAsmOpState::new() }
1147	}
1148
1149	#[must_use]
1150	#[inline]
1151	pub(crate) fn register(&self) -> Register {
1152		self.register
1153	}
1154
1155	#[must_use]
1156	#[inline]
1157	pub(crate) fn state(&self) -> CodeAsmOpState {
1158		self.state
1159	}
1160
1161	/// Adds a `{k1}` opmask register
1162	#[must_use]
1163	#[inline]
1164	pub fn k1(mut self) -> Self {
1165		self.state.set_k1();
1166		self
1167	}
1168
1169	/// Adds a `{k2}` opmask register
1170	#[must_use]
1171	#[inline]
1172	pub fn k2(mut self) -> Self {
1173		self.state.set_k2();
1174		self
1175	}
1176
1177	/// Adds a `{k3}` opmask register
1178	#[must_use]
1179	#[inline]
1180	pub fn k3(mut self) -> Self {
1181		self.state.set_k3();
1182		self
1183	}
1184
1185	/// Adds a `{k4}` opmask register
1186	#[must_use]
1187	#[inline]
1188	pub fn k4(mut self) -> Self {
1189		self.state.set_k4();
1190		self
1191	}
1192
1193	/// Adds a `{k5}` opmask register
1194	#[must_use]
1195	#[inline]
1196	pub fn k5(mut self) -> Self {
1197		self.state.set_k5();
1198		self
1199	}
1200
1201	/// Adds a `{k6}` opmask register
1202	#[must_use]
1203	#[inline]
1204	pub fn k6(mut self) -> Self {
1205		self.state.set_k6();
1206		self
1207	}
1208
1209	/// Adds a `{k7}` opmask register
1210	#[must_use]
1211	#[inline]
1212	pub fn k7(mut self) -> Self {
1213		self.state.set_k7();
1214		self
1215	}
1216
1217	/// Enables zeroing masking `{z}`
1218	#[must_use]
1219	#[inline]
1220	pub fn z(mut self) -> Self {
1221		self.state.set_zeroing_masking();
1222		self
1223	}
1224
1225	/// Enables suppress all exceptions `{sae}`
1226	#[must_use]
1227	#[inline]
1228	pub fn sae(mut self) -> Self {
1229		self.state.set_suppress_all_exceptions();
1230		self
1231	}
1232
1233	/// Round to nearest (even)
1234	#[must_use]
1235	#[inline]
1236	pub fn rn_sae(mut self) -> Self {
1237		self.state.rn_sae();
1238		self
1239	}
1240
1241	/// Round down (toward -inf)
1242	#[must_use]
1243	#[inline]
1244	pub fn rd_sae(mut self) -> Self {
1245		self.state.rd_sae();
1246		self
1247	}
1248
1249	/// Round up (toward +inf)
1250	#[must_use]
1251	#[inline]
1252	pub fn ru_sae(mut self) -> Self {
1253		self.state.ru_sae();
1254		self
1255	}
1256
1257	/// Round toward zero (truncate)
1258	#[must_use]
1259	#[inline]
1260	pub fn rz_sae(mut self) -> Self {
1261		self.state.rz_sae();
1262		self
1263	}
1264}
1265
1266#[rustfmt::skip]
1267impl From<AsmRegisterZmm> for Register {
1268	#[inline]
1269	fn from(reg: AsmRegisterZmm) -> Self {
1270		reg.register
1271	}
1272}
1273
1274/// All tile registers.
1275///
1276/// This type is *not* part of the public API! It's an implementation detail.
1277/// The register identifiers, however, *are* part of the public API.
1278///
1279/// To use the registers, you must import everything from the module:
1280///
1281/// ```
1282/// # #![allow(unused_imports)]
1283/// use iced_x86::code_asm::*;
1284/// ```
1285///
1286/// or import them from this module:
1287///
1288/// ```
1289/// # #![allow(unused_imports)]
1290/// use iced_x86::code_asm::registers::*;
1291/// ```
1292///
1293/// or import only these registers:
1294///
1295/// ```
1296/// # #![allow(unused_imports)]
1297/// use iced_x86::code_asm::registers::tmm::*;
1298/// ```
1299#[derive(Debug, Copy, Clone, Eq, PartialEq)]
1300#[rustfmt::skip]
1301#[repr(transparent)]
1302pub struct AsmRegisterTmm {
1303	register: Register,
1304}
1305
1306#[rustfmt::skip]
1307impl AsmRegisterTmm {
1308	#[must_use]
1309	#[inline]
1310	pub(crate) const fn new(register: Register) -> Self {
1311		Self { register }
1312	}
1313
1314	#[must_use]
1315	#[inline]
1316	pub(crate) fn register(&self) -> Register {
1317		self.register
1318	}
1319}
1320
1321#[rustfmt::skip]
1322impl From<AsmRegisterTmm> for Register {
1323	#[inline]
1324	fn from(reg: AsmRegisterTmm) -> Self {
1325		reg.register
1326	}
1327}
1328
1329/// All opmask registers.
1330///
1331/// This type is *not* part of the public API! It's an implementation detail.
1332/// The register identifiers, however, *are* part of the public API.
1333///
1334/// To use the registers, you must import everything from the module:
1335///
1336/// ```
1337/// # #![allow(unused_imports)]
1338/// use iced_x86::code_asm::*;
1339/// ```
1340///
1341/// or import them from this module:
1342///
1343/// ```
1344/// # #![allow(unused_imports)]
1345/// use iced_x86::code_asm::registers::*;
1346/// ```
1347///
1348/// or import only these registers:
1349///
1350/// ```
1351/// # #![allow(unused_imports)]
1352/// use iced_x86::code_asm::registers::k::*;
1353/// ```
1354#[derive(Debug, Copy, Clone, Eq, PartialEq)]
1355#[rustfmt::skip]
1356pub struct AsmRegisterK {
1357	register: Register,
1358	state: CodeAsmOpState,
1359}
1360
1361#[rustfmt::skip]
1362impl AsmRegisterK {
1363	#[must_use]
1364	#[inline]
1365	pub(crate) const fn new(register: Register) -> Self {
1366		Self { register, state: CodeAsmOpState::new() }
1367	}
1368
1369	#[must_use]
1370	#[inline]
1371	pub(crate) fn register(&self) -> Register {
1372		self.register
1373	}
1374
1375	#[must_use]
1376	#[inline]
1377	pub(crate) fn state(&self) -> CodeAsmOpState {
1378		self.state
1379	}
1380
1381	/// Adds a `{k1}` opmask register
1382	#[must_use]
1383	#[inline]
1384	pub fn k1(mut self) -> Self {
1385		self.state.set_k1();
1386		self
1387	}
1388
1389	/// Adds a `{k2}` opmask register
1390	#[must_use]
1391	#[inline]
1392	pub fn k2(mut self) -> Self {
1393		self.state.set_k2();
1394		self
1395	}
1396
1397	/// Adds a `{k3}` opmask register
1398	#[must_use]
1399	#[inline]
1400	pub fn k3(mut self) -> Self {
1401		self.state.set_k3();
1402		self
1403	}
1404
1405	/// Adds a `{k4}` opmask register
1406	#[must_use]
1407	#[inline]
1408	pub fn k4(mut self) -> Self {
1409		self.state.set_k4();
1410		self
1411	}
1412
1413	/// Adds a `{k5}` opmask register
1414	#[must_use]
1415	#[inline]
1416	pub fn k5(mut self) -> Self {
1417		self.state.set_k5();
1418		self
1419	}
1420
1421	/// Adds a `{k6}` opmask register
1422	#[must_use]
1423	#[inline]
1424	pub fn k6(mut self) -> Self {
1425		self.state.set_k6();
1426		self
1427	}
1428
1429	/// Adds a `{k7}` opmask register
1430	#[must_use]
1431	#[inline]
1432	pub fn k7(mut self) -> Self {
1433		self.state.set_k7();
1434		self
1435	}
1436
1437	/// Enables zeroing masking `{z}`
1438	#[must_use]
1439	#[inline]
1440	pub fn z(mut self) -> Self {
1441		self.state.set_zeroing_masking();
1442		self
1443	}
1444
1445	/// Enables suppress all exceptions `{sae}`
1446	#[must_use]
1447	#[inline]
1448	pub fn sae(mut self) -> Self {
1449		self.state.set_suppress_all_exceptions();
1450		self
1451	}
1452
1453	/// Round to nearest (even)
1454	#[must_use]
1455	#[inline]
1456	pub fn rn_sae(mut self) -> Self {
1457		self.state.rn_sae();
1458		self
1459	}
1460
1461	/// Round down (toward -inf)
1462	#[must_use]
1463	#[inline]
1464	pub fn rd_sae(mut self) -> Self {
1465		self.state.rd_sae();
1466		self
1467	}
1468
1469	/// Round up (toward +inf)
1470	#[must_use]
1471	#[inline]
1472	pub fn ru_sae(mut self) -> Self {
1473		self.state.ru_sae();
1474		self
1475	}
1476
1477	/// Round toward zero (truncate)
1478	#[must_use]
1479	#[inline]
1480	pub fn rz_sae(mut self) -> Self {
1481		self.state.rz_sae();
1482		self
1483	}
1484}
1485
1486#[rustfmt::skip]
1487impl From<AsmRegisterK> for Register {
1488	#[inline]
1489	fn from(reg: AsmRegisterK) -> Self {
1490		reg.register
1491	}
1492}
1493
1494/// All bound registers.
1495///
1496/// This type is *not* part of the public API! It's an implementation detail.
1497/// The register identifiers, however, *are* part of the public API.
1498///
1499/// To use the registers, you must import everything from the module:
1500///
1501/// ```
1502/// # #![allow(unused_imports)]
1503/// use iced_x86::code_asm::*;
1504/// ```
1505///
1506/// or import them from this module:
1507///
1508/// ```
1509/// # #![allow(unused_imports)]
1510/// use iced_x86::code_asm::registers::*;
1511/// ```
1512///
1513/// or import only these registers:
1514///
1515/// ```
1516/// # #![allow(unused_imports)]
1517/// use iced_x86::code_asm::registers::bnd::*;
1518/// ```
1519#[derive(Debug, Copy, Clone, Eq, PartialEq)]
1520#[rustfmt::skip]
1521#[repr(transparent)]
1522pub struct AsmRegisterBnd {
1523	register: Register,
1524}
1525
1526#[rustfmt::skip]
1527impl AsmRegisterBnd {
1528	#[must_use]
1529	#[inline]
1530	pub(crate) const fn new(register: Register) -> Self {
1531		Self { register }
1532	}
1533
1534	#[must_use]
1535	#[inline]
1536	pub(crate) fn register(&self) -> Register {
1537		self.register
1538	}
1539}
1540
1541#[rustfmt::skip]
1542impl From<AsmRegisterBnd> for Register {
1543	#[inline]
1544	fn from(reg: AsmRegisterBnd) -> Self {
1545		reg.register
1546	}
1547}