Correct MPX ChangeLog entries
[deliverable/binutils-gdb.git] / opcodes / i386-opc.h
CommitLineData
0b1cf022 1/* Declarations for Intel 80386 opcode table
29c048b6 2 Copyright 2007, 2008, 2009, 2010, 2012
0b1cf022
L
3 Free Software Foundation, Inc.
4
9b201bb5 5 This file is part of the GNU opcodes library.
0b1cf022 6
9b201bb5 7 This library is free software; you can redistribute it and/or modify
0b1cf022 8 it under the terms of the GNU General Public License as published by
9b201bb5 9 the Free Software Foundation; either version 3, or (at your option)
0b1cf022
L
10 any later version.
11
9b201bb5
NC
12 It is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
0b1cf022
L
16
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20 02110-1301, USA. */
21
22#include "opcode/i386.h"
40fb9820
L
23#ifdef HAVE_LIMITS_H
24#include <limits.h>
25#endif
26
27#ifndef CHAR_BIT
28#define CHAR_BIT 8
29#endif
30
31/* Position of cpu flags bitfiled. */
32
52a6c1fe
L
33enum
34{
35 /* i186 or better required */
36 Cpu186 = 0,
37 /* i286 or better required */
38 Cpu286,
39 /* i386 or better required */
40 Cpu386,
41 /* i486 or better required */
42 Cpu486,
43 /* i585 or better required */
44 Cpu586,
45 /* i686 or better required */
46 Cpu686,
b49dfb4a 47 /* CLFLUSH Instruction support required */
52a6c1fe 48 CpuClflush,
22109423
L
49 /* NOP Instruction support required */
50 CpuNop,
b49dfb4a 51 /* SYSCALL Instructions support required */
52a6c1fe
L
52 CpuSYSCALL,
53 /* Floating point support required */
54 Cpu8087,
55 /* i287 support required */
56 Cpu287,
57 /* i387 support required */
58 Cpu387,
59 /* i686 and floating point support required */
60 Cpu687,
61 /* SSE3 and floating point support required */
62 CpuFISTTP,
63 /* MMX support required */
64 CpuMMX,
65 /* SSE support required */
66 CpuSSE,
67 /* SSE2 support required */
68 CpuSSE2,
69 /* 3dnow! support required */
70 Cpu3dnow,
71 /* 3dnow! Extensions support required */
72 Cpu3dnowA,
73 /* SSE3 support required */
74 CpuSSE3,
75 /* VIA PadLock required */
76 CpuPadLock,
77 /* AMD Secure Virtual Machine Ext-s required */
78 CpuSVME,
79 /* VMX Instructions required */
80 CpuVMX,
81 /* SMX Instructions required */
82 CpuSMX,
83 /* SSSE3 support required */
84 CpuSSSE3,
85 /* SSE4a support required */
86 CpuSSE4a,
87 /* ABM New Instructions required */
88 CpuABM,
89 /* SSE4.1 support required */
90 CpuSSE4_1,
91 /* SSE4.2 support required */
92 CpuSSE4_2,
93 /* AVX support required */
94 CpuAVX,
6c30d220
L
95 /* AVX2 support required */
96 CpuAVX2,
52a6c1fe
L
97 /* Intel L1OM support required */
98 CpuL1OM,
7a9068fe
L
99 /* Intel K1OM support required */
100 CpuK1OM,
b49dfb4a 101 /* Xsave/xrstor New Instructions support required */
52a6c1fe 102 CpuXsave,
b49dfb4a 103 /* Xsaveopt New Instructions support required */
c7b8aa3a 104 CpuXsaveopt,
52a6c1fe
L
105 /* AES support required */
106 CpuAES,
107 /* PCLMUL support required */
108 CpuPCLMUL,
109 /* FMA support required */
110 CpuFMA,
111 /* FMA4 support required */
112 CpuFMA4,
5dd85c99
SP
113 /* XOP support required */
114 CpuXOP,
f88c9eb0
SP
115 /* LWP support required */
116 CpuLWP,
f12dc422
L
117 /* BMI support required */
118 CpuBMI,
2a2a0f38
QN
119 /* TBM support required */
120 CpuTBM,
b49dfb4a 121 /* MOVBE Instruction support required */
52a6c1fe 122 CpuMovbe,
60aa667e
L
123 /* CMPXCHG16B instruction support required. */
124 CpuCX16,
52a6c1fe
L
125 /* EPT Instructions required */
126 CpuEPT,
b49dfb4a 127 /* RDTSCP Instruction support required */
52a6c1fe 128 CpuRdtscp,
77321f53 129 /* FSGSBASE Instructions required */
c7b8aa3a
L
130 CpuFSGSBase,
131 /* RDRND Instructions required */
132 CpuRdRnd,
133 /* F16C Instructions required */
134 CpuF16C,
6c30d220
L
135 /* Intel BMI2 support required */
136 CpuBMI2,
137 /* LZCNT support required */
138 CpuLZCNT,
42164a71
L
139 /* HLE support required */
140 CpuHLE,
141 /* RTM support required */
142 CpuRTM,
6c30d220
L
143 /* INVPCID Instructions required */
144 CpuINVPCID,
8729a6f6
L
145 /* VMFUNC Instruction required */
146 CpuVMFUNC,
7e8b059b
L
147 /* Intel MPX Instructions required */
148 CpuMPX,
52a6c1fe
L
149 /* 64bit support available, used by -march= in assembler. */
150 CpuLM,
e2e1fcde
L
151 /* RDRSEED instruction required. */
152 CpuRDSEED,
153 /* Multi-presisionn add-carry instructions are required. */
154 CpuADX,
7b458c12 155 /* Supports prefetchw and prefetch instructions. */
e2e1fcde 156 CpuPRFCHW,
5c111e37
L
157 /* SMAP instructions required. */
158 CpuSMAP,
52a6c1fe
L
159 /* 64bit support required */
160 Cpu64,
161 /* Not supported in the 64bit mode */
162 CpuNo64,
163 /* The last bitfield in i386_cpu_flags. */
164 CpuMax = CpuNo64
165};
40fb9820
L
166
167#define CpuNumOfUints \
168 (CpuMax / sizeof (unsigned int) / CHAR_BIT + 1)
169#define CpuNumOfBits \
170 (CpuNumOfUints * sizeof (unsigned int) * CHAR_BIT)
171
172/* If you get a compiler error for zero width of the unused field,
173 comment it out. */
7e8b059b 174/* #define CpuUnused (CpuMax + 1) */
40fb9820
L
175
176/* We can check if an instruction is available with array instead
177 of bitfield. */
178typedef union i386_cpu_flags
179{
180 struct
181 {
182 unsigned int cpui186:1;
183 unsigned int cpui286:1;
184 unsigned int cpui386:1;
185 unsigned int cpui486:1;
186 unsigned int cpui586:1;
187 unsigned int cpui686:1;
bd5295b2 188 unsigned int cpuclflush:1;
22109423 189 unsigned int cpunop:1;
bd5295b2 190 unsigned int cpusyscall:1;
309d3373
JB
191 unsigned int cpu8087:1;
192 unsigned int cpu287:1;
193 unsigned int cpu387:1;
194 unsigned int cpu687:1;
195 unsigned int cpufisttp:1;
40fb9820 196 unsigned int cpummx:1;
40fb9820
L
197 unsigned int cpusse:1;
198 unsigned int cpusse2:1;
199 unsigned int cpua3dnow:1;
200 unsigned int cpua3dnowa:1;
201 unsigned int cpusse3:1;
202 unsigned int cpupadlock:1;
203 unsigned int cpusvme:1;
204 unsigned int cpuvmx:1;
47dd174c 205 unsigned int cpusmx:1;
40fb9820
L
206 unsigned int cpussse3:1;
207 unsigned int cpusse4a:1;
208 unsigned int cpuabm:1;
209 unsigned int cpusse4_1:1;
210 unsigned int cpusse4_2:1;
c0f3af97 211 unsigned int cpuavx:1;
6c30d220 212 unsigned int cpuavx2:1;
8a9036a4 213 unsigned int cpul1om:1;
7a9068fe 214 unsigned int cpuk1om:1;
475a2301 215 unsigned int cpuxsave:1;
c7b8aa3a 216 unsigned int cpuxsaveopt:1;
c0f3af97 217 unsigned int cpuaes:1;
594ab6a3 218 unsigned int cpupclmul:1;
c0f3af97 219 unsigned int cpufma:1;
922d8de8 220 unsigned int cpufma4:1;
5dd85c99 221 unsigned int cpuxop:1;
f88c9eb0 222 unsigned int cpulwp:1;
f12dc422 223 unsigned int cpubmi:1;
2a2a0f38 224 unsigned int cputbm:1;
f1f8f695 225 unsigned int cpumovbe:1;
60aa667e 226 unsigned int cpucx16:1;
f1f8f695 227 unsigned int cpuept:1;
1b7f3fb0 228 unsigned int cpurdtscp:1;
c7b8aa3a
L
229 unsigned int cpufsgsbase:1;
230 unsigned int cpurdrnd:1;
231 unsigned int cpuf16c:1;
6c30d220
L
232 unsigned int cpubmi2:1;
233 unsigned int cpulzcnt:1;
42164a71
L
234 unsigned int cpuhle:1;
235 unsigned int cpurtm:1;
6c30d220 236 unsigned int cpuinvpcid:1;
8729a6f6 237 unsigned int cpuvmfunc:1;
7e8b059b 238 unsigned int cpumpx:1;
40fb9820 239 unsigned int cpulm:1;
e2e1fcde
L
240 unsigned int cpurdseed:1;
241 unsigned int cpuadx:1;
242 unsigned int cpuprfchw:1;
5c111e37 243 unsigned int cpusmap:1;
40fb9820
L
244 unsigned int cpu64:1;
245 unsigned int cpuno64:1;
246#ifdef CpuUnused
247 unsigned int unused:(CpuNumOfBits - CpuUnused);
248#endif
249 } bitfield;
250 unsigned int array[CpuNumOfUints];
251} i386_cpu_flags;
252
253/* Position of opcode_modifier bits. */
254
52a6c1fe
L
255enum
256{
257 /* has direction bit. */
258 D = 0,
259 /* set if operands can be words or dwords encoded the canonical way */
260 W,
261 /* Skip the current insn and use the next insn in i386-opc.tbl to swap
262 operand in encoding. */
263 S,
264 /* insn has a modrm byte. */
265 Modrm,
266 /* register is in low 3 bits of opcode */
267 ShortForm,
268 /* special case for jump insns. */
269 Jump,
270 /* call and jump */
271 JumpDword,
272 /* loop and jecxz */
273 JumpByte,
274 /* special case for intersegment leaps/calls */
275 JumpInterSegment,
276 /* FP insn memory format bit, sized by 0x4 */
277 FloatMF,
278 /* src/dest swap for floats. */
279 FloatR,
280 /* has float insn direction bit. */
281 FloatD,
282 /* needs size prefix if in 32-bit mode */
283 Size16,
284 /* needs size prefix if in 16-bit mode */
285 Size32,
286 /* needs size prefix if in 64-bit mode */
287 Size64,
56ffb741
L
288 /* check register size. */
289 CheckRegSize,
52a6c1fe
L
290 /* instruction ignores operand size prefix and in Intel mode ignores
291 mnemonic size suffix check. */
292 IgnoreSize,
293 /* default insn size depends on mode */
294 DefaultSize,
295 /* b suffix on instruction illegal */
296 No_bSuf,
297 /* w suffix on instruction illegal */
298 No_wSuf,
299 /* l suffix on instruction illegal */
300 No_lSuf,
301 /* s suffix on instruction illegal */
302 No_sSuf,
303 /* q suffix on instruction illegal */
304 No_qSuf,
305 /* long double suffix on instruction illegal */
306 No_ldSuf,
307 /* instruction needs FWAIT */
308 FWait,
309 /* quick test for string instructions */
310 IsString,
7e8b059b
L
311 /* quick test if branch instruction is MPX supported */
312 BNDPrefixOk,
c32fa91d
L
313 /* quick test for lockable instructions */
314 IsLockable,
52a6c1fe
L
315 /* fake an extra reg operand for clr, imul and special register
316 processing for some instructions. */
317 RegKludge,
318 /* The first operand must be xmm0 */
319 FirstXmm0,
320 /* An implicit xmm0 as the first operand */
321 Implicit1stXmm0,
42164a71
L
322 /* The HLE prefix is OK:
323 1. With a LOCK prefix.
324 2. With or without a LOCK prefix.
325 3. With a RELEASE (0xf3) prefix.
326 */
82c2def5
L
327#define HLEPrefixNone 0
328#define HLEPrefixLock 1
329#define HLEPrefixAny 2
330#define HLEPrefixRelease 3
42164a71 331 HLEPrefixOk,
29c048b6
RM
332 /* An instruction on which a "rep" prefix is acceptable. */
333 RepPrefixOk,
52a6c1fe
L
334 /* Convert to DWORD */
335 ToDword,
336 /* Convert to QWORD */
337 ToQword,
338 /* Address prefix changes operand 0 */
339 AddrPrefixOp0,
340 /* opcode is a prefix */
341 IsPrefix,
342 /* instruction has extension in 8 bit imm */
343 ImmExt,
344 /* instruction don't need Rex64 prefix. */
345 NoRex64,
346 /* instruction require Rex64 prefix. */
347 Rex64,
348 /* deprecated fp insn, gets a warning */
349 Ugh,
350 /* insn has VEX prefix:
2bf05e57
L
351 1: 128bit VEX prefix.
352 2: 256bit VEX prefix.
712366da 353 3: Scalar VEX prefix.
52a6c1fe 354 */
712366da
L
355#define VEX128 1
356#define VEX256 2
357#define VEXScalar 3
52a6c1fe 358 Vex,
2426c15f
L
359 /* How to encode VEX.vvvv:
360 0: VEX.vvvv must be 1111b.
a2a7d12c 361 1: VEX.NDS. Register-only source is encoded in VEX.vvvv where
2426c15f 362 the content of source registers will be preserved.
29c048b6 363 VEX.DDS. The second register operand is encoded in VEX.vvvv
2426c15f
L
364 where the content of first source register will be overwritten
365 by the result.
6c30d220
L
366 VEX.NDD2. The second destination register operand is encoded in
367 VEX.vvvv for instructions with 2 destination register operands.
368 For assembler, there are no difference between VEX.NDS, VEX.DDS
369 and VEX.NDD2.
370 2. VEX.NDD. Register destination is encoded in VEX.vvvv for
371 instructions with 1 destination register operand.
2426c15f
L
372 3. VEX.LWP. Register destination is encoded in VEX.vvvv and one
373 of the operands can access a memory location.
374 */
375#define VEXXDS 1
376#define VEXNDD 2
377#define VEXLWP 3
378 VexVVVV,
1ef99a7b
L
379 /* How the VEX.W bit is used:
380 0: Set by the REX.W bit.
381 1: VEX.W0. Should always be 0.
382 2: VEX.W1. Should always be 1.
383 */
384#define VEXW0 1
385#define VEXW1 2
386 VexW,
7f399153
L
387 /* VEX opcode prefix:
388 0: VEX 0x0F opcode prefix.
389 1: VEX 0x0F38 opcode prefix.
390 2: VEX 0x0F3A opcode prefix
391 3: XOP 0x08 opcode prefix.
392 4: XOP 0x09 opcode prefix
393 5: XOP 0x0A opcode prefix.
394 */
395#define VEX0F 0
396#define VEX0F38 1
397#define VEX0F3A 2
398#define XOP08 3
399#define XOP09 4
400#define XOP0A 5
401 VexOpcode,
8cd7925b 402 /* number of VEX source operands:
8c43a48b
L
403 0: <= 2 source operands.
404 1: 2 XOP source operands.
8cd7925b
L
405 2: 3 source operands.
406 */
8c43a48b 407#define XOP2SOURCES 1
8cd7925b
L
408#define VEX3SOURCES 2
409 VexSources,
52a6c1fe
L
410 /* instruction has VEX 8 bit imm */
411 VexImmExt,
6c30d220
L
412 /* Instruction with vector SIB byte:
413 1: 128bit vector register.
414 2: 256bit vector register.
415 */
416#define VecSIB128 1
417#define VecSIB256 2
418 VecSIB,
52a6c1fe
L
419 /* SSE to AVX support required */
420 SSE2AVX,
421 /* No AVX equivalent */
422 NoAVX,
423 /* Compatible with old (<= 2.8.1) versions of gcc */
424 OldGcc,
425 /* AT&T mnemonic. */
426 ATTMnemonic,
427 /* AT&T syntax. */
428 ATTSyntax,
429 /* Intel syntax. */
430 IntelSyntax,
431 /* The last bitfield in i386_opcode_modifier. */
432 Opcode_Modifier_Max
433};
40fb9820
L
434
435typedef struct i386_opcode_modifier
436{
437 unsigned int d:1;
438 unsigned int w:1;
b6169b20 439 unsigned int s:1;
40fb9820
L
440 unsigned int modrm:1;
441 unsigned int shortform:1;
442 unsigned int jump:1;
443 unsigned int jumpdword:1;
444 unsigned int jumpbyte:1;
445 unsigned int jumpintersegment:1;
446 unsigned int floatmf:1;
447 unsigned int floatr:1;
448 unsigned int floatd:1;
449 unsigned int size16:1;
450 unsigned int size32:1;
451 unsigned int size64:1;
56ffb741 452 unsigned int checkregsize:1;
40fb9820
L
453 unsigned int ignoresize:1;
454 unsigned int defaultsize:1;
455 unsigned int no_bsuf:1;
456 unsigned int no_wsuf:1;
457 unsigned int no_lsuf:1;
458 unsigned int no_ssuf:1;
459 unsigned int no_qsuf:1;
7ce189b3 460 unsigned int no_ldsuf:1;
40fb9820
L
461 unsigned int fwait:1;
462 unsigned int isstring:1;
7e8b059b 463 unsigned int bndprefixok:1;
c32fa91d 464 unsigned int islockable:1;
40fb9820 465 unsigned int regkludge:1;
e2ec9d29 466 unsigned int firstxmm0:1;
c0f3af97 467 unsigned int implicit1stxmm0:1;
42164a71 468 unsigned int hleprefixok:2;
29c048b6 469 unsigned int repprefixok:1;
ca61edf2
L
470 unsigned int todword:1;
471 unsigned int toqword:1;
472 unsigned int addrprefixop0:1;
40fb9820
L
473 unsigned int isprefix:1;
474 unsigned int immext:1;
475 unsigned int norex64:1;
476 unsigned int rex64:1;
477 unsigned int ugh:1;
2bf05e57 478 unsigned int vex:2;
2426c15f 479 unsigned int vexvvvv:2;
1ef99a7b 480 unsigned int vexw:2;
7f399153 481 unsigned int vexopcode:3;
8cd7925b 482 unsigned int vexsources:2;
c0f3af97 483 unsigned int veximmext:1;
6c30d220 484 unsigned int vecsib:2;
c0f3af97 485 unsigned int sse2avx:1;
81f8a913 486 unsigned int noavx:1;
1efbbeb4
L
487 unsigned int oldgcc:1;
488 unsigned int attmnemonic:1;
e1d4d893 489 unsigned int attsyntax:1;
5c07affc 490 unsigned int intelsyntax:1;
40fb9820
L
491} i386_opcode_modifier;
492
493/* Position of operand_type bits. */
494
52a6c1fe
L
495enum
496{
497 /* 8bit register */
498 Reg8 = 0,
499 /* 16bit register */
500 Reg16,
501 /* 32bit register */
502 Reg32,
503 /* 64bit register */
504 Reg64,
505 /* Floating pointer stack register */
506 FloatReg,
507 /* MMX register */
508 RegMMX,
509 /* SSE register */
510 RegXMM,
511 /* AVX registers */
512 RegYMM,
513 /* Control register */
514 Control,
515 /* Debug register */
516 Debug,
517 /* Test register */
518 Test,
519 /* 2 bit segment register */
520 SReg2,
521 /* 3 bit segment register */
522 SReg3,
523 /* 1 bit immediate */
524 Imm1,
525 /* 8 bit immediate */
526 Imm8,
527 /* 8 bit immediate sign extended */
528 Imm8S,
529 /* 16 bit immediate */
530 Imm16,
531 /* 32 bit immediate */
532 Imm32,
533 /* 32 bit immediate sign extended */
534 Imm32S,
535 /* 64 bit immediate */
536 Imm64,
537 /* 8bit/16bit/32bit displacements are used in different ways,
538 depending on the instruction. For jumps, they specify the
539 size of the PC relative displacement, for instructions with
540 memory operand, they specify the size of the offset relative
541 to the base register, and for instructions with memory offset
542 such as `mov 1234,%al' they specify the size of the offset
543 relative to the segment base. */
544 /* 8 bit displacement */
545 Disp8,
546 /* 16 bit displacement */
547 Disp16,
548 /* 32 bit displacement */
549 Disp32,
550 /* 32 bit signed displacement */
551 Disp32S,
552 /* 64 bit displacement */
553 Disp64,
554 /* Accumulator %al/%ax/%eax/%rax */
555 Acc,
556 /* Floating pointer top stack register %st(0) */
557 FloatAcc,
558 /* Register which can be used for base or index in memory operand. */
559 BaseIndex,
560 /* Register to hold in/out port addr = dx */
561 InOutPortReg,
562 /* Register to hold shift count = cl */
563 ShiftCount,
564 /* Absolute address for jump. */
565 JumpAbsolute,
566 /* String insn operand with fixed es segment */
567 EsSeg,
568 /* RegMem is for instructions with a modrm byte where the register
569 destination operand should be encoded in the mod and regmem fields.
570 Normally, it will be encoded in the reg field. We add a RegMem
571 flag to the destination register operand to indicate that it should
572 be encoded in the regmem field. */
573 RegMem,
574 /* Memory. */
575 Mem,
576 /* BYTE memory. */
577 Byte,
578 /* WORD memory. 2 byte */
579 Word,
580 /* DWORD memory. 4 byte */
581 Dword,
582 /* FWORD memory. 6 byte */
583 Fword,
584 /* QWORD memory. 8 byte */
585 Qword,
586 /* TBYTE memory. 10 byte */
587 Tbyte,
588 /* XMMWORD memory. */
589 Xmmword,
590 /* YMMWORD memory. */
591 Ymmword,
592 /* Unspecified memory size. */
593 Unspecified,
594 /* Any memory size. */
595 Anysize,
40fb9820 596
a683cc34
SP
597 /* Vector 4 bit immediate. */
598 Vec_Imm4,
599
7e8b059b
L
600 /* Bound register. */
601 RegBND,
602
52a6c1fe
L
603 /* The last bitfield in i386_operand_type. */
604 OTMax
605};
40fb9820
L
606
607#define OTNumOfUints \
608 (OTMax / sizeof (unsigned int) / CHAR_BIT + 1)
609#define OTNumOfBits \
610 (OTNumOfUints * sizeof (unsigned int) * CHAR_BIT)
611
612/* If you get a compiler error for zero width of the unused field,
613 comment it out. */
8c6c9809 614#define OTUnused (OTMax + 1)
40fb9820
L
615
616typedef union i386_operand_type
617{
618 struct
619 {
620 unsigned int reg8:1;
621 unsigned int reg16:1;
622 unsigned int reg32:1;
623 unsigned int reg64:1;
7d5e4556
L
624 unsigned int floatreg:1;
625 unsigned int regmmx:1;
626 unsigned int regxmm:1;
c0f3af97 627 unsigned int regymm:1;
7d5e4556
L
628 unsigned int control:1;
629 unsigned int debug:1;
630 unsigned int test:1;
631 unsigned int sreg2:1;
632 unsigned int sreg3:1;
633 unsigned int imm1:1;
40fb9820
L
634 unsigned int imm8:1;
635 unsigned int imm8s:1;
636 unsigned int imm16:1;
637 unsigned int imm32:1;
638 unsigned int imm32s:1;
639 unsigned int imm64:1;
40fb9820
L
640 unsigned int disp8:1;
641 unsigned int disp16:1;
642 unsigned int disp32:1;
643 unsigned int disp32s:1;
644 unsigned int disp64:1;
7d5e4556
L
645 unsigned int acc:1;
646 unsigned int floatacc:1;
647 unsigned int baseindex:1;
40fb9820
L
648 unsigned int inoutportreg:1;
649 unsigned int shiftcount:1;
40fb9820 650 unsigned int jumpabsolute:1;
40fb9820
L
651 unsigned int esseg:1;
652 unsigned int regmem:1;
5c07affc 653 unsigned int mem:1;
7d5e4556
L
654 unsigned int byte:1;
655 unsigned int word:1;
656 unsigned int dword:1;
657 unsigned int fword:1;
658 unsigned int qword:1;
659 unsigned int tbyte:1;
660 unsigned int xmmword:1;
c0f3af97 661 unsigned int ymmword:1;
7d5e4556
L
662 unsigned int unspecified:1;
663 unsigned int anysize:1;
a683cc34 664 unsigned int vec_imm4:1;
7e8b059b 665 unsigned int regbnd:1;
40fb9820
L
666#ifdef OTUnused
667 unsigned int unused:(OTNumOfBits - OTUnused);
668#endif
669 } bitfield;
670 unsigned int array[OTNumOfUints];
671} i386_operand_type;
0b1cf022 672
d3ce72d0 673typedef struct insn_template
0b1cf022
L
674{
675 /* instruction name sans width suffix ("mov" for movl insns) */
676 char *name;
677
678 /* how many operands */
679 unsigned int operands;
680
681 /* base_opcode is the fundamental opcode byte without optional
682 prefix(es). */
683 unsigned int base_opcode;
684#define Opcode_D 0x2 /* Direction bit:
685 set if Reg --> Regmem;
686 unset if Regmem --> Reg. */
687#define Opcode_FloatR 0x8 /* Bit to swap src/dest for float insns. */
688#define Opcode_FloatD 0x400 /* Direction bit for float insns. */
689
690 /* extension_opcode is the 3 bit extension for group <n> insns.
691 This field is also used to store the 8-bit opcode suffix for the
692 AMD 3DNow! instructions.
29c048b6 693 If this template has no extension opcode (the usual case) use None
c1e679ec 694 Instructions */
0b1cf022
L
695 unsigned int extension_opcode;
696#define None 0xffff /* If no extension_opcode is possible. */
697
4dffcebc
L
698 /* Opcode length. */
699 unsigned char opcode_length;
700
0b1cf022 701 /* cpu feature flags */
40fb9820 702 i386_cpu_flags cpu_flags;
0b1cf022
L
703
704 /* the bits in opcode_modifier are used to generate the final opcode from
705 the base_opcode. These bits also are used to detect alternate forms of
706 the same instruction */
40fb9820 707 i386_opcode_modifier opcode_modifier;
0b1cf022
L
708
709 /* operand_types[i] describes the type of operand i. This is made
710 by OR'ing together all of the possible type masks. (e.g.
711 'operand_types[i] = Reg|Imm' specifies that operand i can be
712 either a register or an immediate operand. */
40fb9820 713 i386_operand_type operand_types[MAX_OPERANDS];
0b1cf022 714}
d3ce72d0 715insn_template;
0b1cf022 716
d3ce72d0 717extern const insn_template i386_optab[];
0b1cf022
L
718
719/* these are for register name --> number & type hash lookup */
720typedef struct
721{
722 char *reg_name;
40fb9820 723 i386_operand_type reg_type;
a60de03c 724 unsigned char reg_flags;
0b1cf022
L
725#define RegRex 0x1 /* Extended register. */
726#define RegRex64 0x2 /* Extended 8 bit register. */
a60de03c
JB
727 unsigned char reg_num;
728#define RegRip ((unsigned char ) ~0)
9a04903e 729#define RegEip (RegRip - 1)
db51cc60 730/* EIZ and RIZ are fake index registers. */
9a04903e 731#define RegEiz (RegEip - 1)
db51cc60 732#define RegRiz (RegEiz - 1)
b7240065
JB
733/* FLAT is a fake segment register (Intel mode). */
734#define RegFlat ((unsigned char) ~0)
a60de03c
JB
735 signed char dw2_regnum[2];
736#define Dw2Inval (-1)
0b1cf022
L
737}
738reg_entry;
739
740/* Entries in i386_regtab. */
741#define REGNAM_AL 1
742#define REGNAM_AX 25
743#define REGNAM_EAX 41
744
745extern const reg_entry i386_regtab[];
c3fe08fa 746extern const unsigned int i386_regtab_size;
0b1cf022
L
747
748typedef struct
749{
750 char *seg_name;
751 unsigned int seg_prefix;
752}
753seg_entry;
754
755extern const seg_entry cs;
756extern const seg_entry ds;
757extern const seg_entry ss;
758extern const seg_entry es;
759extern const seg_entry fs;
760extern const seg_entry gs;
This page took 0.457807 seconds and 4 git commands to generate.