1 /* Declarations for Intel 80386 opcode table
2 Copyright (C) 2007-2023 Free Software Foundation, Inc.
4 This file is part of the GNU opcodes library.
6 This library is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 It is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to the Free
18 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
21 #include "opcode/i386.h"
27 /* Position of cpu flags bitfiled. */
31 /* i186 or better required */
33 /* i286 or better required */
35 /* i386 or better required */
37 /* i486 or better required */
39 /* i585 or better required */
41 /* i686 or better required */
43 /* CMOV Instruction support required */
45 /* FXSR Instruction support required */
47 /* CLFLUSH Instruction support required */
49 /* NOP Instruction support required */
51 /* SYSCALL Instructions support required */
53 /* Floating point support required */
55 /* i686 and floating point support required */
57 /* SSE3 and floating point support required */
59 /* MMX support required */
61 /* SSE support required */
63 /* SSE2 support required */
65 /* SSE3 support required */
67 /* VIA PadLock required */
69 /* AMD Secure Virtual Machine Ext-s required */
71 /* VMX Instructions required */
73 /* SMX Instructions required */
75 /* SSSE3 support required */
77 /* SSE4a support required */
79 /* LZCNT support required */
81 /* POPCNT support required */
83 /* MONITOR support required */
85 /* SSE4.1 support required */
87 /* SSE4.2 support required */
89 /* AVX2 support required */
91 /* Intel AVX-512 Conflict Detection Instructions support required */
93 /* Intel AVX-512 Exponential and Reciprocal Instructions support
96 /* Intel AVX-512 Prefetch Instructions support required */
98 /* Intel AVX-512 DQ Instructions support required. */
100 /* Intel AVX-512 BW Instructions support required. */
102 /* Intel IAMCU support required */
104 /* Xsave/xrstor New Instructions support required */
106 /* Xsaveopt New Instructions support required */
108 /* AES support required */
110 /* PCLMULQDQ support required */
112 /* FMA support required */
114 /* FMA4 support required */
116 /* XOP support required */
118 /* LWP support required */
120 /* BMI support required */
122 /* TBM support required */
124 /* MOVBE Instruction support required */
126 /* CMPXCHG16B instruction support required. */
128 /* LAHF/SAHF instruction support required (in 64-bit mode). */
130 /* EPT Instructions required */
132 /* RDTSCP Instruction support required */
134 /* FSGSBASE Instructions required */
136 /* RDRND Instructions required */
138 /* F16C Instructions required */
140 /* Intel BMI2 support required */
142 /* RTM support required */
144 /* INVPCID Instructions required */
146 /* VMFUNC Instruction required */
148 /* Intel MPX Instructions required */
150 /* RDRSEED instruction required. */
152 /* Multi-presisionn add-carry instructions are required. */
154 /* Supports prefetchw and prefetch instructions. */
156 /* SMAP instructions required. */
158 /* SHA instructions required. */
160 /* SHA512 instructions required. */
162 /* SM3 instructions required. */
164 /* SM4 instructions required. */
166 /* CLFLUSHOPT instruction required */
168 /* XSAVES/XRSTORS instruction required */
170 /* XSAVEC instruction required */
172 /* PREFETCHWT1 instruction required */
174 /* SE1 instruction required */
176 /* CLWB instruction required */
178 /* Intel AVX-512 IFMA Instructions support required. */
180 /* Intel AVX-512 VBMI Instructions support required. */
182 /* Intel AVX-512 4FMAPS Instructions support required. */
184 /* Intel AVX-512 4VNNIW Instructions support required. */
186 /* Intel AVX-512 VPOPCNTDQ Instructions support required. */
188 /* Intel AVX-512 VBMI2 Instructions support required. */
190 /* Intel AVX-512 VNNI Instructions support required. */
192 /* Intel AVX-512 BITALG Instructions support required. */
194 /* Intel AVX-512 BF16 Instructions support required. */
196 /* Intel AVX-512 VP2INTERSECT Instructions support required. */
197 CpuAVX512_VP2INTERSECT
,
198 /* TDX Instructions support required. */
200 /* Intel AVX VNNI Instructions support required. */
202 /* Intel AVX-512 FP16 Instructions support required. */
204 /* PREFETCHI instruction required */
206 /* Intel AVX IFMA Instructions support required. */
208 /* Intel AVX VNNI-INT8 Instructions support required. */
210 /* Intel AVX VNNI-INT16 Instructions support required. */
212 /* Intel CMPccXADD instructions support required. */
214 /* Intel WRMSRNS Instructions support required */
216 /* Intel MSRLIST Instructions support required. */
218 /* Intel AVX NE CONVERT Instructions support required. */
220 /* Intel RAO INT Instructions support required. */
222 /* fred instruction required */
224 /* lkgs instruction required */
226 /* Intel USER_MSR Instruction support required. */
228 /* mwaitx instruction required */
230 /* Clzero instruction required */
232 /* OSPKE instruction required */
234 /* RDPID instruction required */
236 /* PTWRITE instruction required */
238 /* CET instructions support required */
241 /* AMX-INT8 instructions required */
243 /* AMX-BF16 instructions required */
245 /* AMX-FP16 instructions required */
247 /* AMX-COMPLEX instructions required. */
249 /* AMX-TILE instructions required */
251 /* GFNI instructions required */
253 /* VAES instructions required */
255 /* VPCLMULQDQ instructions required */
257 /* WBNOINVD instructions required */
259 /* PCONFIG instructions required */
261 /* PBNDKB instructions required. */
263 /* WAITPKG instructions required */
265 /* UINTR instructions required */
267 /* CLDEMOTE instruction required */
269 /* MOVDIRI instruction support required */
271 /* MOVDIRR64B instruction required */
273 /* ENQCMD instruction required */
275 /* SERIALIZE instruction required */
277 /* RDPRU instruction required */
279 /* MCOMMIT instruction required */
281 /* SEV-ES instruction(s) required */
283 /* TSXLDTRK instruction required */
285 /* KL instruction support required */
287 /* WideKL instruction support required */
289 /* HRESET instruction required */
291 /* INVLPGB instructions required */
293 /* TLBSYNC instructions required */
295 /* SNP instructions required */
297 /* RMPQUERY instruction required */
300 /* NOTE: These items, which can be combined with other ISA flags above, need
301 to remain second to last and in sync with CPU_FLAGS_COMMON. */
303 /* i287 support required */
305 CpuAttrEnums
= Cpu287
,
306 /* i387 support required */
308 /* 3dnow! support required */
310 /* 3dnow! Extensions support required */
312 /* 64bit support required */
314 /* AVX support required */
316 /* HLE support required */
318 /* Intel AVX-512 Foundation Instructions support required */
320 /* Intel AVX-512 VL Instructions support required. */
322 /* Not supported in the 64bit mode */
325 /* NOTE: This item needs to remain last. */
327 /* The last bitfield in i386_cpu_flags. */
331 #define CpuNumOfUints \
332 (CpuMax / sizeof (unsigned int) / CHAR_BIT + 1)
333 #define CpuNumOfBits \
334 (CpuNumOfUints * sizeof (unsigned int) * CHAR_BIT)
337 #define CpuAttrNumOfUints \
338 ((CpuIsaBits + CpuMax - CpuAttrEnums) / sizeof (unsigned int) / CHAR_BIT + 1)
339 #define CpuAttrNumOfBits \
340 (CpuAttrNumOfUints * sizeof (unsigned int) * CHAR_BIT)
342 /* If you get a compiler error for zero width of an unused field,
343 comment the respective one out. */
344 #define CpuUnused (CpuMax + 1)
345 #define CpuAttrUnused (CpuIsaBits + CpuMax + 1 - CpuAttrEnums)
347 #define CPU_FLAGS_COMMON \
348 unsigned int cpu287:1, \
357 /* NOTE: This field needs to remain last. */ \
360 typedef union i386_cpu_attr
364 unsigned int isa
:CpuIsaBits
;
367 unsigned int unused
:(CpuAttrNumOfBits
- CpuAttrUnused
);
370 unsigned int array
[CpuAttrNumOfUints
];
373 /* We can check if an instruction is available with array instead
375 typedef union i386_cpu_flags
379 unsigned int cpui186
:1;
380 unsigned int cpui286
:1;
381 unsigned int cpui386
:1;
382 unsigned int cpui486
:1;
383 unsigned int cpui586
:1;
384 unsigned int cpui686
:1;
385 unsigned int cpucmov
:1;
386 unsigned int cpufxsr
:1;
387 unsigned int cpuclflush
:1;
388 unsigned int cpunop
:1;
389 unsigned int cpusyscall
:1;
390 unsigned int cpu8087
:1;
391 unsigned int cpu687
:1;
392 unsigned int cpufisttp
:1;
393 unsigned int cpummx
:1;
394 unsigned int cpusse
:1;
395 unsigned int cpusse2
:1;
396 unsigned int cpusse3
:1;
397 unsigned int cpupadlock
:1;
398 unsigned int cpusvme
:1;
399 unsigned int cpuvmx
:1;
400 unsigned int cpusmx
:1;
401 unsigned int cpussse3
:1;
402 unsigned int cpusse4a
:1;
403 unsigned int cpulzcnt
:1;
404 unsigned int cpupopcnt
:1;
405 unsigned int cpumonitor
:1;
406 unsigned int cpusse4_1
:1;
407 unsigned int cpusse4_2
:1;
408 unsigned int cpuavx2
:1;
409 unsigned int cpuavx512cd
:1;
410 unsigned int cpuavx512er
:1;
411 unsigned int cpuavx512pf
:1;
412 unsigned int cpuavx512dq
:1;
413 unsigned int cpuavx512bw
:1;
414 unsigned int cpuiamcu
:1;
415 unsigned int cpuxsave
:1;
416 unsigned int cpuxsaveopt
:1;
417 unsigned int cpuaes
:1;
418 unsigned int cpupclmulqdq
:1;
419 unsigned int cpufma
:1;
420 unsigned int cpufma4
:1;
421 unsigned int cpuxop
:1;
422 unsigned int cpulwp
:1;
423 unsigned int cpubmi
:1;
424 unsigned int cputbm
:1;
425 unsigned int cpumovbe
:1;
426 unsigned int cpucx16
:1;
427 unsigned int cpulahf_sahf
:1;
428 unsigned int cpuept
:1;
429 unsigned int cpurdtscp
:1;
430 unsigned int cpufsgsbase
:1;
431 unsigned int cpurdrnd
:1;
432 unsigned int cpuf16c
:1;
433 unsigned int cpubmi2
:1;
434 unsigned int cpurtm
:1;
435 unsigned int cpuinvpcid
:1;
436 unsigned int cpuvmfunc
:1;
437 unsigned int cpumpx
:1;
438 unsigned int cpurdseed
:1;
439 unsigned int cpuadx
:1;
440 unsigned int cpuprfchw
:1;
441 unsigned int cpusmap
:1;
442 unsigned int cpusha
:1;
443 unsigned int cpusha512
:1;
444 unsigned int cpusm3
:1;
445 unsigned int cpusm4
:1;
446 unsigned int cpuclflushopt
:1;
447 unsigned int cpuxsaves
:1;
448 unsigned int cpuxsavec
:1;
449 unsigned int cpuprefetchwt1
:1;
450 unsigned int cpuse1
:1;
451 unsigned int cpuclwb
:1;
452 unsigned int cpuavx512ifma
:1;
453 unsigned int cpuavx512vbmi
:1;
454 unsigned int cpuavx512_4fmaps
:1;
455 unsigned int cpuavx512_4vnniw
:1;
456 unsigned int cpuavx512_vpopcntdq
:1;
457 unsigned int cpuavx512_vbmi2
:1;
458 unsigned int cpuavx512_vnni
:1;
459 unsigned int cpuavx512_bitalg
:1;
460 unsigned int cpuavx512_bf16
:1;
461 unsigned int cpuavx512_vp2intersect
:1;
462 unsigned int cputdx
:1;
463 unsigned int cpuavx_vnni
:1;
464 unsigned int cpuavx512_fp16
:1;
465 unsigned int cpuprefetchi
:1;
466 unsigned int cpuavx_ifma
:1;
467 unsigned int cpuavx_vnni_int8
:1;
468 unsigned int cpuavx_vnni_int16
:1;
469 unsigned int cpucmpccxadd
:1;
470 unsigned int cpuwrmsrns
:1;
471 unsigned int cpumsrlist
:1;
472 unsigned int cpuavx_ne_convert
:1;
473 unsigned int cpurao_int
:1;
474 unsigned int cpufred
:1;
475 unsigned int cpulkgs
:1;
476 unsigned int cpuuser_msr
:1;
477 unsigned int cpumwaitx
:1;
478 unsigned int cpuclzero
:1;
479 unsigned int cpuospke
:1;
480 unsigned int cpurdpid
:1;
481 unsigned int cpuptwrite
:1;
482 unsigned int cpuibt
:1;
483 unsigned int cpushstk
:1;
484 unsigned int cpuamx_int8
:1;
485 unsigned int cpuamx_bf16
:1;
486 unsigned int cpuamx_fp16
:1;
487 unsigned int cpuamx_complex
:1;
488 unsigned int cpuamx_tile
:1;
489 unsigned int cpugfni
:1;
490 unsigned int cpuvaes
:1;
491 unsigned int cpuvpclmulqdq
:1;
492 unsigned int cpuwbnoinvd
:1;
493 unsigned int cpupconfig
:1;
494 unsigned int cpupbndkb
:1;
495 unsigned int cpuwaitpkg
:1;
496 unsigned int cpuuintr
:1;
497 unsigned int cpucldemote
:1;
498 unsigned int cpumovdiri
:1;
499 unsigned int cpumovdir64b
:1;
500 unsigned int cpuenqcmd
:1;
501 unsigned int cpuserialize
:1;
502 unsigned int cpurdpru
:1;
503 unsigned int cpumcommit
:1;
504 unsigned int cpusev_es
:1;
505 unsigned int cputsxldtrk
:1;
506 unsigned int cpukl
:1;
507 unsigned int cpuwidekl
:1;
508 unsigned int cpuhreset
:1;
509 unsigned int cpuinvlpgb
:1;
510 unsigned int cputlbsync
:1;
511 unsigned int cpusnp
:1;
512 unsigned int cpurmpquery
:1;
515 unsigned int unused
:(CpuNumOfBits
- CpuUnused
);
518 unsigned int array
[CpuNumOfUints
];
521 /* Position of opcode_modifier bits. */
525 /* has direction bit. */
527 /* set if operands can be both bytes and words/dwords/qwords, encoded the
528 canonical way; the base_opcode field should hold the encoding for byte
531 /* load form instruction. Must be placed before store form. */
533 /* insn has a modrm byte. */
535 /* special case for jump insns; value has to be 1 */
541 /* special case for intersegment leaps/calls */
542 #define JUMP_INTERSEGMENT 4
543 /* absolute address for jump */
544 #define JUMP_ABSOLUTE 5
546 /* FP insn memory format bit, sized by 0x4 */
548 /* needs size prefix if in 32-bit mode */
550 /* needs size prefix if in 16-bit mode */
552 /* needs size prefix if in 64-bit mode */
555 /* Check that operand sizes match. */
557 /* any memory size */
559 /* fake an extra reg operand for clr, imul and special register
560 processing for some instructions. */
562 /* deprecated fp insn, gets a warning */
564 /* An implicit xmm0 as the first operand */
565 #define IMPLICIT_1ST_XMM0 4
566 /* The second operand must be a vector register, {x,y,z}mmN, where N is a multiple of 4.
567 It implicitly denotes the register group of {x,y,z}mmN - {x,y,z}mm(N + 3).
569 #define IMPLICIT_QUAD_GROUP 5
570 /* Two source operands are swapped. */
571 #define SWAP_SOURCES 6
572 /* Default mask isn't allowed. */
573 #define NO_DEFAULT_MASK 7
574 /* Address prefix changes register operand */
575 #define ADDR_PREFIX_OP_REG 8
576 /* Instrucion requires that destination must be distinct from source
578 #define DISTINCT_DEST 9
580 /* instruction ignores operand size prefix and in Intel mode ignores
581 mnemonic size suffix check. */
583 /* default insn size depends on mode */
584 #define DEFAULTSIZE 2
586 /* b suffix on instruction illegal */
588 /* w suffix on instruction illegal */
590 /* l suffix on instruction illegal */
592 /* s suffix on instruction illegal */
594 /* q suffix on instruction illegal */
596 /* instruction needs FWAIT */
598 /* IsString provides for a quick test for string instructions, and
599 its actual value also indicates which of the operands (if any)
600 requires use of the %es segment. */
601 #define IS_STRING_ES_OP0 2
602 #define IS_STRING_ES_OP1 3
604 /* RegMem is for instructions with a modrm byte where the register
605 destination operand should be encoded in the mod and regmem fields.
606 Normally, it will be encoded in the reg field. We add a RegMem
607 flag to indicate that it should be encoded in the regmem field. */
609 /* quick test if branch instruction is MPX supported */
613 #define PrefixHLERelease 2 /* Okay with an XRELEASE (0xf3) prefix. */
614 #define PrefixNoTrack 3
615 /* Prefixes implying "LOCK okay" must come after Lock. All others have
618 #define PrefixHLELock 5 /* Okay with a LOCK prefix. */
619 #define PrefixHLEAny 6 /* Okay with or without a LOCK prefix. */
621 /* opcode is a prefix */
623 /* instruction has extension in 8 bit imm */
625 /* instruction don't need Rex64 prefix. */
627 /* insn has VEX prefix:
628 1: 128bit VEX prefix (or operand dependent).
629 2: 256bit VEX prefix.
630 3: Scalar VEX prefix.
636 /* How to encode VEX.vvvv:
637 0: VEX.vvvv must be 1111b.
638 1: VEX.vvvv encodes one of the register operands.
641 /* How the VEX.W bit is used:
642 0: Set by the REX.W bit.
643 1: VEX.W0. Should always be 0.
644 2: VEX.W1. Should always be 1.
645 3: VEX.WIG. The VEX.W bit is ignored.
651 /* Opcode prefix (values chosen to be usable directly in
652 VEX/XOP/EVEX pp fields):
654 1: Add 0x66 opcode prefix.
655 2: Add 0xf3 opcode prefix.
656 3: Add 0xf2 opcode prefix.
658 #define PREFIX_NONE 0
659 #define PREFIX_0X66 1
660 #define PREFIX_0XF3 2
661 #define PREFIX_0XF2 3
663 /* Instruction with a mandatory SIB byte:
664 1: 128bit vector register.
665 2: 256bit vector register.
666 3: 512bit vector register.
674 /* SSE to AVX support required */
677 /* insn has EVEX prefix:
678 1: 512bit EVEX prefix.
679 2: 128bit EVEX prefix.
680 3: 256bit EVEX prefix.
681 4: Length-ignored (LIG) EVEX prefix.
682 5: Length determined from actual operands.
683 6: L'L = 3 (reserved, .insn only)
693 /* AVX512 masking support */
696 /* AVX512 broadcast support. The number of bytes to broadcast is
697 1 << (Broadcast - 1):
703 #define BYTE_BROADCAST 1
704 #define WORD_BROADCAST 2
705 #define DWORD_BROADCAST 3
706 #define QWORD_BROADCAST 4
709 /* Static rounding control is supported. */
712 /* Supress All Exceptions is supported. */
715 /* Compressed Disp8*N attribute. */
716 #define DISP8_SHIFT_VL 7
719 /* insn has vector size restrictions, requiring a minimum of:
724 #define VSZ128 0 /* Not to be used in templates. */
729 /* Support encoding optimization. */
738 /* ISA64: Don't change the order without other code adjustments.
739 0: Common to AMD64 and Intel64.
746 #define INTEL64ONLY 3
748 /* The last bitfield in i386_opcode_modifier. */
752 typedef struct i386_opcode_modifier
757 unsigned int modrm
:1;
759 unsigned int floatmf
:1;
761 unsigned int checkoperandsize
:1;
762 unsigned int operandconstraint
:4;
763 unsigned int mnemonicsize
:2;
764 unsigned int no_bsuf
:1;
765 unsigned int no_wsuf
:1;
766 unsigned int no_lsuf
:1;
767 unsigned int no_ssuf
:1;
768 unsigned int no_qsuf
:1;
769 unsigned int fwait
:1;
770 unsigned int isstring
:2;
771 unsigned int regmem
:1;
772 unsigned int bndprefixok
:1;
773 unsigned int prefixok
:3;
774 unsigned int isprefix
:1;
775 unsigned int immext
:1;
776 unsigned int norex64
:1;
778 unsigned int vexvvvv
:1;
780 unsigned int opcodeprefix
:2;
782 unsigned int sse2avx
:1;
784 unsigned int masking
:1;
785 unsigned int broadcast
:3;
786 unsigned int staticrounding
:1;
788 unsigned int disp8memshift
:3;
790 unsigned int optimize
:1;
791 unsigned int attmnemonic
:1;
792 unsigned int attsyntax
:1;
793 unsigned int intelsyntax
:1;
794 unsigned int isa64
:2;
795 } i386_opcode_modifier
;
797 /* Operand classes. */
799 #define CLASS_WIDTH 4
803 Reg
, /* GPRs and FP regs, distinguished by operand size */
804 SReg
, /* Segment register */
805 RegCR
, /* Control register */
806 RegDR
, /* Debug register */
807 RegTR
, /* Test register */
808 RegMMX
, /* MMX register */
809 RegSIMD
, /* XMM/YMM/ZMM registers, distinguished by operand size */
810 RegMask
, /* Vector Mask register */
811 RegBND
, /* Bound register */
814 /* Special operand instances. */
816 #define INSTANCE_WIDTH 3
817 enum operand_instance
820 Accum
, /* Accumulator %al/%ax/%eax/%rax/%st(0)/%xmm0 */
821 RegC
, /* %cl / %cx / %ecx / %rcx, e.g. register to hold shift count */
822 RegD
, /* %dl / %dx / %edx / %rdx, e.g. register to hold I/O port addr */
823 RegB
, /* %bl / %bx / %ebx / %rbx */
826 /* Position of operand_type bits. */
830 /* Class and Instance */
831 ClassInstance
= CLASS_WIDTH
+ INSTANCE_WIDTH
- 1,
832 /* 1 bit immediate */
834 /* 8 bit immediate */
836 /* 8 bit immediate sign extended */
838 /* 16 bit immediate */
840 /* 32 bit immediate */
842 /* 32 bit immediate sign extended */
844 /* 64 bit immediate */
846 /* 8bit/16bit/32bit displacements are used in different ways,
847 depending on the instruction. For jumps, they specify the
848 size of the PC relative displacement, for instructions with
849 memory operand, they specify the size of the offset relative
850 to the base register, and for instructions with memory offset
851 such as `mov 1234,%al' they specify the size of the offset
852 relative to the segment base. */
853 /* 8 bit displacement */
855 /* 16 bit displacement */
857 /* 32 bit displacement (64-bit: sign-extended) */
859 /* 64 bit displacement */
861 /* Register which can be used for base or index in memory operand. */
865 /* WORD size. 2 byte */
867 /* DWORD size. 4 byte */
869 /* FWORD size. 6 byte */
871 /* QWORD size. 8 byte */
873 /* TBYTE size. 10 byte */
883 /* Unspecified memory size. */
886 /* The number of bits in i386_operand_type. */
890 #define OTNumOfUints \
891 ((OTNum - 1) / sizeof (unsigned int) / CHAR_BIT + 1)
892 #define OTNumOfBits \
893 (OTNumOfUints * sizeof (unsigned int) * CHAR_BIT)
895 /* If you get a compiler error for zero width of the unused field,
897 #define OTUnused OTNum
899 typedef union i386_operand_type
903 unsigned int class:CLASS_WIDTH
;
904 unsigned int instance
:INSTANCE_WIDTH
;
907 unsigned int imm8s
:1;
908 unsigned int imm16
:1;
909 unsigned int imm32
:1;
910 unsigned int imm32s
:1;
911 unsigned int imm64
:1;
912 unsigned int disp8
:1;
913 unsigned int disp16
:1;
914 unsigned int disp32
:1;
915 unsigned int disp64
:1;
916 unsigned int baseindex
:1;
919 unsigned int dword
:1;
920 unsigned int fword
:1;
921 unsigned int qword
:1;
922 unsigned int tbyte
:1;
923 unsigned int xmmword
:1;
924 unsigned int ymmword
:1;
925 unsigned int zmmword
:1;
926 unsigned int tmmword
:1;
927 unsigned int unspecified
:1;
929 unsigned int unused
:(OTNumOfBits
- OTUnused
);
932 unsigned int array
[OTNumOfUints
];
935 typedef struct insn_template
937 /* instruction name sans width suffix ("mov" for movl insns) */
938 unsigned int mnem_off
;
940 /* Bitfield arrangement is such that individual fields can be easily
941 extracted (in native builds at least) - either by at most a masking
942 operation (base_opcode, operands), or by just a (signed) right shift
943 (extension_opcode). Please try to maintain this property. */
945 /* base_opcode is the fundamental opcode byte without optional
947 unsigned int base_opcode
:16;
948 #define Opcode_D 0x2 /* Direction bit:
949 set if Reg --> Regmem;
950 unset if Regmem --> Reg. */
951 #define Opcode_FloatR 0x8 /* ModR/M bit to swap src/dest for float insns. */
952 #define Opcode_FloatD 0x4 /* Direction bit for float insns. */
953 #define Opcode_ExtD 0x1 /* Direction bit for extended opcode space insns. */
954 #define Opcode_SIMD_IntD 0x10 /* Direction bit for SIMD int insns. */
955 /* The next value is arbitrary, as long as it's non-zero and distinct
956 from all other values above. */
957 #define Opcode_VexW 0xf /* Operand order controlled by VEX.W. */
959 /* how many operands */
960 unsigned int operands
:3;
963 unsigned int opcode_space
:4;
964 /* Opcode encoding space (values chosen to be usable directly in
965 VEX/XOP mmmmm and EVEX mm fields):
966 0: Base opcode space.
967 1: 0F opcode prefix / space.
968 2: 0F38 opcode prefix / space.
969 3: 0F3A opcode prefix / space.
970 5: EVEXMAP5 opcode prefix / space.
971 6: EVEXMAP6 opcode prefix / space.
972 7: VEXMAP7 opcode prefix / space.
973 8: XOP 08 opcode space.
974 9: XOP 09 opcode space.
975 A: XOP 0A opcode space.
981 #define SPACE_EVEXMAP5 5
982 #define SPACE_EVEXMAP6 6
983 #define SPACE_VEXMAP7 7
984 #define SPACE_XOP08 8
985 #define SPACE_XOP09 9
986 #define SPACE_XOP0A 0xA
988 /* (Fake) base opcode value for pseudo prefixes. */
989 #define PSEUDO_PREFIX 0
991 /* extension_opcode is the 3 bit extension for group <n> insns.
992 This field is also used to store the 8-bit opcode suffix for the
993 AMD 3DNow! instructions.
994 If this template has no extension opcode (the usual case) use None
996 signed int extension_opcode
:9;
997 #define None (-1) /* If no extension_opcode is possible. */
999 /* Pseudo prefixes. */
1000 #define Prefix_Disp8 0 /* {disp8} */
1001 #define Prefix_Disp16 1 /* {disp16} */
1002 #define Prefix_Disp32 2 /* {disp32} */
1003 #define Prefix_Load 3 /* {load} */
1004 #define Prefix_Store 4 /* {store} */
1005 #define Prefix_VEX 5 /* {vex} */
1006 #define Prefix_VEX3 6 /* {vex3} */
1007 #define Prefix_EVEX 7 /* {evex} */
1008 #define Prefix_REX 8 /* {rex} */
1009 #define Prefix_NoOptimize 9 /* {nooptimize} */
1011 /* the bits in opcode_modifier are used to generate the final opcode from
1012 the base_opcode. These bits also are used to detect alternate forms of
1013 the same instruction */
1014 i386_opcode_modifier opcode_modifier
;
1016 /* cpu feature attributes */
1017 i386_cpu_attr cpu
, cpu_any
;
1019 /* operand_types[i] describes the type of operand i. This is made
1020 by OR'ing together all of the possible type masks. (e.g.
1021 'operand_types[i] = Reg|Imm' specifies that operand i can be
1022 either a register or an immediate operand. */
1023 i386_operand_type operand_types
[MAX_OPERANDS
];
1027 /* these are for register name --> number & type hash lookup */
1031 i386_operand_type reg_type
;
1032 unsigned char reg_flags
;
1033 #define RegRex 0x1 /* Extended register. */
1034 #define RegRex64 0x2 /* Extended 8 bit register. */
1035 #define RegVRex 0x4 /* Extended vector register. */
1036 unsigned char reg_num
;
1037 #define RegIP ((unsigned char ) ~0)
1038 /* EIZ and RIZ are fake index registers. */
1039 #define RegIZ (RegIP - 1)
1040 /* FLAT is a fake segment register (Intel mode). */
1041 #define RegFlat ((unsigned char) ~0)
1042 signed char dw2_regnum
[2];
1043 #define Dw2Inval (-1)