PR 11123
[platform/upstream/binutils.git] / opcodes / i386-dis.c
1 /* Print i386 instructions for GDB, the GNU debugger.
2    Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3    2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
4    Free Software Foundation, Inc.
5
6    This file is part of the GNU opcodes library.
7
8    This library is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3, or (at your option)
11    any later version.
12
13    It is distributed in the hope that it will be useful, but WITHOUT
14    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16    License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21    MA 02110-1301, USA.  */
22
23
24 /* 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu)
25    July 1988
26     modified by John Hassey (hassey@dg-rtp.dg.com)
27     x86-64 support added by Jan Hubicka (jh@suse.cz)
28     VIA PadLock support by Michal Ludvig (mludvig@suse.cz).  */
29
30 /* The main tables describing the instructions is essentially a copy
31    of the "Opcode Map" chapter (Appendix A) of the Intel 80386
32    Programmers Manual.  Usually, there is a capital letter, followed
33    by a small letter.  The capital letter tell the addressing mode,
34    and the small letter tells about the operand size.  Refer to
35    the Intel manual for details.  */
36
37 #include "sysdep.h"
38 #include "dis-asm.h"
39 #include "opintl.h"
40 #include "opcode/i386.h"
41 #include "libiberty.h"
42
43 #include <setjmp.h>
44
45 static int print_insn (bfd_vma, disassemble_info *);
46 static void dofloat (int);
47 static void OP_ST (int, int);
48 static void OP_STi (int, int);
49 static int putop (const char *, int);
50 static void oappend (const char *);
51 static void append_seg (void);
52 static void OP_indirE (int, int);
53 static void print_operand_value (char *, int, bfd_vma);
54 static void OP_E_register (int, int);
55 static void OP_E_memory (int, int);
56 static void print_displacement (char *, bfd_vma);
57 static void OP_E (int, int);
58 static void OP_G (int, int);
59 static bfd_vma get64 (void);
60 static bfd_signed_vma get32 (void);
61 static bfd_signed_vma get32s (void);
62 static int get16 (void);
63 static void set_op (bfd_vma, int);
64 static void OP_Skip_MODRM (int, int);
65 static void OP_REG (int, int);
66 static void OP_IMREG (int, int);
67 static void OP_I (int, int);
68 static void OP_I64 (int, int);
69 static void OP_sI (int, int);
70 static void OP_J (int, int);
71 static void OP_SEG (int, int);
72 static void OP_DIR (int, int);
73 static void OP_OFF (int, int);
74 static void OP_OFF64 (int, int);
75 static void ptr_reg (int, int);
76 static void OP_ESreg (int, int);
77 static void OP_DSreg (int, int);
78 static void OP_C (int, int);
79 static void OP_D (int, int);
80 static void OP_T (int, int);
81 static void OP_R (int, int);
82 static void OP_MMX (int, int);
83 static void OP_XMM (int, int);
84 static void OP_EM (int, int);
85 static void OP_EX (int, int);
86 static void OP_EMC (int,int);
87 static void OP_MXC (int,int);
88 static void OP_MS (int, int);
89 static void OP_XS (int, int);
90 static void OP_M (int, int);
91 static void OP_VEX (int, int);
92 static void OP_EX_Vex (int, int);
93 static void OP_EX_VexW (int, int);
94 static void OP_XMM_Vex (int, int);
95 static void OP_XMM_VexW (int, int);
96 static void OP_REG_VexI4 (int, int);
97 static void PCLMUL_Fixup (int, int);
98 static void VEXI4_Fixup (int, int);
99 static void VZERO_Fixup (int, int);
100 static void VCMP_Fixup (int, int);
101 static void OP_0f07 (int, int);
102 static void OP_Monitor (int, int);
103 static void OP_Mwait (int, int);
104 static void NOP_Fixup1 (int, int);
105 static void NOP_Fixup2 (int, int);
106 static void OP_3DNowSuffix (int, int);
107 static void CMP_Fixup (int, int);
108 static void BadOp (void);
109 static void REP_Fixup (int, int);
110 static void CMPXCHG8B_Fixup (int, int);
111 static void XMM_Fixup (int, int);
112 static void CRC32_Fixup (int, int);
113 static void FXSAVE_Fixup (int, int);
114 static void OP_LWPCB_E (int, int);
115 static void OP_LWP_E (int, int);
116 static void OP_LWP_I (int, int);
117 static void OP_Vex_2src_1 (int, int);
118 static void OP_Vex_2src_2 (int, int);
119
120 static void MOVBE_Fixup (int, int);
121
122 struct dis_private {
123   /* Points to first byte not fetched.  */
124   bfd_byte *max_fetched;
125   bfd_byte the_buffer[MAX_MNEM_SIZE];
126   bfd_vma insn_start;
127   int orig_sizeflag;
128   jmp_buf bailout;
129 };
130
131 enum address_mode
132 {
133   mode_16bit,
134   mode_32bit,
135   mode_64bit
136 };
137
138 enum address_mode address_mode;
139
140 /* Flags for the prefixes for the current instruction.  See below.  */
141 static int prefixes;
142
143 /* REX prefix the current instruction.  See below.  */
144 static int rex;
145 /* Bits of REX we've already used.  */
146 static int rex_used;
147 /* Original REX prefix.  */
148 static int rex_original;
149 /* REX bits in original REX prefix ignored.  It may not be the same
150    as rex_original since some bits may not be ignored.  */
151 static int rex_ignored;
152 /* Mark parts used in the REX prefix.  When we are testing for
153    empty prefix (for 8bit register REX extension), just mask it
154    out.  Otherwise test for REX bit is excuse for existence of REX
155    only in case value is nonzero.  */
156 #define USED_REX(value)                                 \
157   {                                                     \
158     if (value)                                          \
159       {                                                 \
160         if ((rex & value))                              \
161           rex_used |= (value) | REX_OPCODE;             \
162       }                                                 \
163     else                                                \
164       rex_used |= REX_OPCODE;                           \
165   }
166
167 /* Flags for prefixes which we somehow handled when printing the
168    current instruction.  */
169 static int used_prefixes;
170
171 /* Flags stored in PREFIXES.  */
172 #define PREFIX_REPZ 1
173 #define PREFIX_REPNZ 2
174 #define PREFIX_LOCK 4
175 #define PREFIX_CS 8
176 #define PREFIX_SS 0x10
177 #define PREFIX_DS 0x20
178 #define PREFIX_ES 0x40
179 #define PREFIX_FS 0x80
180 #define PREFIX_GS 0x100
181 #define PREFIX_DATA 0x200
182 #define PREFIX_ADDR 0x400
183 #define PREFIX_FWAIT 0x800
184
185 /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
186    to ADDR (exclusive) are valid.  Returns 1 for success, longjmps
187    on error.  */
188 #define FETCH_DATA(info, addr) \
189   ((addr) <= ((struct dis_private *) (info->private_data))->max_fetched \
190    ? 1 : fetch_data ((info), (addr)))
191
192 static int
193 fetch_data (struct disassemble_info *info, bfd_byte *addr)
194 {
195   int status;
196   struct dis_private *priv = (struct dis_private *) info->private_data;
197   bfd_vma start = priv->insn_start + (priv->max_fetched - priv->the_buffer);
198
199   if (addr <= priv->the_buffer + MAX_MNEM_SIZE)
200     status = (*info->read_memory_func) (start,
201                                         priv->max_fetched,
202                                         addr - priv->max_fetched,
203                                         info);
204   else
205     status = -1;
206   if (status != 0)
207     {
208       /* If we did manage to read at least one byte, then
209          print_insn_i386 will do something sensible.  Otherwise, print
210          an error.  We do that here because this is where we know
211          STATUS.  */
212       if (priv->max_fetched == priv->the_buffer)
213         (*info->memory_error_func) (status, start, info);
214       longjmp (priv->bailout, 1);
215     }
216   else
217     priv->max_fetched = addr;
218   return 1;
219 }
220
221 #define XX { NULL, 0 }
222
223 #define Eb { OP_E, b_mode }
224 #define EbS { OP_E, b_swap_mode }
225 #define Ev { OP_E, v_mode }
226 #define EvS { OP_E, v_swap_mode }
227 #define Ed { OP_E, d_mode }
228 #define Edq { OP_E, dq_mode }
229 #define Edqw { OP_E, dqw_mode }
230 #define Edqb { OP_E, dqb_mode }
231 #define Edqd { OP_E, dqd_mode }
232 #define Eq { OP_E, q_mode }
233 #define indirEv { OP_indirE, stack_v_mode }
234 #define indirEp { OP_indirE, f_mode }
235 #define stackEv { OP_E, stack_v_mode }
236 #define Em { OP_E, m_mode }
237 #define Ew { OP_E, w_mode }
238 #define M { OP_M, 0 }           /* lea, lgdt, etc. */
239 #define Ma { OP_M, a_mode }
240 #define Mb { OP_M, b_mode }
241 #define Md { OP_M, d_mode }
242 #define Mo { OP_M, o_mode }
243 #define Mp { OP_M, f_mode }             /* 32 or 48 bit memory operand for LDS, LES etc */
244 #define Mq { OP_M, q_mode }
245 #define Mx { OP_M, x_mode }
246 #define Mxmm { OP_M, xmm_mode }
247 #define Gb { OP_G, b_mode }
248 #define Gv { OP_G, v_mode }
249 #define Gd { OP_G, d_mode }
250 #define Gdq { OP_G, dq_mode }
251 #define Gm { OP_G, m_mode }
252 #define Gw { OP_G, w_mode }
253 #define Rd { OP_R, d_mode }
254 #define Rm { OP_R, m_mode }
255 #define Ib { OP_I, b_mode }
256 #define sIb { OP_sI, b_mode }   /* sign extened byte */
257 #define Iv { OP_I, v_mode }
258 #define Iq { OP_I, q_mode }
259 #define Iv64 { OP_I64, v_mode }
260 #define Iw { OP_I, w_mode }
261 #define I1 { OP_I, const_1_mode }
262 #define Jb { OP_J, b_mode }
263 #define Jv { OP_J, v_mode }
264 #define Cm { OP_C, m_mode }
265 #define Dm { OP_D, m_mode }
266 #define Td { OP_T, d_mode }
267 #define Skip_MODRM { OP_Skip_MODRM, 0 }
268
269 #define RMeAX { OP_REG, eAX_reg }
270 #define RMeBX { OP_REG, eBX_reg }
271 #define RMeCX { OP_REG, eCX_reg }
272 #define RMeDX { OP_REG, eDX_reg }
273 #define RMeSP { OP_REG, eSP_reg }
274 #define RMeBP { OP_REG, eBP_reg }
275 #define RMeSI { OP_REG, eSI_reg }
276 #define RMeDI { OP_REG, eDI_reg }
277 #define RMrAX { OP_REG, rAX_reg }
278 #define RMrBX { OP_REG, rBX_reg }
279 #define RMrCX { OP_REG, rCX_reg }
280 #define RMrDX { OP_REG, rDX_reg }
281 #define RMrSP { OP_REG, rSP_reg }
282 #define RMrBP { OP_REG, rBP_reg }
283 #define RMrSI { OP_REG, rSI_reg }
284 #define RMrDI { OP_REG, rDI_reg }
285 #define RMAL { OP_REG, al_reg }
286 #define RMAL { OP_REG, al_reg }
287 #define RMCL { OP_REG, cl_reg }
288 #define RMDL { OP_REG, dl_reg }
289 #define RMBL { OP_REG, bl_reg }
290 #define RMAH { OP_REG, ah_reg }
291 #define RMCH { OP_REG, ch_reg }
292 #define RMDH { OP_REG, dh_reg }
293 #define RMBH { OP_REG, bh_reg }
294 #define RMAX { OP_REG, ax_reg }
295 #define RMDX { OP_REG, dx_reg }
296
297 #define eAX { OP_IMREG, eAX_reg }
298 #define eBX { OP_IMREG, eBX_reg }
299 #define eCX { OP_IMREG, eCX_reg }
300 #define eDX { OP_IMREG, eDX_reg }
301 #define eSP { OP_IMREG, eSP_reg }
302 #define eBP { OP_IMREG, eBP_reg }
303 #define eSI { OP_IMREG, eSI_reg }
304 #define eDI { OP_IMREG, eDI_reg }
305 #define AL { OP_IMREG, al_reg }
306 #define CL { OP_IMREG, cl_reg }
307 #define DL { OP_IMREG, dl_reg }
308 #define BL { OP_IMREG, bl_reg }
309 #define AH { OP_IMREG, ah_reg }
310 #define CH { OP_IMREG, ch_reg }
311 #define DH { OP_IMREG, dh_reg }
312 #define BH { OP_IMREG, bh_reg }
313 #define AX { OP_IMREG, ax_reg }
314 #define DX { OP_IMREG, dx_reg }
315 #define zAX { OP_IMREG, z_mode_ax_reg }
316 #define indirDX { OP_IMREG, indir_dx_reg }
317
318 #define Sw { OP_SEG, w_mode }
319 #define Sv { OP_SEG, v_mode }
320 #define Ap { OP_DIR, 0 }
321 #define Ob { OP_OFF64, b_mode }
322 #define Ov { OP_OFF64, v_mode }
323 #define Xb { OP_DSreg, eSI_reg }
324 #define Xv { OP_DSreg, eSI_reg }
325 #define Xz { OP_DSreg, eSI_reg }
326 #define Yb { OP_ESreg, eDI_reg }
327 #define Yv { OP_ESreg, eDI_reg }
328 #define DSBX { OP_DSreg, eBX_reg }
329
330 #define es { OP_REG, es_reg }
331 #define ss { OP_REG, ss_reg }
332 #define cs { OP_REG, cs_reg }
333 #define ds { OP_REG, ds_reg }
334 #define fs { OP_REG, fs_reg }
335 #define gs { OP_REG, gs_reg }
336
337 #define MX { OP_MMX, 0 }
338 #define XM { OP_XMM, 0 }
339 #define XMM { OP_XMM, xmm_mode }
340 #define EM { OP_EM, v_mode }
341 #define EMS { OP_EM, v_swap_mode }
342 #define EMd { OP_EM, d_mode }
343 #define EMx { OP_EM, x_mode }
344 #define EXw { OP_EX, w_mode }
345 #define EXd { OP_EX, d_mode }
346 #define EXdS { OP_EX, d_swap_mode }
347 #define EXq { OP_EX, q_mode }
348 #define EXqS { OP_EX, q_swap_mode }
349 #define EXx { OP_EX, x_mode }
350 #define EXxS { OP_EX, x_swap_mode }
351 #define EXxmm { OP_EX, xmm_mode }
352 #define EXxmmq { OP_EX, xmmq_mode }
353 #define EXymmq { OP_EX, ymmq_mode }
354 #define EXVexWdq { OP_EX, vex_w_dq_mode }
355 #define MS { OP_MS, v_mode }
356 #define XS { OP_XS, v_mode }
357 #define EMCq { OP_EMC, q_mode }
358 #define MXC { OP_MXC, 0 }
359 #define OPSUF { OP_3DNowSuffix, 0 }
360 #define CMP { CMP_Fixup, 0 }
361 #define XMM0 { XMM_Fixup, 0 }
362 #define FXSAVE { FXSAVE_Fixup, 0 }
363 #define Vex_2src_1 { OP_Vex_2src_1, 0 }
364 #define Vex_2src_2 { OP_Vex_2src_2, 0 }
365
366 #define Vex { OP_VEX, vex_mode }
367 #define Vex128 { OP_VEX, vex128_mode }
368 #define Vex256 { OP_VEX, vex256_mode }
369 #define VexI4 { VEXI4_Fixup, 0}
370 #define EXdVex { OP_EX_Vex, d_mode }
371 #define EXdVexS { OP_EX_Vex, d_swap_mode }
372 #define EXqVex { OP_EX_Vex, q_mode }
373 #define EXqVexS { OP_EX_Vex, q_swap_mode }
374 #define EXVexW { OP_EX_VexW, x_mode }
375 #define EXdVexW { OP_EX_VexW, d_mode }
376 #define EXqVexW { OP_EX_VexW, q_mode }
377 #define XMVex { OP_XMM_Vex, 0 }
378 #define XMVexW { OP_XMM_VexW, 0 }
379 #define XMVexI4 { OP_REG_VexI4, x_mode }
380 #define PCLMUL { PCLMUL_Fixup, 0 }
381 #define VZERO { VZERO_Fixup, 0 }
382 #define VCMP { VCMP_Fixup, 0 }
383
384 /* Used handle "rep" prefix for string instructions.  */
385 #define Xbr { REP_Fixup, eSI_reg }
386 #define Xvr { REP_Fixup, eSI_reg }
387 #define Ybr { REP_Fixup, eDI_reg }
388 #define Yvr { REP_Fixup, eDI_reg }
389 #define Yzr { REP_Fixup, eDI_reg }
390 #define indirDXr { REP_Fixup, indir_dx_reg }
391 #define ALr { REP_Fixup, al_reg }
392 #define eAXr { REP_Fixup, eAX_reg }
393
394 #define cond_jump_flag { NULL, cond_jump_mode }
395 #define loop_jcxz_flag { NULL, loop_jcxz_mode }
396
397 /* bits in sizeflag */
398 #define SUFFIX_ALWAYS 4
399 #define AFLAG 2
400 #define DFLAG 1
401
402 enum
403 {
404   /* byte operand */
405   b_mode = 1,
406   /* byte operand with operand swapped */
407   b_swap_mode,
408   /* operand size depends on prefixes */
409   v_mode,
410   /* operand size depends on prefixes with operand swapped */
411   v_swap_mode,
412   /* word operand */
413   w_mode,
414   /* double word operand  */
415   d_mode,
416   /* double word operand with operand swapped */
417   d_swap_mode,
418   /* quad word operand */
419   q_mode,
420   /* quad word operand with operand swapped */
421   q_swap_mode,
422   /* ten-byte operand */
423   t_mode,
424   /* 16-byte XMM or 32-byte YMM operand */
425   x_mode,
426   /* 16-byte XMM or 32-byte YMM operand with operand swapped */
427   x_swap_mode,
428   /* 16-byte XMM operand */
429   xmm_mode,
430   /* 16-byte XMM or quad word operand */
431   xmmq_mode,
432   /* 32-byte YMM or quad word operand */
433   ymmq_mode,
434   /* d_mode in 32bit, q_mode in 64bit mode.  */
435   m_mode,
436   /* pair of v_mode operands */
437   a_mode,
438   cond_jump_mode,
439   loop_jcxz_mode,
440   /* operand size depends on REX prefixes.  */
441   dq_mode,
442   /* registers like dq_mode, memory like w_mode.  */
443   dqw_mode,
444   /* 4- or 6-byte pointer operand */
445   f_mode,
446   const_1_mode,
447   /* v_mode for stack-related opcodes.  */
448   stack_v_mode,
449   /* non-quad operand size depends on prefixes */
450   z_mode,
451   /* 16-byte operand */
452   o_mode,
453   /* registers like dq_mode, memory like b_mode.  */
454   dqb_mode,
455   /* registers like dq_mode, memory like d_mode.  */
456   dqd_mode,
457   /* normal vex mode */
458   vex_mode,
459   /* 128bit vex mode */
460   vex128_mode,
461   /* 256bit vex mode */
462   vex256_mode,
463   /* operand size depends on the VEX.W bit.  */
464   vex_w_dq_mode,
465
466   es_reg,
467   cs_reg,
468   ss_reg,
469   ds_reg,
470   fs_reg,
471   gs_reg,
472
473   eAX_reg,
474   eCX_reg,
475   eDX_reg,
476   eBX_reg,
477   eSP_reg,
478   eBP_reg,
479   eSI_reg,
480   eDI_reg,
481
482   al_reg,
483   cl_reg,
484   dl_reg,
485   bl_reg,
486   ah_reg,
487   ch_reg,
488   dh_reg,
489   bh_reg,
490
491   ax_reg,
492   cx_reg,
493   dx_reg,
494   bx_reg,
495   sp_reg,
496   bp_reg,
497   si_reg,
498   di_reg,
499
500   rAX_reg,
501   rCX_reg,
502   rDX_reg,
503   rBX_reg,
504   rSP_reg,
505   rBP_reg,
506   rSI_reg,
507   rDI_reg,
508
509   z_mode_ax_reg,
510   indir_dx_reg
511 };
512
513 enum
514 {
515   FLOATCODE = 1,
516   USE_REG_TABLE,
517   USE_MOD_TABLE,
518   USE_RM_TABLE,
519   USE_PREFIX_TABLE,
520   USE_X86_64_TABLE,
521   USE_3BYTE_TABLE,
522   USE_XOP_8F_TABLE,
523   USE_VEX_C4_TABLE,
524   USE_VEX_C5_TABLE,
525   USE_VEX_LEN_TABLE,
526   USE_VEX_W_TABLE
527 };
528
529 #define FLOAT                   NULL, { { NULL, FLOATCODE } }
530
531 #define DIS386(T, I)            NULL, { { NULL, (T)}, { NULL,  (I) } }
532 #define REG_TABLE(I)            DIS386 (USE_REG_TABLE, (I))
533 #define MOD_TABLE(I)            DIS386 (USE_MOD_TABLE, (I))
534 #define RM_TABLE(I)             DIS386 (USE_RM_TABLE, (I))
535 #define PREFIX_TABLE(I)         DIS386 (USE_PREFIX_TABLE, (I))
536 #define X86_64_TABLE(I)         DIS386 (USE_X86_64_TABLE, (I))
537 #define THREE_BYTE_TABLE(I)     DIS386 (USE_3BYTE_TABLE, (I))
538 #define XOP_8F_TABLE(I)         DIS386 (USE_XOP_8F_TABLE, (I))
539 #define VEX_C4_TABLE(I)         DIS386 (USE_VEX_C4_TABLE, (I))
540 #define VEX_C5_TABLE(I)         DIS386 (USE_VEX_C5_TABLE, (I))
541 #define VEX_LEN_TABLE(I)        DIS386 (USE_VEX_LEN_TABLE, (I))
542 #define VEX_W_TABLE(I)          DIS386 (USE_VEX_W_TABLE, (I))
543
544 enum
545 {
546   REG_80 = 0,
547   REG_81,
548   REG_82,
549   REG_8F,
550   REG_C0,
551   REG_C1,
552   REG_C6,
553   REG_C7,
554   REG_D0,
555   REG_D1,
556   REG_D2,
557   REG_D3,
558   REG_F6,
559   REG_F7,
560   REG_FE,
561   REG_FF,
562   REG_0F00,
563   REG_0F01,
564   REG_0F0D,
565   REG_0F18,
566   REG_0F71,
567   REG_0F72,
568   REG_0F73,
569   REG_0FA6,
570   REG_0FA7,
571   REG_0FAE,
572   REG_0FBA,
573   REG_0FC7,
574   REG_VEX_71,
575   REG_VEX_72,
576   REG_VEX_73,
577   REG_VEX_AE,
578   REG_XOP_LWPCB,
579   REG_XOP_LWP
580 };
581
582 enum
583 {
584   MOD_8D = 0,
585   MOD_0F01_REG_0,
586   MOD_0F01_REG_1,
587   MOD_0F01_REG_2,
588   MOD_0F01_REG_3,
589   MOD_0F01_REG_7,
590   MOD_0F12_PREFIX_0,
591   MOD_0F13,
592   MOD_0F16_PREFIX_0,
593   MOD_0F17,
594   MOD_0F18_REG_0,
595   MOD_0F18_REG_1,
596   MOD_0F18_REG_2,
597   MOD_0F18_REG_3,
598   MOD_0F20,
599   MOD_0F21,
600   MOD_0F22,
601   MOD_0F23,
602   MOD_0F24,
603   MOD_0F26,
604   MOD_0F2B_PREFIX_0,
605   MOD_0F2B_PREFIX_1,
606   MOD_0F2B_PREFIX_2,
607   MOD_0F2B_PREFIX_3,
608   MOD_0F51,
609   MOD_0F71_REG_2,
610   MOD_0F71_REG_4,
611   MOD_0F71_REG_6,
612   MOD_0F72_REG_2,
613   MOD_0F72_REG_4,
614   MOD_0F72_REG_6,
615   MOD_0F73_REG_2,
616   MOD_0F73_REG_3,
617   MOD_0F73_REG_6,
618   MOD_0F73_REG_7,
619   MOD_0FAE_REG_0,
620   MOD_0FAE_REG_1,
621   MOD_0FAE_REG_2,
622   MOD_0FAE_REG_3,
623   MOD_0FAE_REG_4,
624   MOD_0FAE_REG_5,
625   MOD_0FAE_REG_6,
626   MOD_0FAE_REG_7,
627   MOD_0FB2,
628   MOD_0FB4,
629   MOD_0FB5,
630   MOD_0FC7_REG_6,
631   MOD_0FC7_REG_7,
632   MOD_0FD7,
633   MOD_0FE7_PREFIX_2,
634   MOD_0FF0_PREFIX_3,
635   MOD_0F382A_PREFIX_2,
636   MOD_62_32BIT,
637   MOD_C4_32BIT,
638   MOD_C5_32BIT,
639   MOD_VEX_12_PREFIX_0,
640   MOD_VEX_13,
641   MOD_VEX_16_PREFIX_0,
642   MOD_VEX_17,
643   MOD_VEX_2B,
644   MOD_VEX_50,
645   MOD_VEX_71_REG_2,
646   MOD_VEX_71_REG_4,
647   MOD_VEX_71_REG_6,
648   MOD_VEX_72_REG_2,
649   MOD_VEX_72_REG_4,
650   MOD_VEX_72_REG_6,
651   MOD_VEX_73_REG_2,
652   MOD_VEX_73_REG_3,
653   MOD_VEX_73_REG_6,
654   MOD_VEX_73_REG_7,
655   MOD_VEX_AE_REG_2,
656   MOD_VEX_AE_REG_3,
657   MOD_VEX_D7_PREFIX_2,
658   MOD_VEX_E7_PREFIX_2,
659   MOD_VEX_F0_PREFIX_3,
660   MOD_VEX_3818_PREFIX_2,
661   MOD_VEX_3819_PREFIX_2,
662   MOD_VEX_381A_PREFIX_2,
663   MOD_VEX_382A_PREFIX_2,
664   MOD_VEX_382C_PREFIX_2,
665   MOD_VEX_382D_PREFIX_2,
666   MOD_VEX_382E_PREFIX_2,
667   MOD_VEX_382F_PREFIX_2
668 };
669
670 enum
671 {
672   RM_0F01_REG_0 = 0,
673   RM_0F01_REG_1,
674   RM_0F01_REG_2,
675   RM_0F01_REG_3,
676   RM_0F01_REG_7,
677   RM_0FAE_REG_5,
678   RM_0FAE_REG_6,
679   RM_0FAE_REG_7
680 };
681
682 enum
683 {
684   PREFIX_90 = 0,
685   PREFIX_0F10,
686   PREFIX_0F11,
687   PREFIX_0F12,
688   PREFIX_0F16,
689   PREFIX_0F2A,
690   PREFIX_0F2B,
691   PREFIX_0F2C,
692   PREFIX_0F2D,
693   PREFIX_0F2E,
694   PREFIX_0F2F,
695   PREFIX_0F51,
696   PREFIX_0F52,
697   PREFIX_0F53,
698   PREFIX_0F58,
699   PREFIX_0F59,
700   PREFIX_0F5A,
701   PREFIX_0F5B,
702   PREFIX_0F5C,
703   PREFIX_0F5D,
704   PREFIX_0F5E,
705   PREFIX_0F5F,
706   PREFIX_0F60,
707   PREFIX_0F61,
708   PREFIX_0F62,
709   PREFIX_0F6C,
710   PREFIX_0F6D,
711   PREFIX_0F6F,
712   PREFIX_0F70,
713   PREFIX_0F73_REG_3,
714   PREFIX_0F73_REG_7,
715   PREFIX_0F78,
716   PREFIX_0F79,
717   PREFIX_0F7C,
718   PREFIX_0F7D,
719   PREFIX_0F7E,
720   PREFIX_0F7F,
721   PREFIX_0FB8,
722   PREFIX_0FBD,
723   PREFIX_0FC2,
724   PREFIX_0FC3,
725   PREFIX_0FC7_REG_6,
726   PREFIX_0FD0,
727   PREFIX_0FD6,
728   PREFIX_0FE6,
729   PREFIX_0FE7,
730   PREFIX_0FF0,
731   PREFIX_0FF7,
732   PREFIX_0F3810,
733   PREFIX_0F3814,
734   PREFIX_0F3815,
735   PREFIX_0F3817,
736   PREFIX_0F3820,
737   PREFIX_0F3821,
738   PREFIX_0F3822,
739   PREFIX_0F3823,
740   PREFIX_0F3824,
741   PREFIX_0F3825,
742   PREFIX_0F3828,
743   PREFIX_0F3829,
744   PREFIX_0F382A,
745   PREFIX_0F382B,
746   PREFIX_0F3830,
747   PREFIX_0F3831,
748   PREFIX_0F3832,
749   PREFIX_0F3833,
750   PREFIX_0F3834,
751   PREFIX_0F3835,
752   PREFIX_0F3837,
753   PREFIX_0F3838,
754   PREFIX_0F3839,
755   PREFIX_0F383A,
756   PREFIX_0F383B,
757   PREFIX_0F383C,
758   PREFIX_0F383D,
759   PREFIX_0F383E,
760   PREFIX_0F383F,
761   PREFIX_0F3840,
762   PREFIX_0F3841,
763   PREFIX_0F3880,
764   PREFIX_0F3881,
765   PREFIX_0F38DB,
766   PREFIX_0F38DC,
767   PREFIX_0F38DD,
768   PREFIX_0F38DE,
769   PREFIX_0F38DF,
770   PREFIX_0F38F0,
771   PREFIX_0F38F1,
772   PREFIX_0F3A08,
773   PREFIX_0F3A09,
774   PREFIX_0F3A0A,
775   PREFIX_0F3A0B,
776   PREFIX_0F3A0C,
777   PREFIX_0F3A0D,
778   PREFIX_0F3A0E,
779   PREFIX_0F3A14,
780   PREFIX_0F3A15,
781   PREFIX_0F3A16,
782   PREFIX_0F3A17,
783   PREFIX_0F3A20,
784   PREFIX_0F3A21,
785   PREFIX_0F3A22,
786   PREFIX_0F3A40,
787   PREFIX_0F3A41,
788   PREFIX_0F3A42,
789   PREFIX_0F3A44,
790   PREFIX_0F3A60,
791   PREFIX_0F3A61,
792   PREFIX_0F3A62,
793   PREFIX_0F3A63,
794   PREFIX_0F3ADF,
795   PREFIX_VEX_10,
796   PREFIX_VEX_11,
797   PREFIX_VEX_12,
798   PREFIX_VEX_16,
799   PREFIX_VEX_2A,
800   PREFIX_VEX_2C,
801   PREFIX_VEX_2D,
802   PREFIX_VEX_2E,
803   PREFIX_VEX_2F,
804   PREFIX_VEX_51,
805   PREFIX_VEX_52,
806   PREFIX_VEX_53,
807   PREFIX_VEX_58,
808   PREFIX_VEX_59,
809   PREFIX_VEX_5A,
810   PREFIX_VEX_5B,
811   PREFIX_VEX_5C,
812   PREFIX_VEX_5D,
813   PREFIX_VEX_5E,
814   PREFIX_VEX_5F,
815   PREFIX_VEX_60,
816   PREFIX_VEX_61,
817   PREFIX_VEX_62,
818   PREFIX_VEX_63,
819   PREFIX_VEX_64,
820   PREFIX_VEX_65,
821   PREFIX_VEX_66,
822   PREFIX_VEX_67,
823   PREFIX_VEX_68,
824   PREFIX_VEX_69,
825   PREFIX_VEX_6A,
826   PREFIX_VEX_6B,
827   PREFIX_VEX_6C,
828   PREFIX_VEX_6D,
829   PREFIX_VEX_6E,
830   PREFIX_VEX_6F,
831   PREFIX_VEX_70,
832   PREFIX_VEX_71_REG_2,
833   PREFIX_VEX_71_REG_4,
834   PREFIX_VEX_71_REG_6,
835   PREFIX_VEX_72_REG_2,
836   PREFIX_VEX_72_REG_4,
837   PREFIX_VEX_72_REG_6,
838   PREFIX_VEX_73_REG_2,
839   PREFIX_VEX_73_REG_3,
840   PREFIX_VEX_73_REG_6,
841   PREFIX_VEX_73_REG_7,
842   PREFIX_VEX_74,
843   PREFIX_VEX_75,
844   PREFIX_VEX_76,
845   PREFIX_VEX_77,
846   PREFIX_VEX_7C,
847   PREFIX_VEX_7D,
848   PREFIX_VEX_7E,
849   PREFIX_VEX_7F,
850   PREFIX_VEX_C2,
851   PREFIX_VEX_C4,
852   PREFIX_VEX_C5,
853   PREFIX_VEX_D0,
854   PREFIX_VEX_D1,
855   PREFIX_VEX_D2,
856   PREFIX_VEX_D3,
857   PREFIX_VEX_D4,
858   PREFIX_VEX_D5,
859   PREFIX_VEX_D6,
860   PREFIX_VEX_D7,
861   PREFIX_VEX_D8,
862   PREFIX_VEX_D9,
863   PREFIX_VEX_DA,
864   PREFIX_VEX_DB,
865   PREFIX_VEX_DC,
866   PREFIX_VEX_DD,
867   PREFIX_VEX_DE,
868   PREFIX_VEX_DF,
869   PREFIX_VEX_E0,
870   PREFIX_VEX_E1,
871   PREFIX_VEX_E2,
872   PREFIX_VEX_E3,
873   PREFIX_VEX_E4,
874   PREFIX_VEX_E5,
875   PREFIX_VEX_E6,
876   PREFIX_VEX_E7,
877   PREFIX_VEX_E8,
878   PREFIX_VEX_E9,
879   PREFIX_VEX_EA,
880   PREFIX_VEX_EB,
881   PREFIX_VEX_EC,
882   PREFIX_VEX_ED,
883   PREFIX_VEX_EE,
884   PREFIX_VEX_EF,
885   PREFIX_VEX_F0,
886   PREFIX_VEX_F1,
887   PREFIX_VEX_F2,
888   PREFIX_VEX_F3,
889   PREFIX_VEX_F4,
890   PREFIX_VEX_F5,
891   PREFIX_VEX_F6,
892   PREFIX_VEX_F7,
893   PREFIX_VEX_F8,
894   PREFIX_VEX_F9,
895   PREFIX_VEX_FA,
896   PREFIX_VEX_FB,
897   PREFIX_VEX_FC,
898   PREFIX_VEX_FD,
899   PREFIX_VEX_FE,
900   PREFIX_VEX_3800,
901   PREFIX_VEX_3801,
902   PREFIX_VEX_3802,
903   PREFIX_VEX_3803,
904   PREFIX_VEX_3804,
905   PREFIX_VEX_3805,
906   PREFIX_VEX_3806,
907   PREFIX_VEX_3807,
908   PREFIX_VEX_3808,
909   PREFIX_VEX_3809,
910   PREFIX_VEX_380A,
911   PREFIX_VEX_380B,
912   PREFIX_VEX_380C,
913   PREFIX_VEX_380D,
914   PREFIX_VEX_380E,
915   PREFIX_VEX_380F,
916   PREFIX_VEX_3817,
917   PREFIX_VEX_3818,
918   PREFIX_VEX_3819,
919   PREFIX_VEX_381A,
920   PREFIX_VEX_381C,
921   PREFIX_VEX_381D,
922   PREFIX_VEX_381E,
923   PREFIX_VEX_3820,
924   PREFIX_VEX_3821,
925   PREFIX_VEX_3822,
926   PREFIX_VEX_3823,
927   PREFIX_VEX_3824,
928   PREFIX_VEX_3825,
929   PREFIX_VEX_3828,
930   PREFIX_VEX_3829,
931   PREFIX_VEX_382A,
932   PREFIX_VEX_382B,
933   PREFIX_VEX_382C,
934   PREFIX_VEX_382D,
935   PREFIX_VEX_382E,
936   PREFIX_VEX_382F,
937   PREFIX_VEX_3830,
938   PREFIX_VEX_3831,
939   PREFIX_VEX_3832,
940   PREFIX_VEX_3833,
941   PREFIX_VEX_3834,
942   PREFIX_VEX_3835,
943   PREFIX_VEX_3837,
944   PREFIX_VEX_3838,
945   PREFIX_VEX_3839,
946   PREFIX_VEX_383A,
947   PREFIX_VEX_383B,
948   PREFIX_VEX_383C,
949   PREFIX_VEX_383D,
950   PREFIX_VEX_383E,
951   PREFIX_VEX_383F,
952   PREFIX_VEX_3840,
953   PREFIX_VEX_3841,
954   PREFIX_VEX_3896,
955   PREFIX_VEX_3897,
956   PREFIX_VEX_3898,
957   PREFIX_VEX_3899,
958   PREFIX_VEX_389A,
959   PREFIX_VEX_389B,
960   PREFIX_VEX_389C,
961   PREFIX_VEX_389D,
962   PREFIX_VEX_389E,
963   PREFIX_VEX_389F,
964   PREFIX_VEX_38A6,
965   PREFIX_VEX_38A7,
966   PREFIX_VEX_38A8,
967   PREFIX_VEX_38A9,
968   PREFIX_VEX_38AA,
969   PREFIX_VEX_38AB,
970   PREFIX_VEX_38AC,
971   PREFIX_VEX_38AD,
972   PREFIX_VEX_38AE,
973   PREFIX_VEX_38AF,
974   PREFIX_VEX_38B6,
975   PREFIX_VEX_38B7,
976   PREFIX_VEX_38B8,
977   PREFIX_VEX_38B9,
978   PREFIX_VEX_38BA,
979   PREFIX_VEX_38BB,
980   PREFIX_VEX_38BC,
981   PREFIX_VEX_38BD,
982   PREFIX_VEX_38BE,
983   PREFIX_VEX_38BF,
984   PREFIX_VEX_38DB,
985   PREFIX_VEX_38DC,
986   PREFIX_VEX_38DD,
987   PREFIX_VEX_38DE,
988   PREFIX_VEX_38DF,
989   PREFIX_VEX_3A04,
990   PREFIX_VEX_3A05,
991   PREFIX_VEX_3A06,
992   PREFIX_VEX_3A08,
993   PREFIX_VEX_3A09,
994   PREFIX_VEX_3A0A,
995   PREFIX_VEX_3A0B,
996   PREFIX_VEX_3A0C,
997   PREFIX_VEX_3A0D,
998   PREFIX_VEX_3A0E,
999   PREFIX_VEX_3A0F,
1000   PREFIX_VEX_3A14,
1001   PREFIX_VEX_3A15,
1002   PREFIX_VEX_3A16,
1003   PREFIX_VEX_3A17,
1004   PREFIX_VEX_3A18,
1005   PREFIX_VEX_3A19,
1006   PREFIX_VEX_3A20,
1007   PREFIX_VEX_3A21,
1008   PREFIX_VEX_3A22,
1009   PREFIX_VEX_3A40,
1010   PREFIX_VEX_3A41,
1011   PREFIX_VEX_3A42,
1012   PREFIX_VEX_3A44,
1013   PREFIX_VEX_3A4A,
1014   PREFIX_VEX_3A4B,
1015   PREFIX_VEX_3A4C,
1016   PREFIX_VEX_3A5C,
1017   PREFIX_VEX_3A5D,
1018   PREFIX_VEX_3A5E,
1019   PREFIX_VEX_3A5F,
1020   PREFIX_VEX_3A60,
1021   PREFIX_VEX_3A61,
1022   PREFIX_VEX_3A62,
1023   PREFIX_VEX_3A63,
1024   PREFIX_VEX_3A68,
1025   PREFIX_VEX_3A69,
1026   PREFIX_VEX_3A6A,
1027   PREFIX_VEX_3A6B,
1028   PREFIX_VEX_3A6C,
1029   PREFIX_VEX_3A6D,
1030   PREFIX_VEX_3A6E,
1031   PREFIX_VEX_3A6F,
1032   PREFIX_VEX_3A78,
1033   PREFIX_VEX_3A79,
1034   PREFIX_VEX_3A7A,
1035   PREFIX_VEX_3A7B,
1036   PREFIX_VEX_3A7C,
1037   PREFIX_VEX_3A7D,
1038   PREFIX_VEX_3A7E,
1039   PREFIX_VEX_3A7F,
1040   PREFIX_VEX_3ADF
1041 };
1042
1043 enum
1044 {
1045   X86_64_06 = 0,
1046   X86_64_07,
1047   X86_64_0D,
1048   X86_64_16,
1049   X86_64_17,
1050   X86_64_1E,
1051   X86_64_1F,
1052   X86_64_27,
1053   X86_64_2F,
1054   X86_64_37,
1055   X86_64_3F,
1056   X86_64_60,
1057   X86_64_61,
1058   X86_64_62,
1059   X86_64_63,
1060   X86_64_6D,
1061   X86_64_6F,
1062   X86_64_9A,
1063   X86_64_C4,
1064   X86_64_C5,
1065   X86_64_CE,
1066   X86_64_D4,
1067   X86_64_D5,
1068   X86_64_EA,
1069   X86_64_0F01_REG_0,
1070   X86_64_0F01_REG_1,
1071   X86_64_0F01_REG_2,
1072   X86_64_0F01_REG_3
1073 };
1074
1075 enum
1076 {
1077   THREE_BYTE_0F38 = 0,
1078   THREE_BYTE_0F3A,
1079   THREE_BYTE_0F7A
1080 };
1081
1082 enum
1083 {
1084   XOP_08 = 0,
1085   XOP_09,
1086   XOP_0A
1087 };
1088
1089 enum
1090 {
1091   VEX_0F = 0,
1092   VEX_0F38,
1093   VEX_0F3A
1094 };
1095
1096 enum
1097 {
1098   VEX_LEN_10_P_1 = 0,
1099   VEX_LEN_10_P_3,
1100   VEX_LEN_11_P_1,
1101   VEX_LEN_11_P_3,
1102   VEX_LEN_12_P_0_M_0,
1103   VEX_LEN_12_P_0_M_1,
1104   VEX_LEN_12_P_2,
1105   VEX_LEN_13_M_0,
1106   VEX_LEN_16_P_0_M_0,
1107   VEX_LEN_16_P_0_M_1,
1108   VEX_LEN_16_P_2,
1109   VEX_LEN_17_M_0,
1110   VEX_LEN_2A_P_1,
1111   VEX_LEN_2A_P_3,
1112   VEX_LEN_2C_P_1,
1113   VEX_LEN_2C_P_3,
1114   VEX_LEN_2D_P_1,
1115   VEX_LEN_2D_P_3,
1116   VEX_LEN_2E_P_0,
1117   VEX_LEN_2E_P_2,
1118   VEX_LEN_2F_P_0,
1119   VEX_LEN_2F_P_2,
1120   VEX_LEN_51_P_1,
1121   VEX_LEN_51_P_3,
1122   VEX_LEN_52_P_1,
1123   VEX_LEN_53_P_1,
1124   VEX_LEN_58_P_1,
1125   VEX_LEN_58_P_3,
1126   VEX_LEN_59_P_1,
1127   VEX_LEN_59_P_3,
1128   VEX_LEN_5A_P_1,
1129   VEX_LEN_5A_P_3,
1130   VEX_LEN_5C_P_1,
1131   VEX_LEN_5C_P_3,
1132   VEX_LEN_5D_P_1,
1133   VEX_LEN_5D_P_3,
1134   VEX_LEN_5E_P_1,
1135   VEX_LEN_5E_P_3,
1136   VEX_LEN_5F_P_1,
1137   VEX_LEN_5F_P_3,
1138   VEX_LEN_60_P_2,
1139   VEX_LEN_61_P_2,
1140   VEX_LEN_62_P_2,
1141   VEX_LEN_63_P_2,
1142   VEX_LEN_64_P_2,
1143   VEX_LEN_65_P_2,
1144   VEX_LEN_66_P_2,
1145   VEX_LEN_67_P_2,
1146   VEX_LEN_68_P_2,
1147   VEX_LEN_69_P_2,
1148   VEX_LEN_6A_P_2,
1149   VEX_LEN_6B_P_2,
1150   VEX_LEN_6C_P_2,
1151   VEX_LEN_6D_P_2,
1152   VEX_LEN_6E_P_2,
1153   VEX_LEN_70_P_1,
1154   VEX_LEN_70_P_2,
1155   VEX_LEN_70_P_3,
1156   VEX_LEN_71_R_2_P_2,
1157   VEX_LEN_71_R_4_P_2,
1158   VEX_LEN_71_R_6_P_2,
1159   VEX_LEN_72_R_2_P_2,
1160   VEX_LEN_72_R_4_P_2,
1161   VEX_LEN_72_R_6_P_2,
1162   VEX_LEN_73_R_2_P_2,
1163   VEX_LEN_73_R_3_P_2,
1164   VEX_LEN_73_R_6_P_2,
1165   VEX_LEN_73_R_7_P_2,
1166   VEX_LEN_74_P_2,
1167   VEX_LEN_75_P_2,
1168   VEX_LEN_76_P_2,
1169   VEX_LEN_7E_P_1,
1170   VEX_LEN_7E_P_2,
1171   VEX_LEN_AE_R_2_M_0,
1172   VEX_LEN_AE_R_3_M_0,
1173   VEX_LEN_C2_P_1,
1174   VEX_LEN_C2_P_3,
1175   VEX_LEN_C4_P_2,
1176   VEX_LEN_C5_P_2,
1177   VEX_LEN_D1_P_2,
1178   VEX_LEN_D2_P_2,
1179   VEX_LEN_D3_P_2,
1180   VEX_LEN_D4_P_2,
1181   VEX_LEN_D5_P_2,
1182   VEX_LEN_D6_P_2,
1183   VEX_LEN_D7_P_2_M_1,
1184   VEX_LEN_D8_P_2,
1185   VEX_LEN_D9_P_2,
1186   VEX_LEN_DA_P_2,
1187   VEX_LEN_DB_P_2,
1188   VEX_LEN_DC_P_2,
1189   VEX_LEN_DD_P_2,
1190   VEX_LEN_DE_P_2,
1191   VEX_LEN_DF_P_2,
1192   VEX_LEN_E0_P_2,
1193   VEX_LEN_E1_P_2,
1194   VEX_LEN_E2_P_2,
1195   VEX_LEN_E3_P_2,
1196   VEX_LEN_E4_P_2,
1197   VEX_LEN_E5_P_2,
1198   VEX_LEN_E8_P_2,
1199   VEX_LEN_E9_P_2,
1200   VEX_LEN_EA_P_2,
1201   VEX_LEN_EB_P_2,
1202   VEX_LEN_EC_P_2,
1203   VEX_LEN_ED_P_2,
1204   VEX_LEN_EE_P_2,
1205   VEX_LEN_EF_P_2,
1206   VEX_LEN_F1_P_2,
1207   VEX_LEN_F2_P_2,
1208   VEX_LEN_F3_P_2,
1209   VEX_LEN_F4_P_2,
1210   VEX_LEN_F5_P_2,
1211   VEX_LEN_F6_P_2,
1212   VEX_LEN_F7_P_2,
1213   VEX_LEN_F8_P_2,
1214   VEX_LEN_F9_P_2,
1215   VEX_LEN_FA_P_2,
1216   VEX_LEN_FB_P_2,
1217   VEX_LEN_FC_P_2,
1218   VEX_LEN_FD_P_2,
1219   VEX_LEN_FE_P_2,
1220   VEX_LEN_3800_P_2,
1221   VEX_LEN_3801_P_2,
1222   VEX_LEN_3802_P_2,
1223   VEX_LEN_3803_P_2,
1224   VEX_LEN_3804_P_2,
1225   VEX_LEN_3805_P_2,
1226   VEX_LEN_3806_P_2,
1227   VEX_LEN_3807_P_2,
1228   VEX_LEN_3808_P_2,
1229   VEX_LEN_3809_P_2,
1230   VEX_LEN_380A_P_2,
1231   VEX_LEN_380B_P_2,
1232   VEX_LEN_3819_P_2_M_0,
1233   VEX_LEN_381A_P_2_M_0,
1234   VEX_LEN_381C_P_2,
1235   VEX_LEN_381D_P_2,
1236   VEX_LEN_381E_P_2,
1237   VEX_LEN_3820_P_2,
1238   VEX_LEN_3821_P_2,
1239   VEX_LEN_3822_P_2,
1240   VEX_LEN_3823_P_2,
1241   VEX_LEN_3824_P_2,
1242   VEX_LEN_3825_P_2,
1243   VEX_LEN_3828_P_2,
1244   VEX_LEN_3829_P_2,
1245   VEX_LEN_382A_P_2_M_0,
1246   VEX_LEN_382B_P_2,
1247   VEX_LEN_3830_P_2,
1248   VEX_LEN_3831_P_2,
1249   VEX_LEN_3832_P_2,
1250   VEX_LEN_3833_P_2,
1251   VEX_LEN_3834_P_2,
1252   VEX_LEN_3835_P_2,
1253   VEX_LEN_3837_P_2,
1254   VEX_LEN_3838_P_2,
1255   VEX_LEN_3839_P_2,
1256   VEX_LEN_383A_P_2,
1257   VEX_LEN_383B_P_2,
1258   VEX_LEN_383C_P_2,
1259   VEX_LEN_383D_P_2,
1260   VEX_LEN_383E_P_2,
1261   VEX_LEN_383F_P_2,
1262   VEX_LEN_3840_P_2,
1263   VEX_LEN_3841_P_2,
1264   VEX_LEN_38DB_P_2,
1265   VEX_LEN_38DC_P_2,
1266   VEX_LEN_38DD_P_2,
1267   VEX_LEN_38DE_P_2,
1268   VEX_LEN_38DF_P_2,
1269   VEX_LEN_3A06_P_2,
1270   VEX_LEN_3A0A_P_2,
1271   VEX_LEN_3A0B_P_2,
1272   VEX_LEN_3A0E_P_2,
1273   VEX_LEN_3A0F_P_2,
1274   VEX_LEN_3A14_P_2,
1275   VEX_LEN_3A15_P_2,
1276   VEX_LEN_3A16_P_2,
1277   VEX_LEN_3A17_P_2,
1278   VEX_LEN_3A18_P_2,
1279   VEX_LEN_3A19_P_2,
1280   VEX_LEN_3A20_P_2,
1281   VEX_LEN_3A21_P_2,
1282   VEX_LEN_3A22_P_2,
1283   VEX_LEN_3A41_P_2,
1284   VEX_LEN_3A42_P_2,
1285   VEX_LEN_3A44_P_2,
1286   VEX_LEN_3A4C_P_2,
1287   VEX_LEN_3A60_P_2,
1288   VEX_LEN_3A61_P_2,
1289   VEX_LEN_3A62_P_2,
1290   VEX_LEN_3A63_P_2,
1291   VEX_LEN_3A6A_P_2,
1292   VEX_LEN_3A6B_P_2,
1293   VEX_LEN_3A6E_P_2,
1294   VEX_LEN_3A6F_P_2,
1295   VEX_LEN_3A7A_P_2,
1296   VEX_LEN_3A7B_P_2,
1297   VEX_LEN_3A7E_P_2,
1298   VEX_LEN_3A7F_P_2,
1299   VEX_LEN_3ADF_P_2,
1300   VEX_LEN_XOP_09_80,
1301   VEX_LEN_XOP_09_81
1302 };
1303
1304 enum
1305 {
1306   VEX_W_10_P_0 = 0,
1307   VEX_W_10_P_1,
1308   VEX_W_10_P_2,
1309   VEX_W_10_P_3,
1310   VEX_W_11_P_0,
1311   VEX_W_11_P_1,
1312   VEX_W_11_P_2,
1313   VEX_W_11_P_3,
1314   VEX_W_12_P_0_M_0,
1315   VEX_W_12_P_0_M_1,
1316   VEX_W_12_P_1,
1317   VEX_W_12_P_2,
1318   VEX_W_12_P_3,
1319   VEX_W_13_M_0,
1320   VEX_W_14,
1321   VEX_W_15,
1322   VEX_W_16_P_0_M_0,
1323   VEX_W_16_P_0_M_1,
1324   VEX_W_16_P_1,
1325   VEX_W_16_P_2,
1326   VEX_W_17_M_0,
1327   VEX_W_28,
1328   VEX_W_29,
1329   VEX_W_2B_M_0,
1330   VEX_W_2E_P_0,
1331   VEX_W_2E_P_2,
1332   VEX_W_2F_P_0,
1333   VEX_W_2F_P_2,
1334   VEX_W_50_M_0,
1335   VEX_W_51_P_0,
1336   VEX_W_51_P_1,
1337   VEX_W_51_P_2,
1338   VEX_W_51_P_3,
1339   VEX_W_52_P_0,
1340   VEX_W_52_P_1,
1341   VEX_W_53_P_0,
1342   VEX_W_53_P_1,
1343   VEX_W_58_P_0,
1344   VEX_W_58_P_1,
1345   VEX_W_58_P_2,
1346   VEX_W_58_P_3,
1347   VEX_W_59_P_0,
1348   VEX_W_59_P_1,
1349   VEX_W_59_P_2,
1350   VEX_W_59_P_3,
1351   VEX_W_5A_P_0,
1352   VEX_W_5A_P_1,
1353   VEX_W_5A_P_3,
1354   VEX_W_5B_P_0,
1355   VEX_W_5B_P_1,
1356   VEX_W_5B_P_2,
1357   VEX_W_5C_P_0,
1358   VEX_W_5C_P_1,
1359   VEX_W_5C_P_2,
1360   VEX_W_5C_P_3,
1361   VEX_W_5D_P_0,
1362   VEX_W_5D_P_1,
1363   VEX_W_5D_P_2,
1364   VEX_W_5D_P_3,
1365   VEX_W_5E_P_0,
1366   VEX_W_5E_P_1,
1367   VEX_W_5E_P_2,
1368   VEX_W_5E_P_3,
1369   VEX_W_5F_P_0,
1370   VEX_W_5F_P_1,
1371   VEX_W_5F_P_2,
1372   VEX_W_5F_P_3,
1373   VEX_W_60_P_2,
1374   VEX_W_61_P_2,
1375   VEX_W_62_P_2,
1376   VEX_W_63_P_2,
1377   VEX_W_64_P_2,
1378   VEX_W_65_P_2,
1379   VEX_W_66_P_2,
1380   VEX_W_67_P_2,
1381   VEX_W_68_P_2,
1382   VEX_W_69_P_2,
1383   VEX_W_6A_P_2,
1384   VEX_W_6B_P_2,
1385   VEX_W_6C_P_2,
1386   VEX_W_6D_P_2,
1387   VEX_W_6F_P_1,
1388   VEX_W_6F_P_2,
1389   VEX_W_70_P_1,
1390   VEX_W_70_P_2,
1391   VEX_W_70_P_3,
1392   VEX_W_71_R_2_P_2,
1393   VEX_W_71_R_4_P_2,
1394   VEX_W_71_R_6_P_2,
1395   VEX_W_72_R_2_P_2,
1396   VEX_W_72_R_4_P_2,
1397   VEX_W_72_R_6_P_2,
1398   VEX_W_73_R_2_P_2,
1399   VEX_W_73_R_3_P_2,
1400   VEX_W_73_R_6_P_2,
1401   VEX_W_73_R_7_P_2,
1402   VEX_W_74_P_2,
1403   VEX_W_75_P_2,
1404   VEX_W_76_P_2,
1405   VEX_W_77_P_0,
1406   VEX_W_7C_P_2,
1407   VEX_W_7C_P_3,
1408   VEX_W_7D_P_2,
1409   VEX_W_7D_P_3,
1410   VEX_W_7E_P_1,
1411   VEX_W_7F_P_1,
1412   VEX_W_7F_P_2,
1413   VEX_W_AE_R_2_M_0,
1414   VEX_W_AE_R_3_M_0,
1415   VEX_W_C2_P_0,
1416   VEX_W_C2_P_1,
1417   VEX_W_C2_P_2,
1418   VEX_W_C2_P_3,
1419   VEX_W_C4_P_2,
1420   VEX_W_C5_P_2,
1421   VEX_W_D0_P_2,
1422   VEX_W_D0_P_3,
1423   VEX_W_D1_P_2,
1424   VEX_W_D2_P_2,
1425   VEX_W_D3_P_2,
1426   VEX_W_D4_P_2,
1427   VEX_W_D5_P_2,
1428   VEX_W_D6_P_2,
1429   VEX_W_D7_P_2_M_1,
1430   VEX_W_D8_P_2,
1431   VEX_W_D9_P_2,
1432   VEX_W_DA_P_2,
1433   VEX_W_DB_P_2,
1434   VEX_W_DC_P_2,
1435   VEX_W_DD_P_2,
1436   VEX_W_DE_P_2,
1437   VEX_W_DF_P_2,
1438   VEX_W_E0_P_2,
1439   VEX_W_E1_P_2,
1440   VEX_W_E2_P_2,
1441   VEX_W_E3_P_2,
1442   VEX_W_E4_P_2,
1443   VEX_W_E5_P_2,
1444   VEX_W_E6_P_1,
1445   VEX_W_E6_P_2,
1446   VEX_W_E6_P_3,
1447   VEX_W_E7_P_2_M_0,
1448   VEX_W_E8_P_2,
1449   VEX_W_E9_P_2,
1450   VEX_W_EA_P_2,
1451   VEX_W_EB_P_2,
1452   VEX_W_EC_P_2,
1453   VEX_W_ED_P_2,
1454   VEX_W_EE_P_2,
1455   VEX_W_EF_P_2,
1456   VEX_W_F0_P_3_M_0,
1457   VEX_W_F1_P_2,
1458   VEX_W_F2_P_2,
1459   VEX_W_F3_P_2,
1460   VEX_W_F4_P_2,
1461   VEX_W_F5_P_2,
1462   VEX_W_F6_P_2,
1463   VEX_W_F7_P_2,
1464   VEX_W_F8_P_2,
1465   VEX_W_F9_P_2,
1466   VEX_W_FA_P_2,
1467   VEX_W_FB_P_2,
1468   VEX_W_FC_P_2,
1469   VEX_W_FD_P_2,
1470   VEX_W_FE_P_2,
1471   VEX_W_3800_P_2,
1472   VEX_W_3801_P_2,
1473   VEX_W_3802_P_2,
1474   VEX_W_3803_P_2,
1475   VEX_W_3804_P_2,
1476   VEX_W_3805_P_2,
1477   VEX_W_3806_P_2,
1478   VEX_W_3807_P_2,
1479   VEX_W_3808_P_2,
1480   VEX_W_3809_P_2,
1481   VEX_W_380A_P_2,
1482   VEX_W_380B_P_2,
1483   VEX_W_380C_P_2,
1484   VEX_W_380D_P_2,
1485   VEX_W_380E_P_2,
1486   VEX_W_380F_P_2,
1487   VEX_W_3817_P_2,
1488   VEX_W_3818_P_2_M_0,
1489   VEX_W_3819_P_2_M_0,
1490   VEX_W_381A_P_2_M_0,
1491   VEX_W_381C_P_2,
1492   VEX_W_381D_P_2,
1493   VEX_W_381E_P_2,
1494   VEX_W_3820_P_2,
1495   VEX_W_3821_P_2,
1496   VEX_W_3822_P_2,
1497   VEX_W_3823_P_2,
1498   VEX_W_3824_P_2,
1499   VEX_W_3825_P_2,
1500   VEX_W_3828_P_2,
1501   VEX_W_3829_P_2,
1502   VEX_W_382A_P_2_M_0,
1503   VEX_W_382B_P_2,
1504   VEX_W_382C_P_2_M_0,
1505   VEX_W_382D_P_2_M_0,
1506   VEX_W_382E_P_2_M_0,
1507   VEX_W_382F_P_2_M_0,
1508   VEX_W_3830_P_2,
1509   VEX_W_3831_P_2,
1510   VEX_W_3832_P_2,
1511   VEX_W_3833_P_2,
1512   VEX_W_3834_P_2,
1513   VEX_W_3835_P_2,
1514   VEX_W_3837_P_2,
1515   VEX_W_3838_P_2,
1516   VEX_W_3839_P_2,
1517   VEX_W_383A_P_2,
1518   VEX_W_383B_P_2,
1519   VEX_W_383C_P_2,
1520   VEX_W_383D_P_2,
1521   VEX_W_383E_P_2,
1522   VEX_W_383F_P_2,
1523   VEX_W_3840_P_2,
1524   VEX_W_3841_P_2,
1525   VEX_W_38DB_P_2,
1526   VEX_W_38DC_P_2,
1527   VEX_W_38DD_P_2,
1528   VEX_W_38DE_P_2,
1529   VEX_W_38DF_P_2,
1530   VEX_W_3A04_P_2,
1531   VEX_W_3A05_P_2,
1532   VEX_W_3A06_P_2,
1533   VEX_W_3A08_P_2,
1534   VEX_W_3A09_P_2,
1535   VEX_W_3A0A_P_2,
1536   VEX_W_3A0B_P_2,
1537   VEX_W_3A0C_P_2,
1538   VEX_W_3A0D_P_2,
1539   VEX_W_3A0E_P_2,
1540   VEX_W_3A0F_P_2,
1541   VEX_W_3A14_P_2,
1542   VEX_W_3A15_P_2,
1543   VEX_W_3A18_P_2,
1544   VEX_W_3A19_P_2,
1545   VEX_W_3A20_P_2,
1546   VEX_W_3A21_P_2,
1547   VEX_W_3A40_P_2,
1548   VEX_W_3A41_P_2,
1549   VEX_W_3A42_P_2,
1550   VEX_W_3A44_P_2,
1551   VEX_W_3A4A_P_2,
1552   VEX_W_3A4B_P_2,
1553   VEX_W_3A4C_P_2,
1554   VEX_W_3A60_P_2,
1555   VEX_W_3A61_P_2,
1556   VEX_W_3A62_P_2,
1557   VEX_W_3A63_P_2,
1558   VEX_W_3ADF_P_2
1559 };
1560
1561 typedef void (*op_rtn) (int bytemode, int sizeflag);
1562
1563 struct dis386 {
1564   const char *name;
1565   struct
1566     {
1567       op_rtn rtn;
1568       int bytemode;
1569     } op[MAX_OPERANDS];
1570 };
1571
1572 /* Upper case letters in the instruction names here are macros.
1573    'A' => print 'b' if no register operands or suffix_always is true
1574    'B' => print 'b' if suffix_always is true
1575    'C' => print 's' or 'l' ('w' or 'd' in Intel mode) depending on operand
1576           size prefix
1577    'D' => print 'w' if no register operands or 'w', 'l' or 'q', if
1578           suffix_always is true
1579    'E' => print 'e' if 32-bit form of jcxz
1580    'F' => print 'w' or 'l' depending on address size prefix (loop insns)
1581    'G' => print 'w' or 'l' depending on operand size prefix (i/o insns)
1582    'H' => print ",pt" or ",pn" branch hint
1583    'I' => honor following macro letter even in Intel mode (implemented only
1584           for some of the macro letters)
1585    'J' => print 'l'
1586    'K' => print 'd' or 'q' if rex prefix is present.
1587    'L' => print 'l' if suffix_always is true
1588    'M' => print 'r' if intel_mnemonic is false.
1589    'N' => print 'n' if instruction has no wait "prefix"
1590    'O' => print 'd' or 'o' (or 'q' in Intel mode)
1591    'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix,
1592           or suffix_always is true.  print 'q' if rex prefix is present.
1593    'Q' => print 'w', 'l' or 'q' for memory operand or suffix_always
1594           is true
1595    'R' => print 'w', 'l' or 'q' ('d' for 'l' and 'e' in Intel mode)
1596    'S' => print 'w', 'l' or 'q' if suffix_always is true
1597    'T' => print 'q' in 64bit mode and behave as 'P' otherwise
1598    'U' => print 'q' in 64bit mode and behave as 'Q' otherwise
1599    'V' => print 'q' in 64bit mode and behave as 'S' otherwise
1600    'W' => print 'b', 'w' or 'l' ('d' in Intel mode)
1601    'X' => print 's', 'd' depending on data16 prefix (for XMM)
1602    'Y' => 'q' if instruction has an REX 64bit overwrite prefix and
1603           suffix_always is true.
1604    'Z' => print 'q' in 64bit mode and behave as 'L' otherwise
1605    '!' => change condition from true to false or from false to true.
1606    '%' => add 1 upper case letter to the macro.
1607
1608    2 upper case letter macros:
1609    "XY" => print 'x' or 'y' if no register operands or suffix_always
1610            is true.
1611    "XW" => print 's', 'd' depending on the VEX.W bit (for FMA)
1612    "LQ" => print 'l' ('d' in Intel mode) or 'q' for memory operand
1613            or suffix_always is true
1614    "LB" => print "abs" in 64bit mode and behave as 'B' otherwise
1615    "LS" => print "abs" in 64bit mode and behave as 'S' otherwise
1616    "LV" => print "abs" for 64bit operand and behave as 'S' otherwise
1617
1618    Many of the above letters print nothing in Intel mode.  See "putop"
1619    for the details.
1620
1621    Braces '{' and '}', and vertical bars '|', indicate alternative
1622    mnemonic strings for AT&T and Intel.  */
1623
1624 static const struct dis386 dis386[] = {
1625   /* 00 */
1626   { "addB",             { Eb, Gb } },
1627   { "addS",             { Ev, Gv } },
1628   { "addB",             { Gb, EbS } },
1629   { "addS",             { Gv, EvS } },
1630   { "addB",             { AL, Ib } },
1631   { "addS",             { eAX, Iv } },
1632   { X86_64_TABLE (X86_64_06) },
1633   { X86_64_TABLE (X86_64_07) },
1634   /* 08 */
1635   { "orB",              { Eb, Gb } },
1636   { "orS",              { Ev, Gv } },
1637   { "orB",              { Gb, EbS } },
1638   { "orS",              { Gv, EvS } },
1639   { "orB",              { AL, Ib } },
1640   { "orS",              { eAX, Iv } },
1641   { X86_64_TABLE (X86_64_0D) },
1642   { "(bad)",            { XX } },       /* 0x0f extended opcode escape */
1643   /* 10 */
1644   { "adcB",             { Eb, Gb } },
1645   { "adcS",             { Ev, Gv } },
1646   { "adcB",             { Gb, EbS } },
1647   { "adcS",             { Gv, EvS } },
1648   { "adcB",             { AL, Ib } },
1649   { "adcS",             { eAX, Iv } },
1650   { X86_64_TABLE (X86_64_16) },
1651   { X86_64_TABLE (X86_64_17) },
1652   /* 18 */
1653   { "sbbB",             { Eb, Gb } },
1654   { "sbbS",             { Ev, Gv } },
1655   { "sbbB",             { Gb, EbS } },
1656   { "sbbS",             { Gv, EvS } },
1657   { "sbbB",             { AL, Ib } },
1658   { "sbbS",             { eAX, Iv } },
1659   { X86_64_TABLE (X86_64_1E) },
1660   { X86_64_TABLE (X86_64_1F) },
1661   /* 20 */
1662   { "andB",             { Eb, Gb } },
1663   { "andS",             { Ev, Gv } },
1664   { "andB",             { Gb, EbS } },
1665   { "andS",             { Gv, EvS } },
1666   { "andB",             { AL, Ib } },
1667   { "andS",             { eAX, Iv } },
1668   { "(bad)",            { XX } },       /* SEG ES prefix */
1669   { X86_64_TABLE (X86_64_27) },
1670   /* 28 */
1671   { "subB",             { Eb, Gb } },
1672   { "subS",             { Ev, Gv } },
1673   { "subB",             { Gb, EbS } },
1674   { "subS",             { Gv, EvS } },
1675   { "subB",             { AL, Ib } },
1676   { "subS",             { eAX, Iv } },
1677   { "(bad)",            { XX } },       /* SEG CS prefix */
1678   { X86_64_TABLE (X86_64_2F) },
1679   /* 30 */
1680   { "xorB",             { Eb, Gb } },
1681   { "xorS",             { Ev, Gv } },
1682   { "xorB",             { Gb, EbS } },
1683   { "xorS",             { Gv, EvS } },
1684   { "xorB",             { AL, Ib } },
1685   { "xorS",             { eAX, Iv } },
1686   { "(bad)",            { XX } },       /* SEG SS prefix */
1687   { X86_64_TABLE (X86_64_37) },
1688   /* 38 */
1689   { "cmpB",             { Eb, Gb } },
1690   { "cmpS",             { Ev, Gv } },
1691   { "cmpB",             { Gb, EbS } },
1692   { "cmpS",             { Gv, EvS } },
1693   { "cmpB",             { AL, Ib } },
1694   { "cmpS",             { eAX, Iv } },
1695   { "(bad)",            { XX } },       /* SEG DS prefix */
1696   { X86_64_TABLE (X86_64_3F) },
1697   /* 40 */
1698   { "inc{S|}",          { RMeAX } },
1699   { "inc{S|}",          { RMeCX } },
1700   { "inc{S|}",          { RMeDX } },
1701   { "inc{S|}",          { RMeBX } },
1702   { "inc{S|}",          { RMeSP } },
1703   { "inc{S|}",          { RMeBP } },
1704   { "inc{S|}",          { RMeSI } },
1705   { "inc{S|}",          { RMeDI } },
1706   /* 48 */
1707   { "dec{S|}",          { RMeAX } },
1708   { "dec{S|}",          { RMeCX } },
1709   { "dec{S|}",          { RMeDX } },
1710   { "dec{S|}",          { RMeBX } },
1711   { "dec{S|}",          { RMeSP } },
1712   { "dec{S|}",          { RMeBP } },
1713   { "dec{S|}",          { RMeSI } },
1714   { "dec{S|}",          { RMeDI } },
1715   /* 50 */
1716   { "pushV",            { RMrAX } },
1717   { "pushV",            { RMrCX } },
1718   { "pushV",            { RMrDX } },
1719   { "pushV",            { RMrBX } },
1720   { "pushV",            { RMrSP } },
1721   { "pushV",            { RMrBP } },
1722   { "pushV",            { RMrSI } },
1723   { "pushV",            { RMrDI } },
1724   /* 58 */
1725   { "popV",             { RMrAX } },
1726   { "popV",             { RMrCX } },
1727   { "popV",             { RMrDX } },
1728   { "popV",             { RMrBX } },
1729   { "popV",             { RMrSP } },
1730   { "popV",             { RMrBP } },
1731   { "popV",             { RMrSI } },
1732   { "popV",             { RMrDI } },
1733   /* 60 */
1734   { X86_64_TABLE (X86_64_60) },
1735   { X86_64_TABLE (X86_64_61) },
1736   { X86_64_TABLE (X86_64_62) },
1737   { X86_64_TABLE (X86_64_63) },
1738   { "(bad)",            { XX } },       /* seg fs */
1739   { "(bad)",            { XX } },       /* seg gs */
1740   { "(bad)",            { XX } },       /* op size prefix */
1741   { "(bad)",            { XX } },       /* adr size prefix */
1742   /* 68 */
1743   { "pushT",            { Iq } },
1744   { "imulS",            { Gv, Ev, Iv } },
1745   { "pushT",            { sIb } },
1746   { "imulS",            { Gv, Ev, sIb } },
1747   { "ins{b|}",          { Ybr, indirDX } },
1748   { X86_64_TABLE (X86_64_6D) },
1749   { "outs{b|}",         { indirDXr, Xb } },
1750   { X86_64_TABLE (X86_64_6F) },
1751   /* 70 */
1752   { "joH",              { Jb, XX, cond_jump_flag } },
1753   { "jnoH",             { Jb, XX, cond_jump_flag } },
1754   { "jbH",              { Jb, XX, cond_jump_flag } },
1755   { "jaeH",             { Jb, XX, cond_jump_flag } },
1756   { "jeH",              { Jb, XX, cond_jump_flag } },
1757   { "jneH",             { Jb, XX, cond_jump_flag } },
1758   { "jbeH",             { Jb, XX, cond_jump_flag } },
1759   { "jaH",              { Jb, XX, cond_jump_flag } },
1760   /* 78 */
1761   { "jsH",              { Jb, XX, cond_jump_flag } },
1762   { "jnsH",             { Jb, XX, cond_jump_flag } },
1763   { "jpH",              { Jb, XX, cond_jump_flag } },
1764   { "jnpH",             { Jb, XX, cond_jump_flag } },
1765   { "jlH",              { Jb, XX, cond_jump_flag } },
1766   { "jgeH",             { Jb, XX, cond_jump_flag } },
1767   { "jleH",             { Jb, XX, cond_jump_flag } },
1768   { "jgH",              { Jb, XX, cond_jump_flag } },
1769   /* 80 */
1770   { REG_TABLE (REG_80) },
1771   { REG_TABLE (REG_81) },
1772   { "(bad)",            { XX } },
1773   { REG_TABLE (REG_82) },
1774   { "testB",            { Eb, Gb } },
1775   { "testS",            { Ev, Gv } },
1776   { "xchgB",            { Eb, Gb } },
1777   { "xchgS",            { Ev, Gv } },
1778   /* 88 */
1779   { "movB",             { Eb, Gb } },
1780   { "movS",             { Ev, Gv } },
1781   { "movB",             { Gb, EbS } },
1782   { "movS",             { Gv, EvS } },
1783   { "movD",             { Sv, Sw } },
1784   { MOD_TABLE (MOD_8D) },
1785   { "movD",             { Sw, Sv } },
1786   { REG_TABLE (REG_8F) },
1787   /* 90 */
1788   { PREFIX_TABLE (PREFIX_90) },
1789   { "xchgS",            { RMeCX, eAX } },
1790   { "xchgS",            { RMeDX, eAX } },
1791   { "xchgS",            { RMeBX, eAX } },
1792   { "xchgS",            { RMeSP, eAX } },
1793   { "xchgS",            { RMeBP, eAX } },
1794   { "xchgS",            { RMeSI, eAX } },
1795   { "xchgS",            { RMeDI, eAX } },
1796   /* 98 */
1797   { "cW{t|}R",          { XX } },
1798   { "cR{t|}O",          { XX } },
1799   { X86_64_TABLE (X86_64_9A) },
1800   { "(bad)",            { XX } },       /* fwait */
1801   { "pushfT",           { XX } },
1802   { "popfT",            { XX } },
1803   { "sahf",             { XX } },
1804   { "lahf",             { XX } },
1805   /* a0 */
1806   { "mov%LB",           { AL, Ob } },
1807   { "mov%LS",           { eAX, Ov } },
1808   { "mov%LB",           { Ob, AL } },
1809   { "mov%LS",           { Ov, eAX } },
1810   { "movs{b|}",         { Ybr, Xb } },
1811   { "movs{R|}",         { Yvr, Xv } },
1812   { "cmps{b|}",         { Xb, Yb } },
1813   { "cmps{R|}",         { Xv, Yv } },
1814   /* a8 */
1815   { "testB",            { AL, Ib } },
1816   { "testS",            { eAX, Iv } },
1817   { "stosB",            { Ybr, AL } },
1818   { "stosS",            { Yvr, eAX } },
1819   { "lodsB",            { ALr, Xb } },
1820   { "lodsS",            { eAXr, Xv } },
1821   { "scasB",            { AL, Yb } },
1822   { "scasS",            { eAX, Yv } },
1823   /* b0 */
1824   { "movB",             { RMAL, Ib } },
1825   { "movB",             { RMCL, Ib } },
1826   { "movB",             { RMDL, Ib } },
1827   { "movB",             { RMBL, Ib } },
1828   { "movB",             { RMAH, Ib } },
1829   { "movB",             { RMCH, Ib } },
1830   { "movB",             { RMDH, Ib } },
1831   { "movB",             { RMBH, Ib } },
1832   /* b8 */
1833   { "mov%LV",           { RMeAX, Iv64 } },
1834   { "mov%LV",           { RMeCX, Iv64 } },
1835   { "mov%LV",           { RMeDX, Iv64 } },
1836   { "mov%LV",           { RMeBX, Iv64 } },
1837   { "mov%LV",           { RMeSP, Iv64 } },
1838   { "mov%LV",           { RMeBP, Iv64 } },
1839   { "mov%LV",           { RMeSI, Iv64 } },
1840   { "mov%LV",           { RMeDI, Iv64 } },
1841   /* c0 */
1842   { REG_TABLE (REG_C0) },
1843   { REG_TABLE (REG_C1) },
1844   { "retT",             { Iw } },
1845   { "retT",             { XX } },
1846   { X86_64_TABLE (X86_64_C4) },
1847   { X86_64_TABLE (X86_64_C5) },
1848   { REG_TABLE (REG_C6) },
1849   { REG_TABLE (REG_C7) },
1850   /* c8 */
1851   { "enterT",           { Iw, Ib } },
1852   { "leaveT",           { XX } },
1853   { "Jret{|f}P",        { Iw } },
1854   { "Jret{|f}P",        { XX } },
1855   { "int3",             { XX } },
1856   { "int",              { Ib } },
1857   { X86_64_TABLE (X86_64_CE) },
1858   { "iretP",            { XX } },
1859   /* d0 */
1860   { REG_TABLE (REG_D0) },
1861   { REG_TABLE (REG_D1) },
1862   { REG_TABLE (REG_D2) },
1863   { REG_TABLE (REG_D3) },
1864   { X86_64_TABLE (X86_64_D4) },
1865   { X86_64_TABLE (X86_64_D5) },
1866   { "(bad)",            { XX } },
1867   { "xlat",             { DSBX } },
1868   /* d8 */
1869   { FLOAT },
1870   { FLOAT },
1871   { FLOAT },
1872   { FLOAT },
1873   { FLOAT },
1874   { FLOAT },
1875   { FLOAT },
1876   { FLOAT },
1877   /* e0 */
1878   { "loopneFH",         { Jb, XX, loop_jcxz_flag } },
1879   { "loopeFH",          { Jb, XX, loop_jcxz_flag } },
1880   { "loopFH",           { Jb, XX, loop_jcxz_flag } },
1881   { "jEcxzH",           { Jb, XX, loop_jcxz_flag } },
1882   { "inB",              { AL, Ib } },
1883   { "inG",              { zAX, Ib } },
1884   { "outB",             { Ib, AL } },
1885   { "outG",             { Ib, zAX } },
1886   /* e8 */
1887   { "callT",            { Jv } },
1888   { "jmpT",             { Jv } },
1889   { X86_64_TABLE (X86_64_EA) },
1890   { "jmp",              { Jb } },
1891   { "inB",              { AL, indirDX } },
1892   { "inG",              { zAX, indirDX } },
1893   { "outB",             { indirDX, AL } },
1894   { "outG",             { indirDX, zAX } },
1895   /* f0 */
1896   { "(bad)",            { XX } },       /* lock prefix */
1897   { "icebp",            { XX } },
1898   { "(bad)",            { XX } },       /* repne */
1899   { "(bad)",            { XX } },       /* repz */
1900   { "hlt",              { XX } },
1901   { "cmc",              { XX } },
1902   { REG_TABLE (REG_F6) },
1903   { REG_TABLE (REG_F7) },
1904   /* f8 */
1905   { "clc",              { XX } },
1906   { "stc",              { XX } },
1907   { "cli",              { XX } },
1908   { "sti",              { XX } },
1909   { "cld",              { XX } },
1910   { "std",              { XX } },
1911   { REG_TABLE (REG_FE) },
1912   { REG_TABLE (REG_FF) },
1913 };
1914
1915 static const struct dis386 dis386_twobyte[] = {
1916   /* 00 */
1917   { REG_TABLE (REG_0F00 ) },
1918   { REG_TABLE (REG_0F01 ) },
1919   { "larS",             { Gv, Ew } },
1920   { "lslS",             { Gv, Ew } },
1921   { "(bad)",            { XX } },
1922   { "syscall",          { XX } },
1923   { "clts",             { XX } },
1924   { "sysretP",          { XX } },
1925   /* 08 */
1926   { "invd",             { XX } },
1927   { "wbinvd",           { XX } },
1928   { "(bad)",            { XX } },
1929   { "ud2a",             { XX } },
1930   { "(bad)",            { XX } },
1931   { REG_TABLE (REG_0F0D) },
1932   { "femms",            { XX } },
1933   { "",                 { MX, EM, OPSUF } }, /* See OP_3DNowSuffix.  */
1934   /* 10 */
1935   { PREFIX_TABLE (PREFIX_0F10) },
1936   { PREFIX_TABLE (PREFIX_0F11) },
1937   { PREFIX_TABLE (PREFIX_0F12) },
1938   { MOD_TABLE (MOD_0F13) },
1939   { "unpcklpX",         { XM, EXx } },
1940   { "unpckhpX",         { XM, EXx } },
1941   { PREFIX_TABLE (PREFIX_0F16) },
1942   { MOD_TABLE (MOD_0F17) },
1943   /* 18 */
1944   { REG_TABLE (REG_0F18) },
1945   { "nopQ",             { Ev } },
1946   { "nopQ",             { Ev } },
1947   { "nopQ",             { Ev } },
1948   { "nopQ",             { Ev } },
1949   { "nopQ",             { Ev } },
1950   { "nopQ",             { Ev } },
1951   { "nopQ",             { Ev } },
1952   /* 20 */
1953   { MOD_TABLE (MOD_0F20) },
1954   { MOD_TABLE (MOD_0F21) },
1955   { MOD_TABLE (MOD_0F22) },
1956   { MOD_TABLE (MOD_0F23) },
1957   { MOD_TABLE (MOD_0F24) },
1958   { "(bad)",            { XX } },
1959   { MOD_TABLE (MOD_0F26) },
1960   { "(bad)",            { XX } },
1961   /* 28 */
1962   { "movapX",           { XM, EXx } },
1963   { "movapX",           { EXxS, XM } },
1964   { PREFIX_TABLE (PREFIX_0F2A) },
1965   { PREFIX_TABLE (PREFIX_0F2B) },
1966   { PREFIX_TABLE (PREFIX_0F2C) },
1967   { PREFIX_TABLE (PREFIX_0F2D) },
1968   { PREFIX_TABLE (PREFIX_0F2E) },
1969   { PREFIX_TABLE (PREFIX_0F2F) },
1970   /* 30 */
1971   { "wrmsr",            { XX } },
1972   { "rdtsc",            { XX } },
1973   { "rdmsr",            { XX } },
1974   { "rdpmc",            { XX } },
1975   { "sysenter",         { XX } },
1976   { "sysexit",          { XX } },
1977   { "(bad)",            { XX } },
1978   { "getsec",           { XX } },
1979   /* 38 */
1980   { THREE_BYTE_TABLE (THREE_BYTE_0F38) },
1981   { "(bad)",            { XX } },
1982   { THREE_BYTE_TABLE (THREE_BYTE_0F3A) },
1983   { "(bad)",            { XX } },
1984   { "(bad)",            { XX } },
1985   { "(bad)",            { XX } },
1986   { "(bad)",            { XX } },
1987   { "(bad)",            { XX } },
1988   /* 40 */
1989   { "cmovoS",           { Gv, Ev } },
1990   { "cmovnoS",          { Gv, Ev } },
1991   { "cmovbS",           { Gv, Ev } },
1992   { "cmovaeS",          { Gv, Ev } },
1993   { "cmoveS",           { Gv, Ev } },
1994   { "cmovneS",          { Gv, Ev } },
1995   { "cmovbeS",          { Gv, Ev } },
1996   { "cmovaS",           { Gv, Ev } },
1997   /* 48 */
1998   { "cmovsS",           { Gv, Ev } },
1999   { "cmovnsS",          { Gv, Ev } },
2000   { "cmovpS",           { Gv, Ev } },
2001   { "cmovnpS",          { Gv, Ev } },
2002   { "cmovlS",           { Gv, Ev } },
2003   { "cmovgeS",          { Gv, Ev } },
2004   { "cmovleS",          { Gv, Ev } },
2005   { "cmovgS",           { Gv, Ev } },
2006   /* 50 */
2007   { MOD_TABLE (MOD_0F51) },
2008   { PREFIX_TABLE (PREFIX_0F51) },
2009   { PREFIX_TABLE (PREFIX_0F52) },
2010   { PREFIX_TABLE (PREFIX_0F53) },
2011   { "andpX",            { XM, EXx } },
2012   { "andnpX",           { XM, EXx } },
2013   { "orpX",             { XM, EXx } },
2014   { "xorpX",            { XM, EXx } },
2015   /* 58 */
2016   { PREFIX_TABLE (PREFIX_0F58) },
2017   { PREFIX_TABLE (PREFIX_0F59) },
2018   { PREFIX_TABLE (PREFIX_0F5A) },
2019   { PREFIX_TABLE (PREFIX_0F5B) },
2020   { PREFIX_TABLE (PREFIX_0F5C) },
2021   { PREFIX_TABLE (PREFIX_0F5D) },
2022   { PREFIX_TABLE (PREFIX_0F5E) },
2023   { PREFIX_TABLE (PREFIX_0F5F) },
2024   /* 60 */
2025   { PREFIX_TABLE (PREFIX_0F60) },
2026   { PREFIX_TABLE (PREFIX_0F61) },
2027   { PREFIX_TABLE (PREFIX_0F62) },
2028   { "packsswb",         { MX, EM } },
2029   { "pcmpgtb",          { MX, EM } },
2030   { "pcmpgtw",          { MX, EM } },
2031   { "pcmpgtd",          { MX, EM } },
2032   { "packuswb",         { MX, EM } },
2033   /* 68 */
2034   { "punpckhbw",        { MX, EM } },
2035   { "punpckhwd",        { MX, EM } },
2036   { "punpckhdq",        { MX, EM } },
2037   { "packssdw",         { MX, EM } },
2038   { PREFIX_TABLE (PREFIX_0F6C) },
2039   { PREFIX_TABLE (PREFIX_0F6D) },
2040   { "movK",             { MX, Edq } },
2041   { PREFIX_TABLE (PREFIX_0F6F) },
2042   /* 70 */
2043   { PREFIX_TABLE (PREFIX_0F70) },
2044   { REG_TABLE (REG_0F71) },
2045   { REG_TABLE (REG_0F72) },
2046   { REG_TABLE (REG_0F73) },
2047   { "pcmpeqb",          { MX, EM } },
2048   { "pcmpeqw",          { MX, EM } },
2049   { "pcmpeqd",          { MX, EM } },
2050   { "emms",             { XX } },
2051   /* 78 */
2052   { PREFIX_TABLE (PREFIX_0F78) },
2053   { PREFIX_TABLE (PREFIX_0F79) },
2054   { THREE_BYTE_TABLE (THREE_BYTE_0F7A) },
2055   { "(bad)",            { XX } },
2056   { PREFIX_TABLE (PREFIX_0F7C) },
2057   { PREFIX_TABLE (PREFIX_0F7D) },
2058   { PREFIX_TABLE (PREFIX_0F7E) },
2059   { PREFIX_TABLE (PREFIX_0F7F) },
2060   /* 80 */
2061   { "joH",              { Jv, XX, cond_jump_flag } },
2062   { "jnoH",             { Jv, XX, cond_jump_flag } },
2063   { "jbH",              { Jv, XX, cond_jump_flag } },
2064   { "jaeH",             { Jv, XX, cond_jump_flag } },
2065   { "jeH",              { Jv, XX, cond_jump_flag } },
2066   { "jneH",             { Jv, XX, cond_jump_flag } },
2067   { "jbeH",             { Jv, XX, cond_jump_flag } },
2068   { "jaH",              { Jv, XX, cond_jump_flag } },
2069   /* 88 */
2070   { "jsH",              { Jv, XX, cond_jump_flag } },
2071   { "jnsH",             { Jv, XX, cond_jump_flag } },
2072   { "jpH",              { Jv, XX, cond_jump_flag } },
2073   { "jnpH",             { Jv, XX, cond_jump_flag } },
2074   { "jlH",              { Jv, XX, cond_jump_flag } },
2075   { "jgeH",             { Jv, XX, cond_jump_flag } },
2076   { "jleH",             { Jv, XX, cond_jump_flag } },
2077   { "jgH",              { Jv, XX, cond_jump_flag } },
2078   /* 90 */
2079   { "seto",             { Eb } },
2080   { "setno",            { Eb } },
2081   { "setb",             { Eb } },
2082   { "setae",            { Eb } },
2083   { "sete",             { Eb } },
2084   { "setne",            { Eb } },
2085   { "setbe",            { Eb } },
2086   { "seta",             { Eb } },
2087   /* 98 */
2088   { "sets",             { Eb } },
2089   { "setns",            { Eb } },
2090   { "setp",             { Eb } },
2091   { "setnp",            { Eb } },
2092   { "setl",             { Eb } },
2093   { "setge",            { Eb } },
2094   { "setle",            { Eb } },
2095   { "setg",             { Eb } },
2096   /* a0 */
2097   { "pushT",            { fs } },
2098   { "popT",             { fs } },
2099   { "cpuid",            { XX } },
2100   { "btS",              { Ev, Gv } },
2101   { "shldS",            { Ev, Gv, Ib } },
2102   { "shldS",            { Ev, Gv, CL } },
2103   { REG_TABLE (REG_0FA6) },
2104   { REG_TABLE (REG_0FA7) },
2105   /* a8 */
2106   { "pushT",            { gs } },
2107   { "popT",             { gs } },
2108   { "rsm",              { XX } },
2109   { "btsS",             { Ev, Gv } },
2110   { "shrdS",            { Ev, Gv, Ib } },
2111   { "shrdS",            { Ev, Gv, CL } },
2112   { REG_TABLE (REG_0FAE) },
2113   { "imulS",            { Gv, Ev } },
2114   /* b0 */
2115   { "cmpxchgB",         { Eb, Gb } },
2116   { "cmpxchgS",         { Ev, Gv } },
2117   { MOD_TABLE (MOD_0FB2) },
2118   { "btrS",             { Ev, Gv } },
2119   { MOD_TABLE (MOD_0FB4) },
2120   { MOD_TABLE (MOD_0FB5) },
2121   { "movz{bR|x}",       { Gv, Eb } },
2122   { "movz{wR|x}",       { Gv, Ew } }, /* yes, there really is movzww ! */
2123   /* b8 */
2124   { PREFIX_TABLE (PREFIX_0FB8) },
2125   { "ud2b",             { XX } },
2126   { REG_TABLE (REG_0FBA) },
2127   { "btcS",             { Ev, Gv } },
2128   { "bsfS",             { Gv, Ev } },
2129   { PREFIX_TABLE (PREFIX_0FBD) },
2130   { "movs{bR|x}",       { Gv, Eb } },
2131   { "movs{wR|x}",       { Gv, Ew } }, /* yes, there really is movsww ! */
2132   /* c0 */
2133   { "xaddB",            { Eb, Gb } },
2134   { "xaddS",            { Ev, Gv } },
2135   { PREFIX_TABLE (PREFIX_0FC2) },
2136   { PREFIX_TABLE (PREFIX_0FC3) },
2137   { "pinsrw",           { MX, Edqw, Ib } },
2138   { "pextrw",           { Gdq, MS, Ib } },
2139   { "shufpX",           { XM, EXx, Ib } },
2140   { REG_TABLE (REG_0FC7) },
2141   /* c8 */
2142   { "bswap",            { RMeAX } },
2143   { "bswap",            { RMeCX } },
2144   { "bswap",            { RMeDX } },
2145   { "bswap",            { RMeBX } },
2146   { "bswap",            { RMeSP } },
2147   { "bswap",            { RMeBP } },
2148   { "bswap",            { RMeSI } },
2149   { "bswap",            { RMeDI } },
2150   /* d0 */
2151   { PREFIX_TABLE (PREFIX_0FD0) },
2152   { "psrlw",            { MX, EM } },
2153   { "psrld",            { MX, EM } },
2154   { "psrlq",            { MX, EM } },
2155   { "paddq",            { MX, EM } },
2156   { "pmullw",           { MX, EM } },
2157   { PREFIX_TABLE (PREFIX_0FD6) },
2158   { MOD_TABLE (MOD_0FD7) },
2159   /* d8 */
2160   { "psubusb",          { MX, EM } },
2161   { "psubusw",          { MX, EM } },
2162   { "pminub",           { MX, EM } },
2163   { "pand",             { MX, EM } },
2164   { "paddusb",          { MX, EM } },
2165   { "paddusw",          { MX, EM } },
2166   { "pmaxub",           { MX, EM } },
2167   { "pandn",            { MX, EM } },
2168   /* e0 */
2169   { "pavgb",            { MX, EM } },
2170   { "psraw",            { MX, EM } },
2171   { "psrad",            { MX, EM } },
2172   { "pavgw",            { MX, EM } },
2173   { "pmulhuw",          { MX, EM } },
2174   { "pmulhw",           { MX, EM } },
2175   { PREFIX_TABLE (PREFIX_0FE6) },
2176   { PREFIX_TABLE (PREFIX_0FE7) },
2177   /* e8 */
2178   { "psubsb",           { MX, EM } },
2179   { "psubsw",           { MX, EM } },
2180   { "pminsw",           { MX, EM } },
2181   { "por",              { MX, EM } },
2182   { "paddsb",           { MX, EM } },
2183   { "paddsw",           { MX, EM } },
2184   { "pmaxsw",           { MX, EM } },
2185   { "pxor",             { MX, EM } },
2186   /* f0 */
2187   { PREFIX_TABLE (PREFIX_0FF0) },
2188   { "psllw",            { MX, EM } },
2189   { "pslld",            { MX, EM } },
2190   { "psllq",            { MX, EM } },
2191   { "pmuludq",          { MX, EM } },
2192   { "pmaddwd",          { MX, EM } },
2193   { "psadbw",           { MX, EM } },
2194   { PREFIX_TABLE (PREFIX_0FF7) },
2195   /* f8 */
2196   { "psubb",            { MX, EM } },
2197   { "psubw",            { MX, EM } },
2198   { "psubd",            { MX, EM } },
2199   { "psubq",            { MX, EM } },
2200   { "paddb",            { MX, EM } },
2201   { "paddw",            { MX, EM } },
2202   { "paddd",            { MX, EM } },
2203   { "(bad)",            { XX } },
2204 };
2205
2206 static const unsigned char onebyte_has_modrm[256] = {
2207   /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
2208   /*       -------------------------------        */
2209   /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
2210   /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
2211   /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
2212   /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
2213   /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
2214   /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
2215   /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
2216   /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
2217   /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
2218   /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
2219   /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
2220   /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
2221   /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
2222   /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
2223   /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
2224   /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1  /* f0 */
2225   /*       -------------------------------        */
2226   /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
2227 };
2228
2229 static const unsigned char twobyte_has_modrm[256] = {
2230   /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
2231   /*       -------------------------------        */
2232   /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
2233   /* 10 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 1f */
2234   /* 20 */ 1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1, /* 2f */
2235   /* 30 */ 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, /* 3f */
2236   /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
2237   /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */
2238   /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */
2239   /* 70 */ 1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1, /* 7f */
2240   /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
2241   /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
2242   /* a0 */ 0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1, /* af */
2243   /* b0 */ 1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1, /* bf */
2244   /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
2245   /* d0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
2246   /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
2247   /* f0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0  /* ff */
2248   /*       -------------------------------        */
2249   /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
2250 };
2251
2252 static char obuf[100];
2253 static char *obufp;
2254 static char *mnemonicendp;
2255 static char scratchbuf[100];
2256 static unsigned char *start_codep;
2257 static unsigned char *insn_codep;
2258 static unsigned char *codep;
2259 static int last_lock_prefix;
2260 static int last_repz_prefix;
2261 static int last_repnz_prefix;
2262 static int last_data_prefix;
2263 static int last_addr_prefix;
2264 static int last_rex_prefix;
2265 static int last_seg_prefix;
2266 #define MAX_CODE_LENGTH 15
2267 /* We can up to 14 prefixes since the maximum instruction length is
2268    15bytes.  */
2269 static int all_prefixes[MAX_CODE_LENGTH - 1];
2270 static disassemble_info *the_info;
2271 static struct
2272   {
2273     int mod;
2274     int reg;
2275     int rm;
2276   }
2277 modrm;
2278 static unsigned char need_modrm;
2279 static struct
2280   {
2281     int register_specifier;
2282     int length;
2283     int prefix;
2284     int w;
2285   }
2286 vex;
2287 static unsigned char need_vex;
2288 static unsigned char need_vex_reg;
2289 static unsigned char vex_w_done;
2290
2291 struct op
2292   {
2293     const char *name;
2294     unsigned int len;
2295   };
2296
2297 /* If we are accessing mod/rm/reg without need_modrm set, then the
2298    values are stale.  Hitting this abort likely indicates that you
2299    need to update onebyte_has_modrm or twobyte_has_modrm.  */
2300 #define MODRM_CHECK  if (!need_modrm) abort ()
2301
2302 static const char **names64;
2303 static const char **names32;
2304 static const char **names16;
2305 static const char **names8;
2306 static const char **names8rex;
2307 static const char **names_seg;
2308 static const char *index64;
2309 static const char *index32;
2310 static const char **index16;
2311
2312 static const char *intel_names64[] = {
2313   "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
2314   "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
2315 };
2316 static const char *intel_names32[] = {
2317   "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
2318   "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
2319 };
2320 static const char *intel_names16[] = {
2321   "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
2322   "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
2323 };
2324 static const char *intel_names8[] = {
2325   "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
2326 };
2327 static const char *intel_names8rex[] = {
2328   "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil",
2329   "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"
2330 };
2331 static const char *intel_names_seg[] = {
2332   "es", "cs", "ss", "ds", "fs", "gs", "?", "?",
2333 };
2334 static const char *intel_index64 = "riz";
2335 static const char *intel_index32 = "eiz";
2336 static const char *intel_index16[] = {
2337   "bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx"
2338 };
2339
2340 static const char *att_names64[] = {
2341   "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
2342   "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
2343 };
2344 static const char *att_names32[] = {
2345   "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
2346   "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
2347 };
2348 static const char *att_names16[] = {
2349   "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
2350   "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
2351 };
2352 static const char *att_names8[] = {
2353   "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh",
2354 };
2355 static const char *att_names8rex[] = {
2356   "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
2357   "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
2358 };
2359 static const char *att_names_seg[] = {
2360   "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "%?", "%?",
2361 };
2362 static const char *att_index64 = "%riz";
2363 static const char *att_index32 = "%eiz";
2364 static const char *att_index16[] = {
2365   "%bx,%si", "%bx,%di", "%bp,%si", "%bp,%di", "%si", "%di", "%bp", "%bx"
2366 };
2367
2368 static const struct dis386 reg_table[][8] = {
2369   /* REG_80 */
2370   {
2371     { "addA",   { Eb, Ib } },
2372     { "orA",    { Eb, Ib } },
2373     { "adcA",   { Eb, Ib } },
2374     { "sbbA",   { Eb, Ib } },
2375     { "andA",   { Eb, Ib } },
2376     { "subA",   { Eb, Ib } },
2377     { "xorA",   { Eb, Ib } },
2378     { "cmpA",   { Eb, Ib } },
2379   },
2380   /* REG_81 */
2381   {
2382     { "addQ",   { Ev, Iv } },
2383     { "orQ",    { Ev, Iv } },
2384     { "adcQ",   { Ev, Iv } },
2385     { "sbbQ",   { Ev, Iv } },
2386     { "andQ",   { Ev, Iv } },
2387     { "subQ",   { Ev, Iv } },
2388     { "xorQ",   { Ev, Iv } },
2389     { "cmpQ",   { Ev, Iv } },
2390   },
2391   /* REG_82 */
2392   {
2393     { "addQ",   { Ev, sIb } },
2394     { "orQ",    { Ev, sIb } },
2395     { "adcQ",   { Ev, sIb } },
2396     { "sbbQ",   { Ev, sIb } },
2397     { "andQ",   { Ev, sIb } },
2398     { "subQ",   { Ev, sIb } },
2399     { "xorQ",   { Ev, sIb } },
2400     { "cmpQ",   { Ev, sIb } },
2401   },
2402   /* REG_8F */
2403   {
2404     { "popU",   { stackEv } },
2405     { XOP_8F_TABLE (XOP_09) },
2406     { "(bad)",  { XX } },
2407     { "(bad)",  { XX } },
2408     { "(bad)",  { XX } },
2409     { XOP_8F_TABLE (XOP_09) },
2410     { "(bad)",  { XX } },
2411     { "(bad)",  { XX } },
2412   },
2413   /* REG_C0 */
2414   {
2415     { "rolA",   { Eb, Ib } },
2416     { "rorA",   { Eb, Ib } },
2417     { "rclA",   { Eb, Ib } },
2418     { "rcrA",   { Eb, Ib } },
2419     { "shlA",   { Eb, Ib } },
2420     { "shrA",   { Eb, Ib } },
2421     { "(bad)",  { XX } },
2422     { "sarA",   { Eb, Ib } },
2423   },
2424   /* REG_C1 */
2425   {
2426     { "rolQ",   { Ev, Ib } },
2427     { "rorQ",   { Ev, Ib } },
2428     { "rclQ",   { Ev, Ib } },
2429     { "rcrQ",   { Ev, Ib } },
2430     { "shlQ",   { Ev, Ib } },
2431     { "shrQ",   { Ev, Ib } },
2432     { "(bad)",  { XX } },
2433     { "sarQ",   { Ev, Ib } },
2434   },
2435   /* REG_C6 */
2436   {
2437     { "movA",   { Eb, Ib } },
2438     { "(bad)",  { XX } },
2439     { "(bad)",  { XX } },
2440     { "(bad)",  { XX } },
2441     { "(bad)",  { XX } },
2442     { "(bad)",  { XX } },
2443     { "(bad)",  { XX } },
2444     { "(bad)",  { XX } },
2445   },
2446   /* REG_C7 */
2447   {
2448     { "movQ",   { Ev, Iv } },
2449     { "(bad)",  { XX } },
2450     { "(bad)",  { XX } },
2451     { "(bad)",  { XX } },
2452     { "(bad)",  { XX } },
2453     { "(bad)",  { XX } },
2454     { "(bad)",  { XX } },
2455     { "(bad)",  { XX } },
2456   },
2457   /* REG_D0 */
2458   {
2459     { "rolA",   { Eb, I1 } },
2460     { "rorA",   { Eb, I1 } },
2461     { "rclA",   { Eb, I1 } },
2462     { "rcrA",   { Eb, I1 } },
2463     { "shlA",   { Eb, I1 } },
2464     { "shrA",   { Eb, I1 } },
2465     { "(bad)",  { XX } },
2466     { "sarA",   { Eb, I1 } },
2467   },
2468   /* REG_D1 */
2469   {
2470     { "rolQ",   { Ev, I1 } },
2471     { "rorQ",   { Ev, I1 } },
2472     { "rclQ",   { Ev, I1 } },
2473     { "rcrQ",   { Ev, I1 } },
2474     { "shlQ",   { Ev, I1 } },
2475     { "shrQ",   { Ev, I1 } },
2476     { "(bad)",  { XX } },
2477     { "sarQ",   { Ev, I1 } },
2478   },
2479   /* REG_D2 */
2480   {
2481     { "rolA",   { Eb, CL } },
2482     { "rorA",   { Eb, CL } },
2483     { "rclA",   { Eb, CL } },
2484     { "rcrA",   { Eb, CL } },
2485     { "shlA",   { Eb, CL } },
2486     { "shrA",   { Eb, CL } },
2487     { "(bad)",  { XX } },
2488     { "sarA",   { Eb, CL } },
2489   },
2490   /* REG_D3 */
2491   {
2492     { "rolQ",   { Ev, CL } },
2493     { "rorQ",   { Ev, CL } },
2494     { "rclQ",   { Ev, CL } },
2495     { "rcrQ",   { Ev, CL } },
2496     { "shlQ",   { Ev, CL } },
2497     { "shrQ",   { Ev, CL } },
2498     { "(bad)",  { XX } },
2499     { "sarQ",   { Ev, CL } },
2500   },
2501   /* REG_F6 */
2502   {
2503     { "testA",  { Eb, Ib } },
2504     { "(bad)",  { XX } },
2505     { "notA",   { Eb } },
2506     { "negA",   { Eb } },
2507     { "mulA",   { Eb } },       /* Don't print the implicit %al register,  */
2508     { "imulA",  { Eb } },       /* to distinguish these opcodes from other */
2509     { "divA",   { Eb } },       /* mul/imul opcodes.  Do the same for div  */
2510     { "idivA",  { Eb } },       /* and idiv for consistency.               */
2511   },
2512   /* REG_F7 */
2513   {
2514     { "testQ",  { Ev, Iv } },
2515     { "(bad)",  { XX } },
2516     { "notQ",   { Ev } },
2517     { "negQ",   { Ev } },
2518     { "mulQ",   { Ev } },       /* Don't print the implicit register.  */
2519     { "imulQ",  { Ev } },
2520     { "divQ",   { Ev } },
2521     { "idivQ",  { Ev } },
2522   },
2523   /* REG_FE */
2524   {
2525     { "incA",   { Eb } },
2526     { "decA",   { Eb } },
2527     { "(bad)",  { XX } },
2528     { "(bad)",  { XX } },
2529     { "(bad)",  { XX } },
2530     { "(bad)",  { XX } },
2531     { "(bad)",  { XX } },
2532     { "(bad)",  { XX } },
2533   },
2534   /* REG_FF */
2535   {
2536     { "incQ",   { Ev } },
2537     { "decQ",   { Ev } },
2538     { "callT",  { indirEv } },
2539     { "JcallT", { indirEp } },
2540     { "jmpT",   { indirEv } },
2541     { "JjmpT",  { indirEp } },
2542     { "pushU",  { stackEv } },
2543     { "(bad)",  { XX } },
2544   },
2545   /* REG_0F00 */
2546   {
2547     { "sldtD",  { Sv } },
2548     { "strD",   { Sv } },
2549     { "lldt",   { Ew } },
2550     { "ltr",    { Ew } },
2551     { "verr",   { Ew } },
2552     { "verw",   { Ew } },
2553     { "(bad)",  { XX } },
2554     { "(bad)",  { XX } },
2555   },
2556   /* REG_0F01 */
2557   {
2558     { MOD_TABLE (MOD_0F01_REG_0) },
2559     { MOD_TABLE (MOD_0F01_REG_1) },
2560     { MOD_TABLE (MOD_0F01_REG_2) },
2561     { MOD_TABLE (MOD_0F01_REG_3) },
2562     { "smswD",  { Sv } },
2563     { "(bad)",  { XX } },
2564     { "lmsw",   { Ew } },
2565     { MOD_TABLE (MOD_0F01_REG_7) },
2566   },
2567   /* REG_0F0D */
2568   {
2569     { "prefetch",       { Eb } },
2570     { "prefetchw",      { Eb } },
2571     { "(bad)",          { XX } },
2572     { "(bad)",          { XX } },
2573     { "(bad)",          { XX } },
2574     { "(bad)",          { XX } },
2575     { "(bad)",          { XX } },
2576     { "(bad)",          { XX } },
2577   },
2578   /* REG_0F18 */
2579   {
2580     { MOD_TABLE (MOD_0F18_REG_0) },
2581     { MOD_TABLE (MOD_0F18_REG_1) },
2582     { MOD_TABLE (MOD_0F18_REG_2) },
2583     { MOD_TABLE (MOD_0F18_REG_3) },
2584     { "(bad)",  { XX } },
2585     { "(bad)",  { XX } },
2586     { "(bad)",  { XX } },
2587     { "(bad)",  { XX } },
2588   },
2589   /* REG_0F71 */
2590   {
2591     { "(bad)",  { XX } },
2592     { "(bad)",  { XX } },
2593     { MOD_TABLE (MOD_0F71_REG_2) },
2594     { "(bad)",  { XX } },
2595     { MOD_TABLE (MOD_0F71_REG_4) },
2596     { "(bad)",  { XX } },
2597     { MOD_TABLE (MOD_0F71_REG_6) },
2598     { "(bad)",  { XX } },
2599   },
2600   /* REG_0F72 */
2601   {
2602     { "(bad)",  { XX } },
2603     { "(bad)",  { XX } },
2604     { MOD_TABLE (MOD_0F72_REG_2) },
2605     { "(bad)",  { XX } },
2606     { MOD_TABLE (MOD_0F72_REG_4) },
2607     { "(bad)",  { XX } },
2608     { MOD_TABLE (MOD_0F72_REG_6) },
2609     { "(bad)",  { XX } },
2610   },
2611   /* REG_0F73 */
2612   {
2613     { "(bad)",  { XX } },
2614     { "(bad)",  { XX } },
2615     { MOD_TABLE (MOD_0F73_REG_2) },
2616     { MOD_TABLE (MOD_0F73_REG_3) },
2617     { "(bad)",  { XX } },
2618     { "(bad)",  { XX } },
2619     { MOD_TABLE (MOD_0F73_REG_6) },
2620     { MOD_TABLE (MOD_0F73_REG_7) },
2621   },
2622   /* REG_0FA6 */
2623   {
2624     { "montmul",        { { OP_0f07, 0 } } },
2625     { "xsha1",          { { OP_0f07, 0 } } },
2626     { "xsha256",        { { OP_0f07, 0 } } },
2627     { "(bad)",          { { OP_0f07, 0 } } },
2628     { "(bad)",          { { OP_0f07, 0 } } },
2629     { "(bad)",          { { OP_0f07, 0 } } },
2630     { "(bad)",          { { OP_0f07, 0 } } },
2631     { "(bad)",          { { OP_0f07, 0 } } },
2632   },
2633   /* REG_0FA7 */
2634   {
2635     { "xstore-rng",     { { OP_0f07, 0 } } },
2636     { "xcrypt-ecb",     { { OP_0f07, 0 } } },
2637     { "xcrypt-cbc",     { { OP_0f07, 0 } } },
2638     { "xcrypt-ctr",     { { OP_0f07, 0 } } },
2639     { "xcrypt-cfb",     { { OP_0f07, 0 } } },
2640     { "xcrypt-ofb",     { { OP_0f07, 0 } } },
2641     { "(bad)",          { { OP_0f07, 0 } } },
2642     { "(bad)",          { { OP_0f07, 0 } } },
2643   },
2644   /* REG_0FAE */
2645   {
2646     { MOD_TABLE (MOD_0FAE_REG_0) },
2647     { MOD_TABLE (MOD_0FAE_REG_1) },
2648     { MOD_TABLE (MOD_0FAE_REG_2) },
2649     { MOD_TABLE (MOD_0FAE_REG_3) },
2650     { MOD_TABLE (MOD_0FAE_REG_4) },
2651     { MOD_TABLE (MOD_0FAE_REG_5) },
2652     { MOD_TABLE (MOD_0FAE_REG_6) },
2653     { MOD_TABLE (MOD_0FAE_REG_7) },
2654   },
2655   /* REG_0FBA */
2656   {
2657     { "(bad)",  { XX } },
2658     { "(bad)",  { XX } },
2659     { "(bad)",  { XX } },
2660     { "(bad)",  { XX } },
2661     { "btQ",    { Ev, Ib } },
2662     { "btsQ",   { Ev, Ib } },
2663     { "btrQ",   { Ev, Ib } },
2664     { "btcQ",   { Ev, Ib } },
2665   },
2666   /* REG_0FC7 */
2667   {
2668     { "(bad)",  { XX } },
2669     { "cmpxchg8b", { { CMPXCHG8B_Fixup, q_mode } } },
2670     { "(bad)",  { XX } },
2671     { "(bad)",  { XX } },
2672     { "(bad)",  { XX } },
2673     { "(bad)",  { XX } },
2674     { MOD_TABLE (MOD_0FC7_REG_6) },
2675     { MOD_TABLE (MOD_0FC7_REG_7) },
2676   },
2677   /* REG_VEX_71 */
2678   {
2679     { "(bad)",  { XX } },
2680     { "(bad)",  { XX } },
2681     { MOD_TABLE (MOD_VEX_71_REG_2) },
2682     { "(bad)",  { XX } },
2683     { MOD_TABLE (MOD_VEX_71_REG_4) },
2684     { "(bad)",  { XX } },
2685     { MOD_TABLE (MOD_VEX_71_REG_6) },
2686     { "(bad)",  { XX } },
2687   },
2688   /* REG_VEX_72 */
2689   {
2690     { "(bad)",  { XX } },
2691     { "(bad)",  { XX } },
2692     { MOD_TABLE (MOD_VEX_72_REG_2) },
2693     { "(bad)",  { XX } },
2694     { MOD_TABLE (MOD_VEX_72_REG_4) },
2695     { "(bad)",  { XX } },
2696     { MOD_TABLE (MOD_VEX_72_REG_6) },
2697     { "(bad)",  { XX } },
2698   },
2699   /* REG_VEX_73 */
2700   {
2701     { "(bad)",  { XX } },
2702     { "(bad)",  { XX } },
2703     { MOD_TABLE (MOD_VEX_73_REG_2) },
2704     { MOD_TABLE (MOD_VEX_73_REG_3) },
2705     { "(bad)",  { XX } },
2706     { "(bad)",  { XX } },
2707     { MOD_TABLE (MOD_VEX_73_REG_6) },
2708     { MOD_TABLE (MOD_VEX_73_REG_7) },
2709   },
2710   /* REG_VEX_AE */
2711   {
2712     { "(bad)",  { XX } },
2713     { "(bad)",  { XX } },
2714     { MOD_TABLE (MOD_VEX_AE_REG_2) },
2715     { MOD_TABLE (MOD_VEX_AE_REG_3) },
2716     { "(bad)",  { XX } },
2717     { "(bad)",  { XX } },
2718     { "(bad)",  { XX } },
2719     { "(bad)",  { XX } },
2720   },
2721   /* REG_XOP_LWPCB */
2722   {
2723     { "llwpcb", { { OP_LWPCB_E, 0 } } },
2724     { "slwpcb", { { OP_LWPCB_E, 0 } } },
2725     { "(bad)",  { XX } },
2726     { "(bad)",  { XX } },
2727     { "(bad)",  { XX } },
2728     { "(bad)",  { XX } },
2729     { "(bad)",  { XX } },
2730     { "(bad)",  { XX } },
2731   },
2732   /* REG_XOP_LWP */
2733   {
2734     { "lwpins", { { OP_LWP_E, 0 }, Ed, { OP_LWP_I, 0 } } },
2735     { "lwpval", { { OP_LWP_E, 0 }, Ed, { OP_LWP_I, 0 } } },
2736     { "(bad)",  { XX } },
2737     { "(bad)",  { XX } },
2738     { "(bad)",  { XX } },
2739     { "(bad)",  { XX } },
2740     { "(bad)",  { XX } },
2741     { "(bad)",  { XX } },
2742   },
2743 };
2744
2745 static const struct dis386 prefix_table[][4] = {
2746   /* PREFIX_90 */
2747   {
2748     { "xchgS", { { NOP_Fixup1, eAX_reg }, { NOP_Fixup2, eAX_reg } } },
2749     { "pause", { XX } },
2750     { "xchgS", { { NOP_Fixup1, eAX_reg }, { NOP_Fixup2, eAX_reg } } },
2751     { "(bad)", { XX } },
2752   },
2753
2754   /* PREFIX_0F10 */
2755   {
2756     { "movups", { XM, EXx } },
2757     { "movss",  { XM, EXd } },
2758     { "movupd", { XM, EXx } },
2759     { "movsd",  { XM, EXq } },
2760   },
2761
2762   /* PREFIX_0F11 */
2763   {
2764     { "movups", { EXxS, XM } },
2765     { "movss",  { EXdS, XM } },
2766     { "movupd", { EXxS, XM } },
2767     { "movsd",  { EXqS, XM } },
2768   },
2769
2770   /* PREFIX_0F12 */
2771   {
2772     { MOD_TABLE (MOD_0F12_PREFIX_0) },
2773     { "movsldup", { XM, EXx } },
2774     { "movlpd", { XM, EXq } },
2775     { "movddup", { XM, EXq } },
2776   },
2777
2778   /* PREFIX_0F16 */
2779   {
2780     { MOD_TABLE (MOD_0F16_PREFIX_0) },
2781     { "movshdup", { XM, EXx } },
2782     { "movhpd", { XM, EXq } },
2783     { "(bad)",  { XX } },
2784   },
2785
2786   /* PREFIX_0F2A */
2787   {
2788     { "cvtpi2ps", { XM, EMCq } },
2789     { "cvtsi2ss%LQ", { XM, Ev } },
2790     { "cvtpi2pd", { XM, EMCq } },
2791     { "cvtsi2sd%LQ", { XM, Ev } },
2792   },
2793
2794   /* PREFIX_0F2B */
2795   {
2796     { MOD_TABLE (MOD_0F2B_PREFIX_0) },
2797     { MOD_TABLE (MOD_0F2B_PREFIX_1) },
2798     { MOD_TABLE (MOD_0F2B_PREFIX_2) },
2799     { MOD_TABLE (MOD_0F2B_PREFIX_3) },
2800   },
2801
2802   /* PREFIX_0F2C */
2803   {
2804     { "cvttps2pi", { MXC, EXq } },
2805     { "cvttss2siY", { Gv, EXd } },
2806     { "cvttpd2pi", { MXC, EXx } },
2807     { "cvttsd2siY", { Gv, EXq } },
2808   },
2809
2810   /* PREFIX_0F2D */
2811   {
2812     { "cvtps2pi", { MXC, EXq } },
2813     { "cvtss2siY", { Gv, EXd } },
2814     { "cvtpd2pi", { MXC, EXx } },
2815     { "cvtsd2siY", { Gv, EXq } },
2816   },
2817
2818   /* PREFIX_0F2E */
2819   {
2820     { "ucomiss",{ XM, EXd } }, 
2821     { "(bad)",  { XX } },
2822     { "ucomisd",{ XM, EXq } }, 
2823     { "(bad)",  { XX } },
2824   },
2825
2826   /* PREFIX_0F2F */
2827   {
2828     { "comiss", { XM, EXd } },
2829     { "(bad)",  { XX } },
2830     { "comisd", { XM, EXq } },
2831     { "(bad)",  { XX } },
2832   },
2833
2834   /* PREFIX_0F51 */
2835   {
2836     { "sqrtps", { XM, EXx } },
2837     { "sqrtss", { XM, EXd } },
2838     { "sqrtpd", { XM, EXx } },
2839     { "sqrtsd", { XM, EXq } },
2840   },
2841
2842   /* PREFIX_0F52 */
2843   {
2844     { "rsqrtps",{ XM, EXx } },
2845     { "rsqrtss",{ XM, EXd } },
2846     { "(bad)",  { XX } },
2847     { "(bad)",  { XX } },
2848   },
2849
2850   /* PREFIX_0F53 */
2851   {
2852     { "rcpps",  { XM, EXx } },
2853     { "rcpss",  { XM, EXd } },
2854     { "(bad)",  { XX } },
2855     { "(bad)",  { XX } },
2856   },
2857
2858   /* PREFIX_0F58 */
2859   {
2860     { "addps", { XM, EXx } },
2861     { "addss", { XM, EXd } },
2862     { "addpd", { XM, EXx } },
2863     { "addsd", { XM, EXq } },
2864   },
2865
2866   /* PREFIX_0F59 */
2867   {
2868     { "mulps",  { XM, EXx } },
2869     { "mulss",  { XM, EXd } },
2870     { "mulpd",  { XM, EXx } },
2871     { "mulsd",  { XM, EXq } },
2872   },
2873
2874   /* PREFIX_0F5A */
2875   {
2876     { "cvtps2pd", { XM, EXq } },
2877     { "cvtss2sd", { XM, EXd } },
2878     { "cvtpd2ps", { XM, EXx } },
2879     { "cvtsd2ss", { XM, EXq } },
2880   },
2881
2882   /* PREFIX_0F5B */
2883   {
2884     { "cvtdq2ps", { XM, EXx } },
2885     { "cvttps2dq", { XM, EXx } },
2886     { "cvtps2dq", { XM, EXx } },
2887     { "(bad)",  { XX } },
2888   },
2889
2890   /* PREFIX_0F5C */
2891   {
2892     { "subps",  { XM, EXx } },
2893     { "subss",  { XM, EXd } },
2894     { "subpd",  { XM, EXx } },
2895     { "subsd",  { XM, EXq } },
2896   },
2897
2898   /* PREFIX_0F5D */
2899   {
2900     { "minps",  { XM, EXx } },
2901     { "minss",  { XM, EXd } },
2902     { "minpd",  { XM, EXx } },
2903     { "minsd",  { XM, EXq } },
2904   },
2905
2906   /* PREFIX_0F5E */
2907   {
2908     { "divps",  { XM, EXx } },
2909     { "divss",  { XM, EXd } },
2910     { "divpd",  { XM, EXx } },
2911     { "divsd",  { XM, EXq } },
2912   },
2913
2914   /* PREFIX_0F5F */
2915   {
2916     { "maxps",  { XM, EXx } },
2917     { "maxss",  { XM, EXd } },
2918     { "maxpd",  { XM, EXx } },
2919     { "maxsd",  { XM, EXq } },
2920   },
2921
2922   /* PREFIX_0F60 */
2923   {
2924     { "punpcklbw",{ MX, EMd } },
2925     { "(bad)",  { XX } },
2926     { "punpcklbw",{ MX, EMx } },
2927     { "(bad)",  { XX } },
2928   },
2929
2930   /* PREFIX_0F61 */
2931   {
2932     { "punpcklwd",{ MX, EMd } },
2933     { "(bad)",  { XX } },
2934     { "punpcklwd",{ MX, EMx } },
2935     { "(bad)",  { XX } },
2936   },
2937
2938   /* PREFIX_0F62 */
2939   {
2940     { "punpckldq",{ MX, EMd } },
2941     { "(bad)",  { XX } },
2942     { "punpckldq",{ MX, EMx } },
2943     { "(bad)",  { XX } },
2944   },
2945
2946   /* PREFIX_0F6C */
2947   {
2948     { "(bad)",  { XX } },
2949     { "(bad)",  { XX } },
2950     { "punpcklqdq", { XM, EXx } },
2951     { "(bad)",  { XX } },
2952   },
2953
2954   /* PREFIX_0F6D */
2955   {
2956     { "(bad)",  { XX } },
2957     { "(bad)",  { XX } },
2958     { "punpckhqdq", { XM, EXx } },
2959     { "(bad)",  { XX } },
2960   },
2961
2962   /* PREFIX_0F6F */
2963   {
2964     { "movq",   { MX, EM } },
2965     { "movdqu", { XM, EXx } },
2966     { "movdqa", { XM, EXx } },
2967     { "(bad)",  { XX } },
2968   },
2969
2970   /* PREFIX_0F70 */
2971   {
2972     { "pshufw", { MX, EM, Ib } },
2973     { "pshufhw",{ XM, EXx, Ib } },
2974     { "pshufd", { XM, EXx, Ib } },
2975     { "pshuflw",{ XM, EXx, Ib } },
2976   },
2977
2978   /* PREFIX_0F73_REG_3 */
2979   {
2980     { "(bad)",  { XX } },
2981     { "(bad)",  { XX } },
2982     { "psrldq", { XS, Ib } },
2983     { "(bad)",  { XX } },
2984   },
2985
2986   /* PREFIX_0F73_REG_7 */
2987   {
2988     { "(bad)",  { XX } },
2989     { "(bad)",  { XX } },
2990     { "pslldq", { XS, Ib } },
2991     { "(bad)",  { XX } },
2992   },
2993
2994   /* PREFIX_0F78 */
2995   {
2996     {"vmread",  { Em, Gm } },
2997     {"(bad)",   { XX } },
2998     {"extrq",   { XS, Ib, Ib } },
2999     {"insertq", { XM, XS, Ib, Ib } },
3000   },
3001
3002   /* PREFIX_0F79 */
3003   {
3004     {"vmwrite", { Gm, Em } },
3005     {"(bad)",   { XX } },
3006     {"extrq",   { XM, XS } },
3007     {"insertq", { XM, XS } },
3008   },
3009
3010   /* PREFIX_0F7C */
3011   {
3012     { "(bad)",  { XX } },
3013     { "(bad)",  { XX } },
3014     { "haddpd", { XM, EXx } },
3015     { "haddps", { XM, EXx } },
3016   },
3017
3018   /* PREFIX_0F7D */
3019   {
3020     { "(bad)",  { XX } },
3021     { "(bad)",  { XX } },
3022     { "hsubpd", { XM, EXx } },
3023     { "hsubps", { XM, EXx } },
3024   },
3025
3026   /* PREFIX_0F7E */
3027   {
3028     { "movK",   { Edq, MX } },
3029     { "movq",   { XM, EXq } },
3030     { "movK",   { Edq, XM } },
3031     { "(bad)",  { XX } },
3032   },
3033
3034   /* PREFIX_0F7F */
3035   {
3036     { "movq",   { EMS, MX } },
3037     { "movdqu", { EXxS, XM } },
3038     { "movdqa", { EXxS, XM } },
3039     { "(bad)",  { XX } },
3040   },
3041
3042   /* PREFIX_0FB8 */
3043   {
3044     { "(bad)", { XX } },
3045     { "popcntS", { Gv, Ev } },
3046     { "(bad)", { XX } },
3047     { "(bad)", { XX } },
3048   },
3049
3050   /* PREFIX_0FBD */
3051   {
3052     { "bsrS",   { Gv, Ev } },
3053     { "lzcntS", { Gv, Ev } },
3054     { "bsrS",   { Gv, Ev } },
3055     { "(bad)",  { XX } },
3056   },
3057
3058   /* PREFIX_0FC2 */
3059   {
3060     { "cmpps",  { XM, EXx, CMP } },
3061     { "cmpss",  { XM, EXd, CMP } },
3062     { "cmppd",  { XM, EXx, CMP } },
3063     { "cmpsd",  { XM, EXq, CMP } },
3064   },
3065
3066   /* PREFIX_0FC3 */
3067   {
3068     { "movntiS", { Ma, Gv } },
3069     { "(bad)",  { XX } },
3070     { "(bad)",  { XX } },
3071     { "(bad)",  { XX } },
3072   },
3073
3074   /* PREFIX_0FC7_REG_6 */
3075   {
3076     { "vmptrld",{ Mq } },
3077     { "vmxon",  { Mq } },
3078     { "vmclear",{ Mq } },
3079     { "(bad)",  { XX } },
3080   },
3081
3082   /* PREFIX_0FD0 */
3083   {
3084     { "(bad)",  { XX } },
3085     { "(bad)",  { XX } },
3086     { "addsubpd", { XM, EXx } },
3087     { "addsubps", { XM, EXx } },
3088   },
3089
3090   /* PREFIX_0FD6 */
3091   {
3092     { "(bad)",  { XX } },
3093     { "movq2dq",{ XM, MS } },
3094     { "movq",   { EXqS, XM } },
3095     { "movdq2q",{ MX, XS } },
3096   },
3097
3098   /* PREFIX_0FE6 */
3099   {
3100     { "(bad)",  { XX } },
3101     { "cvtdq2pd", { XM, EXq } },
3102     { "cvttpd2dq", { XM, EXx } },
3103     { "cvtpd2dq", { XM, EXx } },
3104   },
3105
3106   /* PREFIX_0FE7 */
3107   {
3108     { "movntq", { Mq, MX } },
3109     { "(bad)",  { XX } },
3110     { MOD_TABLE (MOD_0FE7_PREFIX_2) },
3111     { "(bad)",  { XX } },
3112   },
3113
3114   /* PREFIX_0FF0 */
3115   {
3116     { "(bad)",  { XX } },
3117     { "(bad)",  { XX } },
3118     { "(bad)",  { XX } },
3119     { MOD_TABLE (MOD_0FF0_PREFIX_3) },
3120   },
3121
3122   /* PREFIX_0FF7 */
3123   {
3124     { "maskmovq", { MX, MS } },
3125     { "(bad)",  { XX } },
3126     { "maskmovdqu", { XM, XS } },
3127     { "(bad)",  { XX } },
3128   },
3129
3130   /* PREFIX_0F3810 */
3131   {
3132     { "(bad)",  { XX } },
3133     { "(bad)",  { XX } },
3134     { "pblendvb", { XM, EXx, XMM0 } },
3135     { "(bad)",  { XX } },
3136   },
3137
3138   /* PREFIX_0F3814 */
3139   {
3140     { "(bad)",  { XX } },
3141     { "(bad)",  { XX } },
3142     { "blendvps", { XM, EXx, XMM0 } },
3143     { "(bad)",  { XX } },
3144   },
3145
3146   /* PREFIX_0F3815 */
3147   {
3148     { "(bad)",  { XX } },
3149     { "(bad)",  { XX } },
3150     { "blendvpd", { XM, EXx, XMM0 } },
3151     { "(bad)",  { XX } },
3152   },
3153
3154   /* PREFIX_0F3817 */
3155   {
3156     { "(bad)",  { XX } },
3157     { "(bad)",  { XX } },
3158     { "ptest",  { XM, EXx } },
3159     { "(bad)",  { XX } },
3160   },
3161
3162   /* PREFIX_0F3820 */
3163   {
3164     { "(bad)",  { XX } },
3165     { "(bad)",  { XX } },
3166     { "pmovsxbw", { XM, EXq } },
3167     { "(bad)",  { XX } },
3168   },
3169
3170   /* PREFIX_0F3821 */
3171   {
3172     { "(bad)",  { XX } },
3173     { "(bad)",  { XX } },
3174     { "pmovsxbd", { XM, EXd } },
3175     { "(bad)",  { XX } },
3176   },
3177
3178   /* PREFIX_0F3822 */
3179   {
3180     { "(bad)",  { XX } },
3181     { "(bad)",  { XX } },
3182     { "pmovsxbq", { XM, EXw } },
3183     { "(bad)",  { XX } },
3184   },
3185
3186   /* PREFIX_0F3823 */
3187   {
3188     { "(bad)",  { XX } },
3189     { "(bad)",  { XX } },
3190     { "pmovsxwd", { XM, EXq } },
3191     { "(bad)",  { XX } },
3192   },
3193
3194   /* PREFIX_0F3824 */
3195   {
3196     { "(bad)",  { XX } },
3197     { "(bad)",  { XX } },
3198     { "pmovsxwq", { XM, EXd } },
3199     { "(bad)",  { XX } },
3200   },
3201
3202   /* PREFIX_0F3825 */
3203   {
3204     { "(bad)",  { XX } },
3205     { "(bad)",  { XX } },
3206     { "pmovsxdq", { XM, EXq } },
3207     { "(bad)",  { XX } },
3208   },
3209
3210   /* PREFIX_0F3828 */
3211   {
3212     { "(bad)",  { XX } },
3213     { "(bad)",  { XX } },
3214     { "pmuldq", { XM, EXx } },
3215     { "(bad)",  { XX } },
3216   },
3217
3218   /* PREFIX_0F3829 */
3219   {
3220     { "(bad)",  { XX } },
3221     { "(bad)",  { XX } },
3222     { "pcmpeqq", { XM, EXx } },
3223     { "(bad)",  { XX } },
3224   },
3225
3226   /* PREFIX_0F382A */
3227   {
3228     { "(bad)",  { XX } },
3229     { "(bad)",  { XX } },
3230     { MOD_TABLE (MOD_0F382A_PREFIX_2) },
3231     { "(bad)",  { XX } },
3232   },
3233
3234   /* PREFIX_0F382B */
3235   {
3236     { "(bad)",  { XX } },
3237     { "(bad)",  { XX } },
3238     { "packusdw", { XM, EXx } },
3239     { "(bad)",  { XX } },
3240   },
3241
3242   /* PREFIX_0F3830 */
3243   {
3244     { "(bad)",  { XX } },
3245     { "(bad)",  { XX } },
3246     { "pmovzxbw", { XM, EXq } },
3247     { "(bad)",  { XX } },
3248   },
3249
3250   /* PREFIX_0F3831 */
3251   {
3252     { "(bad)",  { XX } },
3253     { "(bad)",  { XX } },
3254     { "pmovzxbd", { XM, EXd } },
3255     { "(bad)",  { XX } },
3256   },
3257
3258   /* PREFIX_0F3832 */
3259   {
3260     { "(bad)",  { XX } },
3261     { "(bad)",  { XX } },
3262     { "pmovzxbq", { XM, EXw } },
3263     { "(bad)",  { XX } },
3264   },
3265
3266   /* PREFIX_0F3833 */
3267   {
3268     { "(bad)",  { XX } },
3269     { "(bad)",  { XX } },
3270     { "pmovzxwd", { XM, EXq } },
3271     { "(bad)",  { XX } },
3272   },
3273
3274   /* PREFIX_0F3834 */
3275   {
3276     { "(bad)",  { XX } },
3277     { "(bad)",  { XX } },
3278     { "pmovzxwq", { XM, EXd } },
3279     { "(bad)",  { XX } },
3280   },
3281
3282   /* PREFIX_0F3835 */
3283   {
3284     { "(bad)",  { XX } },
3285     { "(bad)",  { XX } },
3286     { "pmovzxdq", { XM, EXq } },
3287     { "(bad)",  { XX } },
3288   },
3289
3290   /* PREFIX_0F3837 */
3291   {
3292     { "(bad)",  { XX } },
3293     { "(bad)",  { XX } },
3294     { "pcmpgtq", { XM, EXx } },
3295     { "(bad)",  { XX } },
3296   },
3297
3298   /* PREFIX_0F3838 */
3299   {
3300     { "(bad)",  { XX } },
3301     { "(bad)",  { XX } },
3302     { "pminsb", { XM, EXx } },
3303     { "(bad)",  { XX } },
3304   },
3305
3306   /* PREFIX_0F3839 */
3307   {
3308     { "(bad)",  { XX } },
3309     { "(bad)",  { XX } },
3310     { "pminsd", { XM, EXx } },
3311     { "(bad)",  { XX } },
3312   },
3313
3314   /* PREFIX_0F383A */
3315   {
3316     { "(bad)",  { XX } },
3317     { "(bad)",  { XX } },
3318     { "pminuw", { XM, EXx } },
3319     { "(bad)",  { XX } },
3320   },
3321
3322   /* PREFIX_0F383B */
3323   {
3324     { "(bad)",  { XX } },
3325     { "(bad)",  { XX } },
3326     { "pminud", { XM, EXx } },
3327     { "(bad)",  { XX } },
3328   },
3329
3330   /* PREFIX_0F383C */
3331   {
3332     { "(bad)",  { XX } },
3333     { "(bad)",  { XX } },
3334     { "pmaxsb", { XM, EXx } },
3335     { "(bad)",  { XX } },
3336   },
3337
3338   /* PREFIX_0F383D */
3339   {
3340     { "(bad)",  { XX } },
3341     { "(bad)",  { XX } },
3342     { "pmaxsd", { XM, EXx } },
3343     { "(bad)",  { XX } },
3344   },
3345
3346   /* PREFIX_0F383E */
3347   {
3348     { "(bad)",  { XX } },
3349     { "(bad)",  { XX } },
3350     { "pmaxuw", { XM, EXx } },
3351     { "(bad)",  { XX } },
3352   },
3353
3354   /* PREFIX_0F383F */
3355   {
3356     { "(bad)",  { XX } },
3357     { "(bad)",  { XX } },
3358     { "pmaxud", { XM, EXx } },
3359     { "(bad)",  { XX } },
3360   },
3361
3362   /* PREFIX_0F3840 */
3363   {
3364     { "(bad)",  { XX } },
3365     { "(bad)",  { XX } },
3366     { "pmulld", { XM, EXx } },
3367     { "(bad)",  { XX } },
3368   },
3369
3370   /* PREFIX_0F3841 */
3371   {
3372     { "(bad)",  { XX } },
3373     { "(bad)",  { XX } },
3374     { "phminposuw", { XM, EXx } },
3375     { "(bad)",  { XX } },
3376   },
3377
3378   /* PREFIX_0F3880 */
3379   {
3380     { "(bad)",  { XX } },
3381     { "(bad)",  { XX } },
3382     { "invept", { Gm, Mo } },
3383     { "(bad)",  { XX } },
3384   },
3385
3386   /* PREFIX_0F3881 */
3387   {
3388     { "(bad)",  { XX } },
3389     { "(bad)",  { XX } },
3390     { "invvpid", { Gm, Mo } },
3391     { "(bad)",  { XX } },
3392   },
3393
3394   /* PREFIX_0F38DB */
3395   {
3396     { "(bad)",  { XX } },
3397     { "(bad)",  { XX } },
3398     { "aesimc", { XM, EXx } },
3399     { "(bad)",  { XX } },
3400   },
3401
3402   /* PREFIX_0F38DC */
3403   {
3404     { "(bad)",  { XX } },
3405     { "(bad)",  { XX } },
3406     { "aesenc", { XM, EXx } },
3407     { "(bad)",  { XX } },
3408   },
3409
3410   /* PREFIX_0F38DD */
3411   {
3412     { "(bad)",  { XX } },
3413     { "(bad)",  { XX } },
3414     { "aesenclast", { XM, EXx } },
3415     { "(bad)",  { XX } },
3416   },
3417
3418   /* PREFIX_0F38DE */
3419   {
3420     { "(bad)",  { XX } },
3421     { "(bad)",  { XX } },
3422     { "aesdec", { XM, EXx } },
3423     { "(bad)",  { XX } },
3424   },
3425
3426   /* PREFIX_0F38DF */
3427   {
3428     { "(bad)",  { XX } },
3429     { "(bad)",  { XX } },
3430     { "aesdeclast", { XM, EXx } },
3431     { "(bad)",  { XX } },
3432   },
3433
3434   /* PREFIX_0F38F0 */
3435   {
3436     { "movbeS", { Gv, { MOVBE_Fixup, v_mode } } },
3437     { "(bad)",  { XX } },
3438     { "movbeS", { Gv, { MOVBE_Fixup, v_mode } } },
3439     { "crc32",  { Gdq, { CRC32_Fixup, b_mode } } },     
3440   },
3441
3442   /* PREFIX_0F38F1 */
3443   {
3444     { "movbeS", { { MOVBE_Fixup, v_mode }, Gv } },
3445     { "(bad)",  { XX } },
3446     { "movbeS", { { MOVBE_Fixup, v_mode }, Gv } },
3447     { "crc32",  { Gdq, { CRC32_Fixup, v_mode } } },     
3448   },
3449
3450   /* PREFIX_0F3A08 */
3451   {
3452     { "(bad)",  { XX } },
3453     { "(bad)",  { XX } },
3454     { "roundps", { XM, EXx, Ib } },
3455     { "(bad)",  { XX } },
3456   },
3457
3458   /* PREFIX_0F3A09 */
3459   {
3460     { "(bad)",  { XX } },
3461     { "(bad)",  { XX } },
3462     { "roundpd", { XM, EXx, Ib } },
3463     { "(bad)",  { XX } },
3464   },
3465
3466   /* PREFIX_0F3A0A */
3467   {
3468     { "(bad)",  { XX } },
3469     { "(bad)",  { XX } },
3470     { "roundss", { XM, EXd, Ib } },
3471     { "(bad)",  { XX } },
3472   },
3473
3474   /* PREFIX_0F3A0B */
3475   {
3476     { "(bad)",  { XX } },
3477     { "(bad)",  { XX } },
3478     { "roundsd", { XM, EXq, Ib } },
3479     { "(bad)",  { XX } },
3480   },
3481
3482   /* PREFIX_0F3A0C */
3483   {
3484     { "(bad)",  { XX } },
3485     { "(bad)",  { XX } },
3486     { "blendps", { XM, EXx, Ib } },
3487     { "(bad)",  { XX } },
3488   },
3489
3490   /* PREFIX_0F3A0D */
3491   {
3492     { "(bad)",  { XX } },
3493     { "(bad)",  { XX } },
3494     { "blendpd", { XM, EXx, Ib } },
3495     { "(bad)",  { XX } },
3496   },
3497
3498   /* PREFIX_0F3A0E */
3499   {
3500     { "(bad)",  { XX } },
3501     { "(bad)",  { XX } },
3502     { "pblendw", { XM, EXx, Ib } },
3503     { "(bad)",  { XX } },
3504   },
3505
3506   /* PREFIX_0F3A14 */
3507   {
3508     { "(bad)",  { XX } },
3509     { "(bad)",  { XX } },
3510     { "pextrb", { Edqb, XM, Ib } },
3511     { "(bad)",  { XX } },
3512   },
3513
3514   /* PREFIX_0F3A15 */
3515   {
3516     { "(bad)",  { XX } },
3517     { "(bad)",  { XX } },
3518     { "pextrw", { Edqw, XM, Ib } },
3519     { "(bad)",  { XX } },
3520   },
3521
3522   /* PREFIX_0F3A16 */
3523   {
3524     { "(bad)",  { XX } },
3525     { "(bad)",  { XX } },
3526     { "pextrK", { Edq, XM, Ib } },
3527     { "(bad)",  { XX } },
3528   },
3529
3530   /* PREFIX_0F3A17 */
3531   {
3532     { "(bad)",  { XX } },
3533     { "(bad)",  { XX } },
3534     { "extractps", { Edqd, XM, Ib } },
3535     { "(bad)",  { XX } },
3536   },
3537
3538   /* PREFIX_0F3A20 */
3539   {
3540     { "(bad)",  { XX } },
3541     { "(bad)",  { XX } },
3542     { "pinsrb", { XM, Edqb, Ib } },
3543     { "(bad)",  { XX } },
3544   },
3545
3546   /* PREFIX_0F3A21 */
3547   {
3548     { "(bad)",  { XX } },
3549     { "(bad)",  { XX } },
3550     { "insertps", { XM, EXd, Ib } },
3551     { "(bad)",  { XX } },
3552   },
3553
3554   /* PREFIX_0F3A22 */
3555   {
3556     { "(bad)",  { XX } },
3557     { "(bad)",  { XX } },
3558     { "pinsrK", { XM, Edq, Ib } },
3559     { "(bad)",  { XX } },
3560   },
3561
3562   /* PREFIX_0F3A40 */
3563   {
3564     { "(bad)",  { XX } },
3565     { "(bad)",  { XX } },
3566     { "dpps",   { XM, EXx, Ib } },
3567     { "(bad)",  { XX } },
3568   },
3569
3570   /* PREFIX_0F3A41 */
3571   {
3572     { "(bad)",  { XX } },
3573     { "(bad)",  { XX } },
3574     { "dppd",   { XM, EXx, Ib } },
3575     { "(bad)",  { XX } },
3576   },
3577
3578   /* PREFIX_0F3A42 */
3579   {
3580     { "(bad)",  { XX } },
3581     { "(bad)",  { XX } },
3582     { "mpsadbw", { XM, EXx, Ib } },
3583     { "(bad)",  { XX } },
3584   },
3585
3586   /* PREFIX_0F3A44 */
3587   {
3588     { "(bad)",  { XX } },
3589     { "(bad)",  { XX } },
3590     { "pclmulqdq", { XM, EXx, PCLMUL } },
3591     { "(bad)",  { XX } },
3592   },
3593
3594   /* PREFIX_0F3A60 */
3595   {
3596     { "(bad)",  { XX } },
3597     { "(bad)",  { XX } },
3598     { "pcmpestrm", { XM, EXx, Ib } },
3599     { "(bad)",  { XX } },
3600   },
3601
3602   /* PREFIX_0F3A61 */
3603   {
3604     { "(bad)",  { XX } },
3605     { "(bad)",  { XX } },
3606     { "pcmpestri", { XM, EXx, Ib } },
3607     { "(bad)",  { XX } },
3608   },
3609
3610   /* PREFIX_0F3A62 */
3611   {
3612     { "(bad)",  { XX } },
3613     { "(bad)",  { XX } },
3614     { "pcmpistrm", { XM, EXx, Ib } },
3615     { "(bad)",  { XX } },
3616   },
3617
3618   /* PREFIX_0F3A63 */
3619   {
3620     { "(bad)",  { XX } },
3621     { "(bad)",  { XX } },
3622     { "pcmpistri", { XM, EXx, Ib } },
3623     { "(bad)",  { XX } },
3624   },
3625
3626   /* PREFIX_0F3ADF */
3627   {
3628     { "(bad)",  { XX } },
3629     { "(bad)",  { XX } },
3630     { "aeskeygenassist", { XM, EXx, Ib } },
3631     { "(bad)",  { XX } },
3632   },
3633
3634   /* PREFIX_VEX_10 */
3635   {
3636     { VEX_W_TABLE (VEX_W_10_P_0) },
3637     { VEX_LEN_TABLE (VEX_LEN_10_P_1) },
3638     { VEX_W_TABLE (VEX_W_10_P_2) },
3639     { VEX_LEN_TABLE (VEX_LEN_10_P_3) },
3640   },
3641
3642   /* PREFIX_VEX_11 */
3643   {
3644     { VEX_W_TABLE (VEX_W_11_P_0) },
3645     { VEX_LEN_TABLE (VEX_LEN_11_P_1) },
3646     { VEX_W_TABLE (VEX_W_11_P_2) },
3647     { VEX_LEN_TABLE (VEX_LEN_11_P_3) },
3648   },
3649
3650   /* PREFIX_VEX_12 */
3651   {
3652     { MOD_TABLE (MOD_VEX_12_PREFIX_0) },
3653     { VEX_W_TABLE (VEX_W_12_P_1) },
3654     { VEX_LEN_TABLE (VEX_LEN_12_P_2) },
3655     { VEX_W_TABLE (VEX_W_12_P_3) },
3656   },
3657
3658   /* PREFIX_VEX_16 */
3659   {
3660     { MOD_TABLE (MOD_VEX_16_PREFIX_0) },
3661     { VEX_W_TABLE (VEX_W_16_P_1) },
3662     { VEX_LEN_TABLE (VEX_LEN_16_P_2) },
3663     { "(bad)",  { XX } },
3664   },
3665
3666   /* PREFIX_VEX_2A */
3667   {
3668     { "(bad)",  { XX } },
3669     { VEX_LEN_TABLE (VEX_LEN_2A_P_1) },
3670     { "(bad)",  { XX } },
3671     { VEX_LEN_TABLE (VEX_LEN_2A_P_3) },
3672   },
3673
3674   /* PREFIX_VEX_2C */
3675   {
3676     { "(bad)",  { XX } },
3677     { VEX_LEN_TABLE (VEX_LEN_2C_P_1) },
3678     { "(bad)",  { XX } },
3679     { VEX_LEN_TABLE (VEX_LEN_2C_P_3) },
3680   },
3681
3682   /* PREFIX_VEX_2D */
3683   {
3684     { "(bad)",  { XX } },
3685     { VEX_LEN_TABLE (VEX_LEN_2D_P_1) },
3686     { "(bad)",  { XX } },
3687     { VEX_LEN_TABLE (VEX_LEN_2D_P_3) },
3688   },
3689
3690   /* PREFIX_VEX_2E */
3691   {
3692     { VEX_LEN_TABLE (VEX_LEN_2E_P_0) },
3693     { "(bad)",  { XX } },
3694     { VEX_LEN_TABLE (VEX_LEN_2E_P_2) },
3695     { "(bad)",  { XX } },
3696   },
3697
3698   /* PREFIX_VEX_2F */
3699   {
3700     { VEX_LEN_TABLE (VEX_LEN_2F_P_0) },
3701     { "(bad)",  { XX } },
3702     { VEX_LEN_TABLE (VEX_LEN_2F_P_2) },
3703     { "(bad)",  { XX } },
3704   },
3705
3706   /* PREFIX_VEX_51 */
3707   {
3708     { VEX_W_TABLE (VEX_W_51_P_0) },
3709     { VEX_LEN_TABLE (VEX_LEN_51_P_1) },
3710     { VEX_W_TABLE (VEX_W_51_P_2) },
3711     { VEX_LEN_TABLE (VEX_LEN_51_P_3) },
3712   },
3713
3714   /* PREFIX_VEX_52 */
3715   {
3716     { VEX_W_TABLE (VEX_W_52_P_0) },
3717     { VEX_LEN_TABLE (VEX_LEN_52_P_1) },
3718     { "(bad)",  { XX } },
3719     { "(bad)",  { XX } },
3720   },
3721
3722   /* PREFIX_VEX_53 */
3723   {
3724     { VEX_W_TABLE (VEX_W_53_P_0) },
3725     { VEX_LEN_TABLE (VEX_LEN_53_P_1) },
3726     { "(bad)",  { XX } },
3727     { "(bad)",  { XX } },
3728   },
3729
3730   /* PREFIX_VEX_58 */
3731   {
3732     { VEX_W_TABLE (VEX_W_58_P_0) },
3733     { VEX_LEN_TABLE (VEX_LEN_58_P_1) },
3734     { VEX_W_TABLE (VEX_W_58_P_2) },
3735     { VEX_LEN_TABLE (VEX_LEN_58_P_3) },
3736   },
3737
3738   /* PREFIX_VEX_59 */
3739   {
3740     { VEX_W_TABLE (VEX_W_59_P_0) },
3741     { VEX_LEN_TABLE (VEX_LEN_59_P_1) },
3742     { VEX_W_TABLE (VEX_W_59_P_2) },
3743     { VEX_LEN_TABLE (VEX_LEN_59_P_3) },
3744   },
3745
3746   /* PREFIX_VEX_5A */
3747   {
3748     { VEX_W_TABLE (VEX_W_5A_P_0) },
3749     { VEX_LEN_TABLE (VEX_LEN_5A_P_1) },
3750     { "vcvtpd2ps%XY", { XMM, EXx } },
3751     { VEX_LEN_TABLE (VEX_LEN_5A_P_3) },
3752   },
3753
3754   /* PREFIX_VEX_5B */
3755   {
3756     { VEX_W_TABLE (VEX_W_5B_P_0) },
3757     { VEX_W_TABLE (VEX_W_5B_P_1) },
3758     { VEX_W_TABLE (VEX_W_5B_P_2) },
3759     { "(bad)",  { XX } },
3760   },
3761
3762   /* PREFIX_VEX_5C */
3763   {
3764     { VEX_W_TABLE (VEX_W_5C_P_0) },
3765     { VEX_LEN_TABLE (VEX_LEN_5C_P_1) },
3766     { VEX_W_TABLE (VEX_W_5C_P_2) },
3767     { VEX_LEN_TABLE (VEX_LEN_5C_P_3) },
3768   },
3769
3770   /* PREFIX_VEX_5D */
3771   {
3772     { VEX_W_TABLE (VEX_W_5D_P_0) },
3773     { VEX_LEN_TABLE (VEX_LEN_5D_P_1) },
3774     { VEX_W_TABLE (VEX_W_5D_P_2) },
3775     { VEX_LEN_TABLE (VEX_LEN_5D_P_3) },
3776   },
3777
3778   /* PREFIX_VEX_5E */
3779   {
3780     { VEX_W_TABLE (VEX_W_5E_P_0) },
3781     { VEX_LEN_TABLE (VEX_LEN_5E_P_1) },
3782     { VEX_W_TABLE (VEX_W_5E_P_2) },
3783     { VEX_LEN_TABLE (VEX_LEN_5E_P_3) },
3784   },
3785
3786   /* PREFIX_VEX_5F */
3787   {
3788     { VEX_W_TABLE (VEX_W_5F_P_0) },
3789     { VEX_LEN_TABLE (VEX_LEN_5F_P_1) },
3790     { VEX_W_TABLE (VEX_W_5F_P_2) },
3791     { VEX_LEN_TABLE (VEX_LEN_5F_P_3) },
3792   },
3793
3794   /* PREFIX_VEX_60 */
3795   {
3796     { "(bad)",  { XX } },
3797     { "(bad)",  { XX } },
3798     { VEX_LEN_TABLE (VEX_LEN_60_P_2) },
3799     { "(bad)",  { XX } },
3800   },
3801
3802   /* PREFIX_VEX_61 */
3803   {
3804     { "(bad)",  { XX } },
3805     { "(bad)",  { XX } },
3806     { VEX_LEN_TABLE (VEX_LEN_61_P_2) },
3807     { "(bad)",  { XX } },
3808   },
3809
3810   /* PREFIX_VEX_62 */
3811   {
3812     { "(bad)",  { XX } },
3813     { "(bad)",  { XX } },
3814     { VEX_LEN_TABLE (VEX_LEN_62_P_2) },
3815     { "(bad)",  { XX } },
3816   },
3817
3818   /* PREFIX_VEX_63 */
3819   {
3820     { "(bad)",  { XX } },
3821     { "(bad)",  { XX } },
3822     { VEX_LEN_TABLE (VEX_LEN_63_P_2) },
3823     { "(bad)",  { XX } },
3824   },
3825
3826   /* PREFIX_VEX_64 */
3827   {
3828     { "(bad)",  { XX } },
3829     { "(bad)",  { XX } },
3830     { VEX_LEN_TABLE (VEX_LEN_64_P_2) },
3831     { "(bad)",  { XX } },
3832   },
3833
3834   /* PREFIX_VEX_65 */
3835   {
3836     { "(bad)",  { XX } },
3837     { "(bad)",  { XX } },
3838     { VEX_LEN_TABLE (VEX_LEN_65_P_2) },
3839     { "(bad)",  { XX } },
3840   },
3841
3842   /* PREFIX_VEX_66 */
3843   {
3844     { "(bad)",  { XX } },
3845     { "(bad)",  { XX } },
3846     { VEX_LEN_TABLE (VEX_LEN_66_P_2) },
3847     { "(bad)",  { XX } },
3848   },
3849
3850   /* PREFIX_VEX_67 */
3851   {
3852     { "(bad)",  { XX } },
3853     { "(bad)",  { XX } },
3854     { VEX_LEN_TABLE (VEX_LEN_67_P_2) },
3855     { "(bad)",  { XX } },
3856   },
3857
3858   /* PREFIX_VEX_68 */
3859   {
3860     { "(bad)",  { XX } },
3861     { "(bad)",  { XX } },
3862     { VEX_LEN_TABLE (VEX_LEN_68_P_2) },
3863     { "(bad)",  { XX } },
3864   },
3865
3866   /* PREFIX_VEX_69 */
3867   {
3868     { "(bad)",  { XX } },
3869     { "(bad)",  { XX } },
3870     { VEX_LEN_TABLE (VEX_LEN_69_P_2) },
3871     { "(bad)",  { XX } },
3872   },
3873
3874   /* PREFIX_VEX_6A */
3875   {
3876     { "(bad)",  { XX } },
3877     { "(bad)",  { XX } },
3878     { VEX_LEN_TABLE (VEX_LEN_6A_P_2) },
3879     { "(bad)",  { XX } },
3880   },
3881
3882   /* PREFIX_VEX_6B */
3883   {
3884     { "(bad)",  { XX } },
3885     { "(bad)",  { XX } },
3886     { VEX_LEN_TABLE (VEX_LEN_6B_P_2) },
3887     { "(bad)",  { XX } },
3888   },
3889
3890   /* PREFIX_VEX_6C */
3891   {
3892     { "(bad)",  { XX } },
3893     { "(bad)",  { XX } },
3894     { VEX_LEN_TABLE (VEX_LEN_6C_P_2) },
3895     { "(bad)",  { XX } },
3896   },
3897
3898   /* PREFIX_VEX_6D */
3899   {
3900     { "(bad)",  { XX } },
3901     { "(bad)",  { XX } },
3902     { VEX_LEN_TABLE (VEX_LEN_6D_P_2) },
3903     { "(bad)",  { XX } },
3904   },
3905
3906   /* PREFIX_VEX_6E */
3907   {
3908     { "(bad)",  { XX } },
3909     { "(bad)",  { XX } },
3910     { VEX_LEN_TABLE (VEX_LEN_6E_P_2) },
3911     { "(bad)",  { XX } },
3912   },
3913
3914   /* PREFIX_VEX_6F */
3915   {
3916     { "(bad)",  { XX } },
3917     { VEX_W_TABLE (VEX_W_6F_P_1) },
3918     { VEX_W_TABLE (VEX_W_6F_P_2) },
3919     { "(bad)",  { XX } },
3920   },
3921
3922   /* PREFIX_VEX_70 */
3923   {
3924     { "(bad)",  { XX } },
3925     { VEX_LEN_TABLE (VEX_LEN_70_P_1) },
3926     { VEX_LEN_TABLE (VEX_LEN_70_P_2) },
3927     { VEX_LEN_TABLE (VEX_LEN_70_P_3) },
3928   },
3929
3930   /* PREFIX_VEX_71_REG_2 */
3931   {
3932     { "(bad)",  { XX } },
3933     { "(bad)",  { XX } },
3934     { VEX_LEN_TABLE (VEX_LEN_71_R_2_P_2) },
3935     { "(bad)",  { XX } },
3936   },
3937
3938   /* PREFIX_VEX_71_REG_4 */
3939   {
3940     { "(bad)",  { XX } },
3941     { "(bad)",  { XX } },
3942     { VEX_LEN_TABLE (VEX_LEN_71_R_4_P_2) },
3943     { "(bad)",  { XX } },
3944   },
3945
3946   /* PREFIX_VEX_71_REG_6 */
3947   {
3948     { "(bad)",  { XX } },
3949     { "(bad)",  { XX } },
3950     { VEX_LEN_TABLE (VEX_LEN_71_R_6_P_2) },
3951     { "(bad)",  { XX } },
3952   },
3953
3954   /* PREFIX_VEX_72_REG_2 */
3955   {
3956     { "(bad)",  { XX } },
3957     { "(bad)",  { XX } },
3958     { VEX_LEN_TABLE (VEX_LEN_72_R_2_P_2) },
3959     { "(bad)",  { XX } },
3960   },
3961
3962   /* PREFIX_VEX_72_REG_4 */
3963   {
3964     { "(bad)",  { XX } },
3965     { "(bad)",  { XX } },
3966     { VEX_LEN_TABLE (VEX_LEN_72_R_4_P_2) },
3967     { "(bad)",  { XX } },
3968   },
3969
3970   /* PREFIX_VEX_72_REG_6 */
3971   {
3972     { "(bad)",  { XX } },
3973     { "(bad)",  { XX } },
3974     { VEX_LEN_TABLE (VEX_LEN_72_R_6_P_2) },
3975     { "(bad)",  { XX } },
3976   },
3977
3978   /* PREFIX_VEX_73_REG_2 */
3979   {
3980     { "(bad)",  { XX } },
3981     { "(bad)",  { XX } },
3982     { VEX_LEN_TABLE (VEX_LEN_73_R_2_P_2) },
3983     { "(bad)",  { XX } },
3984   },
3985
3986   /* PREFIX_VEX_73_REG_3 */
3987   {
3988     { "(bad)",  { XX } },
3989     { "(bad)",  { XX } },
3990     { VEX_LEN_TABLE (VEX_LEN_73_R_3_P_2) },
3991     { "(bad)",  { XX } },
3992   },
3993
3994   /* PREFIX_VEX_73_REG_6 */
3995   {
3996     { "(bad)",  { XX } },
3997     { "(bad)",  { XX } },
3998     { VEX_LEN_TABLE (VEX_LEN_73_R_6_P_2) },
3999     { "(bad)",  { XX } },
4000   },
4001
4002   /* PREFIX_VEX_73_REG_7 */
4003   {
4004     { "(bad)",  { XX } },
4005     { "(bad)",  { XX } },
4006     { VEX_LEN_TABLE (VEX_LEN_73_R_7_P_2) },
4007     { "(bad)",  { XX } },
4008   },
4009
4010   /* PREFIX_VEX_74 */
4011   {
4012     { "(bad)",  { XX } },
4013     { "(bad)",  { XX } },
4014     { VEX_LEN_TABLE (VEX_LEN_74_P_2) },
4015     { "(bad)",  { XX } },
4016   },
4017
4018   /* PREFIX_VEX_75 */
4019   {
4020     { "(bad)",  { XX } },
4021     { "(bad)",  { XX } },
4022     { VEX_LEN_TABLE (VEX_LEN_75_P_2) },
4023     { "(bad)",  { XX } },
4024   },
4025
4026   /* PREFIX_VEX_76 */
4027   {
4028     { "(bad)",  { XX } },
4029     { "(bad)",  { XX } },
4030     { VEX_LEN_TABLE (VEX_LEN_76_P_2) },
4031     { "(bad)",  { XX } },
4032   },
4033
4034   /* PREFIX_VEX_77 */
4035   {
4036     { VEX_W_TABLE (VEX_W_77_P_0) },
4037     { "(bad)",  { XX } },
4038     { "(bad)",  { XX } },
4039     { "(bad)",  { XX } },
4040   },
4041
4042   /* PREFIX_VEX_7C */
4043   {
4044     { "(bad)",  { XX } },
4045     { "(bad)",  { XX } },
4046     { VEX_W_TABLE (VEX_W_7C_P_2) },
4047     { VEX_W_TABLE (VEX_W_7C_P_3) },
4048   },
4049
4050   /* PREFIX_VEX_7D */
4051   {
4052     { "(bad)",  { XX } },
4053     { "(bad)",  { XX } },
4054     { VEX_W_TABLE (VEX_W_7D_P_2) },
4055     { VEX_W_TABLE (VEX_W_7D_P_3) },
4056   },
4057
4058   /* PREFIX_VEX_7E */
4059   {
4060     { "(bad)",  { XX } },
4061     { VEX_LEN_TABLE (VEX_LEN_7E_P_1) },
4062     { VEX_LEN_TABLE (VEX_LEN_7E_P_2) },
4063     { "(bad)",  { XX } },
4064   },
4065
4066   /* PREFIX_VEX_7F */
4067   {
4068     { "(bad)",  { XX } },
4069     { VEX_W_TABLE (VEX_W_7F_P_1) },
4070     { VEX_W_TABLE (VEX_W_7F_P_2) },
4071     { "(bad)",  { XX } },
4072   },
4073
4074   /* PREFIX_VEX_C2 */
4075   {
4076     { VEX_W_TABLE (VEX_W_C2_P_0) },
4077     { VEX_LEN_TABLE (VEX_LEN_C2_P_1) },
4078     { VEX_W_TABLE (VEX_W_C2_P_2) },
4079     { VEX_LEN_TABLE (VEX_LEN_C2_P_3) },
4080   },
4081
4082   /* PREFIX_VEX_C4 */
4083   {
4084     { "(bad)",  { XX } },
4085     { "(bad)",  { XX } },
4086     { VEX_LEN_TABLE (VEX_LEN_C4_P_2) },
4087     { "(bad)",  { XX } },
4088   },
4089
4090   /* PREFIX_VEX_C5 */
4091   {
4092     { "(bad)",  { XX } },
4093     { "(bad)",  { XX } },
4094     { VEX_LEN_TABLE (VEX_LEN_C5_P_2) },
4095     { "(bad)",  { XX } },
4096   },
4097
4098   /* PREFIX_VEX_D0 */
4099   {
4100     { "(bad)",  { XX } },
4101     { "(bad)",  { XX } },
4102     { VEX_W_TABLE (VEX_W_D0_P_2) },
4103     { VEX_W_TABLE (VEX_W_D0_P_3) },
4104   },
4105
4106   /* PREFIX_VEX_D1 */
4107   {
4108     { "(bad)",  { XX } },
4109     { "(bad)",  { XX } },
4110     { VEX_LEN_TABLE (VEX_LEN_D1_P_2) },
4111     { "(bad)",  { XX } },
4112   },
4113
4114   /* PREFIX_VEX_D2 */
4115   {
4116     { "(bad)",  { XX } },
4117     { "(bad)",  { XX } },
4118     { VEX_LEN_TABLE (VEX_LEN_D2_P_2) },
4119     { "(bad)",  { XX } },
4120   },
4121
4122   /* PREFIX_VEX_D3 */
4123   {
4124     { "(bad)",  { XX } },
4125     { "(bad)",  { XX } },
4126     { VEX_LEN_TABLE (VEX_LEN_D3_P_2) },
4127     { "(bad)",  { XX } },
4128   },
4129
4130   /* PREFIX_VEX_D4 */
4131   {
4132     { "(bad)",  { XX } },
4133     { "(bad)",  { XX } },
4134     { VEX_LEN_TABLE (VEX_LEN_D4_P_2) },
4135     { "(bad)",  { XX } },
4136   },
4137
4138   /* PREFIX_VEX_D5 */
4139   {
4140     { "(bad)",  { XX } },
4141     { "(bad)",  { XX } },
4142     { VEX_LEN_TABLE (VEX_LEN_D5_P_2) },
4143     { "(bad)",  { XX } },
4144   },
4145
4146   /* PREFIX_VEX_D6 */
4147   {
4148     { "(bad)",  { XX } },
4149     { "(bad)",  { XX } },
4150     { VEX_LEN_TABLE (VEX_LEN_D6_P_2) },
4151     { "(bad)",  { XX } },
4152   },
4153
4154   /* PREFIX_VEX_D7 */
4155   {
4156     { "(bad)",  { XX } },
4157     { "(bad)",  { XX } },
4158     { MOD_TABLE (MOD_VEX_D7_PREFIX_2) },
4159     { "(bad)",  { XX } },
4160   },
4161
4162   /* PREFIX_VEX_D8 */
4163   {
4164     { "(bad)",  { XX } },
4165     { "(bad)",  { XX } },
4166     { VEX_LEN_TABLE (VEX_LEN_D8_P_2) },
4167     { "(bad)",  { XX } },
4168   },
4169
4170   /* PREFIX_VEX_D9 */
4171   {
4172     { "(bad)",  { XX } },
4173     { "(bad)",  { XX } },
4174     { VEX_LEN_TABLE (VEX_LEN_D9_P_2) },
4175     { "(bad)",  { XX } },
4176   },
4177
4178   /* PREFIX_VEX_DA */
4179   {
4180     { "(bad)",  { XX } },
4181     { "(bad)",  { XX } },
4182     { VEX_LEN_TABLE (VEX_LEN_DA_P_2) },
4183     { "(bad)",  { XX } },
4184   },
4185
4186   /* PREFIX_VEX_DB */
4187   {
4188     { "(bad)",  { XX } },
4189     { "(bad)",  { XX } },
4190     { VEX_LEN_TABLE (VEX_LEN_DB_P_2) },
4191     { "(bad)",  { XX } },
4192   },
4193
4194   /* PREFIX_VEX_DC */
4195   {
4196     { "(bad)",  { XX } },
4197     { "(bad)",  { XX } },
4198     { VEX_LEN_TABLE (VEX_LEN_DC_P_2) },
4199     { "(bad)",  { XX } },
4200   },
4201
4202   /* PREFIX_VEX_DD */
4203   {
4204     { "(bad)",  { XX } },
4205     { "(bad)",  { XX } },
4206     { VEX_LEN_TABLE (VEX_LEN_DD_P_2) },
4207     { "(bad)",  { XX } },
4208   },
4209
4210   /* PREFIX_VEX_DE */
4211   {
4212     { "(bad)",  { XX } },
4213     { "(bad)",  { XX } },
4214     { VEX_LEN_TABLE (VEX_LEN_DE_P_2) },
4215     { "(bad)",  { XX } },
4216   },
4217
4218   /* PREFIX_VEX_DF */
4219   {
4220     { "(bad)",  { XX } },
4221     { "(bad)",  { XX } },
4222     { VEX_LEN_TABLE (VEX_LEN_DF_P_2) },
4223     { "(bad)",  { XX } },
4224   },
4225
4226   /* PREFIX_VEX_E0 */
4227   {
4228     { "(bad)",  { XX } },
4229     { "(bad)",  { XX } },
4230     { VEX_LEN_TABLE (VEX_LEN_E0_P_2) },
4231     { "(bad)",  { XX } },
4232   },
4233
4234   /* PREFIX_VEX_E1 */
4235   {
4236     { "(bad)",  { XX } },
4237     { "(bad)",  { XX } },
4238     { VEX_LEN_TABLE (VEX_LEN_E1_P_2) },
4239     { "(bad)",  { XX } },
4240   },
4241
4242   /* PREFIX_VEX_E2 */
4243   {
4244     { "(bad)",  { XX } },
4245     { "(bad)",  { XX } },
4246     { VEX_LEN_TABLE (VEX_LEN_E2_P_2) },
4247     { "(bad)",  { XX } },
4248   },
4249
4250   /* PREFIX_VEX_E3 */
4251   {
4252     { "(bad)",  { XX } },
4253     { "(bad)",  { XX } },
4254     { VEX_LEN_TABLE (VEX_LEN_E3_P_2) },
4255     { "(bad)",  { XX } },
4256   },
4257
4258   /* PREFIX_VEX_E4 */
4259   {
4260     { "(bad)",  { XX } },
4261     { "(bad)",  { XX } },
4262     { VEX_LEN_TABLE (VEX_LEN_E4_P_2) },
4263     { "(bad)",  { XX } },
4264   },
4265
4266   /* PREFIX_VEX_E5 */
4267   {
4268     { "(bad)",  { XX } },
4269     { "(bad)",  { XX } },
4270     { VEX_LEN_TABLE (VEX_LEN_E5_P_2) },
4271     { "(bad)",  { XX } },
4272   },
4273
4274   /* PREFIX_VEX_E6 */
4275   {
4276     { "(bad)",  { XX } },
4277     { VEX_W_TABLE (VEX_W_E6_P_1) },
4278     { VEX_W_TABLE (VEX_W_E6_P_2) },
4279     { VEX_W_TABLE (VEX_W_E6_P_3) },
4280   },
4281
4282   /* PREFIX_VEX_E7 */
4283   {
4284     { "(bad)",  { XX } },
4285     { "(bad)",  { XX } },
4286     { MOD_TABLE (MOD_VEX_E7_PREFIX_2) },
4287     { "(bad)",  { XX } },
4288   },
4289
4290   /* PREFIX_VEX_E8 */
4291   {
4292     { "(bad)",  { XX } },
4293     { "(bad)",  { XX } },
4294     { VEX_LEN_TABLE (VEX_LEN_E8_P_2) },
4295     { "(bad)",  { XX } },
4296   },
4297
4298   /* PREFIX_VEX_E9 */
4299   {
4300     { "(bad)",  { XX } },
4301     { "(bad)",  { XX } },
4302     { VEX_LEN_TABLE (VEX_LEN_E9_P_2) },
4303     { "(bad)",  { XX } },
4304   },
4305
4306   /* PREFIX_VEX_EA */
4307   {
4308     { "(bad)",  { XX } },
4309     { "(bad)",  { XX } },
4310     { VEX_LEN_TABLE (VEX_LEN_EA_P_2) },
4311     { "(bad)",  { XX } },
4312   },
4313
4314   /* PREFIX_VEX_EB */
4315   {
4316     { "(bad)",  { XX } },
4317     { "(bad)",  { XX } },
4318     { VEX_LEN_TABLE (VEX_LEN_EB_P_2) },
4319     { "(bad)",  { XX } },
4320   },
4321
4322   /* PREFIX_VEX_EC */
4323   {
4324     { "(bad)",  { XX } },
4325     { "(bad)",  { XX } },
4326     { VEX_LEN_TABLE (VEX_LEN_EC_P_2) },
4327     { "(bad)",  { XX } },
4328   },
4329
4330   /* PREFIX_VEX_ED */
4331   {
4332     { "(bad)",  { XX } },
4333     { "(bad)",  { XX } },
4334     { VEX_LEN_TABLE (VEX_LEN_ED_P_2) },
4335     { "(bad)",  { XX } },
4336   },
4337
4338   /* PREFIX_VEX_EE */
4339   {
4340     { "(bad)",  { XX } },
4341     { "(bad)",  { XX } },
4342     { VEX_LEN_TABLE (VEX_LEN_EE_P_2) },
4343     { "(bad)",  { XX } },
4344   },
4345
4346   /* PREFIX_VEX_EF */
4347   {
4348     { "(bad)",  { XX } },
4349     { "(bad)",  { XX } },
4350     { VEX_LEN_TABLE (VEX_LEN_EF_P_2) },
4351     { "(bad)",  { XX } },
4352   },
4353
4354   /* PREFIX_VEX_F0 */
4355   {
4356     { "(bad)",  { XX } },
4357     { "(bad)",  { XX } },
4358     { "(bad)",  { XX } },
4359     { MOD_TABLE (MOD_VEX_F0_PREFIX_3) },
4360   },
4361
4362   /* PREFIX_VEX_F1 */
4363   {
4364     { "(bad)",  { XX } },
4365     { "(bad)",  { XX } },
4366     { VEX_LEN_TABLE (VEX_LEN_F1_P_2) },
4367     { "(bad)",  { XX } },
4368   },
4369
4370   /* PREFIX_VEX_F2 */
4371   {
4372     { "(bad)",  { XX } },
4373     { "(bad)",  { XX } },
4374     { VEX_LEN_TABLE (VEX_LEN_F2_P_2) },
4375     { "(bad)",  { XX } },
4376   },
4377
4378   /* PREFIX_VEX_F3 */
4379   {
4380     { "(bad)",  { XX } },
4381     { "(bad)",  { XX } },
4382     { VEX_LEN_TABLE (VEX_LEN_F3_P_2) },
4383     { "(bad)",  { XX } },
4384   },
4385
4386   /* PREFIX_VEX_F4 */
4387   {
4388     { "(bad)",  { XX } },
4389     { "(bad)",  { XX } },
4390     { VEX_LEN_TABLE (VEX_LEN_F4_P_2) },
4391     { "(bad)",  { XX } },
4392   },
4393
4394   /* PREFIX_VEX_F5 */
4395   {
4396     { "(bad)",  { XX } },
4397     { "(bad)",  { XX } },
4398     { VEX_LEN_TABLE (VEX_LEN_F5_P_2) },
4399     { "(bad)",  { XX } },
4400   },
4401
4402   /* PREFIX_VEX_F6 */
4403   {
4404     { "(bad)",  { XX } },
4405     { "(bad)",  { XX } },
4406     { VEX_LEN_TABLE (VEX_LEN_F6_P_2) },
4407     { "(bad)",  { XX } },
4408   },
4409
4410   /* PREFIX_VEX_F7 */
4411   {
4412     { "(bad)",  { XX } },
4413     { "(bad)",  { XX } },
4414     { VEX_LEN_TABLE (VEX_LEN_F7_P_2) },
4415     { "(bad)",  { XX } },
4416   },
4417
4418   /* PREFIX_VEX_F8 */
4419   {
4420     { "(bad)",  { XX } },
4421     { "(bad)",  { XX } },
4422     { VEX_LEN_TABLE (VEX_LEN_F8_P_2) },
4423     { "(bad)",  { XX } },
4424   },
4425
4426   /* PREFIX_VEX_F9 */
4427   {
4428     { "(bad)",  { XX } },
4429     { "(bad)",  { XX } },
4430     { VEX_LEN_TABLE (VEX_LEN_F9_P_2) },
4431     { "(bad)",  { XX } },
4432   },
4433
4434   /* PREFIX_VEX_FA */
4435   {
4436     { "(bad)",  { XX } },
4437     { "(bad)",  { XX } },
4438     { VEX_LEN_TABLE (VEX_LEN_FA_P_2) },
4439     { "(bad)",  { XX } },
4440   },
4441
4442   /* PREFIX_VEX_FB */
4443   {
4444     { "(bad)",  { XX } },
4445     { "(bad)",  { XX } },
4446     { VEX_LEN_TABLE (VEX_LEN_FB_P_2) },
4447     { "(bad)",  { XX } },
4448   },
4449
4450   /* PREFIX_VEX_FC */
4451   {
4452     { "(bad)",  { XX } },
4453     { "(bad)",  { XX } },
4454     { VEX_LEN_TABLE (VEX_LEN_FC_P_2) },
4455     { "(bad)",  { XX } },
4456   },
4457
4458   /* PREFIX_VEX_FD */
4459   {
4460     { "(bad)",  { XX } },
4461     { "(bad)",  { XX } },
4462     { VEX_LEN_TABLE (VEX_LEN_FD_P_2) },
4463     { "(bad)",  { XX } },
4464   },
4465
4466   /* PREFIX_VEX_FE */
4467   {
4468     { "(bad)",  { XX } },
4469     { "(bad)",  { XX } },
4470     { VEX_LEN_TABLE (VEX_LEN_FE_P_2) },
4471     { "(bad)",  { XX } },
4472   },
4473
4474   /* PREFIX_VEX_3800 */
4475   {
4476     { "(bad)",  { XX } },
4477     { "(bad)",  { XX } },
4478     { VEX_LEN_TABLE (VEX_LEN_3800_P_2) },
4479     { "(bad)",  { XX } },
4480   },
4481
4482   /* PREFIX_VEX_3801 */
4483   {
4484     { "(bad)",  { XX } },
4485     { "(bad)",  { XX } },
4486     { VEX_LEN_TABLE (VEX_LEN_3801_P_2) },
4487     { "(bad)",  { XX } },
4488   },
4489
4490   /* PREFIX_VEX_3802 */
4491   {
4492     { "(bad)",  { XX } },
4493     { "(bad)",  { XX } },
4494     { VEX_LEN_TABLE (VEX_LEN_3802_P_2) },
4495     { "(bad)",  { XX } },
4496   },
4497
4498   /* PREFIX_VEX_3803 */
4499   {
4500     { "(bad)",  { XX } },
4501     { "(bad)",  { XX } },
4502     { VEX_LEN_TABLE (VEX_LEN_3803_P_2) },
4503     { "(bad)",  { XX } },
4504   },
4505
4506   /* PREFIX_VEX_3804 */
4507   {
4508     { "(bad)",  { XX } },
4509     { "(bad)",  { XX } },
4510     { VEX_LEN_TABLE (VEX_LEN_3804_P_2) },
4511     { "(bad)",  { XX } },
4512   },
4513
4514   /* PREFIX_VEX_3805 */
4515   {
4516     { "(bad)",  { XX } },
4517     { "(bad)",  { XX } },
4518     { VEX_LEN_TABLE (VEX_LEN_3805_P_2) },
4519     { "(bad)",  { XX } },
4520   },
4521
4522   /* PREFIX_VEX_3806 */
4523   {
4524     { "(bad)",  { XX } },
4525     { "(bad)",  { XX } },
4526     { VEX_LEN_TABLE (VEX_LEN_3806_P_2) },
4527     { "(bad)",  { XX } },
4528   },
4529
4530   /* PREFIX_VEX_3807 */
4531   {
4532     { "(bad)",  { XX } },
4533     { "(bad)",  { XX } },
4534     { VEX_LEN_TABLE (VEX_LEN_3807_P_2) },
4535     { "(bad)",  { XX } },
4536   },
4537
4538   /* PREFIX_VEX_3808 */
4539   {
4540     { "(bad)",  { XX } },
4541     { "(bad)",  { XX } },
4542     { VEX_LEN_TABLE (VEX_LEN_3808_P_2) },
4543     { "(bad)",  { XX } },
4544   },
4545
4546   /* PREFIX_VEX_3809 */
4547   {
4548     { "(bad)",  { XX } },
4549     { "(bad)",  { XX } },
4550     { VEX_LEN_TABLE (VEX_LEN_3809_P_2) },
4551     { "(bad)",  { XX } },
4552   },
4553
4554   /* PREFIX_VEX_380A */
4555   {
4556     { "(bad)",  { XX } },
4557     { "(bad)",  { XX } },
4558     { VEX_LEN_TABLE (VEX_LEN_380A_P_2) },
4559     { "(bad)",  { XX } },
4560   },
4561
4562   /* PREFIX_VEX_380B */
4563   {
4564     { "(bad)",  { XX } },
4565     { "(bad)",  { XX } },
4566     { VEX_LEN_TABLE (VEX_LEN_380B_P_2) },
4567     { "(bad)",  { XX } },
4568   },
4569
4570   /* PREFIX_VEX_380C */
4571   {
4572     { "(bad)",  { XX } },
4573     { "(bad)",  { XX } },
4574     { VEX_W_TABLE (VEX_W_380C_P_2) },
4575     { "(bad)",  { XX } },
4576   },
4577
4578   /* PREFIX_VEX_380D */
4579   {
4580     { "(bad)",  { XX } },
4581     { "(bad)",  { XX } },
4582     { VEX_W_TABLE (VEX_W_380D_P_2) },
4583     { "(bad)",  { XX } },
4584   },
4585
4586   /* PREFIX_VEX_380E */
4587   {
4588     { "(bad)",  { XX } },
4589     { "(bad)",  { XX } },
4590     { VEX_W_TABLE (VEX_W_380E_P_2) },
4591     { "(bad)",  { XX } },
4592   },
4593
4594   /* PREFIX_VEX_380F */
4595   {
4596     { "(bad)",  { XX } },
4597     { "(bad)",  { XX } },
4598     { VEX_W_TABLE (VEX_W_380F_P_2) },
4599     { "(bad)",  { XX } },
4600   },
4601
4602   /* PREFIX_VEX_3817 */
4603   {
4604     { "(bad)",  { XX } },
4605     { "(bad)",  { XX } },
4606     { VEX_W_TABLE (VEX_W_3817_P_2) },
4607     { "(bad)",  { XX } },
4608   },
4609
4610   /* PREFIX_VEX_3818 */
4611   {
4612     { "(bad)",  { XX } },
4613     { "(bad)",  { XX } },
4614     { MOD_TABLE (MOD_VEX_3818_PREFIX_2) },
4615     { "(bad)",  { XX } },
4616   },
4617
4618   /* PREFIX_VEX_3819 */
4619   {
4620     { "(bad)",  { XX } },
4621     { "(bad)",  { XX } },
4622     { MOD_TABLE (MOD_VEX_3819_PREFIX_2) },
4623     { "(bad)",  { XX } },
4624   },
4625
4626   /* PREFIX_VEX_381A */
4627   {
4628     { "(bad)",  { XX } },
4629     { "(bad)",  { XX } },
4630     { MOD_TABLE (MOD_VEX_381A_PREFIX_2) },
4631     { "(bad)",  { XX } },
4632   },
4633
4634   /* PREFIX_VEX_381C */
4635   {
4636     { "(bad)",  { XX } },
4637     { "(bad)",  { XX } },
4638     { VEX_LEN_TABLE (VEX_LEN_381C_P_2) },
4639     { "(bad)",  { XX } },
4640   },
4641
4642   /* PREFIX_VEX_381D */
4643   {
4644     { "(bad)",  { XX } },
4645     { "(bad)",  { XX } },
4646     { VEX_LEN_TABLE (VEX_LEN_381D_P_2) },
4647     { "(bad)",  { XX } },
4648   },
4649
4650   /* PREFIX_VEX_381E */
4651   {
4652     { "(bad)",  { XX } },
4653     { "(bad)",  { XX } },
4654     { VEX_LEN_TABLE (VEX_LEN_381E_P_2) },
4655     { "(bad)",  { XX } },
4656   },
4657
4658   /* PREFIX_VEX_3820 */
4659   {
4660     { "(bad)",  { XX } },
4661     { "(bad)",  { XX } },
4662     { VEX_LEN_TABLE (VEX_LEN_3820_P_2) },
4663     { "(bad)",  { XX } },
4664   },
4665
4666   /* PREFIX_VEX_3821 */
4667   {
4668     { "(bad)",  { XX } },
4669     { "(bad)",  { XX } },
4670     { VEX_LEN_TABLE (VEX_LEN_3821_P_2) },
4671     { "(bad)",  { XX } },
4672   },
4673
4674   /* PREFIX_VEX_3822 */
4675   {
4676     { "(bad)",  { XX } },
4677     { "(bad)",  { XX } },
4678     { VEX_LEN_TABLE (VEX_LEN_3822_P_2) },
4679     { "(bad)",  { XX } },
4680   },
4681
4682   /* PREFIX_VEX_3823 */
4683   {
4684     { "(bad)",  { XX } },
4685     { "(bad)",  { XX } },
4686     { VEX_LEN_TABLE (VEX_LEN_3823_P_2) },
4687     { "(bad)",  { XX } },
4688   },
4689
4690   /* PREFIX_VEX_3824 */
4691   {
4692     { "(bad)",  { XX } },
4693     { "(bad)",  { XX } },
4694     { VEX_LEN_TABLE (VEX_LEN_3824_P_2) },
4695     { "(bad)",  { XX } },
4696   },
4697
4698   /* PREFIX_VEX_3825 */
4699   {
4700     { "(bad)",  { XX } },
4701     { "(bad)",  { XX } },
4702     { VEX_LEN_TABLE (VEX_LEN_3825_P_2) },
4703     { "(bad)",  { XX } },
4704   },
4705
4706   /* PREFIX_VEX_3828 */
4707   {
4708     { "(bad)",  { XX } },
4709     { "(bad)",  { XX } },
4710     { VEX_LEN_TABLE (VEX_LEN_3828_P_2) },
4711     { "(bad)",  { XX } },
4712   },
4713
4714   /* PREFIX_VEX_3829 */
4715   {
4716     { "(bad)",  { XX } },
4717     { "(bad)",  { XX } },
4718     { VEX_LEN_TABLE (VEX_LEN_3829_P_2) },
4719     { "(bad)",  { XX } },
4720   },
4721
4722   /* PREFIX_VEX_382A */
4723   {
4724     { "(bad)",  { XX } },
4725     { "(bad)",  { XX } },
4726     { MOD_TABLE (MOD_VEX_382A_PREFIX_2) },
4727     { "(bad)",  { XX } },
4728   },
4729
4730   /* PREFIX_VEX_382B */
4731   {
4732     { "(bad)",  { XX } },
4733     { "(bad)",  { XX } },
4734     { VEX_LEN_TABLE (VEX_LEN_382B_P_2) },
4735     { "(bad)",  { XX } },
4736   },
4737
4738   /* PREFIX_VEX_382C */
4739   {
4740     { "(bad)",  { XX } },
4741     { "(bad)",  { XX } },
4742      { MOD_TABLE (MOD_VEX_382C_PREFIX_2) },
4743     { "(bad)",  { XX } },
4744   },
4745
4746   /* PREFIX_VEX_382D */
4747   {
4748     { "(bad)",  { XX } },
4749     { "(bad)",  { XX } },
4750      { MOD_TABLE (MOD_VEX_382D_PREFIX_2) },
4751     { "(bad)",  { XX } },
4752   },
4753
4754   /* PREFIX_VEX_382E */
4755   {
4756     { "(bad)",  { XX } },
4757     { "(bad)",  { XX } },
4758      { MOD_TABLE (MOD_VEX_382E_PREFIX_2) },
4759     { "(bad)",  { XX } },
4760   },
4761
4762   /* PREFIX_VEX_382F */
4763   {
4764     { "(bad)",  { XX } },
4765     { "(bad)",  { XX } },
4766      { MOD_TABLE (MOD_VEX_382F_PREFIX_2) },
4767     { "(bad)",  { XX } },
4768   },
4769
4770   /* PREFIX_VEX_3830 */
4771   {
4772     { "(bad)",  { XX } },
4773     { "(bad)",  { XX } },
4774     { VEX_LEN_TABLE (VEX_LEN_3830_P_2) },
4775     { "(bad)",  { XX } },
4776   },
4777
4778   /* PREFIX_VEX_3831 */
4779   {
4780     { "(bad)",  { XX } },
4781     { "(bad)",  { XX } },
4782     { VEX_LEN_TABLE (VEX_LEN_3831_P_2) },
4783     { "(bad)",  { XX } },
4784   },
4785
4786   /* PREFIX_VEX_3832 */
4787   {
4788     { "(bad)",  { XX } },
4789     { "(bad)",  { XX } },
4790     { VEX_LEN_TABLE (VEX_LEN_3832_P_2) },
4791     { "(bad)",  { XX } },
4792   },
4793
4794   /* PREFIX_VEX_3833 */
4795   {
4796     { "(bad)",  { XX } },
4797     { "(bad)",  { XX } },
4798     { VEX_LEN_TABLE (VEX_LEN_3833_P_2) },
4799     { "(bad)",  { XX } },
4800   },
4801
4802   /* PREFIX_VEX_3834 */
4803   {
4804     { "(bad)",  { XX } },
4805     { "(bad)",  { XX } },
4806     { VEX_LEN_TABLE (VEX_LEN_3834_P_2) },
4807     { "(bad)",  { XX } },
4808   },
4809
4810   /* PREFIX_VEX_3835 */
4811   {
4812     { "(bad)",  { XX } },
4813     { "(bad)",  { XX } },
4814     { VEX_LEN_TABLE (VEX_LEN_3835_P_2) },
4815     { "(bad)",  { XX } },
4816   },
4817
4818   /* PREFIX_VEX_3837 */
4819   {
4820     { "(bad)",  { XX } },
4821     { "(bad)",  { XX } },
4822     { VEX_LEN_TABLE (VEX_LEN_3837_P_2) },
4823     { "(bad)",  { XX } },
4824   },
4825
4826   /* PREFIX_VEX_3838 */
4827   {
4828     { "(bad)",  { XX } },
4829     { "(bad)",  { XX } },
4830     { VEX_LEN_TABLE (VEX_LEN_3838_P_2) },
4831     { "(bad)",  { XX } },
4832   },
4833
4834   /* PREFIX_VEX_3839 */
4835   {
4836     { "(bad)",  { XX } },
4837     { "(bad)",  { XX } },
4838     { VEX_LEN_TABLE (VEX_LEN_3839_P_2) },
4839     { "(bad)",  { XX } },
4840   },
4841
4842   /* PREFIX_VEX_383A */
4843   {
4844     { "(bad)",  { XX } },
4845     { "(bad)",  { XX } },
4846     { VEX_LEN_TABLE (VEX_LEN_383A_P_2) },
4847     { "(bad)",  { XX } },
4848   },
4849
4850   /* PREFIX_VEX_383B */
4851   {
4852     { "(bad)",  { XX } },
4853     { "(bad)",  { XX } },
4854     { VEX_LEN_TABLE (VEX_LEN_383B_P_2) },
4855     { "(bad)",  { XX } },
4856   },
4857
4858   /* PREFIX_VEX_383C */
4859   {
4860     { "(bad)",  { XX } },
4861     { "(bad)",  { XX } },
4862     { VEX_LEN_TABLE (VEX_LEN_383C_P_2) },
4863     { "(bad)",  { XX } },
4864   },
4865
4866   /* PREFIX_VEX_383D */
4867   {
4868     { "(bad)",  { XX } },
4869     { "(bad)",  { XX } },
4870     { VEX_LEN_TABLE (VEX_LEN_383D_P_2) },
4871     { "(bad)",  { XX } },
4872   },
4873
4874   /* PREFIX_VEX_383E */
4875   {
4876     { "(bad)",  { XX } },
4877     { "(bad)",  { XX } },
4878     { VEX_LEN_TABLE (VEX_LEN_383E_P_2) },
4879     { "(bad)",  { XX } },
4880   },
4881
4882   /* PREFIX_VEX_383F */
4883   {
4884     { "(bad)",  { XX } },
4885     { "(bad)",  { XX } },
4886     { VEX_LEN_TABLE (VEX_LEN_383F_P_2) },
4887     { "(bad)",  { XX } },
4888   },
4889
4890   /* PREFIX_VEX_3840 */
4891   {
4892     { "(bad)",  { XX } },
4893     { "(bad)",  { XX } },
4894     { VEX_LEN_TABLE (VEX_LEN_3840_P_2) },
4895     { "(bad)",  { XX } },
4896   },
4897
4898   /* PREFIX_VEX_3841 */
4899   {
4900     { "(bad)",  { XX } },
4901     { "(bad)",  { XX } },
4902     { VEX_LEN_TABLE (VEX_LEN_3841_P_2) },
4903     { "(bad)",  { XX } },
4904   },
4905
4906   /* PREFIX_VEX_3896 */
4907   {
4908     { "(bad)",  { XX } },
4909     { "(bad)",  { XX } },
4910     { "vfmaddsub132p%XW", { XM, Vex, EXx } },
4911     { "(bad)",  { XX } },
4912   },
4913
4914   /* PREFIX_VEX_3897 */
4915   {
4916     { "(bad)",  { XX } },
4917     { "(bad)",  { XX } },
4918     { "vfmsubadd132p%XW", { XM, Vex, EXx } },
4919     { "(bad)",  { XX } },
4920   },
4921
4922   /* PREFIX_VEX_3898 */
4923   {
4924     { "(bad)",  { XX } },
4925     { "(bad)",  { XX } },
4926     { "vfmadd132p%XW", { XM, Vex, EXx } },
4927     { "(bad)",  { XX } },
4928   },
4929
4930   /* PREFIX_VEX_3899 */
4931   {
4932     { "(bad)",  { XX } },
4933     { "(bad)",  { XX } },
4934     { "vfmadd132s%XW", { XM, Vex, EXVexWdq } },
4935     { "(bad)",  { XX } },
4936   },
4937
4938   /* PREFIX_VEX_389A */
4939   {
4940     { "(bad)",  { XX } },
4941     { "(bad)",  { XX } },
4942     { "vfmsub132p%XW", { XM, Vex, EXx } },
4943     { "(bad)",  { XX } },
4944   },
4945
4946   /* PREFIX_VEX_389B */
4947   {
4948     { "(bad)",  { XX } },
4949     { "(bad)",  { XX } },
4950     { "vfmsub132s%XW", { XM, Vex, EXVexWdq } },
4951     { "(bad)",  { XX } },
4952   },
4953
4954   /* PREFIX_VEX_389C */
4955   {
4956     { "(bad)",  { XX } },
4957     { "(bad)",  { XX } },
4958     { "vfnmadd132p%XW", { XM, Vex, EXx } },
4959     { "(bad)",  { XX } },
4960   },
4961
4962   /* PREFIX_VEX_389D */
4963   {
4964     { "(bad)",  { XX } },
4965     { "(bad)",  { XX } },
4966     { "vfnmadd132s%XW", { XM, Vex, EXVexWdq } },
4967     { "(bad)",  { XX } },
4968   },
4969
4970   /* PREFIX_VEX_389E */
4971   {
4972     { "(bad)",  { XX } },
4973     { "(bad)",  { XX } },
4974     { "vfnmsub132p%XW", { XM, Vex, EXx } },
4975     { "(bad)",  { XX } },
4976   },
4977
4978   /* PREFIX_VEX_389F */
4979   {
4980     { "(bad)",  { XX } },
4981     { "(bad)",  { XX } },
4982     { "vfnmsub132s%XW", { XM, Vex, EXVexWdq } },
4983     { "(bad)",  { XX } },
4984   },
4985
4986   /* PREFIX_VEX_38A6 */
4987   {
4988     { "(bad)",  { XX } },
4989     { "(bad)",  { XX } },
4990     { "vfmaddsub213p%XW", { XM, Vex, EXx } },
4991     { "(bad)",  { XX } },
4992   },
4993
4994   /* PREFIX_VEX_38A7 */
4995   {
4996     { "(bad)",  { XX } },
4997     { "(bad)",  { XX } },
4998     { "vfmsubadd213p%XW", { XM, Vex, EXx } },
4999     { "(bad)",  { XX } },
5000   },
5001
5002   /* PREFIX_VEX_38A8 */
5003   {
5004     { "(bad)",  { XX } },
5005     { "(bad)",  { XX } },
5006     { "vfmadd213p%XW", { XM, Vex, EXx } },
5007     { "(bad)",  { XX } },
5008   },
5009
5010   /* PREFIX_VEX_38A9 */
5011   {
5012     { "(bad)",  { XX } },
5013     { "(bad)",  { XX } },
5014     { "vfmadd213s%XW", { XM, Vex, EXVexWdq } },
5015     { "(bad)",  { XX } },
5016   },
5017
5018   /* PREFIX_VEX_38AA */
5019   {
5020     { "(bad)",  { XX } },
5021     { "(bad)",  { XX } },
5022     { "vfmsub213p%XW", { XM, Vex, EXx } },
5023     { "(bad)",  { XX } },
5024   },
5025
5026   /* PREFIX_VEX_38AB */
5027   {
5028     { "(bad)",  { XX } },
5029     { "(bad)",  { XX } },
5030     { "vfmsub213s%XW", { XM, Vex, EXVexWdq } },
5031     { "(bad)",  { XX } },
5032   },
5033
5034   /* PREFIX_VEX_38AC */
5035   {
5036     { "(bad)",  { XX } },
5037     { "(bad)",  { XX } },
5038     { "vfnmadd213p%XW", { XM, Vex, EXx } },
5039     { "(bad)",  { XX } },
5040   },
5041
5042   /* PREFIX_VEX_38AD */
5043   {
5044     { "(bad)",  { XX } },
5045     { "(bad)",  { XX } },
5046     { "vfnmadd213s%XW", { XM, Vex, EXVexWdq } },
5047     { "(bad)",  { XX } },
5048   },
5049
5050   /* PREFIX_VEX_38AE */
5051   {
5052     { "(bad)",  { XX } },
5053     { "(bad)",  { XX } },
5054     { "vfnmsub213p%XW", { XM, Vex, EXx } },
5055     { "(bad)",  { XX } },
5056   },
5057
5058   /* PREFIX_VEX_38AF */
5059   {
5060     { "(bad)",  { XX } },
5061     { "(bad)",  { XX } },
5062     { "vfnmsub213s%XW", { XM, Vex, EXVexWdq } },
5063     { "(bad)",  { XX } },
5064   },
5065
5066   /* PREFIX_VEX_38B6 */
5067   {
5068     { "(bad)",  { XX } },
5069     { "(bad)",  { XX } },
5070     { "vfmaddsub231p%XW", { XM, Vex, EXx } },
5071     { "(bad)",  { XX } },
5072   },
5073
5074   /* PREFIX_VEX_38B7 */
5075   {
5076     { "(bad)",  { XX } },
5077     { "(bad)",  { XX } },
5078     { "vfmsubadd231p%XW", { XM, Vex, EXx } },
5079     { "(bad)",  { XX } },
5080   },
5081
5082   /* PREFIX_VEX_38B8 */
5083   {
5084     { "(bad)",  { XX } },
5085     { "(bad)",  { XX } },
5086     { "vfmadd231p%XW", { XM, Vex, EXx } },
5087     { "(bad)",  { XX } },
5088   },
5089
5090   /* PREFIX_VEX_38B9 */
5091   {
5092     { "(bad)",  { XX } },
5093     { "(bad)",  { XX } },
5094     { "vfmadd231s%XW", { XM, Vex, EXVexWdq } },
5095     { "(bad)",  { XX } },
5096   },
5097
5098   /* PREFIX_VEX_38BA */
5099   {
5100     { "(bad)",  { XX } },
5101     { "(bad)",  { XX } },
5102     { "vfmsub231p%XW", { XM, Vex, EXx } },
5103     { "(bad)",  { XX } },
5104   },
5105
5106   /* PREFIX_VEX_38BB */
5107   {
5108     { "(bad)",  { XX } },
5109     { "(bad)",  { XX } },
5110     { "vfmsub231s%XW", { XM, Vex, EXVexWdq } },
5111     { "(bad)",  { XX } },
5112   },
5113
5114   /* PREFIX_VEX_38BC */
5115   {
5116     { "(bad)",  { XX } },
5117     { "(bad)",  { XX } },
5118     { "vfnmadd231p%XW", { XM, Vex, EXx } },
5119     { "(bad)",  { XX } },
5120   },
5121
5122   /* PREFIX_VEX_38BD */
5123   {
5124     { "(bad)",  { XX } },
5125     { "(bad)",  { XX } },
5126     { "vfnmadd231s%XW", { XM, Vex, EXVexWdq } },
5127     { "(bad)",  { XX } },
5128   },
5129
5130   /* PREFIX_VEX_38BE */
5131   {
5132     { "(bad)",  { XX } },
5133     { "(bad)",  { XX } },
5134     { "vfnmsub231p%XW", { XM, Vex, EXx } },
5135     { "(bad)",  { XX } },
5136   },
5137
5138   /* PREFIX_VEX_38BF */
5139   {
5140     { "(bad)",  { XX } },
5141     { "(bad)",  { XX } },
5142     { "vfnmsub231s%XW", { XM, Vex, EXVexWdq } },
5143     { "(bad)",  { XX } },
5144   },
5145
5146   /* PREFIX_VEX_38DB */
5147   {
5148     { "(bad)",  { XX } },
5149     { "(bad)",  { XX } },
5150     { VEX_LEN_TABLE (VEX_LEN_38DB_P_2) },
5151     { "(bad)",  { XX } },
5152   },
5153
5154   /* PREFIX_VEX_38DC */
5155   {
5156     { "(bad)",  { XX } },
5157     { "(bad)",  { XX } },
5158     { VEX_LEN_TABLE (VEX_LEN_38DC_P_2) },
5159     { "(bad)",  { XX } },
5160   },
5161
5162   /* PREFIX_VEX_38DD */
5163   {
5164     { "(bad)",  { XX } },
5165     { "(bad)",  { XX } },
5166     { VEX_LEN_TABLE (VEX_LEN_38DD_P_2) },
5167     { "(bad)",  { XX } },
5168   },
5169
5170   /* PREFIX_VEX_38DE */
5171   {
5172     { "(bad)",  { XX } },
5173     { "(bad)",  { XX } },
5174     { VEX_LEN_TABLE (VEX_LEN_38DE_P_2) },
5175     { "(bad)",  { XX } },
5176   },
5177
5178   /* PREFIX_VEX_38DF */
5179   {
5180     { "(bad)",  { XX } },
5181     { "(bad)",  { XX } },
5182     { VEX_LEN_TABLE (VEX_LEN_38DF_P_2) },
5183     { "(bad)",  { XX } },
5184   },
5185
5186   /* PREFIX_VEX_3A04 */
5187   {
5188     { "(bad)",  { XX } },
5189     { "(bad)",  { XX } },
5190     { VEX_W_TABLE (VEX_W_3A04_P_2) },
5191     { "(bad)",  { XX } },
5192   },
5193
5194   /* PREFIX_VEX_3A05 */
5195   {
5196     { "(bad)",  { XX } },
5197     { "(bad)",  { XX } },
5198     { VEX_W_TABLE (VEX_W_3A05_P_2) },
5199     { "(bad)",  { XX } },
5200   },
5201
5202   /* PREFIX_VEX_3A06 */
5203   {
5204     { "(bad)",  { XX } },
5205     { "(bad)",  { XX } },
5206     { VEX_LEN_TABLE (VEX_LEN_3A06_P_2) },
5207     { "(bad)",  { XX } },
5208   },
5209
5210   /* PREFIX_VEX_3A08 */
5211   {
5212     { "(bad)",  { XX } },
5213     { "(bad)",  { XX } },
5214     { VEX_W_TABLE (VEX_W_3A08_P_2) },
5215     { "(bad)",  { XX } },
5216   },
5217
5218   /* PREFIX_VEX_3A09 */
5219   {
5220     { "(bad)",  { XX } },
5221     { "(bad)",  { XX } },
5222     { VEX_W_TABLE (VEX_W_3A09_P_2) },
5223     { "(bad)",  { XX } },
5224   },
5225
5226   /* PREFIX_VEX_3A0A */
5227   {
5228     { "(bad)",  { XX } },
5229     { "(bad)",  { XX } },
5230     { VEX_LEN_TABLE (VEX_LEN_3A0A_P_2) },
5231     { "(bad)",  { XX } },
5232   },
5233
5234   /* PREFIX_VEX_3A0B */
5235   {
5236     { "(bad)",  { XX } },
5237     { "(bad)",  { XX } },
5238     { VEX_LEN_TABLE (VEX_LEN_3A0B_P_2) },
5239     { "(bad)",  { XX } },
5240   },
5241
5242   /* PREFIX_VEX_3A0C */
5243   {
5244     { "(bad)",  { XX } },
5245     { "(bad)",  { XX } },
5246     { VEX_W_TABLE (VEX_W_3A0C_P_2) },
5247     { "(bad)",  { XX } },
5248   },
5249
5250   /* PREFIX_VEX_3A0D */
5251   {
5252     { "(bad)",  { XX } },
5253     { "(bad)",  { XX } },
5254     { VEX_W_TABLE (VEX_W_3A0D_P_2) },
5255     { "(bad)",  { XX } },
5256   },
5257
5258   /* PREFIX_VEX_3A0E */
5259   {
5260     { "(bad)",  { XX } },
5261     { "(bad)",  { XX } },
5262     { VEX_LEN_TABLE (VEX_LEN_3A0E_P_2) },
5263     { "(bad)",  { XX } },
5264   },
5265
5266   /* PREFIX_VEX_3A0F */
5267   {
5268     { "(bad)",  { XX } },
5269     { "(bad)",  { XX } },
5270     { VEX_LEN_TABLE (VEX_LEN_3A0F_P_2) },
5271     { "(bad)",  { XX } },
5272   },
5273
5274   /* PREFIX_VEX_3A14 */
5275   {
5276     { "(bad)",  { XX } },
5277     { "(bad)",  { XX } },
5278     { VEX_LEN_TABLE (VEX_LEN_3A14_P_2) },
5279     { "(bad)",  { XX } },
5280   },
5281
5282   /* PREFIX_VEX_3A15 */
5283   {
5284     { "(bad)",  { XX } },
5285     { "(bad)",  { XX } },
5286     { VEX_LEN_TABLE (VEX_LEN_3A15_P_2) },
5287     { "(bad)",  { XX } },
5288   },
5289
5290   /* PREFIX_VEX_3A16 */
5291   {
5292     { "(bad)",  { XX } },
5293     { "(bad)",  { XX } },
5294     { VEX_LEN_TABLE (VEX_LEN_3A16_P_2) },
5295     { "(bad)",  { XX } },
5296   },
5297
5298   /* PREFIX_VEX_3A17 */
5299   {
5300     { "(bad)",  { XX } },
5301     { "(bad)",  { XX } },
5302     { VEX_LEN_TABLE (VEX_LEN_3A17_P_2) },
5303     { "(bad)",  { XX } },
5304   },
5305
5306   /* PREFIX_VEX_3A18 */
5307   {
5308     { "(bad)",  { XX } },
5309     { "(bad)",  { XX } },
5310     { VEX_LEN_TABLE (VEX_LEN_3A18_P_2) },
5311     { "(bad)",  { XX } },
5312   },
5313
5314   /* PREFIX_VEX_3A19 */
5315   {
5316     { "(bad)",  { XX } },
5317     { "(bad)",  { XX } },
5318     { VEX_LEN_TABLE (VEX_LEN_3A19_P_2) },
5319     { "(bad)",  { XX } },
5320   },
5321
5322   /* PREFIX_VEX_3A20 */
5323   {
5324     { "(bad)",  { XX } },
5325     { "(bad)",  { XX } },
5326     { VEX_LEN_TABLE (VEX_LEN_3A20_P_2) },
5327     { "(bad)",  { XX } },
5328   },
5329
5330   /* PREFIX_VEX_3A21 */
5331   {
5332     { "(bad)",  { XX } },
5333     { "(bad)",  { XX } },
5334     { VEX_LEN_TABLE (VEX_LEN_3A21_P_2) },
5335     { "(bad)",  { XX } },
5336   },
5337
5338   /* PREFIX_VEX_3A22 */
5339   {
5340     { "(bad)",  { XX } },
5341     { "(bad)",  { XX } },
5342     { VEX_LEN_TABLE (VEX_LEN_3A22_P_2) },
5343     { "(bad)",  { XX } },
5344   },
5345
5346   /* PREFIX_VEX_3A40 */
5347   {
5348     { "(bad)",  { XX } },
5349     { "(bad)",  { XX } },
5350     { VEX_W_TABLE (VEX_W_3A40_P_2) },
5351     { "(bad)",  { XX } },
5352   },
5353
5354   /* PREFIX_VEX_3A41 */
5355   {
5356     { "(bad)",  { XX } },
5357     { "(bad)",  { XX } },
5358     { VEX_LEN_TABLE (VEX_LEN_3A41_P_2) },
5359     { "(bad)",  { XX } },
5360   },
5361
5362   /* PREFIX_VEX_3A42 */
5363   {
5364     { "(bad)",  { XX } },
5365     { "(bad)",  { XX } },
5366     { VEX_LEN_TABLE (VEX_LEN_3A42_P_2) },
5367     { "(bad)",  { XX } },
5368   },
5369
5370   /* PREFIX_VEX_3A44 */
5371   {
5372     { "(bad)",  { XX } },
5373     { "(bad)",  { XX } },
5374     { VEX_LEN_TABLE (VEX_LEN_3A44_P_2) },
5375     { "(bad)",  { XX } },
5376   },
5377
5378   /* PREFIX_VEX_3A4A */
5379   {
5380     { "(bad)",  { XX } },
5381     { "(bad)",  { XX } },
5382     { VEX_W_TABLE (VEX_W_3A4A_P_2) },
5383     { "(bad)",  { XX } },
5384   },
5385
5386   /* PREFIX_VEX_3A4B */
5387   {
5388     { "(bad)",  { XX } },
5389     { "(bad)",  { XX } },
5390     { VEX_W_TABLE (VEX_W_3A4B_P_2) },
5391     { "(bad)",  { XX } },
5392   },
5393
5394   /* PREFIX_VEX_3A4C */
5395   {
5396     { "(bad)",  { XX } },
5397     { "(bad)",  { XX } },
5398     { VEX_LEN_TABLE (VEX_LEN_3A4C_P_2) },
5399     { "(bad)",  { XX } },
5400   },
5401
5402   /* PREFIX_VEX_3A5C */
5403   {
5404     { "(bad)",  { XX } },
5405     { "(bad)",  { XX } },
5406     { "vfmaddsubps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5407     { "(bad)",  { XX } },
5408   },
5409
5410   /* PREFIX_VEX_3A5D */
5411   {
5412     { "(bad)",  { XX } },
5413     { "(bad)",  { XX } },
5414     { "vfmaddsubpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5415     { "(bad)",  { XX } },
5416   },
5417
5418   /* PREFIX_VEX_3A5E */
5419   {
5420     { "(bad)",  { XX } },
5421     { "(bad)",  { XX } },
5422     { "vfmsubaddps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5423     { "(bad)",  { XX } },
5424   },
5425
5426   /* PREFIX_VEX_3A5F */
5427   {
5428     { "(bad)",  { XX } },
5429     { "(bad)",  { XX } },
5430     { "vfmsubaddpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5431     { "(bad)",  { XX } },
5432   },
5433
5434   /* PREFIX_VEX_3A60 */
5435   {
5436     { "(bad)",  { XX } },
5437     { "(bad)",  { XX } },
5438     { VEX_LEN_TABLE (VEX_LEN_3A60_P_2) },
5439     { "(bad)",  { XX } },
5440   },
5441
5442   /* PREFIX_VEX_3A61 */
5443   {
5444     { "(bad)",  { XX } },
5445     { "(bad)",  { XX } },
5446     { VEX_LEN_TABLE (VEX_LEN_3A61_P_2) },
5447     { "(bad)",  { XX } },
5448   },
5449
5450   /* PREFIX_VEX_3A62 */
5451   {
5452     { "(bad)",  { XX } },
5453     { "(bad)",  { XX } },
5454     { VEX_LEN_TABLE (VEX_LEN_3A62_P_2) },
5455     { "(bad)",  { XX } },
5456   },
5457
5458   /* PREFIX_VEX_3A63 */
5459   {
5460     { "(bad)",  { XX } },
5461     { "(bad)",  { XX } },
5462     { VEX_LEN_TABLE (VEX_LEN_3A63_P_2) },
5463     { "(bad)",  { XX } },
5464   },
5465
5466   /* PREFIX_VEX_3A68 */
5467   {
5468     { "(bad)",  { XX } },
5469     { "(bad)",  { XX } },
5470     { "vfmaddps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5471     { "(bad)",  { XX } },
5472   },
5473
5474   /* PREFIX_VEX_3A69 */
5475   {
5476     { "(bad)",  { XX } },
5477     { "(bad)",  { XX } },
5478     { "vfmaddpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5479     { "(bad)",  { XX } },
5480   },
5481
5482   /* PREFIX_VEX_3A6A */
5483   {
5484     { "(bad)",  { XX } },
5485     { "(bad)",  { XX } },
5486     { VEX_LEN_TABLE (VEX_LEN_3A6A_P_2) },
5487     { "(bad)",  { XX } },
5488   },
5489
5490   /* PREFIX_VEX_3A6B */
5491   {
5492     { "(bad)",  { XX } },
5493     { "(bad)",  { XX } },
5494     { VEX_LEN_TABLE (VEX_LEN_3A6B_P_2) },
5495     { "(bad)",  { XX } },
5496   },
5497
5498   /* PREFIX_VEX_3A6C */
5499   {
5500     { "(bad)",  { XX } },
5501     { "(bad)",  { XX } },
5502     { "vfmsubps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5503     { "(bad)",  { XX } },
5504   },
5505
5506   /* PREFIX_VEX_3A6D */
5507   {
5508     { "(bad)",  { XX } },
5509     { "(bad)",  { XX } },
5510     { "vfmsubpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5511     { "(bad)",  { XX } },
5512   },
5513
5514   /* PREFIX_VEX_3A6E */
5515   {
5516     { "(bad)",  { XX } },
5517     { "(bad)",  { XX } },
5518     { VEX_LEN_TABLE (VEX_LEN_3A6E_P_2) },
5519     { "(bad)",  { XX } },
5520   },
5521
5522   /* PREFIX_VEX_3A6F */
5523   {
5524     { "(bad)",  { XX } },
5525     { "(bad)",  { XX } },
5526     { VEX_LEN_TABLE (VEX_LEN_3A6F_P_2) },
5527     { "(bad)",  { XX } },
5528   },
5529
5530   /* PREFIX_VEX_3A78 */
5531   {
5532     { "(bad)",  { XX } },
5533     { "(bad)",  { XX } },
5534     { "vfnmaddps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5535     { "(bad)",  { XX } },
5536   },
5537
5538   /* PREFIX_VEX_3A79 */
5539   {
5540     { "(bad)",  { XX } },
5541     { "(bad)",  { XX } },
5542     { "vfnmaddpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5543     { "(bad)",  { XX } },
5544   },
5545
5546   /* PREFIX_VEX_3A7A */
5547   {
5548     { "(bad)",  { XX } },
5549     { "(bad)",  { XX } },
5550     { VEX_LEN_TABLE (VEX_LEN_3A7A_P_2) },
5551     { "(bad)",  { XX } },
5552   },
5553
5554   /* PREFIX_VEX_3A7B */
5555   {
5556     { "(bad)",  { XX } },
5557     { "(bad)",  { XX } },
5558     { VEX_LEN_TABLE (VEX_LEN_3A7B_P_2) },
5559     { "(bad)",  { XX } },
5560   },
5561
5562   /* PREFIX_VEX_3A7C */
5563   {
5564     { "(bad)",  { XX } },
5565     { "(bad)",  { XX } },
5566     { "vfnmsubps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5567     { "(bad)",  { XX } },
5568   },
5569
5570   /* PREFIX_VEX_3A7D */
5571   {
5572     { "(bad)",  { XX } },
5573     { "(bad)",  { XX } },
5574     { "vfnmsubpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5575     { "(bad)",  { XX } },
5576   },
5577
5578   /* PREFIX_VEX_3A7E */
5579   {
5580     { "(bad)",  { XX } },
5581     { "(bad)",  { XX } },
5582     { VEX_LEN_TABLE (VEX_LEN_3A7E_P_2) },
5583     { "(bad)",  { XX } },
5584   },
5585
5586   /* PREFIX_VEX_3A7F */
5587   {
5588     { "(bad)",  { XX } },
5589     { "(bad)",  { XX } },
5590     { VEX_LEN_TABLE (VEX_LEN_3A7F_P_2) },
5591     { "(bad)",  { XX } },
5592   },
5593
5594   /* PREFIX_VEX_3ADF */
5595   {
5596     { "(bad)",  { XX } },
5597     { "(bad)",  { XX } },
5598     { VEX_LEN_TABLE (VEX_LEN_3ADF_P_2) },
5599     { "(bad)",  { XX } },
5600   },
5601 };
5602
5603 static const struct dis386 x86_64_table[][2] = {
5604   /* X86_64_06 */
5605   {
5606     { "push{T|}", { es } },
5607     { "(bad)", { XX } },
5608   },
5609
5610   /* X86_64_07 */
5611   {
5612     { "pop{T|}", { es } },
5613     { "(bad)", { XX } },
5614   },
5615
5616   /* X86_64_0D */
5617   {
5618     { "push{T|}", { cs } },
5619     { "(bad)", { XX } },
5620   },
5621
5622   /* X86_64_16 */
5623   {
5624     { "push{T|}", { ss } },
5625     { "(bad)", { XX } },
5626   },
5627
5628   /* X86_64_17 */
5629   {
5630     { "pop{T|}", { ss } },
5631     { "(bad)", { XX } },
5632   },
5633
5634   /* X86_64_1E */
5635   {
5636     { "push{T|}", { ds } },
5637     { "(bad)", { XX } },
5638   },
5639
5640   /* X86_64_1F */
5641   {
5642     { "pop{T|}", { ds } },
5643     { "(bad)", { XX } },
5644   },
5645
5646   /* X86_64_27 */
5647   {
5648     { "daa", { XX } },
5649     { "(bad)", { XX } },
5650   },
5651
5652   /* X86_64_2F */
5653   {
5654     { "das", { XX } },
5655     { "(bad)", { XX } },
5656   },
5657
5658   /* X86_64_37 */
5659   {
5660     { "aaa", { XX } },
5661     { "(bad)", { XX } },
5662   },
5663
5664   /* X86_64_3F */
5665   {
5666     { "aas", { XX } },
5667     { "(bad)", { XX } },
5668   },
5669
5670   /* X86_64_60 */
5671   {
5672     { "pusha{P|}", { XX } },
5673     { "(bad)", { XX } },
5674   },
5675
5676   /* X86_64_61 */
5677   {
5678     { "popa{P|}", { XX } },
5679     { "(bad)", { XX } },
5680   },
5681
5682   /* X86_64_62 */
5683   {
5684     { MOD_TABLE (MOD_62_32BIT) },
5685     { "(bad)", { XX } },
5686   },
5687
5688   /* X86_64_63 */
5689   {
5690     { "arpl", { Ew, Gw } },
5691     { "movs{lq|xd}", { Gv, Ed } },
5692   },
5693
5694   /* X86_64_6D */
5695   {
5696     { "ins{R|}", { Yzr, indirDX } },
5697     { "ins{G|}", { Yzr, indirDX } },
5698   },
5699
5700   /* X86_64_6F */
5701   {
5702     { "outs{R|}", { indirDXr, Xz } },
5703     { "outs{G|}", { indirDXr, Xz } },
5704   },
5705
5706   /* X86_64_9A */
5707   {
5708     { "Jcall{T|}", { Ap } },
5709     { "(bad)", { XX } },
5710   },
5711
5712   /* X86_64_C4 */
5713   {
5714     { MOD_TABLE (MOD_C4_32BIT) },
5715     { VEX_C4_TABLE (VEX_0F) },
5716   },
5717
5718   /* X86_64_C5 */
5719   {
5720     { MOD_TABLE (MOD_C5_32BIT) },
5721     { VEX_C5_TABLE (VEX_0F) },
5722   },
5723
5724   /* X86_64_CE */
5725   {
5726     { "into", { XX } },
5727     { "(bad)", { XX } },
5728   },
5729
5730   /* X86_64_D4 */
5731   {
5732     { "aam", { sIb } },
5733     { "(bad)", { XX } },
5734   },
5735
5736   /* X86_64_D5 */
5737   {
5738     { "aad", { sIb } },
5739     { "(bad)", { XX } },
5740   },
5741
5742   /* X86_64_EA */
5743   {
5744     { "Jjmp{T|}", { Ap } },
5745     { "(bad)", { XX } },
5746   },
5747
5748   /* X86_64_0F01_REG_0 */
5749   {
5750     { "sgdt{Q|IQ}", { M } },
5751     { "sgdt", { M } },
5752   },
5753
5754   /* X86_64_0F01_REG_1 */
5755   {
5756     { "sidt{Q|IQ}", { M } },
5757     { "sidt", { M } },
5758   },
5759
5760   /* X86_64_0F01_REG_2 */
5761   {
5762     { "lgdt{Q|Q}", { M } },
5763     { "lgdt", { M } },
5764   },
5765
5766   /* X86_64_0F01_REG_3 */
5767   {
5768     { "lidt{Q|Q}", { M } },
5769     { "lidt", { M } },
5770   },
5771 };
5772
5773 static const struct dis386 three_byte_table[][256] = {
5774
5775   /* THREE_BYTE_0F38 */
5776   {
5777     /* 00 */
5778     { "pshufb",         { MX, EM } },
5779     { "phaddw",         { MX, EM } },
5780     { "phaddd",         { MX, EM } },
5781     { "phaddsw",        { MX, EM } },
5782     { "pmaddubsw",      { MX, EM } },
5783     { "phsubw",         { MX, EM } },
5784     { "phsubd",         { MX, EM } },
5785     { "phsubsw",        { MX, EM } },
5786     /* 08 */
5787     { "psignb",         { MX, EM } },
5788     { "psignw",         { MX, EM } },
5789     { "psignd",         { MX, EM } },
5790     { "pmulhrsw",       { MX, EM } },
5791     { "(bad)",          { XX } },
5792     { "(bad)",          { XX } },
5793     { "(bad)",          { XX } },
5794     { "(bad)",          { XX } },
5795     /* 10 */
5796     { PREFIX_TABLE (PREFIX_0F3810) },
5797     { "(bad)",          { XX } },
5798     { "(bad)",          { XX } },
5799     { "(bad)",          { XX } },
5800     { PREFIX_TABLE (PREFIX_0F3814) },
5801     { PREFIX_TABLE (PREFIX_0F3815) },
5802     { "(bad)",          { XX } },
5803     { PREFIX_TABLE (PREFIX_0F3817) },
5804     /* 18 */
5805     { "(bad)",          { XX } },
5806     { "(bad)",          { XX } },
5807     { "(bad)",          { XX } },
5808     { "(bad)",          { XX } },
5809     { "pabsb",          { MX, EM } },
5810     { "pabsw",          { MX, EM } },
5811     { "pabsd",          { MX, EM } },
5812     { "(bad)",          { XX } },
5813     /* 20 */
5814     { PREFIX_TABLE (PREFIX_0F3820) },
5815     { PREFIX_TABLE (PREFIX_0F3821) },
5816     { PREFIX_TABLE (PREFIX_0F3822) },
5817     { PREFIX_TABLE (PREFIX_0F3823) },
5818     { PREFIX_TABLE (PREFIX_0F3824) },
5819     { PREFIX_TABLE (PREFIX_0F3825) },
5820     { "(bad)",          { XX } },
5821     { "(bad)",          { XX } },
5822     /* 28 */
5823     { PREFIX_TABLE (PREFIX_0F3828) },
5824     { PREFIX_TABLE (PREFIX_0F3829) },
5825     { PREFIX_TABLE (PREFIX_0F382A) },
5826     { PREFIX_TABLE (PREFIX_0F382B) },
5827     { "(bad)",          { XX } },
5828     { "(bad)",          { XX } },
5829     { "(bad)",          { XX } },
5830     { "(bad)",          { XX } },
5831     /* 30 */
5832     { PREFIX_TABLE (PREFIX_0F3830) },
5833     { PREFIX_TABLE (PREFIX_0F3831) },
5834     { PREFIX_TABLE (PREFIX_0F3832) },
5835     { PREFIX_TABLE (PREFIX_0F3833) },
5836     { PREFIX_TABLE (PREFIX_0F3834) },
5837     { PREFIX_TABLE (PREFIX_0F3835) },
5838     { "(bad)",          { XX } },
5839     { PREFIX_TABLE (PREFIX_0F3837) },
5840     /* 38 */
5841     { PREFIX_TABLE (PREFIX_0F3838) },
5842     { PREFIX_TABLE (PREFIX_0F3839) },
5843     { PREFIX_TABLE (PREFIX_0F383A) },
5844     { PREFIX_TABLE (PREFIX_0F383B) },
5845     { PREFIX_TABLE (PREFIX_0F383C) },
5846     { PREFIX_TABLE (PREFIX_0F383D) },
5847     { PREFIX_TABLE (PREFIX_0F383E) },
5848     { PREFIX_TABLE (PREFIX_0F383F) },
5849     /* 40 */
5850     { PREFIX_TABLE (PREFIX_0F3840) },
5851     { PREFIX_TABLE (PREFIX_0F3841) },
5852     { "(bad)",          { XX } },
5853     { "(bad)",          { XX } },
5854     { "(bad)",          { XX } },
5855     { "(bad)",          { XX } },
5856     { "(bad)",          { XX } },
5857     { "(bad)",          { XX } },
5858     /* 48 */
5859     { "(bad)",          { XX } },
5860     { "(bad)",          { XX } },
5861     { "(bad)",          { XX } },
5862     { "(bad)",          { XX } },
5863     { "(bad)",          { XX } },
5864     { "(bad)",          { XX } },
5865     { "(bad)",          { XX } },
5866     { "(bad)",          { XX } },
5867     /* 50 */
5868     { "(bad)",          { XX } },
5869     { "(bad)",          { XX } },
5870     { "(bad)",          { XX } },
5871     { "(bad)",          { XX } },
5872     { "(bad)",          { XX } },
5873     { "(bad)",          { XX } },
5874     { "(bad)",          { XX } },
5875     { "(bad)",          { XX } },
5876     /* 58 */
5877     { "(bad)",          { XX } },
5878     { "(bad)",          { XX } },
5879     { "(bad)",          { XX } },
5880     { "(bad)",          { XX } },
5881     { "(bad)",          { XX } },
5882     { "(bad)",          { XX } },
5883     { "(bad)",          { XX } },
5884     { "(bad)",          { XX } },
5885     /* 60 */
5886     { "(bad)",          { XX } },
5887     { "(bad)",          { XX } },
5888     { "(bad)",          { XX } },
5889     { "(bad)",          { XX } },
5890     { "(bad)",          { XX } },
5891     { "(bad)",          { XX } },
5892     { "(bad)",          { XX } },
5893     { "(bad)",          { XX } },
5894     /* 68 */
5895     { "(bad)",          { XX } },
5896     { "(bad)",          { XX } },
5897     { "(bad)",          { XX } },
5898     { "(bad)",          { XX } },
5899     { "(bad)",          { XX } },
5900     { "(bad)",          { XX } },
5901     { "(bad)",          { XX } },
5902     { "(bad)",          { XX } },
5903     /* 70 */
5904     { "(bad)",          { XX } },
5905     { "(bad)",          { XX } },
5906     { "(bad)",          { XX } },
5907     { "(bad)",          { XX } },
5908     { "(bad)",          { XX } },
5909     { "(bad)",          { XX } },
5910     { "(bad)",          { XX } },
5911     { "(bad)",          { XX } },
5912     /* 78 */
5913     { "(bad)",          { XX } },
5914     { "(bad)",          { XX } },
5915     { "(bad)",          { XX } },
5916     { "(bad)",          { XX } },
5917     { "(bad)",          { XX } },
5918     { "(bad)",          { XX } },
5919     { "(bad)",          { XX } },
5920     { "(bad)",          { XX } },
5921     /* 80 */
5922     { PREFIX_TABLE (PREFIX_0F3880) },
5923     { PREFIX_TABLE (PREFIX_0F3881) },
5924     { "(bad)",          { XX } },
5925     { "(bad)",          { XX } },
5926     { "(bad)",          { XX } },
5927     { "(bad)",          { XX } },
5928     { "(bad)",          { XX } },
5929     { "(bad)",          { XX } },
5930     /* 88 */
5931     { "(bad)",          { XX } },
5932     { "(bad)",          { XX } },
5933     { "(bad)",          { XX } },
5934     { "(bad)",          { XX } },
5935     { "(bad)",          { XX } },
5936     { "(bad)",          { XX } },
5937     { "(bad)",          { XX } },
5938     { "(bad)",          { XX } },
5939     /* 90 */
5940     { "(bad)",          { XX } },
5941     { "(bad)",          { XX } },
5942     { "(bad)",          { XX } },
5943     { "(bad)",          { XX } },
5944     { "(bad)",          { XX } },
5945     { "(bad)",          { XX } },
5946     { "(bad)",          { XX } },
5947     { "(bad)",          { XX } },
5948     /* 98 */
5949     { "(bad)",          { XX } },
5950     { "(bad)",          { XX } },
5951     { "(bad)",          { XX } },
5952     { "(bad)",          { XX } },
5953     { "(bad)",          { XX } },
5954     { "(bad)",          { XX } },
5955     { "(bad)",          { XX } },
5956     { "(bad)",          { XX } },
5957     /* a0 */
5958     { "(bad)",          { XX } },
5959     { "(bad)",          { XX } },
5960     { "(bad)",          { XX } },
5961     { "(bad)",          { XX } },
5962     { "(bad)",          { XX } },
5963     { "(bad)",          { XX } },
5964     { "(bad)",          { XX } },
5965     { "(bad)",          { XX } },
5966     /* a8 */
5967     { "(bad)",          { XX } },
5968     { "(bad)",          { XX } },
5969     { "(bad)",          { XX } },
5970     { "(bad)",          { XX } },
5971     { "(bad)",          { XX } },
5972     { "(bad)",          { XX } },
5973     { "(bad)",          { XX } },
5974     { "(bad)",          { XX } },
5975     /* b0 */
5976     { "(bad)",          { XX } },
5977     { "(bad)",          { XX } },
5978     { "(bad)",          { XX } },
5979     { "(bad)",          { XX } },
5980     { "(bad)",          { XX } },
5981     { "(bad)",          { XX } },
5982     { "(bad)",          { XX } },
5983     { "(bad)",          { XX } },
5984     /* b8 */
5985     { "(bad)",          { XX } },
5986     { "(bad)",          { XX } },
5987     { "(bad)",          { XX } },
5988     { "(bad)",          { XX } },
5989     { "(bad)",          { XX } },
5990     { "(bad)",          { XX } },
5991     { "(bad)",          { XX } },
5992     { "(bad)",          { XX } },
5993     /* c0 */
5994     { "(bad)",          { XX } },
5995     { "(bad)",          { XX } },
5996     { "(bad)",          { XX } },
5997     { "(bad)",          { XX } },
5998     { "(bad)",          { XX } },
5999     { "(bad)",          { XX } },
6000     { "(bad)",          { XX } },
6001     { "(bad)",          { XX } },
6002     /* c8 */
6003     { "(bad)",          { XX } },
6004     { "(bad)",          { XX } },
6005     { "(bad)",          { XX } },
6006     { "(bad)",          { XX } },
6007     { "(bad)",          { XX } },
6008     { "(bad)",          { XX } },
6009     { "(bad)",          { XX } },
6010     { "(bad)",          { XX } },
6011     /* d0 */
6012     { "(bad)",          { XX } },
6013     { "(bad)",          { XX } },
6014     { "(bad)",          { XX } },
6015     { "(bad)",          { XX } },
6016     { "(bad)",          { XX } },
6017     { "(bad)",          { XX } },
6018     { "(bad)",          { XX } },
6019     { "(bad)",          { XX } },
6020     /* d8 */
6021     { "(bad)",          { XX } },
6022     { "(bad)",          { XX } },
6023     { "(bad)",          { XX } },
6024     { PREFIX_TABLE (PREFIX_0F38DB) },
6025     { PREFIX_TABLE (PREFIX_0F38DC) },
6026     { PREFIX_TABLE (PREFIX_0F38DD) },
6027     { PREFIX_TABLE (PREFIX_0F38DE) },
6028     { PREFIX_TABLE (PREFIX_0F38DF) },
6029     /* e0 */
6030     { "(bad)",          { XX } },
6031     { "(bad)",          { XX } },
6032     { "(bad)",          { XX } },
6033     { "(bad)",          { XX } },
6034     { "(bad)",          { XX } },
6035     { "(bad)",          { XX } },
6036     { "(bad)",          { XX } },
6037     { "(bad)",          { XX } },
6038     /* e8 */
6039     { "(bad)",          { XX } },
6040     { "(bad)",          { XX } },
6041     { "(bad)",          { XX } },
6042     { "(bad)",          { XX } },
6043     { "(bad)",          { XX } },
6044     { "(bad)",          { XX } },
6045     { "(bad)",          { XX } },
6046     { "(bad)",          { XX } },
6047     /* f0 */
6048     { PREFIX_TABLE (PREFIX_0F38F0) },
6049     { PREFIX_TABLE (PREFIX_0F38F1) },
6050     { "(bad)",          { XX } },
6051     { "(bad)",          { XX } },
6052     { "(bad)",          { XX } },
6053     { "(bad)",          { XX } },
6054     { "(bad)",          { XX } },
6055     { "(bad)",          { XX } },
6056     /* f8 */
6057     { "(bad)",          { XX } },
6058     { "(bad)",          { XX } },
6059     { "(bad)",          { XX } },
6060     { "(bad)",          { XX } },
6061     { "(bad)",          { XX } },
6062     { "(bad)",          { XX } },
6063     { "(bad)",          { XX } },
6064     { "(bad)",          { XX } },
6065   },
6066   /* THREE_BYTE_0F3A */
6067   {
6068     /* 00 */
6069     { "(bad)",          { XX } },
6070     { "(bad)",          { XX } },
6071     { "(bad)",          { XX } },
6072     { "(bad)",          { XX } },
6073     { "(bad)",          { XX } },
6074     { "(bad)",          { XX } },
6075     { "(bad)",          { XX } },
6076     { "(bad)",          { XX } },
6077     /* 08 */
6078     { PREFIX_TABLE (PREFIX_0F3A08) },
6079     { PREFIX_TABLE (PREFIX_0F3A09) },
6080     { PREFIX_TABLE (PREFIX_0F3A0A) },
6081     { PREFIX_TABLE (PREFIX_0F3A0B) },
6082     { PREFIX_TABLE (PREFIX_0F3A0C) },
6083     { PREFIX_TABLE (PREFIX_0F3A0D) },
6084     { PREFIX_TABLE (PREFIX_0F3A0E) },
6085     { "palignr",        { MX, EM, Ib } },
6086     /* 10 */
6087     { "(bad)",          { XX } },
6088     { "(bad)",          { XX } },
6089     { "(bad)",          { XX } },
6090     { "(bad)",          { XX } },
6091     { PREFIX_TABLE (PREFIX_0F3A14) },
6092     { PREFIX_TABLE (PREFIX_0F3A15) },
6093     { PREFIX_TABLE (PREFIX_0F3A16) },
6094     { PREFIX_TABLE (PREFIX_0F3A17) },
6095     /* 18 */
6096     { "(bad)",          { XX } },
6097     { "(bad)",          { XX } },
6098     { "(bad)",          { XX } },
6099     { "(bad)",          { XX } },
6100     { "(bad)",          { XX } },
6101     { "(bad)",          { XX } },
6102     { "(bad)",          { XX } },
6103     { "(bad)",          { XX } },
6104     /* 20 */
6105     { PREFIX_TABLE (PREFIX_0F3A20) },
6106     { PREFIX_TABLE (PREFIX_0F3A21) },
6107     { PREFIX_TABLE (PREFIX_0F3A22) },
6108     { "(bad)",          { XX } },
6109     { "(bad)",          { XX } },
6110     { "(bad)",          { XX } },
6111     { "(bad)",          { XX } },
6112     { "(bad)",          { XX } },
6113     /* 28 */
6114     { "(bad)",          { XX } },
6115     { "(bad)",          { XX } },
6116     { "(bad)",          { XX } },
6117     { "(bad)",          { XX } },
6118     { "(bad)",          { XX } },
6119     { "(bad)",          { XX } },
6120     { "(bad)",          { XX } },
6121     { "(bad)",          { XX } },
6122     /* 30 */
6123     { "(bad)",          { XX } },
6124     { "(bad)",          { XX } },
6125     { "(bad)",          { XX } },
6126     { "(bad)",          { XX } },
6127     { "(bad)",          { XX } },
6128     { "(bad)",          { XX } },
6129     { "(bad)",          { XX } },
6130     { "(bad)",          { XX } },
6131     /* 38 */
6132     { "(bad)",          { XX } },
6133     { "(bad)",          { XX } },
6134     { "(bad)",          { XX } },
6135     { "(bad)",          { XX } },
6136     { "(bad)",          { XX } },
6137     { "(bad)",          { XX } },
6138     { "(bad)",          { XX } },
6139     { "(bad)",          { XX } },
6140     /* 40 */
6141     { PREFIX_TABLE (PREFIX_0F3A40) },
6142     { PREFIX_TABLE (PREFIX_0F3A41) },
6143     { PREFIX_TABLE (PREFIX_0F3A42) },
6144     { "(bad)",          { XX } },
6145     { PREFIX_TABLE (PREFIX_0F3A44) },
6146     { "(bad)",          { XX } },
6147     { "(bad)",          { XX } },
6148     { "(bad)",          { XX } },
6149     /* 48 */
6150     { "(bad)",          { XX } },
6151     { "(bad)",          { XX } },
6152     { "(bad)",          { XX } },
6153     { "(bad)",          { XX } },
6154     { "(bad)",          { XX } },
6155     { "(bad)",          { XX } },
6156     { "(bad)",          { XX } },
6157     { "(bad)",          { XX } },
6158     /* 50 */
6159     { "(bad)",          { XX } },
6160     { "(bad)",          { XX } },
6161     { "(bad)",          { XX } },
6162     { "(bad)",          { XX } },
6163     { "(bad)",          { XX } },
6164     { "(bad)",          { XX } },
6165     { "(bad)",          { XX } },
6166     { "(bad)",          { XX } },
6167     /* 58 */
6168     { "(bad)",          { XX } },
6169     { "(bad)",          { XX } },
6170     { "(bad)",          { XX } },
6171     { "(bad)",          { XX } },
6172     { "(bad)",          { XX } },
6173     { "(bad)",          { XX } },
6174     { "(bad)",          { XX } },
6175     { "(bad)",          { XX } },
6176     /* 60 */
6177     { PREFIX_TABLE (PREFIX_0F3A60) },
6178     { PREFIX_TABLE (PREFIX_0F3A61) },
6179     { PREFIX_TABLE (PREFIX_0F3A62) },
6180     { PREFIX_TABLE (PREFIX_0F3A63) },
6181     { "(bad)",          { XX } },
6182     { "(bad)",          { XX } },
6183     { "(bad)",          { XX } },
6184     { "(bad)",          { XX } },
6185     /* 68 */
6186     { "(bad)",          { XX } },
6187     { "(bad)",          { XX } },
6188     { "(bad)",          { XX } },
6189     { "(bad)",          { XX } },
6190     { "(bad)",          { XX } },
6191     { "(bad)",          { XX } },
6192     { "(bad)",          { XX } },
6193     { "(bad)",          { XX } },
6194     /* 70 */
6195     { "(bad)",          { XX } },
6196     { "(bad)",          { XX } },
6197     { "(bad)",          { XX } },
6198     { "(bad)",          { XX } },
6199     { "(bad)",          { XX } },
6200     { "(bad)",          { XX } },
6201     { "(bad)",          { XX } },
6202     { "(bad)",          { XX } },
6203     /* 78 */
6204     { "(bad)",          { XX } },
6205     { "(bad)",          { XX } },
6206     { "(bad)",          { XX } },
6207     { "(bad)",          { XX } },
6208     { "(bad)",          { XX } },
6209     { "(bad)",          { XX } },
6210     { "(bad)",          { XX } },
6211     { "(bad)",          { XX } },
6212     /* 80 */
6213     { "(bad)",          { XX } },
6214     { "(bad)",          { XX } },
6215     { "(bad)",          { XX } },
6216     { "(bad)",          { XX } },
6217     { "(bad)",          { XX } },
6218     { "(bad)",          { XX } },
6219     { "(bad)",          { XX } },
6220     { "(bad)",          { XX } },
6221     /* 88 */
6222     { "(bad)",          { XX } },
6223     { "(bad)",          { XX } },
6224     { "(bad)",          { XX } },
6225     { "(bad)",          { XX } },
6226     { "(bad)",          { XX } },
6227     { "(bad)",          { XX } },
6228     { "(bad)",          { XX } },
6229     { "(bad)",          { XX } },
6230     /* 90 */
6231     { "(bad)",          { XX } },
6232     { "(bad)",          { XX } },
6233     { "(bad)",          { XX } },
6234     { "(bad)",          { XX } },
6235     { "(bad)",          { XX } },
6236     { "(bad)",          { XX } },
6237     { "(bad)",          { XX } },
6238     { "(bad)",          { XX } },
6239     /* 98 */
6240     { "(bad)",          { XX } },
6241     { "(bad)",          { XX } },
6242     { "(bad)",          { XX } },
6243     { "(bad)",          { XX } },
6244     { "(bad)",          { XX } },
6245     { "(bad)",          { XX } },
6246     { "(bad)",          { XX } },
6247     { "(bad)",          { XX } },
6248     /* a0 */
6249     { "(bad)",          { XX } },
6250     { "(bad)",          { XX } },
6251     { "(bad)",          { XX } },
6252     { "(bad)",          { XX } },
6253     { "(bad)",          { XX } },
6254     { "(bad)",          { XX } },
6255     { "(bad)",          { XX } },
6256     { "(bad)",          { XX } },
6257     /* a8 */
6258     { "(bad)",          { XX } },
6259     { "(bad)",          { XX } },
6260     { "(bad)",          { XX } },
6261     { "(bad)",          { XX } },
6262     { "(bad)",          { XX } },
6263     { "(bad)",          { XX } },
6264     { "(bad)",          { XX } },
6265     { "(bad)",          { XX } },
6266     /* b0 */
6267     { "(bad)",          { XX } },
6268     { "(bad)",          { XX } },
6269     { "(bad)",          { XX } },
6270     { "(bad)",          { XX } },
6271     { "(bad)",          { XX } },
6272     { "(bad)",          { XX } },
6273     { "(bad)",          { XX } },
6274     { "(bad)",          { XX } },
6275     /* b8 */
6276     { "(bad)",          { XX } },
6277     { "(bad)",          { XX } },
6278     { "(bad)",          { XX } },
6279     { "(bad)",          { XX } },
6280     { "(bad)",          { XX } },
6281     { "(bad)",          { XX } },
6282     { "(bad)",          { XX } },
6283     { "(bad)",          { XX } },
6284     /* c0 */
6285     { "(bad)",          { XX } },
6286     { "(bad)",          { XX } },
6287     { "(bad)",          { XX } },
6288     { "(bad)",          { XX } },
6289     { "(bad)",          { XX } },
6290     { "(bad)",          { XX } },
6291     { "(bad)",          { XX } },
6292     { "(bad)",          { XX } },
6293     /* c8 */
6294     { "(bad)",          { XX } },
6295     { "(bad)",          { XX } },
6296     { "(bad)",          { XX } },
6297     { "(bad)",          { XX } },
6298     { "(bad)",          { XX } },
6299     { "(bad)",          { XX } },
6300     { "(bad)",          { XX } },
6301     { "(bad)",          { XX } },
6302     /* d0 */
6303     { "(bad)",          { XX } },
6304     { "(bad)",          { XX } },
6305     { "(bad)",          { XX } },
6306     { "(bad)",          { XX } },
6307     { "(bad)",          { XX } },
6308     { "(bad)",          { XX } },
6309     { "(bad)",          { XX } },
6310     { "(bad)",          { XX } },
6311     /* d8 */
6312     { "(bad)",          { XX } },
6313     { "(bad)",          { XX } },
6314     { "(bad)",          { XX } },
6315     { "(bad)",          { XX } },
6316     { "(bad)",          { XX } },
6317     { "(bad)",          { XX } },
6318     { "(bad)",          { XX } },
6319     { PREFIX_TABLE (PREFIX_0F3ADF) },
6320     /* e0 */
6321     { "(bad)",          { XX } },
6322     { "(bad)",          { XX } },
6323     { "(bad)",          { XX } },
6324     { "(bad)",          { XX } },
6325     { "(bad)",          { XX } },
6326     { "(bad)",          { XX } },
6327     { "(bad)",          { XX } },
6328     { "(bad)",          { XX } },
6329     /* e8 */
6330     { "(bad)",          { XX } },
6331     { "(bad)",          { XX } },
6332     { "(bad)",          { XX } },
6333     { "(bad)",          { XX } },
6334     { "(bad)",          { XX } },
6335     { "(bad)",          { XX } },
6336     { "(bad)",          { XX } },
6337     { "(bad)",          { XX } },
6338     /* f0 */
6339     { "(bad)",          { XX } },
6340     { "(bad)",          { XX } },
6341     { "(bad)",          { XX } },
6342     { "(bad)",          { XX } },
6343     { "(bad)",          { XX } },
6344     { "(bad)",          { XX } },
6345     { "(bad)",          { XX } },
6346     { "(bad)",          { XX } },
6347     /* f8 */
6348     { "(bad)",          { XX } },
6349     { "(bad)",          { XX } },
6350     { "(bad)",          { XX } },
6351     { "(bad)",          { XX } },
6352     { "(bad)",          { XX } },
6353     { "(bad)",          { XX } },
6354     { "(bad)",          { XX } },
6355     { "(bad)",          { XX } },
6356   },
6357
6358   /* THREE_BYTE_0F7A */
6359   {
6360     /* 00 */
6361     { "(bad)",          { XX } },
6362     { "(bad)",          { XX } },
6363     { "(bad)",          { XX } },
6364     { "(bad)",          { XX } },
6365     { "(bad)",          { XX } },
6366     { "(bad)",          { XX } },
6367     { "(bad)",          { XX } },
6368     { "(bad)",          { XX } },
6369     /* 08 */
6370     { "(bad)",          { XX } },
6371     { "(bad)",          { XX } },
6372     { "(bad)",          { XX } },
6373     { "(bad)",          { XX } },
6374     { "(bad)",          { XX } },
6375     { "(bad)",          { XX } },
6376     { "(bad)",          { XX } },
6377     { "(bad)",          { XX } },
6378     /* 10 */
6379     { "(bad)",          { XX } },
6380     { "(bad)",          { XX } },
6381     { "(bad)",          { XX } },
6382     { "(bad)",          { XX } },
6383     { "(bad)",          { XX } },
6384     { "(bad)",          { XX } },
6385     { "(bad)",          { XX } },
6386     { "(bad)",          { XX } },
6387     /* 18 */
6388     { "(bad)",          { XX } },
6389     { "(bad)",          { XX } },
6390     { "(bad)",          { XX } },
6391     { "(bad)",          { XX } },
6392     { "(bad)",          { XX } },
6393     { "(bad)",          { XX } },
6394     { "(bad)",          { XX } },
6395     { "(bad)",          { XX } },
6396     /* 20 */
6397     { "ptest",          { XX } },
6398     { "(bad)",          { XX } },
6399     { "(bad)",          { XX } },
6400     { "(bad)",          { XX } },
6401     { "(bad)",          { XX } },
6402     { "(bad)",          { XX } },
6403     { "(bad)",          { XX } },
6404     { "(bad)",          { XX } },
6405     /* 28 */
6406     { "(bad)",          { XX } },
6407     { "(bad)",          { XX } },
6408     { "(bad)",          { XX } },
6409     { "(bad)",          { XX } },
6410     { "(bad)",          { XX } },
6411     { "(bad)",          { XX } },
6412     { "(bad)",          { XX } },
6413     { "(bad)",          { XX } },
6414     /* 30 */
6415     { "(bad)",          { XX } },
6416     { "(bad)",          { XX } },
6417     { "(bad)",          { XX } },
6418     { "(bad)",          { XX } },
6419     { "(bad)",          { XX } },
6420     { "(bad)",          { XX } },
6421     { "(bad)",          { XX } },
6422     { "(bad)",          { XX } },
6423     /* 38 */
6424     { "(bad)",          { XX } },
6425     { "(bad)",          { XX } },
6426     { "(bad)",          { XX } },
6427     { "(bad)",          { XX } },
6428     { "(bad)",          { XX } },
6429     { "(bad)",          { XX } },
6430     { "(bad)",          { XX } },
6431     { "(bad)",          { XX } },
6432     /* 40 */
6433     { "(bad)",          { XX } },
6434     { "phaddbw",        { XM, EXq } },
6435     { "phaddbd",        { XM, EXq } },
6436     { "phaddbq",        { XM, EXq } },
6437     { "(bad)",          { XX } },
6438     { "(bad)",          { XX } },
6439     { "phaddwd",        { XM, EXq } },
6440     { "phaddwq",        { XM, EXq } },
6441     /* 48 */
6442     { "(bad)",          { XX } },
6443     { "(bad)",          { XX } },
6444     { "(bad)",          { XX } },
6445     { "phadddq",        { XM, EXq } },
6446     { "(bad)",          { XX } },
6447     { "(bad)",          { XX } },
6448     { "(bad)",          { XX } },
6449     { "(bad)",          { XX } },
6450     /* 50 */
6451     { "(bad)",          { XX } },
6452     { "phaddubw",       { XM, EXq } },
6453     { "phaddubd",       { XM, EXq } },
6454     { "phaddubq",       { XM, EXq } },
6455     { "(bad)",          { XX } },
6456     { "(bad)",          { XX } },
6457     { "phadduwd",       { XM, EXq } },
6458     { "phadduwq",       { XM, EXq } },
6459     /* 58 */
6460     { "(bad)",          { XX } },
6461     { "(bad)",          { XX } },
6462     { "(bad)",          { XX } },
6463     { "phaddudq",       { XM, EXq } },
6464     { "(bad)",          { XX } },
6465     { "(bad)",          { XX } },
6466     { "(bad)",          { XX } },
6467     { "(bad)",          { XX } },
6468     /* 60 */
6469     { "(bad)",          { XX } },
6470     { "phsubbw",        { XM, EXq } },
6471     { "phsubbd",        { XM, EXq } },
6472     { "phsubbq",        { XM, EXq } },
6473     { "(bad)",          { XX } },
6474     { "(bad)",          { XX } },
6475     { "(bad)",          { XX } },
6476     { "(bad)",          { XX } },
6477     /* 68 */
6478     { "(bad)",          { XX } },
6479     { "(bad)",          { XX } },
6480     { "(bad)",          { XX } },
6481     { "(bad)",          { XX } },
6482     { "(bad)",          { XX } },
6483     { "(bad)",          { XX } },
6484     { "(bad)",          { XX } },
6485     { "(bad)",          { XX } },
6486     /* 70 */
6487     { "(bad)",          { XX } },
6488     { "(bad)",          { XX } },
6489     { "(bad)",          { XX } },
6490     { "(bad)",          { XX } },
6491     { "(bad)",          { XX } },
6492     { "(bad)",          { XX } },
6493     { "(bad)",          { XX } },
6494     { "(bad)",          { XX } },
6495     /* 78 */
6496     { "(bad)",          { XX } },
6497     { "(bad)",          { XX } },
6498     { "(bad)",          { XX } },
6499     { "(bad)",          { XX } },
6500     { "(bad)",          { XX } },
6501     { "(bad)",          { XX } },
6502     { "(bad)",          { XX } },
6503     { "(bad)",          { XX } },
6504     /* 80 */
6505     { "(bad)",          { XX } },
6506     { "(bad)",          { XX } },
6507     { "(bad)",          { XX } },
6508     { "(bad)",          { XX } },
6509     { "(bad)",          { XX } },
6510     { "(bad)",          { XX } },
6511     { "(bad)",          { XX } },
6512     { "(bad)",          { XX } },
6513     /* 88 */
6514     { "(bad)",          { XX } },
6515     { "(bad)",          { XX } },
6516     { "(bad)",          { XX } },
6517     { "(bad)",          { XX } },
6518     { "(bad)",          { XX } },
6519     { "(bad)",          { XX } },
6520     { "(bad)",          { XX } },
6521     { "(bad)",          { XX } },
6522     /* 90 */
6523     { "(bad)",          { XX } },
6524     { "(bad)",          { XX } },
6525     { "(bad)",          { XX } },
6526     { "(bad)",          { XX } },
6527     { "(bad)",          { XX } },
6528     { "(bad)",          { XX } },
6529     { "(bad)",          { XX } },
6530     { "(bad)",          { XX } },
6531     /* 98 */
6532     { "(bad)",          { XX } },
6533     { "(bad)",          { XX } },
6534     { "(bad)",          { XX } },
6535     { "(bad)",          { XX } },
6536     { "(bad)",          { XX } },
6537     { "(bad)",          { XX } },
6538     { "(bad)",          { XX } },
6539     { "(bad)",          { XX } },
6540     /* a0 */
6541     { "(bad)",          { XX } },
6542     { "(bad)",          { XX } },
6543     { "(bad)",          { XX } },
6544     { "(bad)",          { XX } },
6545     { "(bad)",          { XX } },
6546     { "(bad)",          { XX } },
6547     { "(bad)",          { XX } },
6548     { "(bad)",          { XX } },
6549     /* a8 */
6550     { "(bad)",          { XX } },
6551     { "(bad)",          { XX } },
6552     { "(bad)",          { XX } },
6553     { "(bad)",          { XX } },
6554     { "(bad)",          { XX } },
6555     { "(bad)",          { XX } },
6556     { "(bad)",          { XX } },
6557     { "(bad)",          { XX } },
6558     /* b0 */
6559     { "(bad)",          { XX } },
6560     { "(bad)",          { XX } },
6561     { "(bad)",          { XX } },
6562     { "(bad)",          { XX } },
6563     { "(bad)",          { XX } },
6564     { "(bad)",          { XX } },
6565     { "(bad)",          { XX } },
6566     { "(bad)",          { XX } },
6567     /* b8 */
6568     { "(bad)",          { XX } },
6569     { "(bad)",          { XX } },
6570     { "(bad)",          { XX } },
6571     { "(bad)",          { XX } },
6572     { "(bad)",          { XX } },
6573     { "(bad)",          { XX } },
6574     { "(bad)",          { XX } },
6575     { "(bad)",          { XX } },
6576     /* c0 */
6577     { "(bad)",          { XX } },
6578     { "(bad)",          { XX } },
6579     { "(bad)",          { XX } },
6580     { "(bad)",          { XX } },
6581     { "(bad)",          { XX } },
6582     { "(bad)",          { XX } },
6583     { "(bad)",          { XX } },
6584     { "(bad)",          { XX } },
6585     /* c8 */
6586     { "(bad)",          { XX } },
6587     { "(bad)",          { XX } },
6588     { "(bad)",          { XX } },
6589     { "(bad)",          { XX } },
6590     { "(bad)",          { XX } },
6591     { "(bad)",          { XX } },
6592     { "(bad)",          { XX } },
6593     { "(bad)",          { XX } },
6594     /* d0 */
6595     { "(bad)",          { XX } },
6596     { "(bad)",          { XX } },
6597     { "(bad)",          { XX } },
6598     { "(bad)",          { XX } },
6599     { "(bad)",          { XX } },
6600     { "(bad)",          { XX } },
6601     { "(bad)",          { XX } },
6602     { "(bad)",          { XX } },
6603     /* d8 */
6604     { "(bad)",          { XX } },
6605     { "(bad)",          { XX } },
6606     { "(bad)",          { XX } },
6607     { "(bad)",          { XX } },
6608     { "(bad)",          { XX } },
6609     { "(bad)",          { XX } },
6610     { "(bad)",          { XX } },
6611     { "(bad)",          { XX } },
6612     /* e0 */
6613     { "(bad)",          { XX } },
6614     { "(bad)",          { XX } },
6615     { "(bad)",          { XX } },
6616     { "(bad)",          { XX } },
6617     { "(bad)",          { XX } },
6618     { "(bad)",          { XX } },
6619     { "(bad)",          { XX } },
6620     { "(bad)",          { XX } },
6621     /* e8 */
6622     { "(bad)",          { XX } },
6623     { "(bad)",          { XX } },
6624     { "(bad)",          { XX } },
6625     { "(bad)",          { XX } },
6626     { "(bad)",          { XX } },
6627     { "(bad)",          { XX } },
6628     { "(bad)",          { XX } },
6629     { "(bad)",          { XX } },
6630     /* f0 */
6631     { "(bad)",          { XX } },
6632     { "(bad)",          { XX } },
6633     { "(bad)",          { XX } },
6634     { "(bad)",          { XX } },
6635     { "(bad)",          { XX } },
6636     { "(bad)",          { XX } },
6637     { "(bad)",          { XX } },
6638     { "(bad)",          { XX } },
6639     /* f8 */
6640     { "(bad)",          { XX } },
6641     { "(bad)",          { XX } },
6642     { "(bad)",          { XX } },
6643     { "(bad)",          { XX } },
6644     { "(bad)",          { XX } },
6645     { "(bad)",          { XX } },
6646     { "(bad)",          { XX } },
6647     { "(bad)",          { XX } },
6648   },
6649 };
6650
6651 static const struct dis386 xop_table[][256] = {
6652   /* XOP_08 */
6653   {
6654     /* 00 */
6655     { "(bad)",          { XX } },
6656     { "(bad)",          { XX } },
6657     { "(bad)",          { XX } },
6658     { "(bad)",          { XX } },
6659     { "(bad)",          { XX } },
6660     { "(bad)",          { XX } },
6661     { "(bad)",          { XX } },
6662     { "(bad)",          { XX } },
6663     /* 08 */
6664     { "(bad)",          { XX } },
6665     { "(bad)",          { XX } },
6666     { "(bad)",          { XX } },
6667     { "(bad)",          { XX } },
6668     { "(bad)",          { XX } },
6669     { "(bad)",          { XX } },
6670     { "(bad)",          { XX } },
6671     { "(bad)",          { XX } },
6672     /* 10 */
6673     { "(bad)",          { XX } },
6674     { "(bad)",          { XX } },
6675     { "(bad)",          { XX } },
6676     { "(bad)",          { XX } },
6677     { "(bad)",          { XX } },
6678     { "(bad)",          { XX } },
6679     { "(bad)",          { XX } },
6680     { "(bad)",          { XX } },
6681     /* 18 */
6682     { "(bad)",          { XX } },
6683     { "(bad)",          { XX } },
6684     { "(bad)",          { XX } },
6685     { "(bad)",          { XX } },
6686     { "(bad)",          { XX } },
6687     { "(bad)",          { XX } },
6688     { "(bad)",          { XX } },
6689     { "(bad)",          { XX } },
6690     /* 20 */
6691     { "(bad)",          { XX } },
6692     { "(bad)",          { XX } },
6693     { "(bad)",          { XX } },
6694     { "(bad)",          { XX } },
6695     { "(bad)",          { XX } },
6696     { "(bad)",          { XX } },
6697     { "(bad)",          { XX } },
6698     { "(bad)",          { XX } },
6699     /* 28 */
6700     { "(bad)",          { XX } },
6701     { "(bad)",          { XX } },
6702     { "(bad)",          { XX } },
6703     { "(bad)",          { XX } },
6704     { "(bad)",          { XX } },
6705     { "(bad)",          { XX } },
6706     { "(bad)",          { XX } },
6707     { "(bad)",          { XX } },
6708     /* 30 */
6709     { "(bad)",          { XX } },
6710     { "(bad)",          { XX } },
6711     { "(bad)",          { XX } },
6712     { "(bad)",          { XX } },
6713     { "(bad)",          { XX } },
6714     { "(bad)",          { XX } },
6715     { "(bad)",          { XX } },
6716     { "(bad)",          { XX } },
6717     /* 38 */
6718     { "(bad)",          { XX } },
6719     { "(bad)",          { XX } },
6720     { "(bad)",          { XX } },
6721     { "(bad)",          { XX } },
6722     { "(bad)",          { XX } },
6723     { "(bad)",          { XX } },
6724     { "(bad)",          { XX } },
6725     { "(bad)",          { XX } },
6726     /* 40 */
6727     { "(bad)",          { XX } },
6728     { "(bad)",          { XX } },
6729     { "(bad)",          { XX } },
6730     { "(bad)",          { XX } },
6731     { "(bad)",          { XX } },
6732     { "(bad)",          { XX } },
6733     { "(bad)",          { XX } },
6734     { "(bad)",          { XX } },
6735     /* 48 */
6736     { "(bad)",          { XX } },
6737     { "(bad)",          { XX } },
6738     { "(bad)",          { XX } },
6739     { "(bad)",          { XX } },
6740     { "(bad)",          { XX } },
6741     { "(bad)",          { XX } },
6742     { "(bad)",          { XX } },
6743     { "(bad)",          { XX } },
6744     /* 50 */
6745     { "(bad)",          { XX } },
6746     { "(bad)",          { XX } },
6747     { "(bad)",          { XX } },
6748     { "(bad)",          { XX } },
6749     { "(bad)",          { XX } },
6750     { "(bad)",          { XX } },
6751     { "(bad)",          { XX } },
6752     { "(bad)",          { XX } },
6753     /* 58 */
6754     { "(bad)",          { XX } },
6755     { "(bad)",          { XX } },
6756     { "(bad)",          { XX } },
6757     { "(bad)",          { XX } },
6758     { "(bad)",          { XX } },
6759     { "(bad)",          { XX } },
6760     { "(bad)",          { XX } },
6761     { "(bad)",          { XX } },
6762     /* 60 */
6763     { "(bad)",          { XX } },
6764     { "(bad)",          { XX } },
6765     { "(bad)",          { XX } },
6766     { "(bad)",          { XX } },
6767     { "(bad)",          { XX } },
6768     { "(bad)",          { XX } },
6769     { "(bad)",          { XX } },
6770     { "(bad)",          { XX } },
6771     /* 68 */
6772     { "(bad)",          { XX } },
6773     { "(bad)",          { XX } },
6774     { "(bad)",          { XX } },
6775     { "(bad)",          { XX } },
6776     { "(bad)",          { XX } },
6777     { "(bad)",          { XX } },
6778     { "(bad)",          { XX } },
6779     { "(bad)",          { XX } },
6780     /* 70 */
6781     { "(bad)",          { XX } },
6782     { "(bad)",          { XX } },
6783     { "(bad)",          { XX } },
6784     { "(bad)",          { XX } },
6785     { "(bad)",          { XX } },
6786     { "(bad)",          { XX } },
6787     { "(bad)",          { XX } },
6788     { "(bad)",          { XX } },
6789     /* 78 */
6790     { "(bad)",          { XX } },
6791     { "(bad)",          { XX } },
6792     { "(bad)",          { XX } },
6793     { "(bad)",          { XX } },
6794     { "(bad)",          { XX } },
6795     { "(bad)",          { XX } },
6796     { "(bad)",          { XX } },
6797     { "(bad)",          { XX } },
6798     /* 80 */
6799     { "(bad)",          { XX } },
6800     { "(bad)",          { XX } },
6801     { "(bad)",          { XX } },
6802     { "(bad)",          { XX } },
6803     { "(bad)",          { XX } },
6804     { "vpmacssww",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6805     { "vpmacsswd",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6806     { "vpmacssdql",     { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6807     /* 88 */
6808     { "(bad)",          { XX } },
6809     { "(bad)",          { XX } },
6810     { "(bad)",          { XX } },
6811     { "(bad)",          { XX } },
6812     { "(bad)",          { XX } },
6813     { "(bad)",          { XX } },
6814     { "vpmacssdd",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6815     { "vpmacssdqh",     { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6816     /* 90 */
6817     { "(bad)",          { XX } },
6818     { "(bad)",          { XX } },
6819     { "(bad)",          { XX } },
6820     { "(bad)",          { XX } },
6821     { "(bad)",          { XX } },
6822     { "vpmacsww",       { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6823     { "vpmacswd",       { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6824     { "vpmacsdql",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6825     /* 98 */
6826     { "(bad)",          { XX } },
6827     { "(bad)",          { XX } },
6828     { "(bad)",          { XX } },
6829     { "(bad)",          { XX } },
6830     { "(bad)",          { XX } },
6831     { "(bad)",          { XX } },
6832     { "vpmacsdd",       { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6833     { "vpmacsdqh",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6834     /* a0 */
6835     { "(bad)",          { XX } },
6836     { "(bad)",          { XX } },
6837     { "vpcmov",         { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6838     { "vpperm",         { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6839     { "(bad)",          { XX } },
6840     { "(bad)",          { XX } },
6841     { "vpmadcsswd",     { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6842     { "(bad)",          { XX } },
6843     /* a8 */
6844     { "(bad)",          { XX } },
6845     { "(bad)",          { XX } },
6846     { "(bad)",          { XX } },
6847     { "(bad)",          { XX } },
6848     { "(bad)",          { XX } },
6849     { "(bad)",          { XX } },
6850     { "(bad)",          { XX } },
6851     { "(bad)",          { XX } },
6852     /* b0 */
6853     { "(bad)",          { XX } },
6854     { "(bad)",          { XX } },
6855     { "(bad)",          { XX } },
6856     { "(bad)",          { XX } },
6857     { "(bad)",          { XX } },
6858     { "(bad)",          { XX } },
6859     { "vpmadcswd",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6860     { "(bad)",          { XX } },
6861     /* b8 */
6862     { "(bad)",          { XX } },
6863     { "(bad)",          { XX } },
6864     { "(bad)",          { XX } },
6865     { "(bad)",          { XX } },
6866     { "(bad)",          { XX } },
6867     { "(bad)",          { XX } },
6868     { "(bad)",          { XX } },
6869     { "(bad)",          { XX } },
6870     /* c0 */
6871     { "vprotb",         { XM, Vex_2src_1, Ib } },
6872     { "vprotw",         { XM, Vex_2src_1, Ib } },
6873     { "vprotd",         { XM, Vex_2src_1, Ib } },
6874     { "vprotq",         { XM, Vex_2src_1, Ib } },
6875     { "(bad)",          { XX } },
6876     { "(bad)",          { XX } },
6877     { "(bad)",          { XX } },
6878     { "(bad)",          { XX } },
6879     /* c8 */
6880     { "(bad)",          { XX } },
6881     { "(bad)",          { XX } },
6882     { "(bad)",          { XX } },
6883     { "(bad)",          { XX } },
6884     { "vpcomb",         { XM, Vex128, EXx, Ib } },
6885     { "vpcomw",         { XM, Vex128, EXx, Ib } },
6886     { "vpcomd",         { XM, Vex128, EXx, Ib } },
6887     { "vpcomq",         { XM, Vex128, EXx, Ib } },
6888     /* d0 */
6889     { "(bad)",          { XX } },
6890     { "(bad)",          { XX } },
6891     { "(bad)",          { XX } },
6892     { "(bad)",          { XX } },
6893     { "(bad)",          { XX } },
6894     { "(bad)",          { XX } },
6895     { "(bad)",          { XX } },
6896     { "(bad)",          { XX } },
6897     /* d8 */
6898     { "(bad)",          { XX } },
6899     { "(bad)",          { XX } },
6900     { "(bad)",          { XX } },
6901     { "(bad)",          { XX } },
6902     { "(bad)",          { XX } },
6903     { "(bad)",          { XX } },
6904     { "(bad)",          { XX } },
6905     { "(bad)",          { XX } },
6906     /* e0 */
6907     { "(bad)",          { XX } },
6908     { "(bad)",          { XX } },
6909     { "(bad)",          { XX } },
6910     { "(bad)",          { XX } },
6911     { "(bad)",          { XX } },
6912     { "(bad)",          { XX } },
6913     { "(bad)",          { XX } },
6914     { "(bad)",          { XX } },
6915     /* e8 */
6916     { "(bad)",          { XX } },
6917     { "(bad)",          { XX } },
6918     { "(bad)",          { XX } },
6919     { "(bad)",          { XX } },
6920     { "vpcomub",        { XM, Vex128, EXx, Ib } },
6921     { "vpcomuw",        { XM, Vex128, EXx, Ib } },
6922     { "vpcomud",        { XM, Vex128, EXx, Ib } },
6923     { "vpcomuq",        { XM, Vex128, EXx, Ib } },
6924     /* f0 */
6925     { "(bad)",          { XX } },
6926     { "(bad)",          { XX } },
6927     { "(bad)",          { XX } },
6928     { "(bad)",          { XX } },
6929     { "(bad)",          { XX } },
6930     { "(bad)",          { XX } },
6931     { "(bad)",          { XX } },
6932     { "(bad)",          { XX } },
6933     /* f8 */
6934     { "(bad)",          { XX } },
6935     { "(bad)",          { XX } },
6936     { "(bad)",          { XX } },
6937     { "(bad)",          { XX } },
6938     { "(bad)",          { XX } },
6939     { "(bad)",          { XX } },
6940     { "(bad)",          { XX } },
6941     { "(bad)",          { XX } },
6942   },
6943   /* XOP_09 */
6944   {
6945     /* 00 */
6946     { "(bad)",          { XX } },
6947     { "(bad)",          { XX } },
6948     { "(bad)",          { XX } },
6949     { "(bad)",          { XX } },
6950     { "(bad)",          { XX } },
6951     { "(bad)",          { XX } },
6952     { "(bad)",          { XX } },
6953     { "(bad)",          { XX } },
6954     /* 08 */
6955     { "(bad)",          { XX } },
6956     { "(bad)",          { XX } },
6957     { "(bad)",          { XX } },
6958     { "(bad)",          { XX } },
6959     { "(bad)",          { XX } },
6960     { "(bad)",          { XX } },
6961     { "(bad)",          { XX } },
6962     { "(bad)",          { XX } },
6963     /* 10 */
6964     { "(bad)",          { XX } },
6965     { "(bad)",          { XX } },
6966     { REG_TABLE (REG_XOP_LWPCB) },
6967     { "(bad)",          { XX } },
6968     { "(bad)",          { XX } },
6969     { "(bad)",          { XX } },
6970     { "(bad)",          { XX } },
6971     { "(bad)",          { XX } },
6972     /* 18 */
6973     { "(bad)",          { XX } },
6974     { "(bad)",          { XX } },
6975     { "(bad)",          { XX } },
6976     { "(bad)",          { XX } },
6977     { "(bad)",          { XX } },
6978     { "(bad)",          { XX } },
6979     { "(bad)",          { XX } },
6980     { "(bad)",          { XX } },
6981     /* 20 */
6982     { "(bad)",          { XX } },
6983     { "(bad)",          { XX } },
6984     { "(bad)",          { XX } },
6985     { "(bad)",          { XX } },
6986     { "(bad)",          { XX } },
6987     { "(bad)",          { XX } },
6988     { "(bad)",          { XX } },
6989     { "(bad)",          { XX } },
6990     /* 28 */
6991     { "(bad)",          { XX } },
6992     { "(bad)",          { XX } },
6993     { "(bad)",          { XX } },
6994     { "(bad)",          { XX } },
6995     { "(bad)",          { XX } },
6996     { "(bad)",          { XX } },
6997     { "(bad)",          { XX } },
6998     { "(bad)",          { XX } },
6999     /* 30 */
7000     { "(bad)",          { XX } },
7001     { "(bad)",          { XX } },
7002     { "(bad)",          { XX } },
7003     { "(bad)",          { XX } },
7004     { "(bad)",          { XX } },
7005     { "(bad)",          { XX } },
7006     { "(bad)",          { XX } },
7007     { "(bad)",          { XX } },
7008     /* 38 */
7009     { "(bad)",          { XX } },
7010     { "(bad)",          { XX } },
7011     { "(bad)",          { XX } },
7012     { "(bad)",          { XX } },
7013     { "(bad)",          { XX } },
7014     { "(bad)",          { XX } },
7015     { "(bad)",          { XX } },
7016     { "(bad)",          { XX } },
7017     /* 40 */
7018     { "(bad)",          { XX } },
7019     { "(bad)",          { XX } },
7020     { "(bad)",          { XX } },
7021     { "(bad)",          { XX } },
7022     { "(bad)",          { XX } },
7023     { "(bad)",          { XX } },
7024     { "(bad)",          { XX } },
7025     { "(bad)",          { XX } },
7026     /* 48 */
7027     { "(bad)",          { XX } },
7028     { "(bad)",          { XX } },
7029     { "(bad)",          { XX } },
7030     { "(bad)",          { XX } },
7031     { "(bad)",          { XX } },
7032     { "(bad)",          { XX } },
7033     { "(bad)",          { XX } },
7034     { "(bad)",          { XX } },
7035     /* 50 */
7036     { "(bad)",          { XX } },
7037     { "(bad)",          { XX } },
7038     { "(bad)",          { XX } },
7039     { "(bad)",          { XX } },
7040     { "(bad)",          { XX } },
7041     { "(bad)",          { XX } },
7042     { "(bad)",          { XX } },
7043     { "(bad)",          { XX } },
7044     /* 58 */
7045     { "(bad)",          { XX } },
7046     { "(bad)",          { XX } },
7047     { "(bad)",          { XX } },
7048     { "(bad)",          { XX } },
7049     { "(bad)",          { XX } },
7050     { "(bad)",          { XX } },
7051     { "(bad)",          { XX } },
7052     { "(bad)",          { XX } },
7053     /* 60 */
7054     { "(bad)",          { XX } },
7055     { "(bad)",          { XX } },
7056     { "(bad)",          { XX } },
7057     { "(bad)",          { XX } },
7058     { "(bad)",          { XX } },
7059     { "(bad)",          { XX } },
7060     { "(bad)",          { XX } },
7061     { "(bad)",          { XX } },
7062     /* 68 */
7063     { "(bad)",          { XX } },
7064     { "(bad)",          { XX } },
7065     { "(bad)",          { XX } },
7066     { "(bad)",          { XX } },
7067     { "(bad)",          { XX } },
7068     { "(bad)",          { XX } },
7069     { "(bad)",          { XX } },
7070     { "(bad)",          { XX } },
7071     /* 70 */
7072     { "(bad)",          { XX } },
7073     { "(bad)",          { XX } },
7074     { "(bad)",          { XX } },
7075     { "(bad)",          { XX } },
7076     { "(bad)",          { XX } },
7077     { "(bad)",          { XX } },
7078     { "(bad)",          { XX } },
7079     { "(bad)",          { XX } },
7080     /* 78 */
7081     { "(bad)",          { XX } },
7082     { "(bad)",          { XX } },
7083     { "(bad)",          { XX } },
7084     { "(bad)",          { XX } },
7085     { "(bad)",          { XX } },
7086     { "(bad)",          { XX } },
7087     { "(bad)",          { XX } },
7088     { "(bad)",          { XX } },
7089     /* 80 */
7090     { VEX_LEN_TABLE (VEX_LEN_XOP_09_80) },
7091     { VEX_LEN_TABLE (VEX_LEN_XOP_09_81) },
7092     { "vfrczss",        { XM, EXd } },
7093     { "vfrczsd",        { XM, EXq } },
7094     { "(bad)",          { XX } },
7095     { "(bad)",          { XX } },
7096     { "(bad)",          { XX } },
7097     { "(bad)",          { XX } },
7098     /* 88 */
7099     { "(bad)",          { XX } },
7100     { "(bad)",          { XX } },
7101     { "(bad)",          { XX } },
7102     { "(bad)",          { XX } },
7103     { "(bad)",          { XX } },
7104     { "(bad)",          { XX } },
7105     { "(bad)",          { XX } },
7106     { "(bad)",          { XX } },
7107     /* 90 */
7108     { "vprotb",         { XM, Vex_2src_1, Vex_2src_2 } },
7109     { "vprotw",         { XM, Vex_2src_1, Vex_2src_2 } },
7110     { "vprotd",         { XM, Vex_2src_1, Vex_2src_2 } },
7111     { "vprotq",         { XM, Vex_2src_1, Vex_2src_2 } },
7112     { "vpshlb",         { XM, Vex_2src_1, Vex_2src_2 } },
7113     { "vpshlw",         { XM, Vex_2src_1, Vex_2src_2 } },
7114     { "vpshld",         { XM, Vex_2src_1, Vex_2src_2 } },
7115     { "vpshlq",         { XM, Vex_2src_1, Vex_2src_2 } },
7116     /* 98 */
7117     { "vpshab",         { XM, Vex_2src_1, Vex_2src_2 } },
7118     { "vpshaw",         { XM, Vex_2src_1, Vex_2src_2 } },
7119     { "vpshad",         { XM, Vex_2src_1, Vex_2src_2 } },
7120     { "vpshaq",         { XM, Vex_2src_1, Vex_2src_2 } },
7121     { "(bad)",          { XX } },
7122     { "(bad)",          { XX } },
7123     { "(bad)",          { XX } },
7124     { "(bad)",          { XX } },
7125     /* a0 */
7126     { "(bad)",          { XX } },
7127     { "(bad)",          { XX } },
7128     { "(bad)",          { XX } },
7129     { "(bad)",          { XX } },
7130     { "(bad)",          { XX } },
7131     { "(bad)",          { XX } },
7132     { "(bad)",          { XX } },
7133     { "(bad)",          { XX } },
7134     /* a8 */
7135     { "(bad)",          { XX } },
7136     { "(bad)",          { XX } },
7137     { "(bad)",          { XX } },
7138     { "(bad)",          { XX } },
7139     { "(bad)",          { XX } },
7140     { "(bad)",          { XX } },
7141     { "(bad)",          { XX } },
7142     { "(bad)",          { XX } },
7143     /* b0 */
7144     { "(bad)",          { XX } },
7145     { "(bad)",          { XX } },
7146     { "(bad)",          { XX } },
7147     { "(bad)",          { XX } },
7148     { "(bad)",          { XX } },
7149     { "(bad)",          { XX } },
7150     { "(bad)",          { XX } },
7151     { "(bad)",          { XX } },
7152     /* b8 */
7153     { "(bad)",          { XX } },
7154     { "(bad)",          { XX } },
7155     { "(bad)",          { XX } },
7156     { "(bad)",          { XX } },
7157     { "(bad)",          { XX } },
7158     { "(bad)",          { XX } },
7159     { "(bad)",          { XX } },
7160     { "(bad)",          { XX } },
7161     /* c0 */
7162     { "(bad)",          { XX } },
7163     { "vphaddbw",       { XM, EXxmm } },
7164     { "vphaddbd",       { XM, EXxmm } },
7165     { "vphaddbq",       { XM, EXxmm } },
7166     { "(bad)",          { XX } },
7167     { "(bad)",          { XX } },
7168     { "vphaddwd",       { XM, EXxmm } },
7169     { "vphaddwq",       { XM, EXxmm } },
7170     /* c8 */
7171     { "(bad)",          { XX } },
7172     { "(bad)",          { XX } },
7173     { "(bad)",          { XX } },
7174     { "vphadddq",       { XM, EXxmm } },
7175     { "(bad)",          { XX } },
7176     { "(bad)",          { XX } },
7177     { "(bad)",          { XX } },
7178     { "(bad)",          { XX } },
7179     /* d0 */
7180     { "(bad)",          { XX } },
7181     { "vphaddubw",      { XM, EXxmm } },
7182     { "vphaddubd",      { XM, EXxmm } },
7183     { "vphaddubq",      { XM, EXxmm } },
7184     { "(bad)",          { XX } },
7185     { "(bad)",          { XX } },
7186     { "vphadduwd",      { XM, EXxmm } },
7187     { "vphadduwq",      { XM, EXxmm } },
7188     /* d8 */
7189     { "(bad)",          { XX } },
7190     { "(bad)",          { XX } },
7191     { "(bad)",          { XX } },
7192     { "vphaddudq",      { XM, EXxmm } },
7193     { "(bad)",          { XX } },
7194     { "(bad)",          { XX } },
7195     { "(bad)",          { XX } },
7196     { "(bad)",          { XX } },
7197     /* e0 */
7198     { "(bad)",          { XX } },
7199     { "vphsubbw",       { XM, EXxmm } },
7200     { "vphsubwd",       { XM, EXxmm } },
7201     { "vphsubdq",       { XM, EXxmm } },
7202     { "(bad)",          { XX } },
7203     { "(bad)",          { XX } },
7204     { "(bad)",          { XX } },
7205     { "(bad)",          { XX } },
7206     /* e8 */
7207     { "(bad)",          { XX } },
7208     { "(bad)",          { XX } },
7209     { "(bad)",          { XX } },
7210     { "(bad)",          { XX } },
7211     { "(bad)",          { XX } },
7212     { "(bad)",          { XX } },
7213     { "(bad)",          { XX } },
7214     { "(bad)",          { XX } },
7215     /* f0 */
7216     { "(bad)",          { XX } },
7217     { "(bad)",          { XX } },
7218     { "(bad)",          { XX } },
7219     { "(bad)",          { XX } },
7220     { "(bad)",          { XX } },
7221     { "(bad)",          { XX } },
7222     { "(bad)",          { XX } },
7223     { "(bad)",          { XX } },
7224     /* f8 */
7225     { "(bad)",          { XX } },
7226     { "(bad)",          { XX } },
7227     { "(bad)",          { XX } },
7228     { "(bad)",          { XX } },
7229     { "(bad)",          { XX } },
7230     { "(bad)",          { XX } },
7231     { "(bad)",          { XX } },
7232     { "(bad)",          { XX } },
7233   },
7234   /* XOP_0A */
7235   {
7236     /* 00 */
7237     { "(bad)",          { XX } },
7238     { "(bad)",          { XX } },
7239     { "(bad)",          { XX } },
7240     { "(bad)",          { XX } },
7241     { "(bad)",          { XX } },
7242     { "(bad)",          { XX } },
7243     { "(bad)",          { XX } },
7244     { "(bad)",          { XX } },
7245     /* 08 */
7246     { "(bad)",          { XX } },
7247     { "(bad)",          { XX } },
7248     { "(bad)",          { XX } },
7249     { "(bad)",          { XX } },
7250     { "(bad)",          { XX } },
7251     { "(bad)",          { XX } },
7252     { "(bad)",          { XX } },
7253     { "(bad)",          { XX } },
7254     /* 10 */
7255     { "(bad)",          { XX } },
7256     { "(bad)",          { XX } },
7257     { REG_TABLE (REG_XOP_LWP) },
7258     { "(bad)",          { XX } },
7259     { "(bad)",          { XX } },
7260     { "(bad)",          { XX } },
7261     { "(bad)",          { XX } },
7262     { "(bad)",          { XX } },
7263     /* 18 */
7264     { "(bad)",          { XX } },
7265     { "(bad)",          { XX } },
7266     { "(bad)",          { XX } },
7267     { "(bad)",          { XX } },
7268     { "(bad)",          { XX } },
7269     { "(bad)",          { XX } },
7270     { "(bad)",          { XX } },
7271     { "(bad)",          { XX } },
7272     /* 20 */
7273     { "(bad)",          { XX } },
7274     { "(bad)",          { XX } },
7275     { "(bad)",          { XX } },
7276     { "(bad)",          { XX } },
7277     { "(bad)",          { XX } },
7278     { "(bad)",          { XX } },
7279     { "(bad)",          { XX } },
7280     { "(bad)",          { XX } },
7281     /* 28 */
7282     { "(bad)",          { XX } },
7283     { "(bad)",          { XX } },
7284     { "(bad)",          { XX } },
7285     { "(bad)",          { XX } },
7286     { "(bad)",          { XX } },
7287     { "(bad)",          { XX } },
7288     { "(bad)",          { XX } },
7289     { "(bad)",          { XX } },
7290     /* 30 */
7291     { "(bad)",          { XX } },
7292     { "(bad)",          { XX } },
7293     { "(bad)",          { XX } },
7294     { "(bad)",          { XX } },
7295     { "(bad)",          { XX } },
7296     { "(bad)",          { XX } },
7297     { "(bad)",          { XX } },
7298     { "(bad)",          { XX } },
7299     /* 38 */
7300     { "(bad)",          { XX } },
7301     { "(bad)",          { XX } },
7302     { "(bad)",          { XX } },
7303     { "(bad)",          { XX } },
7304     { "(bad)",          { XX } },
7305     { "(bad)",          { XX } },
7306     { "(bad)",          { XX } },
7307     { "(bad)",          { XX } },
7308     /* 40 */
7309     { "(bad)",          { XX } },
7310     { "(bad)",          { XX } },
7311     { "(bad)",          { XX } },
7312     { "(bad)",          { XX } },
7313     { "(bad)",          { XX } },
7314     { "(bad)",          { XX } },
7315     { "(bad)",          { XX } },
7316     { "(bad)",          { XX } },
7317     /* 48 */
7318     { "(bad)",          { XX } },
7319     { "(bad)",          { XX } },
7320     { "(bad)",          { XX } },
7321     { "(bad)",          { XX } },
7322     { "(bad)",          { XX } },
7323     { "(bad)",          { XX } },
7324     { "(bad)",          { XX } },
7325     { "(bad)",          { XX } },
7326     /* 50 */
7327     { "(bad)",          { XX } },
7328     { "(bad)",          { XX } },
7329     { "(bad)",          { XX } },
7330     { "(bad)",          { XX } },
7331     { "(bad)",          { XX } },
7332     { "(bad)",          { XX } },
7333     { "(bad)",          { XX } },
7334     { "(bad)",          { XX } },
7335     /* 58 */
7336     { "(bad)",          { XX } },
7337     { "(bad)",          { XX } },
7338     { "(bad)",          { XX } },
7339     { "(bad)",          { XX } },
7340     { "(bad)",          { XX } },
7341     { "(bad)",          { XX } },
7342     { "(bad)",          { XX } },
7343     { "(bad)",          { XX } },
7344     /* 60 */
7345     { "(bad)",          { XX } },
7346     { "(bad)",          { XX } },
7347     { "(bad)",          { XX } },
7348     { "(bad)",          { XX } },
7349     { "(bad)",          { XX } },
7350     { "(bad)",          { XX } },
7351     { "(bad)",          { XX } },
7352     { "(bad)",          { XX } },
7353     /* 68 */
7354     { "(bad)",          { XX } },
7355     { "(bad)",          { XX } },
7356     { "(bad)",          { XX } },
7357     { "(bad)",          { XX } },
7358     { "(bad)",          { XX } },
7359     { "(bad)",          { XX } },
7360     { "(bad)",          { XX } },
7361     { "(bad)",          { XX } },
7362     /* 70 */
7363     { "(bad)",          { XX } },
7364     { "(bad)",          { XX } },
7365     { "(bad)",          { XX } },
7366     { "(bad)",          { XX } },
7367     { "(bad)",          { XX } },
7368     { "(bad)",          { XX } },
7369     { "(bad)",          { XX } },
7370     { "(bad)",          { XX } },
7371     /* 78 */
7372     { "(bad)",          { XX } },
7373     { "(bad)",          { XX } },
7374     { "(bad)",          { XX } },
7375     { "(bad)",          { XX } },
7376     { "(bad)",          { XX } },
7377     { "(bad)",          { XX } },
7378     { "(bad)",          { XX } },
7379     { "(bad)",          { XX } },
7380     /* 80 */
7381     { "(bad)",          { XX } },
7382     { "(bad)",          { XX } },
7383     { "(bad)",          { XX } },
7384     { "(bad)",          { XX } },
7385     { "(bad)",          { XX } },
7386     { "(bad)",          { XX } },
7387     { "(bad)",          { XX } },
7388     { "(bad)",          { XX } },
7389     /* 88 */
7390     { "(bad)",          { XX } },
7391     { "(bad)",          { XX } },
7392     { "(bad)",          { XX } },
7393     { "(bad)",          { XX } },
7394     { "(bad)",          { XX } },
7395     { "(bad)",          { XX } },
7396     { "(bad)",          { XX } },
7397     { "(bad)",          { XX } },
7398     /* 90 */
7399     { "(bad)",          { XX } },
7400     { "(bad)",          { XX } },
7401     { "(bad)",          { XX } },
7402     { "(bad)",          { XX } },
7403     { "(bad)",          { XX } },
7404     { "(bad)",          { XX } },
7405     { "(bad)",          { XX } },
7406     { "(bad)",          { XX } },
7407     /* 98 */
7408     { "(bad)",          { XX } },
7409     { "(bad)",          { XX } },
7410     { "(bad)",          { XX } },
7411     { "(bad)",          { XX } },
7412     { "(bad)",          { XX } },
7413     { "(bad)",          { XX } },
7414     { "(bad)",          { XX } },
7415     { "(bad)",          { XX } },
7416     /* a0 */
7417     { "(bad)",          { XX } },
7418     { "(bad)",          { XX } },
7419     { "(bad)",          { XX } },
7420     { "(bad)",          { XX } },
7421     { "(bad)",          { XX } },
7422     { "(bad)",          { XX } },
7423     { "(bad)",          { XX } },
7424     { "(bad)",          { XX } },
7425     /* a8 */
7426     { "(bad)",          { XX } },
7427     { "(bad)",          { XX } },
7428     { "(bad)",          { XX } },
7429     { "(bad)",          { XX } },
7430     { "(bad)",          { XX } },
7431     { "(bad)",          { XX } },
7432     { "(bad)",          { XX } },
7433     { "(bad)",          { XX } },
7434     /* b0 */
7435     { "(bad)",          { XX } },
7436     { "(bad)",          { XX } },
7437     { "(bad)",          { XX } },
7438     { "(bad)",          { XX } },
7439     { "(bad)",          { XX } },
7440     { "(bad)",          { XX } },
7441     { "(bad)",          { XX } },
7442     { "(bad)",          { XX } },
7443     /* b8 */
7444     { "(bad)",          { XX } },
7445     { "(bad)",          { XX } },
7446     { "(bad)",          { XX } },
7447     { "(bad)",          { XX } },
7448     { "(bad)",          { XX } },
7449     { "(bad)",          { XX } },
7450     { "(bad)",          { XX } },
7451     { "(bad)",          { XX } },
7452     /* c0 */
7453     { "(bad)",          { XX } },
7454     { "(bad)",          { XX } },
7455     { "(bad)",          { XX } },
7456     { "(bad)",          { XX } },
7457     { "(bad)",          { XX } },
7458     { "(bad)",          { XX } },
7459     { "(bad)",          { XX } },
7460     { "(bad)",          { XX } },
7461     /* c8 */
7462     { "(bad)",          { XX } },
7463     { "(bad)",          { XX } },
7464     { "(bad)",          { XX } },
7465     { "(bad)",          { XX } },
7466     { "(bad)",          { XX } },
7467     { "(bad)",          { XX } },
7468     { "(bad)",          { XX } },
7469     { "(bad)",          { XX } },
7470     /* d0 */
7471     { "(bad)",          { XX } },
7472     { "(bad)",          { XX } },
7473     { "(bad)",          { XX } },
7474     { "(bad)",          { XX } },
7475     { "(bad)",          { XX } },
7476     { "(bad)",          { XX } },
7477     { "(bad)",          { XX } },
7478     { "(bad)",          { XX } },
7479     /* d8 */
7480     { "(bad)",          { XX } },
7481     { "(bad)",          { XX } },
7482     { "(bad)",          { XX } },
7483     { "(bad)",          { XX } },
7484     { "(bad)",          { XX } },
7485     { "(bad)",          { XX } },
7486     { "(bad)",          { XX } },
7487     { "(bad)",          { XX } },
7488     /* e0 */
7489     { "(bad)",          { XX } },
7490     { "(bad)",          { XX } },
7491     { "(bad)",          { XX } },
7492     { "(bad)",          { XX } },
7493     { "(bad)",          { XX } },
7494     { "(bad)",          { XX } },
7495     { "(bad)",          { XX } },
7496     { "(bad)",          { XX } },
7497     /* e8 */
7498     { "(bad)",          { XX } },
7499     { "(bad)",          { XX } },
7500     { "(bad)",          { XX } },
7501     { "(bad)",          { XX } },
7502     { "(bad)",          { XX } },
7503     { "(bad)",          { XX } },
7504     { "(bad)",          { XX } },
7505     { "(bad)",          { XX } },
7506     /* f0 */
7507     { "(bad)",          { XX } },
7508     { "(bad)",          { XX } },
7509     { "(bad)",          { XX } },
7510     { "(bad)",          { XX } },
7511     { "(bad)",          { XX } },
7512     { "(bad)",          { XX } },
7513     { "(bad)",          { XX } },
7514     { "(bad)",          { XX } },
7515     /* f8 */
7516     { "(bad)",          { XX } },
7517     { "(bad)",          { XX } },
7518     { "(bad)",          { XX } },
7519     { "(bad)",          { XX } },
7520     { "(bad)",          { XX } },
7521     { "(bad)",          { XX } },
7522     { "(bad)",          { XX } },
7523     { "(bad)",          { XX } },
7524   },
7525 };
7526
7527 static const struct dis386 vex_table[][256] = {
7528   /* VEX_0F */
7529   {
7530     /* 00 */
7531     { "(bad)",          { XX } },
7532     { "(bad)",          { XX } },
7533     { "(bad)",          { XX } },
7534     { "(bad)",          { XX } },
7535     { "(bad)",          { XX } },
7536     { "(bad)",          { XX } },
7537     { "(bad)",          { XX } },
7538     { "(bad)",          { XX } },
7539     /* 08 */
7540     { "(bad)",          { XX } },
7541     { "(bad)",          { XX } },
7542     { "(bad)",          { XX } },
7543     { "(bad)",          { XX } },
7544     { "(bad)",          { XX } },
7545     { "(bad)",          { XX } },
7546     { "(bad)",          { XX } },
7547     { "(bad)",          { XX } },
7548     /* 10 */
7549     { PREFIX_TABLE (PREFIX_VEX_10) },
7550     { PREFIX_TABLE (PREFIX_VEX_11) },
7551     { PREFIX_TABLE (PREFIX_VEX_12) },
7552     { MOD_TABLE (MOD_VEX_13) },
7553     { VEX_W_TABLE (VEX_W_14) },
7554     { VEX_W_TABLE (VEX_W_15) },
7555     { PREFIX_TABLE (PREFIX_VEX_16) },
7556     { MOD_TABLE (MOD_VEX_17) },
7557     /* 18 */
7558     { "(bad)",          { XX } },
7559     { "(bad)",          { XX } },
7560     { "(bad)",          { XX } },
7561     { "(bad)",          { XX } },
7562     { "(bad)",          { XX } },
7563     { "(bad)",          { XX } },
7564     { "(bad)",          { XX } },
7565     { "(bad)",          { XX } },
7566     /* 20 */
7567     { "(bad)",          { XX } },
7568     { "(bad)",          { XX } },
7569     { "(bad)",          { XX } },
7570     { "(bad)",          { XX } },
7571     { "(bad)",          { XX } },
7572     { "(bad)",          { XX } },
7573     { "(bad)",          { XX } },
7574     { "(bad)",          { XX } },
7575     /* 28 */
7576     { VEX_W_TABLE (VEX_W_28) },
7577     { VEX_W_TABLE (VEX_W_29) },
7578     { PREFIX_TABLE (PREFIX_VEX_2A) },
7579     { MOD_TABLE (MOD_VEX_2B) },
7580     { PREFIX_TABLE (PREFIX_VEX_2C) },
7581     { PREFIX_TABLE (PREFIX_VEX_2D) },
7582     { PREFIX_TABLE (PREFIX_VEX_2E) },
7583     { PREFIX_TABLE (PREFIX_VEX_2F) },
7584     /* 30 */
7585     { "(bad)",          { XX } },
7586     { "(bad)",          { XX } },
7587     { "(bad)",          { XX } },
7588     { "(bad)",          { XX } },
7589     { "(bad)",          { XX } },
7590     { "(bad)",          { XX } },
7591     { "(bad)",          { XX } },
7592     { "(bad)",          { XX } },
7593     /* 38 */
7594     { "(bad)",          { XX } },
7595     { "(bad)",          { XX } },
7596     { "(bad)",          { XX } },
7597     { "(bad)",          { XX } },
7598     { "(bad)",          { XX } },
7599     { "(bad)",          { XX } },
7600     { "(bad)",          { XX } },
7601     { "(bad)",          { XX } },
7602     /* 40 */
7603     { "(bad)",          { XX } },
7604     { "(bad)",          { XX } },
7605     { "(bad)",          { XX } },
7606     { "(bad)",          { XX } },
7607     { "(bad)",          { XX } },
7608     { "(bad)",          { XX } },
7609     { "(bad)",          { XX } },
7610     { "(bad)",          { XX } },
7611     /* 48 */
7612     { "(bad)",          { XX } },
7613     { "(bad)",          { XX } },
7614     { "(bad)",          { XX } },
7615     { "(bad)",          { XX } },
7616     { "(bad)",          { XX } },
7617     { "(bad)",          { XX } },
7618     { "(bad)",          { XX } },
7619     { "(bad)",          { XX } },
7620     /* 50 */
7621     { MOD_TABLE (MOD_VEX_50) },
7622     { PREFIX_TABLE (PREFIX_VEX_51) },
7623     { PREFIX_TABLE (PREFIX_VEX_52) },
7624     { PREFIX_TABLE (PREFIX_VEX_53) },
7625     { "vandpX",         { XM, Vex, EXx } },
7626     { "vandnpX",        { XM, Vex, EXx } },
7627     { "vorpX",          { XM, Vex, EXx } },
7628     { "vxorpX",         { XM, Vex, EXx } },
7629     /* 58 */
7630     { PREFIX_TABLE (PREFIX_VEX_58) },
7631     { PREFIX_TABLE (PREFIX_VEX_59) },
7632     { PREFIX_TABLE (PREFIX_VEX_5A) },
7633     { PREFIX_TABLE (PREFIX_VEX_5B) },
7634     { PREFIX_TABLE (PREFIX_VEX_5C) },
7635     { PREFIX_TABLE (PREFIX_VEX_5D) },
7636     { PREFIX_TABLE (PREFIX_VEX_5E) },
7637     { PREFIX_TABLE (PREFIX_VEX_5F) },
7638     /* 60 */
7639     { PREFIX_TABLE (PREFIX_VEX_60) },
7640     { PREFIX_TABLE (PREFIX_VEX_61) },
7641     { PREFIX_TABLE (PREFIX_VEX_62) },
7642     { PREFIX_TABLE (PREFIX_VEX_63) },
7643     { PREFIX_TABLE (PREFIX_VEX_64) },
7644     { PREFIX_TABLE (PREFIX_VEX_65) },
7645     { PREFIX_TABLE (PREFIX_VEX_66) },
7646     { PREFIX_TABLE (PREFIX_VEX_67) },
7647     /* 68 */
7648     { PREFIX_TABLE (PREFIX_VEX_68) },
7649     { PREFIX_TABLE (PREFIX_VEX_69) },
7650     { PREFIX_TABLE (PREFIX_VEX_6A) },
7651     { PREFIX_TABLE (PREFIX_VEX_6B) },
7652     { PREFIX_TABLE (PREFIX_VEX_6C) },
7653     { PREFIX_TABLE (PREFIX_VEX_6D) },
7654     { PREFIX_TABLE (PREFIX_VEX_6E) },
7655     { PREFIX_TABLE (PREFIX_VEX_6F) },
7656     /* 70 */
7657     { PREFIX_TABLE (PREFIX_VEX_70) },
7658     { REG_TABLE (REG_VEX_71) },
7659     { REG_TABLE (REG_VEX_72) },
7660     { REG_TABLE (REG_VEX_73) },
7661     { PREFIX_TABLE (PREFIX_VEX_74) },
7662     { PREFIX_TABLE (PREFIX_VEX_75) },
7663     { PREFIX_TABLE (PREFIX_VEX_76) },
7664     { PREFIX_TABLE (PREFIX_VEX_77) },
7665     /* 78 */
7666     { "(bad)",          { XX } },
7667     { "(bad)",          { XX } },
7668     { "(bad)",          { XX } },
7669     { "(bad)",          { XX } },
7670     { PREFIX_TABLE (PREFIX_VEX_7C) },
7671     { PREFIX_TABLE (PREFIX_VEX_7D) },
7672     { PREFIX_TABLE (PREFIX_VEX_7E) },
7673     { PREFIX_TABLE (PREFIX_VEX_7F) },
7674     /* 80 */
7675     { "(bad)",          { XX } },
7676     { "(bad)",          { XX } },
7677     { "(bad)",          { XX } },
7678     { "(bad)",          { XX } },
7679     { "(bad)",          { XX } },
7680     { "(bad)",          { XX } },
7681     { "(bad)",          { XX } },
7682     { "(bad)",          { XX } },
7683     /* 88 */
7684     { "(bad)",          { XX } },
7685     { "(bad)",          { XX } },
7686     { "(bad)",          { XX } },
7687     { "(bad)",          { XX } },
7688     { "(bad)",          { XX } },
7689     { "(bad)",          { XX } },
7690     { "(bad)",          { XX } },
7691     { "(bad)",          { XX } },
7692     /* 90 */
7693     { "(bad)",          { XX } },
7694     { "(bad)",          { XX } },
7695     { "(bad)",          { XX } },
7696     { "(bad)",          { XX } },
7697     { "(bad)",          { XX } },
7698     { "(bad)",          { XX } },
7699     { "(bad)",          { XX } },
7700     { "(bad)",          { XX } },
7701     /* 98 */
7702     { "(bad)",          { XX } },
7703     { "(bad)",          { XX } },
7704     { "(bad)",          { XX } },
7705     { "(bad)",          { XX } },
7706     { "(bad)",          { XX } },
7707     { "(bad)",          { XX } },
7708     { "(bad)",          { XX } },
7709     { "(bad)",          { XX } },
7710     /* a0 */
7711     { "(bad)",          { XX } },
7712     { "(bad)",          { XX } },
7713     { "(bad)",          { XX } },
7714     { "(bad)",          { XX } },
7715     { "(bad)",          { XX } },
7716     { "(bad)",          { XX } },
7717     { "(bad)",          { XX } },
7718     { "(bad)",          { XX } },
7719     /* a8 */
7720     { "(bad)",          { XX } },
7721     { "(bad)",          { XX } },
7722     { "(bad)",          { XX } },
7723     { "(bad)",          { XX } },
7724     { "(bad)",          { XX } },
7725     { "(bad)",          { XX } },
7726     { REG_TABLE (REG_VEX_AE) },
7727     { "(bad)",          { XX } },
7728     /* b0 */
7729     { "(bad)",          { XX } },
7730     { "(bad)",          { XX } },
7731     { "(bad)",          { XX } },
7732     { "(bad)",          { XX } },
7733     { "(bad)",          { XX } },
7734     { "(bad)",          { XX } },
7735     { "(bad)",          { XX } },
7736     { "(bad)",          { XX } },
7737     /* b8 */
7738     { "(bad)",          { XX } },
7739     { "(bad)",          { XX } },
7740     { "(bad)",          { XX } },
7741     { "(bad)",          { XX } },
7742     { "(bad)",          { XX } },
7743     { "(bad)",          { XX } },
7744     { "(bad)",          { XX } },
7745     { "(bad)",          { XX } },
7746     /* c0 */
7747     { "(bad)",          { XX } },
7748     { "(bad)",          { XX } },
7749     { PREFIX_TABLE (PREFIX_VEX_C2) },
7750     { "(bad)",          { XX } },
7751     { PREFIX_TABLE (PREFIX_VEX_C4) },
7752     { PREFIX_TABLE (PREFIX_VEX_C5) },
7753     { "vshufpX",        { XM, Vex, EXx, Ib } },
7754     { "(bad)",          { XX } },
7755     /* c8 */
7756     { "(bad)",          { XX } },
7757     { "(bad)",          { XX } },
7758     { "(bad)",          { XX } },
7759     { "(bad)",          { XX } },
7760     { "(bad)",          { XX } },
7761     { "(bad)",          { XX } },
7762     { "(bad)",          { XX } },
7763     { "(bad)",          { XX } },
7764     /* d0 */
7765     { PREFIX_TABLE (PREFIX_VEX_D0) },
7766     { PREFIX_TABLE (PREFIX_VEX_D1) },
7767     { PREFIX_TABLE (PREFIX_VEX_D2) },
7768     { PREFIX_TABLE (PREFIX_VEX_D3) },
7769     { PREFIX_TABLE (PREFIX_VEX_D4) },
7770     { PREFIX_TABLE (PREFIX_VEX_D5) },
7771     { PREFIX_TABLE (PREFIX_VEX_D6) },
7772     { PREFIX_TABLE (PREFIX_VEX_D7) },
7773     /* d8 */
7774     { PREFIX_TABLE (PREFIX_VEX_D8) },
7775     { PREFIX_TABLE (PREFIX_VEX_D9) },
7776     { PREFIX_TABLE (PREFIX_VEX_DA) },
7777     { PREFIX_TABLE (PREFIX_VEX_DB) },
7778     { PREFIX_TABLE (PREFIX_VEX_DC) },
7779     { PREFIX_TABLE (PREFIX_VEX_DD) },
7780     { PREFIX_TABLE (PREFIX_VEX_DE) },
7781     { PREFIX_TABLE (PREFIX_VEX_DF) },
7782     /* e0 */
7783     { PREFIX_TABLE (PREFIX_VEX_E0) },
7784     { PREFIX_TABLE (PREFIX_VEX_E1) },
7785     { PREFIX_TABLE (PREFIX_VEX_E2) },
7786     { PREFIX_TABLE (PREFIX_VEX_E3) },
7787     { PREFIX_TABLE (PREFIX_VEX_E4) },
7788     { PREFIX_TABLE (PREFIX_VEX_E5) },
7789     { PREFIX_TABLE (PREFIX_VEX_E6) },
7790     { PREFIX_TABLE (PREFIX_VEX_E7) },
7791     /* e8 */
7792     { PREFIX_TABLE (PREFIX_VEX_E8) },
7793     { PREFIX_TABLE (PREFIX_VEX_E9) },
7794     { PREFIX_TABLE (PREFIX_VEX_EA) },
7795     { PREFIX_TABLE (PREFIX_VEX_EB) },
7796     { PREFIX_TABLE (PREFIX_VEX_EC) },
7797     { PREFIX_TABLE (PREFIX_VEX_ED) },
7798     { PREFIX_TABLE (PREFIX_VEX_EE) },
7799     { PREFIX_TABLE (PREFIX_VEX_EF) },
7800     /* f0 */
7801     { PREFIX_TABLE (PREFIX_VEX_F0) },
7802     { PREFIX_TABLE (PREFIX_VEX_F1) },
7803     { PREFIX_TABLE (PREFIX_VEX_F2) },
7804     { PREFIX_TABLE (PREFIX_VEX_F3) },
7805     { PREFIX_TABLE (PREFIX_VEX_F4) },
7806     { PREFIX_TABLE (PREFIX_VEX_F5) },
7807     { PREFIX_TABLE (PREFIX_VEX_F6) },
7808     { PREFIX_TABLE (PREFIX_VEX_F7) },
7809     /* f8 */
7810     { PREFIX_TABLE (PREFIX_VEX_F8) },
7811     { PREFIX_TABLE (PREFIX_VEX_F9) },
7812     { PREFIX_TABLE (PREFIX_VEX_FA) },
7813     { PREFIX_TABLE (PREFIX_VEX_FB) },
7814     { PREFIX_TABLE (PREFIX_VEX_FC) },
7815     { PREFIX_TABLE (PREFIX_VEX_FD) },
7816     { PREFIX_TABLE (PREFIX_VEX_FE) },
7817     { "(bad)",          { XX } },
7818   },
7819   /* VEX_0F38 */
7820   {
7821     /* 00 */
7822     { PREFIX_TABLE (PREFIX_VEX_3800) },
7823     { PREFIX_TABLE (PREFIX_VEX_3801) },
7824     { PREFIX_TABLE (PREFIX_VEX_3802) },
7825     { PREFIX_TABLE (PREFIX_VEX_3803) },
7826     { PREFIX_TABLE (PREFIX_VEX_3804) },
7827     { PREFIX_TABLE (PREFIX_VEX_3805) },
7828     { PREFIX_TABLE (PREFIX_VEX_3806) },
7829     { PREFIX_TABLE (PREFIX_VEX_3807) },
7830     /* 08 */
7831     { PREFIX_TABLE (PREFIX_VEX_3808) },
7832     { PREFIX_TABLE (PREFIX_VEX_3809) },
7833     { PREFIX_TABLE (PREFIX_VEX_380A) },
7834     { PREFIX_TABLE (PREFIX_VEX_380B) },
7835     { PREFIX_TABLE (PREFIX_VEX_380C) },
7836     { PREFIX_TABLE (PREFIX_VEX_380D) },
7837     { PREFIX_TABLE (PREFIX_VEX_380E) },
7838     { PREFIX_TABLE (PREFIX_VEX_380F) },
7839     /* 10 */
7840     { "(bad)",          { XX } },
7841     { "(bad)",          { XX } },
7842     { "(bad)",          { XX } },
7843     { "(bad)",          { XX } },
7844     { "(bad)",          { XX } },
7845     { "(bad)",          { XX } },
7846     { "(bad)",          { XX } },
7847     { PREFIX_TABLE (PREFIX_VEX_3817) },
7848     /* 18 */
7849     { PREFIX_TABLE (PREFIX_VEX_3818) },
7850     { PREFIX_TABLE (PREFIX_VEX_3819) },
7851     { PREFIX_TABLE (PREFIX_VEX_381A) },
7852     { "(bad)",          { XX } },
7853     { PREFIX_TABLE (PREFIX_VEX_381C) },
7854     { PREFIX_TABLE (PREFIX_VEX_381D) },
7855     { PREFIX_TABLE (PREFIX_VEX_381E) },
7856     { "(bad)",          { XX } },
7857     /* 20 */
7858     { PREFIX_TABLE (PREFIX_VEX_3820) },
7859     { PREFIX_TABLE (PREFIX_VEX_3821) },
7860     { PREFIX_TABLE (PREFIX_VEX_3822) },
7861     { PREFIX_TABLE (PREFIX_VEX_3823) },
7862     { PREFIX_TABLE (PREFIX_VEX_3824) },
7863     { PREFIX_TABLE (PREFIX_VEX_3825) },
7864     { "(bad)",          { XX } },
7865     { "(bad)",          { XX } },
7866     /* 28 */
7867     { PREFIX_TABLE (PREFIX_VEX_3828) },
7868     { PREFIX_TABLE (PREFIX_VEX_3829) },
7869     { PREFIX_TABLE (PREFIX_VEX_382A) },
7870     { PREFIX_TABLE (PREFIX_VEX_382B) },
7871     { PREFIX_TABLE (PREFIX_VEX_382C) },
7872     { PREFIX_TABLE (PREFIX_VEX_382D) },
7873     { PREFIX_TABLE (PREFIX_VEX_382E) },
7874     { PREFIX_TABLE (PREFIX_VEX_382F) },
7875     /* 30 */
7876     { PREFIX_TABLE (PREFIX_VEX_3830) },
7877     { PREFIX_TABLE (PREFIX_VEX_3831) },
7878     { PREFIX_TABLE (PREFIX_VEX_3832) },
7879     { PREFIX_TABLE (PREFIX_VEX_3833) },
7880     { PREFIX_TABLE (PREFIX_VEX_3834) },
7881     { PREFIX_TABLE (PREFIX_VEX_3835) },
7882     { "(bad)",          { XX } },
7883     { PREFIX_TABLE (PREFIX_VEX_3837) },
7884     /* 38 */
7885     { PREFIX_TABLE (PREFIX_VEX_3838) },
7886     { PREFIX_TABLE (PREFIX_VEX_3839) },
7887     { PREFIX_TABLE (PREFIX_VEX_383A) },
7888     { PREFIX_TABLE (PREFIX_VEX_383B) },
7889     { PREFIX_TABLE (PREFIX_VEX_383C) },
7890     { PREFIX_TABLE (PREFIX_VEX_383D) },
7891     { PREFIX_TABLE (PREFIX_VEX_383E) },
7892     { PREFIX_TABLE (PREFIX_VEX_383F) },
7893     /* 40 */
7894     { PREFIX_TABLE (PREFIX_VEX_3840) },
7895     { PREFIX_TABLE (PREFIX_VEX_3841) },
7896     { "(bad)",          { XX } },
7897     { "(bad)",          { XX } },
7898     { "(bad)",          { XX } },
7899     { "(bad)",          { XX } },
7900     { "(bad)",          { XX } },
7901     { "(bad)",          { XX } },
7902     /* 48 */
7903     { "(bad)",          { XX } },
7904     { "(bad)",          { XX } },
7905     { "(bad)",          { XX } },
7906     { "(bad)",          { XX } },
7907     { "(bad)",          { XX } },
7908     { "(bad)",          { XX } },
7909     { "(bad)",          { XX } },
7910     { "(bad)",          { XX } },
7911     /* 50 */
7912     { "(bad)",          { XX } },
7913     { "(bad)",          { XX } },
7914     { "(bad)",          { XX } },
7915     { "(bad)",          { XX } },
7916     { "(bad)",          { XX } },
7917     { "(bad)",          { XX } },
7918     { "(bad)",          { XX } },
7919     { "(bad)",          { XX } },
7920     /* 58 */
7921     { "(bad)",          { XX } },
7922     { "(bad)",          { XX } },
7923     { "(bad)",          { XX } },
7924     { "(bad)",          { XX } },
7925     { "(bad)",          { XX } },
7926     { "(bad)",          { XX } },
7927     { "(bad)",          { XX } },
7928     { "(bad)",          { XX } },
7929     /* 60 */
7930     { "(bad)",          { XX } },
7931     { "(bad)",          { XX } },
7932     { "(bad)",          { XX } },
7933     { "(bad)",          { XX } },
7934     { "(bad)",          { XX } },
7935     { "(bad)",          { XX } },
7936     { "(bad)",          { XX } },
7937     { "(bad)",          { XX } },
7938     /* 68 */
7939     { "(bad)",          { XX } },
7940     { "(bad)",          { XX } },
7941     { "(bad)",          { XX } },
7942     { "(bad)",          { XX } },
7943     { "(bad)",          { XX } },
7944     { "(bad)",          { XX } },
7945     { "(bad)",          { XX } },
7946     { "(bad)",          { XX } },
7947     /* 70 */
7948     { "(bad)",          { XX } },
7949     { "(bad)",          { XX } },
7950     { "(bad)",          { XX } },
7951     { "(bad)",          { XX } },
7952     { "(bad)",          { XX } },
7953     { "(bad)",          { XX } },
7954     { "(bad)",          { XX } },
7955     { "(bad)",          { XX } },
7956     /* 78 */
7957     { "(bad)",          { XX } },
7958     { "(bad)",          { XX } },
7959     { "(bad)",          { XX } },
7960     { "(bad)",          { XX } },
7961     { "(bad)",          { XX } },
7962     { "(bad)",          { XX } },
7963     { "(bad)",          { XX } },
7964     { "(bad)",          { XX } },
7965     /* 80 */
7966     { "(bad)",          { XX } },
7967     { "(bad)",          { XX } },
7968     { "(bad)",          { XX } },
7969     { "(bad)",          { XX } },
7970     { "(bad)",          { XX } },
7971     { "(bad)",          { XX } },
7972     { "(bad)",          { XX } },
7973     { "(bad)",          { XX } },
7974     /* 88 */
7975     { "(bad)",          { XX } },
7976     { "(bad)",          { XX } },
7977     { "(bad)",          { XX } },
7978     { "(bad)",          { XX } },
7979     { "(bad)",          { XX } },
7980     { "(bad)",          { XX } },
7981     { "(bad)",          { XX } },
7982     { "(bad)",          { XX } },
7983     /* 90 */
7984     { "(bad)",          { XX } },
7985     { "(bad)",          { XX } },
7986     { "(bad)",          { XX } },
7987     { "(bad)",          { XX } },
7988     { "(bad)",          { XX } },
7989     { "(bad)",          { XX } },
7990     { PREFIX_TABLE (PREFIX_VEX_3896) },
7991     { PREFIX_TABLE (PREFIX_VEX_3897) },
7992     /* 98 */
7993     { PREFIX_TABLE (PREFIX_VEX_3898) },
7994     { PREFIX_TABLE (PREFIX_VEX_3899) },
7995     { PREFIX_TABLE (PREFIX_VEX_389A) },
7996     { PREFIX_TABLE (PREFIX_VEX_389B) },
7997     { PREFIX_TABLE (PREFIX_VEX_389C) },
7998     { PREFIX_TABLE (PREFIX_VEX_389D) },
7999     { PREFIX_TABLE (PREFIX_VEX_389E) },
8000     { PREFIX_TABLE (PREFIX_VEX_389F) },
8001     /* a0 */
8002     { "(bad)",          { XX } },
8003     { "(bad)",          { XX } },
8004     { "(bad)",          { XX } },
8005     { "(bad)",          { XX } },
8006     { "(bad)",          { XX } },
8007     { "(bad)",          { XX } },
8008     { PREFIX_TABLE (PREFIX_VEX_38A6) },
8009     { PREFIX_TABLE (PREFIX_VEX_38A7) },
8010     /* a8 */
8011     { PREFIX_TABLE (PREFIX_VEX_38A8) },
8012     { PREFIX_TABLE (PREFIX_VEX_38A9) },
8013     { PREFIX_TABLE (PREFIX_VEX_38AA) },
8014     { PREFIX_TABLE (PREFIX_VEX_38AB) },
8015     { PREFIX_TABLE (PREFIX_VEX_38AC) },
8016     { PREFIX_TABLE (PREFIX_VEX_38AD) },
8017     { PREFIX_TABLE (PREFIX_VEX_38AE) },
8018     { PREFIX_TABLE (PREFIX_VEX_38AF) },
8019     /* b0 */
8020     { "(bad)",          { XX } },
8021     { "(bad)",          { XX } },
8022     { "(bad)",          { XX } },
8023     { "(bad)",          { XX } },
8024     { "(bad)",          { XX } },
8025     { "(bad)",          { XX } },
8026     { PREFIX_TABLE (PREFIX_VEX_38B6) },
8027     { PREFIX_TABLE (PREFIX_VEX_38B7) },
8028     /* b8 */
8029     { PREFIX_TABLE (PREFIX_VEX_38B8) },
8030     { PREFIX_TABLE (PREFIX_VEX_38B9) },
8031     { PREFIX_TABLE (PREFIX_VEX_38BA) },
8032     { PREFIX_TABLE (PREFIX_VEX_38BB) },
8033     { PREFIX_TABLE (PREFIX_VEX_38BC) },
8034     { PREFIX_TABLE (PREFIX_VEX_38BD) },
8035     { PREFIX_TABLE (PREFIX_VEX_38BE) },
8036     { PREFIX_TABLE (PREFIX_VEX_38BF) },
8037     /* c0 */
8038     { "(bad)",          { XX } },
8039     { "(bad)",          { XX } },
8040     { "(bad)",          { XX } },
8041     { "(bad)",          { XX } },
8042     { "(bad)",          { XX } },
8043     { "(bad)",          { XX } },
8044     { "(bad)",          { XX } },
8045     { "(bad)",          { XX } },
8046     /* c8 */
8047     { "(bad)",          { XX } },
8048     { "(bad)",          { XX } },
8049     { "(bad)",          { XX } },
8050     { "(bad)",          { XX } },
8051     { "(bad)",          { XX } },
8052     { "(bad)",          { XX } },
8053     { "(bad)",          { XX } },
8054     { "(bad)",          { XX } },
8055     /* d0 */
8056     { "(bad)",          { XX } },
8057     { "(bad)",          { XX } },
8058     { "(bad)",          { XX } },
8059     { "(bad)",          { XX } },
8060     { "(bad)",          { XX } },
8061     { "(bad)",          { XX } },
8062     { "(bad)",          { XX } },
8063     { "(bad)",          { XX } },
8064     /* d8 */
8065     { "(bad)",          { XX } },
8066     { "(bad)",          { XX } },
8067     { "(bad)",          { XX } },
8068     { PREFIX_TABLE (PREFIX_VEX_38DB) },
8069     { PREFIX_TABLE (PREFIX_VEX_38DC) },
8070     { PREFIX_TABLE (PREFIX_VEX_38DD) },
8071     { PREFIX_TABLE (PREFIX_VEX_38DE) },
8072     { PREFIX_TABLE (PREFIX_VEX_38DF) },
8073     /* e0 */
8074     { "(bad)",          { XX } },
8075     { "(bad)",          { XX } },
8076     { "(bad)",          { XX } },
8077     { "(bad)",          { XX } },
8078     { "(bad)",          { XX } },
8079     { "(bad)",          { XX } },
8080     { "(bad)",          { XX } },
8081     { "(bad)",          { XX } },
8082     /* e8 */
8083     { "(bad)",          { XX } },
8084     { "(bad)",          { XX } },
8085     { "(bad)",          { XX } },
8086     { "(bad)",          { XX } },
8087     { "(bad)",          { XX } },
8088     { "(bad)",          { XX } },
8089     { "(bad)",          { XX } },
8090     { "(bad)",          { XX } },
8091     /* f0 */
8092     { "(bad)",          { XX } },
8093     { "(bad)",          { XX } },
8094     { "(bad)",          { XX } },
8095     { "(bad)",          { XX } },
8096     { "(bad)",          { XX } },
8097     { "(bad)",          { XX } },
8098     { "(bad)",          { XX } },
8099     { "(bad)",          { XX } },
8100     /* f8 */
8101     { "(bad)",          { XX } },
8102     { "(bad)",          { XX } },
8103     { "(bad)",          { XX } },
8104     { "(bad)",          { XX } },
8105     { "(bad)",          { XX } },
8106     { "(bad)",          { XX } },
8107     { "(bad)",          { XX } },
8108     { "(bad)",          { XX } },
8109   },
8110   /* VEX_0F3A */
8111   {
8112     /* 00 */
8113     { "(bad)",          { XX } },
8114     { "(bad)",          { XX } },
8115     { "(bad)",          { XX } },
8116     { "(bad)",          { XX } },
8117     { PREFIX_TABLE (PREFIX_VEX_3A04) },
8118     { PREFIX_TABLE (PREFIX_VEX_3A05) },
8119     { PREFIX_TABLE (PREFIX_VEX_3A06) },
8120     { "(bad)",          { XX } },
8121     /* 08 */
8122     { PREFIX_TABLE (PREFIX_VEX_3A08) },
8123     { PREFIX_TABLE (PREFIX_VEX_3A09) },
8124     { PREFIX_TABLE (PREFIX_VEX_3A0A) },
8125     { PREFIX_TABLE (PREFIX_VEX_3A0B) },
8126     { PREFIX_TABLE (PREFIX_VEX_3A0C) },
8127     { PREFIX_TABLE (PREFIX_VEX_3A0D) },
8128     { PREFIX_TABLE (PREFIX_VEX_3A0E) },
8129     { PREFIX_TABLE (PREFIX_VEX_3A0F) },
8130     /* 10 */
8131     { "(bad)",          { XX } },
8132     { "(bad)",          { XX } },
8133     { "(bad)",          { XX } },
8134     { "(bad)",          { XX } },
8135     { PREFIX_TABLE (PREFIX_VEX_3A14) },
8136     { PREFIX_TABLE (PREFIX_VEX_3A15) },
8137     { PREFIX_TABLE (PREFIX_VEX_3A16) },
8138     { PREFIX_TABLE (PREFIX_VEX_3A17) },
8139     /* 18 */
8140     { PREFIX_TABLE (PREFIX_VEX_3A18) },
8141     { PREFIX_TABLE (PREFIX_VEX_3A19) },
8142     { "(bad)",          { XX } },
8143     { "(bad)",          { XX } },
8144     { "(bad)",          { XX } },
8145     { "(bad)",          { XX } },
8146     { "(bad)",          { XX } },
8147     { "(bad)",          { XX } },
8148     /* 20 */
8149     { PREFIX_TABLE (PREFIX_VEX_3A20) },
8150     { PREFIX_TABLE (PREFIX_VEX_3A21) },
8151     { PREFIX_TABLE (PREFIX_VEX_3A22) },
8152     { "(bad)",          { XX } },
8153     { "(bad)",          { XX } },
8154     { "(bad)",          { XX } },
8155     { "(bad)",          { XX } },
8156     { "(bad)",          { XX } },
8157     /* 28 */
8158     { "(bad)",          { XX } },
8159     { "(bad)",          { XX } },
8160     { "(bad)",          { XX } },
8161     { "(bad)",          { XX } },
8162     { "(bad)",          { XX } },
8163     { "(bad)",          { XX } },
8164     { "(bad)",          { XX } },
8165     { "(bad)",          { XX } },
8166     /* 30 */
8167     { "(bad)",          { XX } },
8168     { "(bad)",          { XX } },
8169     { "(bad)",          { XX } },
8170     { "(bad)",          { XX } },
8171     { "(bad)",          { XX } },
8172     { "(bad)",          { XX } },
8173     { "(bad)",          { XX } },
8174     { "(bad)",          { XX } },
8175     /* 38 */
8176     { "(bad)",          { XX } },
8177     { "(bad)",          { XX } },
8178     { "(bad)",          { XX } },
8179     { "(bad)",          { XX } },
8180     { "(bad)",          { XX } },
8181     { "(bad)",          { XX } },
8182     { "(bad)",          { XX } },
8183     { "(bad)",          { XX } },
8184     /* 40 */
8185     { PREFIX_TABLE (PREFIX_VEX_3A40) },
8186     { PREFIX_TABLE (PREFIX_VEX_3A41) },
8187     { PREFIX_TABLE (PREFIX_VEX_3A42) },
8188     { "(bad)",          { XX } },
8189     { PREFIX_TABLE (PREFIX_VEX_3A44) },
8190     { "(bad)",          { XX } },
8191     { "(bad)",          { XX } },
8192     { "(bad)",          { XX } },
8193     /* 48 */
8194     { "(bad)",          { XX } },
8195     { "(bad)",          { XX } },
8196     { PREFIX_TABLE (PREFIX_VEX_3A4A) },
8197     { PREFIX_TABLE (PREFIX_VEX_3A4B) },
8198     { PREFIX_TABLE (PREFIX_VEX_3A4C) },
8199     { "(bad)",          { XX } },
8200     { "(bad)",          { XX } },
8201     { "(bad)",          { XX } },
8202     /* 50 */
8203     { "(bad)",          { XX } },
8204     { "(bad)",          { XX } },
8205     { "(bad)",          { XX } },
8206     { "(bad)",          { XX } },
8207     { "(bad)",          { XX } },
8208     { "(bad)",          { XX } },
8209     { "(bad)",          { XX } },
8210     { "(bad)",          { XX } },
8211     /* 58 */
8212     { "(bad)",          { XX } },
8213     { "(bad)",          { XX } },
8214     { "(bad)",          { XX } },
8215     { "(bad)",          { XX } },
8216     { PREFIX_TABLE (PREFIX_VEX_3A5C) },
8217     { PREFIX_TABLE (PREFIX_VEX_3A5D) },
8218     { PREFIX_TABLE (PREFIX_VEX_3A5E) },
8219     { PREFIX_TABLE (PREFIX_VEX_3A5F) },
8220     /* 60 */
8221     { PREFIX_TABLE (PREFIX_VEX_3A60) },
8222     { PREFIX_TABLE (PREFIX_VEX_3A61) },
8223     { PREFIX_TABLE (PREFIX_VEX_3A62) },
8224     { PREFIX_TABLE (PREFIX_VEX_3A63) },
8225     { "(bad)",          { XX } },
8226     { "(bad)",          { XX } },
8227     { "(bad)",          { XX } },
8228     { "(bad)",          { XX } },
8229     /* 68 */
8230     { PREFIX_TABLE (PREFIX_VEX_3A68) },
8231     { PREFIX_TABLE (PREFIX_VEX_3A69) },
8232     { PREFIX_TABLE (PREFIX_VEX_3A6A) },
8233     { PREFIX_TABLE (PREFIX_VEX_3A6B) },
8234     { PREFIX_TABLE (PREFIX_VEX_3A6C) },
8235     { PREFIX_TABLE (PREFIX_VEX_3A6D) },
8236     { PREFIX_TABLE (PREFIX_VEX_3A6E) },
8237     { PREFIX_TABLE (PREFIX_VEX_3A6F) },
8238     /* 70 */
8239     { "(bad)",          { XX } },
8240     { "(bad)",          { XX } },
8241     { "(bad)",          { XX } },
8242     { "(bad)",          { XX } },
8243     { "(bad)",          { XX } },
8244     { "(bad)",          { XX } },
8245     { "(bad)",          { XX } },
8246     { "(bad)",          { XX } },
8247     /* 78 */
8248     { PREFIX_TABLE (PREFIX_VEX_3A78) },
8249     { PREFIX_TABLE (PREFIX_VEX_3A79) },
8250     { PREFIX_TABLE (PREFIX_VEX_3A7A) },
8251     { PREFIX_TABLE (PREFIX_VEX_3A7B) },
8252     { PREFIX_TABLE (PREFIX_VEX_3A7C) },
8253     { PREFIX_TABLE (PREFIX_VEX_3A7D) },
8254     { PREFIX_TABLE (PREFIX_VEX_3A7E) },
8255     { PREFIX_TABLE (PREFIX_VEX_3A7F) },
8256     /* 80 */
8257     { "(bad)",          { XX } },
8258     { "(bad)",          { XX } },
8259     { "(bad)",          { XX } },
8260     { "(bad)",          { XX } },
8261     { "(bad)",          { XX } },
8262     { "(bad)",          { XX } },
8263     { "(bad)",          { XX } },
8264     { "(bad)",          { XX } },
8265     /* 88 */
8266     { "(bad)",          { XX } },
8267     { "(bad)",          { XX } },
8268     { "(bad)",          { XX } },
8269     { "(bad)",          { XX } },
8270     { "(bad)",          { XX } },
8271     { "(bad)",          { XX } },
8272     { "(bad)",          { XX } },
8273     { "(bad)",          { XX } },
8274     /* 90 */
8275     { "(bad)",          { XX } },
8276     { "(bad)",          { XX } },
8277     { "(bad)",          { XX } },
8278     { "(bad)",          { XX } },
8279     { "(bad)",          { XX } },
8280     { "(bad)",          { XX } },
8281     { "(bad)",          { XX } },
8282     { "(bad)",          { XX } },
8283     /* 98 */
8284     { "(bad)",          { XX } },
8285     { "(bad)",          { XX } },
8286     { "(bad)",          { XX } },
8287     { "(bad)",          { XX } },
8288     { "(bad)",          { XX } },
8289     { "(bad)",          { XX } },
8290     { "(bad)",          { XX } },
8291     { "(bad)",          { XX } },
8292     /* a0 */
8293     { "(bad)",          { XX } },
8294     { "(bad)",          { XX } },
8295     { "(bad)",          { XX } },
8296     { "(bad)",          { XX } },
8297     { "(bad)",          { XX } },
8298     { "(bad)",          { XX } },
8299     { "(bad)",          { XX } },
8300     { "(bad)",          { XX } },
8301     /* a8 */
8302     { "(bad)",          { XX } },
8303     { "(bad)",          { XX } },
8304     { "(bad)",          { XX } },
8305     { "(bad)",          { XX } },
8306     { "(bad)",          { XX } },
8307     { "(bad)",          { XX } },
8308     { "(bad)",          { XX } },
8309     { "(bad)",          { XX } },
8310     /* b0 */
8311     { "(bad)",          { XX } },
8312     { "(bad)",          { XX } },
8313     { "(bad)",          { XX } },
8314     { "(bad)",          { XX } },
8315     { "(bad)",          { XX } },
8316     { "(bad)",          { XX } },
8317     { "(bad)",          { XX } },
8318     { "(bad)",          { XX } },
8319     /* b8 */
8320     { "(bad)",          { XX } },
8321     { "(bad)",          { XX } },
8322     { "(bad)",          { XX } },
8323     { "(bad)",          { XX } },
8324     { "(bad)",          { XX } },
8325     { "(bad)",          { XX } },
8326     { "(bad)",          { XX } },
8327     { "(bad)",          { XX } },
8328     /* c0 */
8329     { "(bad)",          { XX } },
8330     { "(bad)",          { XX } },
8331     { "(bad)",          { XX } },
8332     { "(bad)",          { XX } },
8333     { "(bad)",          { XX } },
8334     { "(bad)",          { XX } },
8335     { "(bad)",          { XX } },
8336     { "(bad)",          { XX } },
8337     /* c8 */
8338     { "(bad)",          { XX } },
8339     { "(bad)",          { XX } },
8340     { "(bad)",          { XX } },
8341     { "(bad)",          { XX } },
8342     { "(bad)",          { XX } },
8343     { "(bad)",          { XX } },
8344     { "(bad)",          { XX } },
8345     { "(bad)",          { XX } },
8346     /* d0 */
8347     { "(bad)",          { XX } },
8348     { "(bad)",          { XX } },
8349     { "(bad)",          { XX } },
8350     { "(bad)",          { XX } },
8351     { "(bad)",          { XX } },
8352     { "(bad)",          { XX } },
8353     { "(bad)",          { XX } },
8354     { "(bad)",          { XX } },
8355     /* d8 */
8356     { "(bad)",          { XX } },
8357     { "(bad)",          { XX } },
8358     { "(bad)",          { XX } },
8359     { "(bad)",          { XX } },
8360     { "(bad)",          { XX } },
8361     { "(bad)",          { XX } },
8362     { "(bad)",          { XX } },
8363     { PREFIX_TABLE (PREFIX_VEX_3ADF) },
8364     /* e0 */
8365     { "(bad)",          { XX } },
8366     { "(bad)",          { XX } },
8367     { "(bad)",          { XX } },
8368     { "(bad)",          { XX } },
8369     { "(bad)",          { XX } },
8370     { "(bad)",          { XX } },
8371     { "(bad)",          { XX } },
8372     { "(bad)",          { XX } },
8373     /* e8 */
8374     { "(bad)",          { XX } },
8375     { "(bad)",          { XX } },
8376     { "(bad)",          { XX } },
8377     { "(bad)",          { XX } },
8378     { "(bad)",          { XX } },
8379     { "(bad)",          { XX } },
8380     { "(bad)",          { XX } },
8381     { "(bad)",          { XX } },
8382     /* f0 */
8383     { "(bad)",          { XX } },
8384     { "(bad)",          { XX } },
8385     { "(bad)",          { XX } },
8386     { "(bad)",          { XX } },
8387     { "(bad)",          { XX } },
8388     { "(bad)",          { XX } },
8389     { "(bad)",          { XX } },
8390     { "(bad)",          { XX } },
8391     /* f8 */
8392     { "(bad)",          { XX } },
8393     { "(bad)",          { XX } },
8394     { "(bad)",          { XX } },
8395     { "(bad)",          { XX } },
8396     { "(bad)",          { XX } },
8397     { "(bad)",          { XX } },
8398     { "(bad)",          { XX } },
8399     { "(bad)",          { XX } },
8400   },
8401 };
8402
8403 static const struct dis386 vex_len_table[][2] = {
8404   /* VEX_LEN_10_P_1 */
8405   {
8406     { VEX_W_TABLE (VEX_W_10_P_1) },
8407     { "(bad)",          { XX } },
8408   },
8409
8410   /* VEX_LEN_10_P_3 */
8411   {
8412     { VEX_W_TABLE (VEX_W_10_P_3) },
8413     { "(bad)",          { XX } },
8414   },
8415
8416   /* VEX_LEN_11_P_1 */
8417   {
8418     { VEX_W_TABLE (VEX_W_11_P_1) },
8419     { "(bad)",          { XX } },
8420   },
8421
8422   /* VEX_LEN_11_P_3 */
8423   {
8424     { VEX_W_TABLE (VEX_W_11_P_3) },
8425     { "(bad)",          { XX } },
8426   },
8427
8428   /* VEX_LEN_12_P_0_M_0 */
8429   {
8430     { VEX_W_TABLE (VEX_W_12_P_0_M_0) },
8431     { "(bad)",          { XX } },
8432   },
8433
8434   /* VEX_LEN_12_P_0_M_1 */
8435   {
8436     { VEX_W_TABLE (VEX_W_12_P_0_M_1) },
8437     { "(bad)",          { XX } },
8438   },
8439
8440   /* VEX_LEN_12_P_2 */
8441   {
8442     { VEX_W_TABLE (VEX_W_12_P_2) },
8443     { "(bad)",          { XX } },
8444   },
8445
8446   /* VEX_LEN_13_M_0 */
8447   {
8448     { VEX_W_TABLE (VEX_W_13_M_0) },
8449     { "(bad)",          { XX } },
8450   },
8451
8452   /* VEX_LEN_16_P_0_M_0 */
8453   {
8454     { VEX_W_TABLE (VEX_W_16_P_0_M_0) },
8455     { "(bad)",          { XX } },
8456   },
8457
8458   /* VEX_LEN_16_P_0_M_1 */
8459   {
8460     { VEX_W_TABLE (VEX_W_16_P_0_M_1) },
8461     { "(bad)",          { XX } },
8462   },
8463
8464   /* VEX_LEN_16_P_2 */
8465   {
8466     { VEX_W_TABLE (VEX_W_16_P_2) },
8467     { "(bad)",          { XX } },
8468   },
8469
8470   /* VEX_LEN_17_M_0 */
8471   {
8472     { VEX_W_TABLE (VEX_W_17_M_0) },
8473     { "(bad)",          { XX } },
8474   },
8475
8476   /* VEX_LEN_2A_P_1 */
8477   {
8478     { "vcvtsi2ss%LQ",   { XM, Vex128, Ev } },
8479     { "(bad)",          { XX } },
8480   },
8481
8482   /* VEX_LEN_2A_P_3 */
8483   {
8484     { "vcvtsi2sd%LQ",   { XM, Vex128, Ev } },
8485     { "(bad)",          { XX } },
8486   },
8487
8488   /* VEX_LEN_2C_P_1 */
8489   {
8490     { "vcvttss2siY",    { Gv, EXd } },
8491     { "(bad)",          { XX } },
8492   },
8493
8494   /* VEX_LEN_2C_P_3 */
8495   {
8496     { "vcvttsd2siY",    { Gv, EXq } },
8497     { "(bad)",          { XX } },
8498   },
8499
8500   /* VEX_LEN_2D_P_1 */
8501   {
8502     { "vcvtss2siY",     { Gv, EXd } },
8503     { "(bad)",          { XX } },
8504   },
8505
8506   /* VEX_LEN_2D_P_3 */
8507   {
8508     { "vcvtsd2siY",     { Gv, EXq } },
8509     { "(bad)",          { XX } },
8510   },
8511
8512   /* VEX_LEN_2E_P_0 */
8513   {
8514     { VEX_W_TABLE (VEX_W_2E_P_0) },
8515     { "(bad)",          { XX } },
8516   },
8517
8518   /* VEX_LEN_2E_P_2 */
8519   {
8520     { VEX_W_TABLE (VEX_W_2E_P_2) },
8521     { "(bad)",          { XX } },
8522   },
8523
8524   /* VEX_LEN_2F_P_0 */
8525   {
8526     { VEX_W_TABLE (VEX_W_2F_P_0) },
8527     { "(bad)",          { XX } },
8528   },
8529
8530   /* VEX_LEN_2F_P_2 */
8531   {
8532     { VEX_W_TABLE (VEX_W_2F_P_2) },
8533     { "(bad)",          { XX } },
8534   },
8535
8536   /* VEX_LEN_51_P_1 */
8537   {
8538     { VEX_W_TABLE (VEX_W_51_P_1) },
8539     { "(bad)",          { XX } },
8540   },
8541
8542   /* VEX_LEN_51_P_3 */
8543   {
8544     { VEX_W_TABLE (VEX_W_51_P_3) },
8545     { "(bad)",          { XX } },
8546   },
8547
8548   /* VEX_LEN_52_P_1 */
8549   {
8550     { VEX_W_TABLE (VEX_W_52_P_1) },
8551     { "(bad)",          { XX } },
8552   },
8553
8554   /* VEX_LEN_53_P_1 */
8555   {
8556     { VEX_W_TABLE (VEX_W_53_P_1) },
8557     { "(bad)",          { XX } },
8558   },
8559
8560   /* VEX_LEN_58_P_1 */
8561   {
8562     { VEX_W_TABLE (VEX_W_58_P_1) },
8563     { "(bad)",          { XX } },
8564   },
8565
8566   /* VEX_LEN_58_P_3 */
8567   {
8568     { VEX_W_TABLE (VEX_W_58_P_3) },
8569     { "(bad)",          { XX } },
8570   },
8571
8572   /* VEX_LEN_59_P_1 */
8573   {
8574     { VEX_W_TABLE (VEX_W_59_P_1) },
8575     { "(bad)",          { XX } },
8576   },
8577
8578   /* VEX_LEN_59_P_3 */
8579   {
8580     { VEX_W_TABLE (VEX_W_59_P_3) },
8581     { "(bad)",          { XX } },
8582   },
8583
8584   /* VEX_LEN_5A_P_1 */
8585   {
8586     { VEX_W_TABLE (VEX_W_5A_P_1) },
8587     { "(bad)",          { XX } },
8588   },
8589
8590   /* VEX_LEN_5A_P_3 */
8591   {
8592     { VEX_W_TABLE (VEX_W_5A_P_3) },
8593     { "(bad)",          { XX } },
8594   },
8595
8596   /* VEX_LEN_5C_P_1 */
8597   {
8598     { VEX_W_TABLE (VEX_W_5C_P_1) },
8599     { "(bad)",          { XX } },
8600   },
8601
8602   /* VEX_LEN_5C_P_3 */
8603   {
8604     { VEX_W_TABLE (VEX_W_5C_P_3) },
8605     { "(bad)",          { XX } },
8606   },
8607
8608   /* VEX_LEN_5D_P_1 */
8609   {
8610     { VEX_W_TABLE (VEX_W_5D_P_1) },
8611     { "(bad)",          { XX } },
8612   },
8613
8614   /* VEX_LEN_5D_P_3 */
8615   {
8616     { VEX_W_TABLE (VEX_W_5D_P_3) },
8617     { "(bad)",          { XX } },
8618   },
8619
8620   /* VEX_LEN_5E_P_1 */
8621   {
8622     { VEX_W_TABLE (VEX_W_5E_P_1) },
8623     { "(bad)",          { XX } },
8624   },
8625
8626   /* VEX_LEN_5E_P_3 */
8627   {
8628     { VEX_W_TABLE (VEX_W_5E_P_3) },
8629     { "(bad)",          { XX } },
8630   },
8631
8632   /* VEX_LEN_5F_P_1 */
8633   {
8634     { VEX_W_TABLE (VEX_W_5F_P_1) },
8635     { "(bad)",          { XX } },
8636   },
8637
8638   /* VEX_LEN_5F_P_3 */
8639   {
8640     { VEX_W_TABLE (VEX_W_5F_P_3) },
8641     { "(bad)",          { XX } },
8642   },
8643
8644   /* VEX_LEN_60_P_2 */
8645   {
8646     { VEX_W_TABLE (VEX_W_60_P_2) },
8647     { "(bad)",          { XX } },
8648   },
8649
8650   /* VEX_LEN_61_P_2 */
8651   {
8652     { VEX_W_TABLE (VEX_W_61_P_2) },
8653     { "(bad)",          { XX } },
8654   },
8655
8656   /* VEX_LEN_62_P_2 */
8657   {
8658     { VEX_W_TABLE (VEX_W_62_P_2) },
8659     { "(bad)",          { XX } },
8660   },
8661
8662   /* VEX_LEN_63_P_2 */
8663   {
8664     { VEX_W_TABLE (VEX_W_63_P_2) },
8665     { "(bad)",          { XX } },
8666   },
8667
8668   /* VEX_LEN_64_P_2 */
8669   {
8670     { VEX_W_TABLE (VEX_W_64_P_2) },
8671     { "(bad)",          { XX } },
8672   },
8673
8674   /* VEX_LEN_65_P_2 */
8675   {
8676     { VEX_W_TABLE (VEX_W_65_P_2) },
8677     { "(bad)",          { XX } },
8678   },
8679
8680   /* VEX_LEN_66_P_2 */
8681   {
8682     { VEX_W_TABLE (VEX_W_66_P_2) },
8683     { "(bad)",          { XX } },
8684   },
8685
8686   /* VEX_LEN_67_P_2 */
8687   {
8688     { VEX_W_TABLE (VEX_W_67_P_2) },
8689     { "(bad)",          { XX } },
8690   },
8691
8692   /* VEX_LEN_68_P_2 */
8693   {
8694     { VEX_W_TABLE (VEX_W_68_P_2) },
8695     { "(bad)",          { XX } },
8696   },
8697
8698   /* VEX_LEN_69_P_2 */
8699   {
8700     { VEX_W_TABLE (VEX_W_69_P_2) },
8701     { "(bad)",          { XX } },
8702   },
8703
8704   /* VEX_LEN_6A_P_2 */
8705   {
8706     { VEX_W_TABLE (VEX_W_6A_P_2) },
8707     { "(bad)",          { XX } },
8708   },
8709
8710   /* VEX_LEN_6B_P_2 */
8711   {
8712     { VEX_W_TABLE (VEX_W_6B_P_2) },
8713     { "(bad)",          { XX } },
8714   },
8715
8716   /* VEX_LEN_6C_P_2 */
8717   {
8718     { VEX_W_TABLE (VEX_W_6C_P_2) },
8719     { "(bad)",          { XX } },
8720   },
8721
8722   /* VEX_LEN_6D_P_2 */
8723   {
8724     { VEX_W_TABLE (VEX_W_6D_P_2) },
8725     { "(bad)",          { XX } },
8726   },
8727
8728   /* VEX_LEN_6E_P_2 */
8729   {
8730     { "vmovK",          { XM, Edq } },
8731     { "(bad)",          { XX } },
8732   },
8733
8734   /* VEX_LEN_70_P_1 */
8735   {
8736     { VEX_W_TABLE (VEX_W_70_P_1) },
8737     { "(bad)",          { XX } },
8738   },
8739
8740   /* VEX_LEN_70_P_2 */
8741   {
8742     { VEX_W_TABLE (VEX_W_70_P_2) },
8743     { "(bad)",          { XX } },
8744   },
8745
8746   /* VEX_LEN_70_P_3 */
8747   {
8748     { VEX_W_TABLE (VEX_W_70_P_3) },
8749     { "(bad)",          { XX } },
8750   },
8751
8752   /* VEX_LEN_71_R_2_P_2 */
8753   {
8754     { VEX_W_TABLE (VEX_W_71_R_2_P_2) },
8755     { "(bad)",          { XX } },
8756   },
8757
8758   /* VEX_LEN_71_R_4_P_2 */
8759   {
8760     { VEX_W_TABLE (VEX_W_71_R_4_P_2) },
8761     { "(bad)",          { XX } },
8762   },
8763
8764   /* VEX_LEN_71_R_6_P_2 */
8765   {
8766     { VEX_W_TABLE (VEX_W_71_R_6_P_2) },
8767     { "(bad)",          { XX } },
8768   },
8769
8770   /* VEX_LEN_72_R_2_P_2 */
8771   {
8772     { VEX_W_TABLE (VEX_W_72_R_2_P_2) },
8773     { "(bad)",          { XX } },
8774   },
8775
8776   /* VEX_LEN_72_R_4_P_2 */
8777   {
8778     { VEX_W_TABLE (VEX_W_72_R_4_P_2) },
8779     { "(bad)",          { XX } },
8780   },
8781
8782   /* VEX_LEN_72_R_6_P_2 */
8783   {
8784     { VEX_W_TABLE (VEX_W_72_R_6_P_2) },
8785     { "(bad)",          { XX } },
8786   },
8787
8788   /* VEX_LEN_73_R_2_P_2 */
8789   {
8790     { VEX_W_TABLE (VEX_W_73_R_2_P_2) },
8791     { "(bad)",          { XX } },
8792   },
8793
8794   /* VEX_LEN_73_R_3_P_2 */
8795   {
8796     { VEX_W_TABLE (VEX_W_73_R_3_P_2) },
8797     { "(bad)",          { XX } },
8798   },
8799
8800   /* VEX_LEN_73_R_6_P_2 */
8801   {
8802     { VEX_W_TABLE (VEX_W_73_R_6_P_2) },
8803     { "(bad)",          { XX } },
8804   },
8805
8806   /* VEX_LEN_73_R_7_P_2 */
8807   {
8808     { VEX_W_TABLE (VEX_W_73_R_7_P_2) },
8809     { "(bad)",          { XX } },
8810   },
8811
8812   /* VEX_LEN_74_P_2 */
8813   {
8814     { VEX_W_TABLE (VEX_W_74_P_2) },
8815     { "(bad)",          { XX } },
8816   },
8817
8818   /* VEX_LEN_75_P_2 */
8819   {
8820     { VEX_W_TABLE (VEX_W_75_P_2) },
8821     { "(bad)",          { XX } },
8822   },
8823
8824   /* VEX_LEN_76_P_2 */
8825   {
8826     { VEX_W_TABLE (VEX_W_76_P_2) },
8827     { "(bad)",          { XX } },
8828   },
8829
8830   /* VEX_LEN_7E_P_1 */
8831   {
8832     { VEX_W_TABLE (VEX_W_7E_P_1) },
8833     { "(bad)",          { XX } },
8834   },
8835
8836   /* VEX_LEN_7E_P_2 */
8837   {
8838     { "vmovK",          { Edq, XM } },
8839     { "(bad)",          { XX } },
8840   },
8841
8842   /* VEX_LEN_AE_R_2_M_0 */
8843   {
8844     { VEX_W_TABLE (VEX_W_AE_R_2_M_0) },
8845     { "(bad)",          { XX } },
8846   },
8847
8848   /* VEX_LEN_AE_R_3_M_0 */
8849   {
8850     { VEX_W_TABLE (VEX_W_AE_R_3_M_0) },
8851     { "(bad)",          { XX } },
8852   },
8853
8854   /* VEX_LEN_C2_P_1 */
8855   {
8856     { VEX_W_TABLE (VEX_W_C2_P_1) },
8857     { "(bad)",          { XX } },
8858   },
8859
8860   /* VEX_LEN_C2_P_3 */
8861   {
8862     { VEX_W_TABLE (VEX_W_C2_P_3) },
8863     { "(bad)",          { XX } },
8864   },
8865
8866   /* VEX_LEN_C4_P_2 */
8867   {
8868     { VEX_W_TABLE (VEX_W_C4_P_2) },
8869     { "(bad)",          { XX } },
8870   },
8871
8872   /* VEX_LEN_C5_P_2 */
8873   {
8874     { VEX_W_TABLE (VEX_W_C5_P_2) },
8875     { "(bad)",          { XX } },
8876   },
8877
8878   /* VEX_LEN_D1_P_2 */
8879   {
8880     { VEX_W_TABLE (VEX_W_D1_P_2) },
8881     { "(bad)",          { XX } },
8882   },
8883
8884   /* VEX_LEN_D2_P_2 */
8885   {
8886     { VEX_W_TABLE (VEX_W_D2_P_2) },
8887     { "(bad)",          { XX } },
8888   },
8889
8890   /* VEX_LEN_D3_P_2 */
8891   {
8892     { VEX_W_TABLE (VEX_W_D3_P_2) },
8893     { "(bad)",          { XX } },
8894   },
8895
8896   /* VEX_LEN_D4_P_2 */
8897   {
8898     { VEX_W_TABLE (VEX_W_D4_P_2) },
8899     { "(bad)",          { XX } },
8900   },
8901
8902   /* VEX_LEN_D5_P_2 */
8903   {
8904     { VEX_W_TABLE (VEX_W_D5_P_2) },
8905     { "(bad)",          { XX } },
8906   },
8907
8908   /* VEX_LEN_D6_P_2 */
8909   {
8910     { VEX_W_TABLE (VEX_W_D6_P_2) },
8911     { "(bad)",          { XX } },
8912   },
8913
8914   /* VEX_LEN_D7_P_2_M_1 */
8915   {
8916     { VEX_W_TABLE (VEX_W_D7_P_2_M_1) },
8917     { "(bad)",          { XX } },
8918   },
8919
8920   /* VEX_LEN_D8_P_2 */
8921   {
8922     { VEX_W_TABLE (VEX_W_D8_P_2) },
8923     { "(bad)",          { XX } },
8924   },
8925
8926   /* VEX_LEN_D9_P_2 */
8927   {
8928     { VEX_W_TABLE (VEX_W_D9_P_2) },
8929     { "(bad)",          { XX } },
8930   },
8931
8932   /* VEX_LEN_DA_P_2 */
8933   {
8934     { VEX_W_TABLE (VEX_W_DA_P_2) },
8935     { "(bad)",          { XX } },
8936   },
8937
8938   /* VEX_LEN_DB_P_2 */
8939   {
8940     { VEX_W_TABLE (VEX_W_DB_P_2) },
8941     { "(bad)",          { XX } },
8942   },
8943
8944   /* VEX_LEN_DC_P_2 */
8945   {
8946     { VEX_W_TABLE (VEX_W_DC_P_2) },
8947     { "(bad)",          { XX } },
8948   },
8949
8950   /* VEX_LEN_DD_P_2 */
8951   {
8952     { VEX_W_TABLE (VEX_W_DD_P_2) },
8953     { "(bad)",          { XX } },
8954   },
8955
8956   /* VEX_LEN_DE_P_2 */
8957   {
8958     { VEX_W_TABLE (VEX_W_DE_P_2) },
8959     { "(bad)",          { XX } },
8960   },
8961
8962   /* VEX_LEN_DF_P_2 */
8963   {
8964     { VEX_W_TABLE (VEX_W_DF_P_2) },
8965     { "(bad)",          { XX } },
8966   },
8967
8968   /* VEX_LEN_E0_P_2 */
8969   {
8970     { VEX_W_TABLE (VEX_W_E0_P_2) },
8971     { "(bad)",          { XX } },
8972   },
8973
8974   /* VEX_LEN_E1_P_2 */
8975   {
8976     { VEX_W_TABLE (VEX_W_E1_P_2) },
8977     { "(bad)",          { XX } },
8978   },
8979
8980   /* VEX_LEN_E2_P_2 */
8981   {
8982     { VEX_W_TABLE (VEX_W_E2_P_2) },
8983     { "(bad)",          { XX } },
8984   },
8985
8986   /* VEX_LEN_E3_P_2 */
8987   {
8988     { VEX_W_TABLE (VEX_W_E3_P_2) },
8989     { "(bad)",          { XX } },
8990   },
8991
8992   /* VEX_LEN_E4_P_2 */
8993   {
8994     { VEX_W_TABLE (VEX_W_E4_P_2) },
8995     { "(bad)",          { XX } },
8996   },
8997
8998   /* VEX_LEN_E5_P_2 */
8999   {
9000     { VEX_W_TABLE (VEX_W_E5_P_2) },
9001     { "(bad)",          { XX } },
9002   },
9003
9004   /* VEX_LEN_E8_P_2 */
9005   {
9006     { VEX_W_TABLE (VEX_W_E8_P_2) },
9007     { "(bad)",          { XX } },
9008   },
9009
9010   /* VEX_LEN_E9_P_2 */
9011   {
9012     { VEX_W_TABLE (VEX_W_E9_P_2) },
9013     { "(bad)",          { XX } },
9014   },
9015
9016   /* VEX_LEN_EA_P_2 */
9017   {
9018     { VEX_W_TABLE (VEX_W_EA_P_2) },
9019     { "(bad)",          { XX } },
9020   },
9021
9022   /* VEX_LEN_EB_P_2 */
9023   {
9024     { VEX_W_TABLE (VEX_W_EB_P_2) },
9025     { "(bad)",          { XX } },
9026   },
9027
9028   /* VEX_LEN_EC_P_2 */
9029   {
9030     { VEX_W_TABLE (VEX_W_EC_P_2) },
9031     { "(bad)",          { XX } },
9032   },
9033
9034   /* VEX_LEN_ED_P_2 */
9035   {
9036     { VEX_W_TABLE (VEX_W_ED_P_2) },
9037     { "(bad)",          { XX } },
9038   },
9039
9040   /* VEX_LEN_EE_P_2 */
9041   {
9042     { VEX_W_TABLE (VEX_W_EE_P_2) },
9043     { "(bad)",          { XX } },
9044   },
9045
9046   /* VEX_LEN_EF_P_2 */
9047   {
9048     { VEX_W_TABLE (VEX_W_EF_P_2) },
9049     { "(bad)",          { XX } },
9050   },
9051
9052   /* VEX_LEN_F1_P_2 */
9053   {
9054     { VEX_W_TABLE (VEX_W_F1_P_2) },
9055     { "(bad)",          { XX } },
9056   },
9057
9058   /* VEX_LEN_F2_P_2 */
9059   {
9060     { VEX_W_TABLE (VEX_W_F2_P_2) },
9061     { "(bad)",          { XX } },
9062   },
9063
9064   /* VEX_LEN_F3_P_2 */
9065   {
9066     { VEX_W_TABLE (VEX_W_F3_P_2) },
9067     { "(bad)",          { XX } },
9068   },
9069
9070   /* VEX_LEN_F4_P_2 */
9071   {
9072     { VEX_W_TABLE (VEX_W_F4_P_2) },
9073     { "(bad)",          { XX } },
9074   },
9075
9076   /* VEX_LEN_F5_P_2 */
9077   {
9078     { VEX_W_TABLE (VEX_W_F5_P_2) },
9079     { "(bad)",          { XX } },
9080   },
9081
9082   /* VEX_LEN_F6_P_2 */
9083   {
9084     { VEX_W_TABLE (VEX_W_F6_P_2) },
9085     { "(bad)",          { XX } },
9086   },
9087
9088   /* VEX_LEN_F7_P_2 */
9089   {
9090     { VEX_W_TABLE (VEX_W_F7_P_2) },
9091     { "(bad)",          { XX } },
9092   },
9093
9094   /* VEX_LEN_F8_P_2 */
9095   {
9096     { VEX_W_TABLE (VEX_W_F8_P_2) },
9097     { "(bad)",          { XX } },
9098   },
9099
9100   /* VEX_LEN_F9_P_2 */
9101   {
9102     { VEX_W_TABLE (VEX_W_F9_P_2) },
9103     { "(bad)",          { XX } },
9104   },
9105
9106   /* VEX_LEN_FA_P_2 */
9107   {
9108     { VEX_W_TABLE (VEX_W_FA_P_2) },
9109     { "(bad)",          { XX } },
9110   },
9111
9112   /* VEX_LEN_FB_P_2 */
9113   {
9114     { VEX_W_TABLE (VEX_W_FB_P_2) },
9115     { "(bad)",          { XX } },
9116   },
9117
9118   /* VEX_LEN_FC_P_2 */
9119   {
9120     { VEX_W_TABLE (VEX_W_FC_P_2) },
9121     { "(bad)",          { XX } },
9122   },
9123
9124   /* VEX_LEN_FD_P_2 */
9125   {
9126     { VEX_W_TABLE (VEX_W_FD_P_2) },
9127     { "(bad)",          { XX } },
9128   },
9129
9130   /* VEX_LEN_FE_P_2 */
9131   {
9132     { VEX_W_TABLE (VEX_W_FE_P_2) },
9133     { "(bad)",          { XX } },
9134   },
9135
9136   /* VEX_LEN_3800_P_2 */
9137   {
9138     { VEX_W_TABLE (VEX_W_3800_P_2) },
9139     { "(bad)",          { XX } },
9140   },
9141
9142   /* VEX_LEN_3801_P_2 */
9143   {
9144     { VEX_W_TABLE (VEX_W_3801_P_2) },
9145     { "(bad)",          { XX } },
9146   },
9147
9148   /* VEX_LEN_3802_P_2 */
9149   {
9150     { VEX_W_TABLE (VEX_W_3802_P_2) },
9151     { "(bad)",          { XX } },
9152   },
9153
9154   /* VEX_LEN_3803_P_2 */
9155   {
9156     { VEX_W_TABLE (VEX_W_3803_P_2) },
9157     { "(bad)",          { XX } },
9158   },
9159
9160   /* VEX_LEN_3804_P_2 */
9161   {
9162     { VEX_W_TABLE (VEX_W_3804_P_2) },
9163     { "(bad)",          { XX } },
9164   },
9165
9166   /* VEX_LEN_3805_P_2 */
9167   {
9168     { VEX_W_TABLE (VEX_W_3805_P_2) },
9169     { "(bad)",          { XX } },
9170   },
9171
9172   /* VEX_LEN_3806_P_2 */
9173   {
9174     { VEX_W_TABLE (VEX_W_3806_P_2) },
9175     { "(bad)",          { XX } },
9176   },
9177
9178   /* VEX_LEN_3807_P_2 */
9179   {
9180     { VEX_W_TABLE (VEX_W_3807_P_2) },
9181     { "(bad)",          { XX } },
9182   },
9183
9184   /* VEX_LEN_3808_P_2 */
9185   {
9186     { VEX_W_TABLE (VEX_W_3808_P_2) },
9187     { "(bad)",          { XX } },
9188   },
9189
9190   /* VEX_LEN_3809_P_2 */
9191   {
9192     { VEX_W_TABLE (VEX_W_3809_P_2) },
9193     { "(bad)",          { XX } },
9194   },
9195
9196   /* VEX_LEN_380A_P_2 */
9197   {
9198     { VEX_W_TABLE (VEX_W_380A_P_2) },
9199     { "(bad)",          { XX } },
9200   },
9201
9202   /* VEX_LEN_380B_P_2 */
9203   {
9204     { VEX_W_TABLE (VEX_W_380B_P_2) },
9205     { "(bad)",          { XX } },
9206   },
9207
9208   /* VEX_LEN_3819_P_2_M_0 */
9209   {
9210     { "(bad)",          { XX } },
9211     { VEX_W_TABLE (VEX_W_3819_P_2_M_0) },
9212   },
9213
9214   /* VEX_LEN_381A_P_2_M_0 */
9215   {
9216     { "(bad)",          { XX } },
9217     { VEX_W_TABLE (VEX_W_381A_P_2_M_0) },
9218   },
9219
9220   /* VEX_LEN_381C_P_2 */
9221   {
9222     { VEX_W_TABLE (VEX_W_381C_P_2) },
9223     { "(bad)",          { XX } },
9224   },
9225
9226   /* VEX_LEN_381D_P_2 */
9227   {
9228     { VEX_W_TABLE (VEX_W_381D_P_2) },
9229     { "(bad)",          { XX } },
9230   },
9231
9232   /* VEX_LEN_381E_P_2 */
9233   {
9234     { VEX_W_TABLE (VEX_W_381E_P_2) },
9235     { "(bad)",          { XX } },
9236   },
9237
9238   /* VEX_LEN_3820_P_2 */
9239   {
9240     { VEX_W_TABLE (VEX_W_3820_P_2) },
9241     { "(bad)",          { XX } },
9242   },
9243
9244   /* VEX_LEN_3821_P_2 */
9245   {
9246     { VEX_W_TABLE (VEX_W_3821_P_2) },
9247     { "(bad)",          { XX } },
9248   },
9249
9250   /* VEX_LEN_3822_P_2 */
9251   {
9252     { VEX_W_TABLE (VEX_W_3822_P_2) },
9253     { "(bad)",          { XX } },
9254   },
9255
9256   /* VEX_LEN_3823_P_2 */
9257   {
9258     { VEX_W_TABLE (VEX_W_3823_P_2) },
9259     { "(bad)",          { XX } },
9260   },
9261
9262   /* VEX_LEN_3824_P_2 */
9263   {
9264     { VEX_W_TABLE (VEX_W_3824_P_2) },
9265     { "(bad)",          { XX } },
9266   },
9267
9268   /* VEX_LEN_3825_P_2 */
9269   {
9270     { VEX_W_TABLE (VEX_W_3825_P_2) },
9271     { "(bad)",          { XX } },
9272   },
9273
9274   /* VEX_LEN_3828_P_2 */
9275   {
9276     { VEX_W_TABLE (VEX_W_3828_P_2) },
9277     { "(bad)",          { XX } },
9278   },
9279
9280   /* VEX_LEN_3829_P_2 */
9281   {
9282     { VEX_W_TABLE (VEX_W_3829_P_2) },
9283     { "(bad)",          { XX } },
9284   },
9285
9286   /* VEX_LEN_382A_P_2_M_0 */
9287   {
9288     { VEX_W_TABLE (VEX_W_382A_P_2_M_0) },
9289     { "(bad)",          { XX } },
9290   },
9291
9292   /* VEX_LEN_382B_P_2 */
9293   {
9294     { VEX_W_TABLE (VEX_W_382B_P_2) },
9295     { "(bad)",          { XX } },
9296   },
9297
9298   /* VEX_LEN_3830_P_2 */
9299   {
9300     { VEX_W_TABLE (VEX_W_3830_P_2) },
9301     { "(bad)",          { XX } },
9302   },
9303
9304   /* VEX_LEN_3831_P_2 */
9305   {
9306     { VEX_W_TABLE (VEX_W_3831_P_2) },
9307     { "(bad)",          { XX } },
9308   },
9309
9310   /* VEX_LEN_3832_P_2 */
9311   {
9312     { VEX_W_TABLE (VEX_W_3832_P_2) },
9313     { "(bad)",          { XX } },
9314   },
9315
9316   /* VEX_LEN_3833_P_2 */
9317   {
9318     { VEX_W_TABLE (VEX_W_3833_P_2) },
9319     { "(bad)",          { XX } },
9320   },
9321
9322   /* VEX_LEN_3834_P_2 */
9323   {
9324     { VEX_W_TABLE (VEX_W_3834_P_2) },
9325     { "(bad)",          { XX } },
9326   },
9327
9328   /* VEX_LEN_3835_P_2 */
9329   {
9330     { VEX_W_TABLE (VEX_W_3835_P_2) },
9331     { "(bad)",          { XX } },
9332   },
9333
9334   /* VEX_LEN_3837_P_2 */
9335   {
9336     { VEX_W_TABLE (VEX_W_3837_P_2) },
9337     { "(bad)",          { XX } },
9338   },
9339
9340   /* VEX_LEN_3838_P_2 */
9341   {
9342     { VEX_W_TABLE (VEX_W_3838_P_2) },
9343     { "(bad)",          { XX } },
9344   },
9345
9346   /* VEX_LEN_3839_P_2 */
9347   {
9348     { VEX_W_TABLE (VEX_W_3839_P_2) },
9349     { "(bad)",          { XX } },
9350   },
9351
9352   /* VEX_LEN_383A_P_2 */
9353   {
9354     { VEX_W_TABLE (VEX_W_383A_P_2) },
9355     { "(bad)",          { XX } },
9356   },
9357
9358   /* VEX_LEN_383B_P_2 */
9359   {
9360     { VEX_W_TABLE (VEX_W_383B_P_2) },
9361     { "(bad)",          { XX } },
9362   },
9363
9364   /* VEX_LEN_383C_P_2 */
9365   {
9366     { VEX_W_TABLE (VEX_W_383C_P_2) },
9367     { "(bad)",          { XX } },
9368   },
9369
9370   /* VEX_LEN_383D_P_2 */
9371   {
9372     { VEX_W_TABLE (VEX_W_383D_P_2) },
9373     { "(bad)",          { XX } },
9374   },
9375
9376   /* VEX_LEN_383E_P_2 */
9377   {
9378     { VEX_W_TABLE (VEX_W_383E_P_2) },
9379     { "(bad)",          { XX } },
9380   },
9381
9382   /* VEX_LEN_383F_P_2 */
9383   {
9384     { VEX_W_TABLE (VEX_W_383F_P_2) },
9385     { "(bad)",          { XX } },
9386   },
9387
9388   /* VEX_LEN_3840_P_2 */
9389   {
9390     { VEX_W_TABLE (VEX_W_3840_P_2) },
9391     { "(bad)",          { XX } },
9392   },
9393
9394   /* VEX_LEN_3841_P_2 */
9395   {
9396     { VEX_W_TABLE (VEX_W_3841_P_2) },
9397     { "(bad)",          { XX } },
9398   },
9399
9400   /* VEX_LEN_38DB_P_2 */
9401   {
9402     { VEX_W_TABLE (VEX_W_38DB_P_2) },
9403     { "(bad)",          { XX } },
9404   },
9405
9406   /* VEX_LEN_38DC_P_2 */
9407   {
9408     { VEX_W_TABLE (VEX_W_38DC_P_2) },
9409     { "(bad)",          { XX } },
9410   },
9411
9412   /* VEX_LEN_38DD_P_2 */
9413   {
9414     { VEX_W_TABLE (VEX_W_38DD_P_2) },
9415     { "(bad)",          { XX } },
9416   },
9417
9418   /* VEX_LEN_38DE_P_2 */
9419   {
9420     { VEX_W_TABLE (VEX_W_38DE_P_2) },
9421     { "(bad)",          { XX } },
9422   },
9423
9424   /* VEX_LEN_38DF_P_2 */
9425   {
9426     { VEX_W_TABLE (VEX_W_38DF_P_2) },
9427     { "(bad)",          { XX } },
9428   },
9429
9430   /* VEX_LEN_3A06_P_2 */
9431   {
9432     { "(bad)",          { XX } },
9433     { VEX_W_TABLE (VEX_W_3A06_P_2) },
9434   },
9435
9436   /* VEX_LEN_3A0A_P_2 */
9437   {
9438     { VEX_W_TABLE (VEX_W_3A0A_P_2) },
9439     { "(bad)",          { XX } },
9440   },
9441
9442   /* VEX_LEN_3A0B_P_2 */
9443   {
9444     { VEX_W_TABLE (VEX_W_3A0B_P_2) },
9445     { "(bad)",          { XX } },
9446   },
9447
9448   /* VEX_LEN_3A0E_P_2 */
9449   {
9450     { VEX_W_TABLE (VEX_W_3A0E_P_2) },
9451     { "(bad)",          { XX } },
9452   },
9453
9454   /* VEX_LEN_3A0F_P_2 */
9455   {
9456     { VEX_W_TABLE (VEX_W_3A0F_P_2) },
9457     { "(bad)",          { XX } },
9458   },
9459
9460   /* VEX_LEN_3A14_P_2 */
9461   {
9462     { VEX_W_TABLE (VEX_W_3A14_P_2) },
9463     { "(bad)",          { XX } },
9464   },
9465
9466   /* VEX_LEN_3A15_P_2 */
9467   {
9468     { VEX_W_TABLE (VEX_W_3A15_P_2) },
9469     { "(bad)",          { XX } },
9470   },
9471
9472   /* VEX_LEN_3A16_P_2  */
9473   {
9474     { "vpextrK",        { Edq, XM, Ib } },
9475     { "(bad)",          { XX } },
9476   },
9477
9478   /* VEX_LEN_3A17_P_2 */
9479   {
9480     { "vextractps",     { Edqd, XM, Ib } },
9481     { "(bad)",          { XX } },
9482   },
9483
9484   /* VEX_LEN_3A18_P_2 */
9485   {
9486     { "(bad)",          { XX } },
9487     { VEX_W_TABLE (VEX_W_3A18_P_2) },
9488   },
9489
9490   /* VEX_LEN_3A19_P_2 */
9491   {
9492     { "(bad)",          { XX } },
9493     { VEX_W_TABLE (VEX_W_3A19_P_2) },
9494   },
9495
9496   /* VEX_LEN_3A20_P_2 */
9497   {
9498     { VEX_W_TABLE (VEX_W_3A20_P_2) },
9499     { "(bad)",          { XX } },
9500   },
9501
9502   /* VEX_LEN_3A21_P_2 */
9503   {
9504     { VEX_W_TABLE (VEX_W_3A21_P_2) },
9505     { "(bad)",          { XX } },
9506   },
9507
9508   /* VEX_LEN_3A22_P_2 */
9509   {
9510     { "vpinsrK",        { XM, Vex128, Edq, Ib } },
9511     { "(bad)",          { XX } },
9512   },
9513
9514   /* VEX_LEN_3A41_P_2 */
9515   {
9516     { VEX_W_TABLE (VEX_W_3A41_P_2) },
9517     { "(bad)",          { XX } },
9518   },
9519
9520   /* VEX_LEN_3A42_P_2 */
9521   {
9522     { VEX_W_TABLE (VEX_W_3A42_P_2) },
9523     { "(bad)",          { XX } },
9524   },
9525
9526   /* VEX_LEN_3A44_P_2 */
9527   {
9528     { VEX_W_TABLE (VEX_W_3A44_P_2) },
9529     { "(bad)",          { XX } },
9530   },
9531
9532   /* VEX_LEN_3A4C_P_2 */
9533   {
9534     { VEX_W_TABLE (VEX_W_3A4C_P_2) },
9535     { "(bad)",          { XX } },
9536   },
9537
9538   /* VEX_LEN_3A60_P_2 */
9539   {
9540     { VEX_W_TABLE (VEX_W_3A60_P_2) },
9541     { "(bad)",          { XX } },
9542   },
9543
9544   /* VEX_LEN_3A61_P_2 */
9545   {
9546     { VEX_W_TABLE (VEX_W_3A61_P_2) },
9547     { "(bad)",          { XX } },
9548   },
9549
9550   /* VEX_LEN_3A62_P_2 */
9551   {
9552     { VEX_W_TABLE (VEX_W_3A62_P_2) },
9553     { "(bad)",          { XX } },
9554   },
9555
9556   /* VEX_LEN_3A63_P_2 */
9557   {
9558     { VEX_W_TABLE (VEX_W_3A63_P_2) },
9559     { "(bad)",          { XX } },
9560   },
9561
9562   /* VEX_LEN_3A6A_P_2 */
9563   {
9564     { "vfmaddss",       { XMVexW, Vex128, EXdVexW, EXdVexW, VexI4 } },
9565     { "(bad)",          { XX } },
9566   },
9567
9568   /* VEX_LEN_3A6B_P_2 */
9569   {
9570     { "vfmaddsd",       { XMVexW, Vex128, EXqVexW, EXqVexW, VexI4 } },
9571     { "(bad)",          { XX } },
9572   },
9573
9574   /* VEX_LEN_3A6E_P_2 */
9575   {
9576     { "vfmsubss",       { XMVexW, Vex128, EXdVexW, EXdVexW, VexI4 } },
9577     { "(bad)",          { XX } },
9578   },
9579
9580   /* VEX_LEN_3A6F_P_2 */
9581   {
9582     { "vfmsubsd",       { XMVexW, Vex128, EXqVexW, EXqVexW, VexI4 } },
9583     { "(bad)",          { XX } },
9584   },
9585
9586   /* VEX_LEN_3A7A_P_2 */
9587   {
9588     { "vfnmaddss",      { XMVexW, Vex128, EXdVexW, EXdVexW, VexI4 } },
9589     { "(bad)",          { XX } },
9590   },
9591
9592   /* VEX_LEN_3A7B_P_2 */
9593   {
9594     { "vfnmaddsd",      { XMVexW, Vex128, EXqVexW, EXqVexW, VexI4 } },
9595     { "(bad)",          { XX } },
9596   },
9597
9598   /* VEX_LEN_3A7E_P_2 */
9599   {
9600     { "vfnmsubss",      { XMVexW, Vex128, EXdVexW, EXdVexW, VexI4 } },
9601     { "(bad)",          { XX } },
9602   },
9603
9604   /* VEX_LEN_3A7F_P_2 */
9605   {
9606     { "vfnmsubsd",      { XMVexW, Vex128, EXqVexW, EXqVexW, VexI4 } },
9607     { "(bad)",          { XX } },
9608   },
9609
9610   /* VEX_LEN_3ADF_P_2 */
9611   {
9612     { VEX_W_TABLE (VEX_W_3ADF_P_2) },
9613     { "(bad)",          { XX } },
9614   },
9615
9616   /* VEX_LEN_XOP_09_80 */
9617   {
9618     { "vfrczps",        { XM, EXxmm } },
9619     { "vfrczps",        { XM, EXymmq } },
9620   },
9621
9622   /* VEX_LEN_XOP_09_81 */
9623   {
9624     { "vfrczpd",        { XM, EXxmm } },
9625     { "vfrczpd",        { XM, EXymmq } },
9626   },
9627 };
9628
9629 static const struct dis386 vex_w_table[][2] = {
9630   {
9631     /* VEX_W_10_P_0 */
9632     { "vmovups",        { XM, EXx } },
9633     { "(bad)",          { XX } },
9634   },
9635   {
9636     /* VEX_W_10_P_1 */
9637     { "vmovss",         { XMVex, Vex128, EXd } },
9638     { "(bad)",          { XX } },
9639   },
9640   {
9641     /* VEX_W_10_P_2 */
9642     { "vmovupd",        { XM, EXx } },
9643     { "(bad)",          { XX } },
9644   },
9645   {
9646     /* VEX_W_10_P_3 */
9647     { "vmovsd",         { XMVex, Vex128, EXq } },
9648     { "(bad)",          { XX } },
9649   },
9650   {
9651     /* VEX_W_11_P_0 */
9652     { "vmovups",        { EXxS, XM } },
9653     { "(bad)",          { XX } },
9654   },
9655   {
9656     /* VEX_W_11_P_1 */
9657     { "vmovss",         { EXdVexS, Vex128, XM } },
9658     { "(bad)",          { XX } },
9659   },
9660   {
9661     /* VEX_W_11_P_2 */
9662     { "vmovupd",        { EXxS, XM } },
9663     { "(bad)",          { XX } },
9664   },
9665   {
9666     /* VEX_W_11_P_3 */
9667     { "vmovsd",         { EXqVexS, Vex128, XM } },
9668     { "(bad)",          { XX } },
9669   },
9670   {
9671     /* VEX_W_12_P_0_M_0 */
9672     { "vmovlps",        { XM, Vex128, EXq } },
9673     { "(bad)",          { XX } },
9674   },
9675   {
9676     /* VEX_W_12_P_0_M_1 */
9677     { "vmovhlps",       { XM, Vex128, EXq } },
9678     { "(bad)",          { XX } },
9679   },
9680   {
9681     /* VEX_W_12_P_1 */
9682     { "vmovsldup",      { XM, EXx } },
9683     { "(bad)",          { XX } },
9684   },
9685   {
9686     /* VEX_W_12_P_2 */
9687     { "vmovlpd",        { XM, Vex128, EXq } },
9688     { "(bad)",          { XX } },
9689   },
9690   {
9691     /* VEX_W_12_P_3 */
9692     { "vmovddup",       { XM, EXymmq } },
9693     { "(bad)",          { XX } },
9694   },
9695   {
9696     /* VEX_W_13_M_0 */
9697     { "vmovlpX",        { EXq, XM } },
9698     { "(bad)",          { XX } },
9699   },
9700   {
9701     /* VEX_W_14 */
9702     { "vunpcklpX",      { XM, Vex, EXx } },
9703     { "(bad)",          { XX } },
9704   },
9705   {
9706     /* VEX_W_15 */
9707     { "vunpckhpX",      { XM, Vex, EXx } },
9708     { "(bad)",          { XX } },
9709   },
9710   {
9711     /* VEX_W_16_P_0_M_0 */
9712     { "vmovhps",        { XM, Vex128, EXq } },
9713     { "(bad)",          { XX } },
9714   },
9715   {
9716     /* VEX_W_16_P_0_M_1 */
9717     { "vmovlhps",       { XM, Vex128, EXq } },
9718     { "(bad)",          { XX } },
9719   },
9720   {
9721     /* VEX_W_16_P_1 */
9722     { "vmovshdup",      { XM, EXx } },
9723     { "(bad)",          { XX } },
9724   },
9725   {
9726     /* VEX_W_16_P_2 */
9727     { "vmovhpd",        { XM, Vex128, EXq } },
9728     { "(bad)",          { XX } },
9729   },
9730   {
9731     /* VEX_W_17_M_0 */
9732     { "vmovhpX",        { EXq, XM } },
9733     { "(bad)",          { XX } },
9734   },
9735   {
9736     /* VEX_W_28 */
9737     { "vmovapX",        { XM, EXx } },
9738     { "(bad)",          { XX } },
9739   },
9740   {
9741     /* VEX_W_29 */
9742     { "vmovapX",        { EXxS, XM } },
9743     { "(bad)",          { XX } },
9744   },
9745   {
9746     /* VEX_W_2B_M_0 */
9747     { "vmovntpX",       { Mx, XM } },
9748     { "(bad)",          { XX } },
9749   },
9750   {
9751     /* VEX_W_2E_P_0 */
9752     { "vucomiss",       { XM, EXd } }, 
9753     { "(bad)",          { XX } },
9754   },
9755   {
9756     /* VEX_W_2E_P_2 */
9757     { "vucomisd",       { XM, EXq } }, 
9758     { "(bad)",          { XX } },
9759   },
9760   {
9761     /* VEX_W_2F_P_0 */
9762     { "vcomiss",        { XM, EXd } },
9763     { "(bad)",          { XX } },
9764   },
9765   {
9766     /* VEX_W_2F_P_2 */
9767     { "vcomisd",        { XM, EXq } },
9768     { "(bad)",          { XX } },
9769   },
9770   {
9771     /* VEX_W_50_M_0 */
9772     { "vmovmskpX",      { Gdq, XS } },
9773     { "(bad)",          { XX } },
9774   },
9775   {
9776     /* VEX_W_51_P_0 */
9777     { "vsqrtps",        { XM, EXx } },
9778     { "(bad)",          { XX } },
9779   },
9780   {
9781     /* VEX_W_51_P_1 */
9782     { "vsqrtss",        { XM, Vex128, EXd } },
9783     { "(bad)",          { XX } },
9784   },
9785   {
9786     /* VEX_W_51_P_2  */
9787     { "vsqrtpd",        { XM, EXx } },
9788     { "(bad)",          { XX } },
9789   },
9790   {
9791     /* VEX_W_51_P_3 */
9792     { "vsqrtsd",        { XM, Vex128, EXq } },
9793     { "(bad)",          { XX } },
9794   },
9795   {
9796     /* VEX_W_52_P_0 */
9797     { "vrsqrtps",       { XM, EXx } },
9798     { "(bad)",          { XX } },
9799   },
9800   {
9801     /* VEX_W_52_P_1 */
9802     { "vrsqrtss",       { XM, Vex128, EXd } },
9803     { "(bad)",          { XX } },
9804   },
9805   {
9806     /* VEX_W_53_P_0  */
9807     { "vrcpps",         { XM, EXx } },
9808     { "(bad)",          { XX } },
9809   },
9810   {
9811     /* VEX_W_53_P_1  */
9812     { "vrcpss",         { XM, Vex128, EXd } },
9813     { "(bad)",          { XX } },
9814   },
9815   {
9816     /* VEX_W_58_P_0  */
9817     { "vaddps",         { XM, Vex, EXx } },
9818     { "(bad)",          { XX } },
9819   },
9820   {
9821     /* VEX_W_58_P_1  */
9822     { "vaddss",         { XM, Vex128, EXd } },
9823     { "(bad)",          { XX } },
9824   },
9825   {
9826     /* VEX_W_58_P_2  */
9827     { "vaddpd",         { XM, Vex, EXx } },
9828     { "(bad)",          { XX } },
9829   },
9830   {
9831     /* VEX_W_58_P_3  */
9832     { "vaddsd",         { XM, Vex128, EXq } },
9833     { "(bad)",          { XX } },
9834   },
9835   {
9836     /* VEX_W_59_P_0  */
9837     { "vmulps",         { XM, Vex, EXx } },
9838     { "(bad)",          { XX } },
9839   },
9840   {
9841     /* VEX_W_59_P_1  */
9842     { "vmulss",         { XM, Vex128, EXd } },
9843     { "(bad)",          { XX } },
9844   },
9845   {
9846     /* VEX_W_59_P_2  */
9847     { "vmulpd",         { XM, Vex, EXx } },
9848     { "(bad)",          { XX } },
9849   },
9850   {
9851     /* VEX_W_59_P_3  */
9852     { "vmulsd",         { XM, Vex128, EXq } },
9853     { "(bad)",          { XX } },
9854   },
9855   {
9856     /* VEX_W_5A_P_0  */
9857     { "vcvtps2pd",      { XM, EXxmmq } },
9858     { "(bad)",          { XX } },
9859   },
9860   {
9861     /* VEX_W_5A_P_1  */
9862     { "vcvtss2sd",      { XM, Vex128, EXd } },
9863     { "(bad)",          { XX } },
9864   },
9865   {
9866     /* VEX_W_5A_P_3  */
9867     { "vcvtsd2ss",      { XM, Vex128, EXq } },
9868     { "(bad)",          { XX } },
9869   },
9870   {
9871     /* VEX_W_5B_P_0  */
9872     { "vcvtdq2ps",      { XM, EXx } },
9873     { "(bad)",          { XX } },
9874   },
9875   {
9876     /* VEX_W_5B_P_1  */
9877     { "vcvttps2dq",     { XM, EXx } },
9878     { "(bad)",          { XX } },
9879   },
9880   {
9881     /* VEX_W_5B_P_2  */
9882     { "vcvtps2dq",      { XM, EXx } },
9883     { "(bad)",          { XX } },
9884   },
9885   {
9886     /* VEX_W_5C_P_0  */
9887     { "vsubps",         { XM, Vex, EXx } },
9888     { "(bad)",          { XX } },
9889   },
9890   {
9891     /* VEX_W_5C_P_1  */
9892     { "vsubss",         { XM, Vex128, EXd } },
9893     { "(bad)",          { XX } },
9894   },
9895   {
9896     /* VEX_W_5C_P_2  */
9897     { "vsubpd",         { XM, Vex, EXx } },
9898     { "(bad)",          { XX } },
9899   },
9900   {
9901     /* VEX_W_5C_P_3  */
9902     { "vsubsd",         { XM, Vex128, EXq } },
9903     { "(bad)",          { XX } },
9904   },
9905   {
9906     /* VEX_W_5D_P_0  */
9907     { "vminps",         { XM, Vex, EXx } },
9908     { "(bad)",          { XX } },
9909   },
9910   {
9911     /* VEX_W_5D_P_1  */
9912     { "vminss",         { XM, Vex128, EXd } },
9913     { "(bad)",          { XX } },
9914   },
9915   {
9916     /* VEX_W_5D_P_2  */
9917     { "vminpd",         { XM, Vex, EXx } },
9918     { "(bad)",          { XX } },
9919   },
9920   {
9921     /* VEX_W_5D_P_3  */
9922     { "vminsd",         { XM, Vex128, EXq } },
9923     { "(bad)",          { XX } },
9924   },
9925   {
9926     /* VEX_W_5E_P_0  */
9927     { "vdivps",         { XM, Vex, EXx } },
9928     { "(bad)",          { XX } },
9929   },
9930   {
9931     /* VEX_W_5E_P_1  */
9932     { "vdivss",         { XM, Vex128, EXd } },
9933     { "(bad)",          { XX } },
9934   },
9935   {
9936     /* VEX_W_5E_P_2  */
9937     { "vdivpd",         { XM, Vex, EXx } },
9938     { "(bad)",          { XX } },
9939   },
9940   {
9941     /* VEX_W_5E_P_3  */
9942     { "vdivsd",         { XM, Vex128, EXq } },
9943     { "(bad)",          { XX } },
9944   },
9945   {
9946     /* VEX_W_5F_P_0  */
9947     { "vmaxps",         { XM, Vex, EXx } },
9948     { "(bad)",          { XX } },
9949   },
9950   {
9951     /* VEX_W_5F_P_1  */
9952     { "vmaxss",         { XM, Vex128, EXd } },
9953     { "(bad)",          { XX } },
9954   },
9955   {
9956     /* VEX_W_5F_P_2  */
9957     { "vmaxpd",         { XM, Vex, EXx } },
9958     { "(bad)",          { XX } },
9959   },
9960   {
9961     /* VEX_W_5F_P_3  */
9962     { "vmaxsd",         { XM, Vex128, EXq } },
9963     { "(bad)",          { XX } },
9964   },
9965   {
9966     /* VEX_W_60_P_2  */
9967     { "vpunpcklbw",     { XM, Vex128, EXx } },
9968     { "(bad)",          { XX } },
9969   },
9970   {
9971     /* VEX_W_61_P_2  */
9972     { "vpunpcklwd",     { XM, Vex128, EXx } },
9973     { "(bad)",          { XX } },
9974   },
9975   {
9976     /* VEX_W_62_P_2  */
9977     { "vpunpckldq",     { XM, Vex128, EXx } },
9978     { "(bad)",          { XX } },
9979   },
9980   {
9981     /* VEX_W_63_P_2  */
9982     { "vpacksswb",      { XM, Vex128, EXx } },
9983     { "(bad)",          { XX } },
9984   },
9985   {
9986     /* VEX_W_64_P_2  */
9987     { "vpcmpgtb",       { XM, Vex128, EXx } },
9988     { "(bad)",          { XX } },
9989   },
9990   {
9991     /* VEX_W_65_P_2  */
9992     { "vpcmpgtw",       { XM, Vex128, EXx } },
9993     { "(bad)",          { XX } },
9994   },
9995   {
9996     /* VEX_W_66_P_2  */
9997     { "vpcmpgtd",       { XM, Vex128, EXx } },
9998     { "(bad)",          { XX } },
9999   },
10000   {
10001     /* VEX_W_67_P_2  */
10002     { "vpackuswb",      { XM, Vex128, EXx } },
10003     { "(bad)",          { XX } },
10004   },
10005   {
10006     /* VEX_W_68_P_2  */
10007     { "vpunpckhbw",     { XM, Vex128, EXx } },
10008     { "(bad)",          { XX } },
10009   },
10010   {
10011     /* VEX_W_69_P_2  */
10012     { "vpunpckhwd",     { XM, Vex128, EXx } },
10013     { "(bad)",          { XX } },
10014   },
10015   {
10016     /* VEX_W_6A_P_2  */
10017     { "vpunpckhdq",     { XM, Vex128, EXx } },
10018     { "(bad)",          { XX } },
10019   },
10020   {
10021     /* VEX_W_6B_P_2  */
10022     { "vpackssdw",      { XM, Vex128, EXx } },
10023     { "(bad)",          { XX } },
10024   },
10025   {
10026     /* VEX_W_6C_P_2  */
10027     { "vpunpcklqdq",    { XM, Vex128, EXx } },
10028     { "(bad)",          { XX } },
10029   },
10030   {
10031     /* VEX_W_6D_P_2  */
10032     { "vpunpckhqdq",    { XM, Vex128, EXx } },
10033     { "(bad)",          { XX } },
10034   },
10035   {
10036     /* VEX_W_6F_P_1  */
10037     { "vmovdqu",        { XM, EXx } },
10038     { "(bad)",          { XX } },
10039   },
10040   {
10041     /* VEX_W_6F_P_2  */
10042     { "vmovdqa",        { XM, EXx } },
10043     { "(bad)",          { XX } },
10044   },
10045   {
10046     /* VEX_W_70_P_1 */
10047     { "vpshufhw",       { XM, EXx, Ib } },
10048     { "(bad)",          { XX } },
10049   },
10050   {
10051     /* VEX_W_70_P_2 */
10052     { "vpshufd",        { XM, EXx, Ib } },
10053     { "(bad)",          { XX } },
10054   },
10055   {
10056     /* VEX_W_70_P_3 */
10057     { "vpshuflw",       { XM, EXx, Ib } },
10058     { "(bad)",          { XX } },
10059   },
10060   {
10061     /* VEX_W_71_R_2_P_2  */
10062     { "vpsrlw",         { Vex128, XS, Ib } },
10063     { "(bad)",          { XX } },
10064   },
10065   {
10066     /* VEX_W_71_R_4_P_2  */
10067     { "vpsraw",         { Vex128, XS, Ib } },
10068     { "(bad)",          { XX } },
10069   },
10070   {
10071     /* VEX_W_71_R_6_P_2  */
10072     { "vpsllw",         { Vex128, XS, Ib } },
10073     { "(bad)",          { XX } },
10074   },
10075   {
10076     /* VEX_W_72_R_2_P_2  */
10077     { "vpsrld",         { Vex128, XS, Ib } },
10078     { "(bad)",          { XX } },
10079   },
10080   {
10081     /* VEX_W_72_R_4_P_2  */
10082     { "vpsrad",         { Vex128, XS, Ib } },
10083     { "(bad)",          { XX } },
10084   },
10085   {
10086     /* VEX_W_72_R_6_P_2  */
10087     { "vpslld",         { Vex128, XS, Ib } },
10088     { "(bad)",          { XX } },
10089   },
10090   {
10091     /* VEX_W_73_R_2_P_2  */
10092     { "vpsrlq",         { Vex128, XS, Ib } },
10093     { "(bad)",          { XX } },
10094   },
10095   {
10096     /* VEX_W_73_R_3_P_2  */
10097     { "vpsrldq",        { Vex128, XS, Ib } },
10098     { "(bad)",          { XX } },
10099   },
10100   {
10101     /* VEX_W_73_R_6_P_2  */
10102     { "vpsllq",         { Vex128, XS, Ib } },
10103     { "(bad)",          { XX } },
10104   },
10105   {
10106     /* VEX_W_73_R_7_P_2  */
10107     { "vpslldq",        { Vex128, XS, Ib } },
10108     { "(bad)",          { XX } },
10109   },
10110   {
10111     /* VEX_W_74_P_2 */
10112     { "vpcmpeqb",       { XM, Vex128, EXx } },
10113     { "(bad)",          { XX } },
10114   },
10115   {
10116     /* VEX_W_75_P_2 */
10117     { "vpcmpeqw",       { XM, Vex128, EXx } },
10118     { "(bad)",          { XX } },
10119   },
10120   {
10121     /* VEX_W_76_P_2 */
10122     { "vpcmpeqd",       { XM, Vex128, EXx } },
10123     { "(bad)",          { XX } },
10124   },
10125   {
10126     /* VEX_W_77_P_0 */
10127     { "",               { VZERO } },
10128     { "(bad)",          { XX } },
10129   },
10130   {
10131     /* VEX_W_7C_P_2 */
10132     { "vhaddpd",        { XM, Vex, EXx } },
10133     { "(bad)",          { XX } },
10134   },
10135   {
10136     /* VEX_W_7C_P_3 */
10137     { "vhaddps",        { XM, Vex, EXx } },
10138     { "(bad)",          { XX } },
10139   },
10140   {
10141     /* VEX_W_7D_P_2 */
10142     { "vhsubpd",        { XM, Vex, EXx } },
10143     { "(bad)",          { XX } },
10144   },
10145   {
10146     /* VEX_W_7D_P_3 */
10147     { "vhsubps",        { XM, Vex, EXx } },
10148     { "(bad)",          { XX } },
10149   },
10150   {
10151     /* VEX_W_7E_P_1 */
10152     { "vmovq",          { XM, EXq } },
10153     { "(bad)",          { XX } },
10154   },
10155   {
10156     /* VEX_W_7F_P_1 */
10157     { "vmovdqu",        { EXxS, XM } },
10158     { "(bad)",          { XX } },
10159   },
10160   {
10161     /* VEX_W_7F_P_2 */
10162     { "vmovdqa",        { EXxS, XM } },
10163     { "(bad)",          { XX } },
10164   },
10165   {
10166     /* VEX_W_AE_R_2_M_0 */
10167     { "vldmxcsr",       { Md } },
10168     { "(bad)",          { XX } },
10169   },
10170   {
10171     /* VEX_W_AE_R_3_M_0 */
10172     { "vstmxcsr",       { Md } },
10173     { "(bad)",          { XX } },
10174   },
10175   {
10176     /* VEX_W_C2_P_0 */
10177     { "vcmpps",         { XM, Vex, EXx, VCMP } },
10178     { "(bad)",          { XX } },
10179   },
10180   {
10181     /* VEX_W_C2_P_1 */
10182     { "vcmpss",         { XM, Vex128, EXd, VCMP } },
10183     { "(bad)",          { XX } },
10184   },
10185   {
10186     /* VEX_W_C2_P_2 */
10187     { "vcmppd",         { XM, Vex, EXx, VCMP } },
10188     { "(bad)",          { XX } },
10189   },
10190   {
10191     /* VEX_W_C2_P_3 */
10192     { "vcmpsd",         { XM, Vex128, EXq, VCMP } },
10193     { "(bad)",          { XX } },
10194   },
10195   {
10196     /* VEX_W_C4_P_2 */
10197     { "vpinsrw",        { XM, Vex128, Edqw, Ib } },
10198     { "(bad)",          { XX } },
10199   },
10200   {
10201     /* VEX_W_C5_P_2 */
10202     { "vpextrw",        { Gdq, XS, Ib } },
10203     { "(bad)",          { XX } },
10204   },
10205   {
10206     /* VEX_W_D0_P_2 */
10207     { "vaddsubpd",      { XM, Vex, EXx } },
10208     { "(bad)",          { XX } },
10209   },
10210   {
10211     /* VEX_W_D0_P_3 */
10212     { "vaddsubps",      { XM, Vex, EXx } },
10213     { "(bad)",          { XX } },
10214   },
10215   {
10216     /* VEX_W_D1_P_2 */
10217     { "vpsrlw",         { XM, Vex128, EXx } },
10218     { "(bad)",          { XX } },
10219   },
10220   {
10221     /* VEX_W_D2_P_2 */
10222     { "vpsrld",         { XM, Vex128, EXx } },
10223     { "(bad)",          { XX } },
10224   },
10225   {
10226     /* VEX_W_D3_P_2 */
10227     { "vpsrlq",         { XM, Vex128, EXx } },
10228     { "(bad)",          { XX } },
10229   },
10230   {
10231     /* VEX_W_D4_P_2 */
10232     { "vpaddq",         { XM, Vex128, EXx } },
10233     { "(bad)",          { XX } },
10234   },
10235   {
10236     /* VEX_W_D5_P_2 */
10237     { "vpmullw",        { XM, Vex128, EXx } },
10238     { "(bad)",          { XX } },
10239   },
10240   {
10241     /* VEX_W_D6_P_2 */
10242     { "vmovq",          { EXqS, XM } },
10243     { "(bad)",          { XX } },
10244   },
10245   {
10246     /* VEX_W_D7_P_2_M_1 */
10247     { "vpmovmskb",      { Gdq, XS } },
10248     { "(bad)",          { XX } },
10249   },
10250   {
10251     /* VEX_W_D8_P_2 */
10252     { "vpsubusb",       { XM, Vex128, EXx } },
10253     { "(bad)",          { XX } },
10254   },
10255   {
10256     /* VEX_W_D9_P_2 */
10257     { "vpsubusw",       { XM, Vex128, EXx } },
10258     { "(bad)",          { XX } },
10259   },
10260   {
10261     /* VEX_W_DA_P_2 */
10262     { "vpminub",        { XM, Vex128, EXx } },
10263     { "(bad)",          { XX } },
10264   },
10265   {
10266     /* VEX_W_DB_P_2 */
10267     { "vpand",          { XM, Vex128, EXx } },
10268     { "(bad)",          { XX } },
10269   },
10270   {
10271     /* VEX_W_DC_P_2 */
10272     { "vpaddusb",       { XM, Vex128, EXx } },
10273     { "(bad)",          { XX } },
10274   },
10275   {
10276     /* VEX_W_DD_P_2 */
10277     { "vpaddusw",       { XM, Vex128, EXx } },
10278     { "(bad)",          { XX } },
10279   },
10280   {
10281     /* VEX_W_DE_P_2 */
10282     { "vpmaxub",        { XM, Vex128, EXx } },
10283     { "(bad)",          { XX } },
10284   },
10285   {
10286     /* VEX_W_DF_P_2 */
10287     { "vpandn",         { XM, Vex128, EXx } },
10288     { "(bad)",          { XX } },
10289   },
10290   {
10291     /* VEX_W_E0_P_2  */
10292     { "vpavgb",         { XM, Vex128, EXx } },
10293     { "(bad)",          { XX } },
10294   },
10295   {
10296     /* VEX_W_E1_P_2  */
10297     { "vpsraw",         { XM, Vex128, EXx } },
10298     { "(bad)",          { XX } },
10299   },
10300   {
10301     /* VEX_W_E2_P_2  */
10302     { "vpsrad",         { XM, Vex128, EXx } },
10303     { "(bad)",          { XX } },
10304   },
10305   {
10306     /* VEX_W_E3_P_2  */
10307     { "vpavgw",         { XM, Vex128, EXx } },
10308     { "(bad)",          { XX } },
10309   },
10310   {
10311     /* VEX_W_E4_P_2  */
10312     { "vpmulhuw",       { XM, Vex128, EXx } },
10313     { "(bad)",          { XX } },
10314   },
10315   {
10316     /* VEX_W_E5_P_2  */
10317     { "vpmulhw",        { XM, Vex128, EXx } },
10318     { "(bad)",          { XX } },
10319   },
10320   {
10321     /* VEX_W_E6_P_1  */
10322     { "vcvtdq2pd",      { XM, EXxmmq } },
10323     { "(bad)",          { XX } },
10324   },
10325   {
10326     /* VEX_W_E6_P_2  */
10327     { "vcvttpd2dq%XY",  { XMM, EXx } },
10328     { "(bad)",          { XX } },
10329   },
10330   {
10331     /* VEX_W_E6_P_3  */
10332     { "vcvtpd2dq%XY",   { XMM, EXx } },
10333     { "(bad)",          { XX } },
10334   },
10335   {
10336     /* VEX_W_E7_P_2_M_0 */
10337     { "vmovntdq",       { Mx, XM } },
10338     { "(bad)",          { XX } },
10339   },
10340   {
10341     /* VEX_W_E8_P_2  */
10342     { "vpsubsb",        { XM, Vex128, EXx } },
10343     { "(bad)",          { XX } },
10344   },
10345   {
10346     /* VEX_W_E9_P_2  */
10347     { "vpsubsw",        { XM, Vex128, EXx } },
10348     { "(bad)",          { XX } },
10349   },
10350   {
10351     /* VEX_W_EA_P_2  */
10352     { "vpminsw",        { XM, Vex128, EXx } },
10353     { "(bad)",          { XX } },
10354   },
10355   {
10356     /* VEX_W_EB_P_2  */
10357     { "vpor",           { XM, Vex128, EXx } },
10358     { "(bad)",          { XX } },
10359   },
10360   {
10361     /* VEX_W_EC_P_2  */
10362     { "vpaddsb",        { XM, Vex128, EXx } },
10363     { "(bad)",          { XX } },
10364   },
10365   {
10366     /* VEX_W_ED_P_2  */
10367     { "vpaddsw",        { XM, Vex128, EXx } },
10368     { "(bad)",          { XX } },
10369   },
10370   {
10371     /* VEX_W_EE_P_2  */
10372     { "vpmaxsw",        { XM, Vex128, EXx } },
10373     { "(bad)",          { XX } },
10374   },
10375   {
10376     /* VEX_W_EF_P_2  */
10377     { "vpxor",          { XM, Vex128, EXx } },
10378     { "(bad)",          { XX } },
10379   },
10380   {
10381     /* VEX_W_F0_P_3_M_0 */
10382     { "vlddqu",         { XM, M } },
10383     { "(bad)",          { XX } },
10384   },
10385   {
10386     /* VEX_W_F1_P_2 */
10387     { "vpsllw",         { XM, Vex128, EXx } },
10388     { "(bad)",          { XX } },
10389   },
10390   {
10391     /* VEX_W_F2_P_2 */
10392     { "vpslld",         { XM, Vex128, EXx } },
10393     { "(bad)",          { XX } },
10394   },
10395   {
10396     /* VEX_W_F3_P_2 */
10397     { "vpsllq",         { XM, Vex128, EXx } },
10398     { "(bad)",          { XX } },
10399   },
10400   {
10401     /* VEX_W_F4_P_2 */
10402     { "vpmuludq",       { XM, Vex128, EXx } },
10403     { "(bad)",          { XX } },
10404   },
10405   {
10406     /* VEX_W_F5_P_2 */
10407     { "vpmaddwd",       { XM, Vex128, EXx } },
10408     { "(bad)",          { XX } },
10409   },
10410   {
10411     /* VEX_W_F6_P_2 */
10412     { "vpsadbw",        { XM, Vex128, EXx } },
10413     { "(bad)",          { XX } },
10414   },
10415   {
10416     /* VEX_W_F7_P_2 */
10417     { "vmaskmovdqu",    { XM, XS } },
10418     { "(bad)",          { XX } },
10419   },
10420   {
10421     /* VEX_W_F8_P_2 */
10422     { "vpsubb",         { XM, Vex128, EXx } },
10423     { "(bad)",          { XX } },
10424   },
10425   {
10426     /* VEX_W_F9_P_2 */
10427     { "vpsubw",         { XM, Vex128, EXx } },
10428     { "(bad)",          { XX } },
10429   },
10430   {
10431     /* VEX_W_FA_P_2 */
10432     { "vpsubd",         { XM, Vex128, EXx } },
10433     { "(bad)",          { XX } },
10434   },
10435   {
10436     /* VEX_W_FB_P_2 */
10437     { "vpsubq",         { XM, Vex128, EXx } },
10438     { "(bad)",          { XX } },
10439   },
10440   {
10441     /* VEX_W_FC_P_2 */
10442     { "vpaddb",         { XM, Vex128, EXx } },
10443     { "(bad)",          { XX } },
10444   },
10445   {
10446     /* VEX_W_FD_P_2 */
10447     { "vpaddw",         { XM, Vex128, EXx } },
10448     { "(bad)",          { XX } },
10449   },
10450   {
10451     /* VEX_W_FE_P_2 */
10452     { "vpaddd",         { XM, Vex128, EXx } },
10453     { "(bad)",          { XX } },
10454   },
10455   {
10456     /* VEX_W_3800_P_2  */
10457     { "vpshufb",        { XM, Vex128, EXx } },
10458     { "(bad)",          { XX } },
10459   },
10460   {
10461     /* VEX_W_3801_P_2  */
10462     { "vphaddw",        { XM, Vex128, EXx } },
10463     { "(bad)",          { XX } },
10464   },
10465   {
10466     /* VEX_W_3802_P_2  */
10467     { "vphaddd",        { XM, Vex128, EXx } },
10468     { "(bad)",          { XX } },
10469   },
10470   {
10471     /* VEX_W_3803_P_2  */
10472     { "vphaddsw",       { XM, Vex128, EXx } },
10473     { "(bad)",          { XX } },
10474   },
10475   {
10476     /* VEX_W_3804_P_2  */
10477     { "vpmaddubsw",     { XM, Vex128, EXx } },
10478     { "(bad)",          { XX } },
10479   },
10480   {
10481     /* VEX_W_3805_P_2  */
10482     { "vphsubw",        { XM, Vex128, EXx } },
10483     { "(bad)",          { XX } },
10484   },
10485   {
10486     /* VEX_W_3806_P_2  */
10487     { "vphsubd",        { XM, Vex128, EXx } },
10488     { "(bad)",          { XX } },
10489   },
10490   {
10491     /* VEX_W_3807_P_2  */
10492     { "vphsubsw",       { XM, Vex128, EXx } },
10493     { "(bad)",          { XX } },
10494   },
10495   {
10496     /* VEX_W_3808_P_2  */
10497     { "vpsignb",        { XM, Vex128, EXx } },
10498     { "(bad)",          { XX } },
10499   },
10500   {
10501     /* VEX_W_3809_P_2  */
10502     { "vpsignw",        { XM, Vex128, EXx } },
10503     { "(bad)",          { XX } },
10504   },
10505   {
10506     /* VEX_W_380A_P_2  */
10507     { "vpsignd",        { XM, Vex128, EXx } },
10508     { "(bad)",          { XX } },
10509   },
10510   {
10511     /* VEX_W_380B_P_2  */
10512     { "vpmulhrsw",      { XM, Vex128, EXx } },
10513     { "(bad)",          { XX } },
10514   },
10515   {
10516     /* VEX_W_380C_P_2  */
10517     { "vpermilps",      { XM, Vex, EXx } },
10518     { "(bad)",          { XX } },
10519   },
10520   {
10521     /* VEX_W_380D_P_2  */
10522     { "vpermilpd",      { XM, Vex, EXx } },
10523     { "(bad)",          { XX } },
10524   },
10525   {
10526     /* VEX_W_380E_P_2  */
10527     { "vtestps",        { XM, EXx } },
10528     { "(bad)",          { XX } },
10529   },
10530   {
10531     /* VEX_W_380F_P_2  */
10532     { "vtestpd",        { XM, EXx } },
10533     { "(bad)",          { XX } },
10534   },
10535   {
10536     /* VEX_W_3817_P_2 */
10537     { "vptest",         { XM, EXx } },
10538     { "(bad)",          { XX } },
10539   },
10540   {
10541     /* VEX_W_3818_P_2_M_0 */
10542     { "vbroadcastss",   { XM, Md } },
10543     { "(bad)",          { XX } },
10544   },
10545   {
10546     /* VEX_W_3819_P_2_M_0 */
10547     { "vbroadcastsd",   { XM, Mq } },
10548     { "(bad)",          { XX } },
10549   },
10550   {
10551     /* VEX_W_381A_P_2_M_0 */
10552     { "vbroadcastf128", { XM, Mxmm } },
10553     { "(bad)",          { XX } },
10554   },
10555   {
10556     /* VEX_W_381C_P_2 */
10557     { "vpabsb",         { XM, EXx } },
10558     { "(bad)",          { XX } },
10559   },
10560   {
10561     /* VEX_W_381D_P_2 */
10562     { "vpabsw",         { XM, EXx } },
10563     { "(bad)",          { XX } },
10564   },
10565   {
10566     /* VEX_W_381E_P_2 */
10567     { "vpabsd",         { XM, EXx } },
10568     { "(bad)",          { XX } },
10569   },
10570   {
10571     /* VEX_W_3820_P_2 */
10572     { "vpmovsxbw",      { XM, EXq } },
10573     { "(bad)",          { XX } },
10574   },
10575   {
10576     /* VEX_W_3821_P_2 */
10577     { "vpmovsxbd",      { XM, EXd } },
10578     { "(bad)",          { XX } },
10579   },
10580   {
10581     /* VEX_W_3822_P_2 */
10582     { "vpmovsxbq",      { XM, EXw } },
10583     { "(bad)",          { XX } },
10584   },
10585   {
10586     /* VEX_W_3823_P_2 */
10587     { "vpmovsxwd",      { XM, EXq } },
10588     { "(bad)",          { XX } },
10589   },
10590   {
10591     /* VEX_W_3824_P_2 */
10592     { "vpmovsxwq",      { XM, EXd } },
10593     { "(bad)",          { XX } },
10594   },
10595   {
10596     /* VEX_W_3825_P_2 */
10597     { "vpmovsxdq",      { XM, EXq } },
10598     { "(bad)",          { XX } },
10599   },
10600   {
10601     /* VEX_W_3828_P_2 */
10602     { "vpmuldq",        { XM, Vex128, EXx } },
10603     { "(bad)",          { XX } },
10604   },
10605   {
10606     /* VEX_W_3829_P_2 */
10607     { "vpcmpeqq",       { XM, Vex128, EXx } },
10608     { "(bad)",          { XX } },
10609   },
10610   {
10611     /* VEX_W_382A_P_2_M_0 */
10612     { "vmovntdqa",      { XM, Mx } },
10613     { "(bad)",          { XX } },
10614   },
10615   {
10616     /* VEX_W_382B_P_2 */
10617     { "vpackusdw",      { XM, Vex128, EXx } },
10618     { "(bad)",          { XX } },
10619   },
10620   {
10621     /* VEX_W_382C_P_2_M_0 */
10622     { "vmaskmovps",     { XM, Vex, Mx } },
10623     { "(bad)",          { XX } },
10624   },
10625   {
10626     /* VEX_W_382D_P_2_M_0 */
10627     { "vmaskmovpd",     { XM, Vex, Mx } },
10628     { "(bad)",          { XX } },
10629   },
10630   {
10631     /* VEX_W_382E_P_2_M_0 */
10632     { "vmaskmovps",     { Mx, Vex, XM } },
10633     { "(bad)",          { XX } },
10634   },
10635   {
10636     /* VEX_W_382F_P_2_M_0 */
10637     { "vmaskmovpd",     { Mx, Vex, XM } },
10638     { "(bad)",          { XX } },
10639   },
10640   {
10641     /* VEX_W_3830_P_2 */
10642     { "vpmovzxbw",      { XM, EXq } },
10643     { "(bad)",          { XX } },
10644   },
10645   {
10646     /* VEX_W_3831_P_2 */
10647     { "vpmovzxbd",      { XM, EXd } },
10648     { "(bad)",          { XX } },
10649   },
10650   {
10651     /* VEX_W_3832_P_2 */
10652     { "vpmovzxbq",      { XM, EXw } },
10653     { "(bad)",          { XX } },
10654   },
10655   {
10656     /* VEX_W_3833_P_2 */
10657     { "vpmovzxwd",      { XM, EXq } },
10658     { "(bad)",          { XX } },
10659   },
10660   {
10661     /* VEX_W_3834_P_2 */
10662     { "vpmovzxwq",      { XM, EXd } },
10663     { "(bad)",          { XX } },
10664   },
10665   {
10666     /* VEX_W_3835_P_2 */
10667     { "vpmovzxdq",      { XM, EXq } },
10668     { "(bad)",          { XX } },
10669   },
10670   {
10671     /* VEX_W_3837_P_2 */
10672     { "vpcmpgtq",       { XM, Vex128, EXx } },
10673     { "(bad)",          { XX } },
10674   },
10675   {
10676     /* VEX_W_3838_P_2 */
10677     { "vpminsb",        { XM, Vex128, EXx } },
10678     { "(bad)",          { XX } },
10679   },
10680   {
10681     /* VEX_W_3839_P_2 */
10682     { "vpminsd",        { XM, Vex128, EXx } },
10683     { "(bad)",          { XX } },
10684   },
10685   {
10686     /* VEX_W_383A_P_2 */
10687     { "vpminuw",        { XM, Vex128, EXx } },
10688     { "(bad)",          { XX } },
10689   },
10690   {
10691     /* VEX_W_383B_P_2 */
10692     { "vpminud",        { XM, Vex128, EXx } },
10693     { "(bad)",          { XX } },
10694   },
10695   {
10696     /* VEX_W_383C_P_2 */
10697     { "vpmaxsb",        { XM, Vex128, EXx } },
10698     { "(bad)",          { XX } },
10699   },
10700   {
10701     /* VEX_W_383D_P_2 */
10702     { "vpmaxsd",        { XM, Vex128, EXx } },
10703     { "(bad)",          { XX } },
10704   },
10705   {
10706     /* VEX_W_383E_P_2 */
10707     { "vpmaxuw",        { XM, Vex128, EXx } },
10708     { "(bad)",          { XX } },
10709   },
10710   {
10711     /* VEX_W_383F_P_2 */
10712     { "vpmaxud",        { XM, Vex128, EXx } },
10713     { "(bad)",          { XX } },
10714   },
10715   {
10716     /* VEX_W_3840_P_2 */
10717     { "vpmulld",        { XM, Vex128, EXx } },
10718     { "(bad)",          { XX } },
10719   },
10720   {
10721     /* VEX_W_3841_P_2 */
10722     { "vphminposuw",    { XM, EXx } },
10723     { "(bad)",          { XX } },
10724   },
10725   {
10726     /* VEX_W_38DB_P_2 */
10727     { "vaesimc",        { XM, EXx } },
10728     { "(bad)",          { XX } },
10729   },
10730   {
10731     /* VEX_W_38DC_P_2 */
10732     { "vaesenc",        { XM, Vex128, EXx } },
10733     { "(bad)",          { XX } },
10734   },
10735   {
10736     /* VEX_W_38DD_P_2 */
10737     { "vaesenclast",    { XM, Vex128, EXx } },
10738     { "(bad)",          { XX } },
10739   },
10740   {
10741     /* VEX_W_38DE_P_2 */
10742     { "vaesdec",        { XM, Vex128, EXx } },
10743     { "(bad)",          { XX } },
10744   },
10745   {
10746     /* VEX_W_38DF_P_2 */
10747     { "vaesdeclast",    { XM, Vex128, EXx } },
10748     { "(bad)",          { XX } },
10749   },
10750   {
10751     /* VEX_W_3A04_P_2 */
10752     { "vpermilps",      { XM, EXx, Ib } },
10753     { "(bad)",          { XX } },
10754   },
10755   {
10756     /* VEX_W_3A05_P_2 */
10757     { "vpermilpd",      { XM, EXx, Ib } },
10758     { "(bad)",          { XX } },
10759   },
10760   {
10761     /* VEX_W_3A06_P_2 */
10762     { "vperm2f128",     { XM, Vex256, EXx, Ib } },
10763     { "(bad)",          { XX } },
10764   },
10765   {
10766     /* VEX_W_3A08_P_2 */
10767     { "vroundps",       { XM, EXx, Ib } },
10768     { "(bad)",          { XX } },
10769   },
10770   {
10771     /* VEX_W_3A09_P_2 */
10772     { "vroundpd",       { XM, EXx, Ib } },
10773     { "(bad)",          { XX } },
10774   },
10775   {
10776     /* VEX_W_3A0A_P_2 */
10777     { "vroundss",       { XM, Vex128, EXd, Ib } },
10778     { "(bad)",          { XX } },
10779   },
10780   {
10781     /* VEX_W_3A0B_P_2 */
10782     { "vroundsd",       { XM, Vex128, EXq, Ib } },
10783     { "(bad)",          { XX } },
10784   },
10785   {
10786     /* VEX_W_3A0C_P_2 */
10787     { "vblendps",       { XM, Vex, EXx, Ib } },
10788     { "(bad)",          { XX } },
10789   },
10790   {
10791     /* VEX_W_3A0D_P_2 */
10792     { "vblendpd",       { XM, Vex, EXx, Ib } },
10793     { "(bad)",          { XX } },
10794   },
10795   {
10796     /* VEX_W_3A0E_P_2 */
10797     { "vpblendw",       { XM, Vex128, EXx, Ib } },
10798     { "(bad)",          { XX } },
10799   },
10800   {
10801     /* VEX_W_3A0F_P_2 */
10802     { "vpalignr",       { XM, Vex128, EXx, Ib } },
10803     { "(bad)",          { XX } },
10804   },
10805   {
10806     /* VEX_W_3A14_P_2 */
10807     { "vpextrb",        { Edqb, XM, Ib } },
10808     { "(bad)",          { XX } },
10809   },
10810   {
10811     /* VEX_W_3A15_P_2 */
10812     { "vpextrw",        { Edqw, XM, Ib } },
10813     { "(bad)",          { XX } },
10814   },
10815   {
10816     /* VEX_W_3A18_P_2 */
10817     { "vinsertf128",    { XM, Vex256, EXxmm, Ib } },
10818     { "(bad)",          { XX } },
10819   },
10820   {
10821     /* VEX_W_3A19_P_2 */
10822     { "vextractf128",   { EXxmm, XM, Ib } },
10823     { "(bad)",          { XX } },
10824   },
10825   {
10826     /* VEX_W_3A20_P_2 */
10827     { "vpinsrb",        { XM, Vex128, Edqb, Ib } },
10828     { "(bad)",          { XX } },
10829   },
10830   {
10831     /* VEX_W_3A21_P_2 */
10832     { "vinsertps",      { XM, Vex128, EXd, Ib } },
10833     { "(bad)",          { XX } },
10834   },
10835   {
10836     /* VEX_W_3A40_P_2 */
10837     { "vdpps",          { XM, Vex, EXx, Ib } },
10838     { "(bad)",          { XX } },
10839   },
10840   {
10841     /* VEX_W_3A41_P_2 */
10842     { "vdppd",          { XM, Vex128, EXx, Ib } },
10843     { "(bad)",          { XX } },
10844   },
10845   {
10846     /* VEX_W_3A42_P_2 */
10847     { "vmpsadbw",       { XM, Vex128, EXx, Ib } },
10848     { "(bad)",          { XX } },
10849   },
10850   {
10851     /* VEX_W_3A44_P_2 */
10852     { "vpclmulqdq",     { XM, Vex128, EXx, PCLMUL } },
10853     { "(bad)",          { XX } },
10854   },
10855   {
10856     /* VEX_W_3A4A_P_2 */
10857     { "vblendvps",      { XM, Vex, EXx, XMVexI4 } },
10858     { "(bad)",          { XX } },
10859   },
10860   {
10861     /* VEX_W_3A4B_P_2 */
10862     { "vblendvpd",      { XM, Vex, EXx, XMVexI4 } },
10863     { "(bad)",          { XX } },
10864   },
10865   {
10866     /* VEX_W_3A4C_P_2 */
10867     { "vpblendvb",      { XM, Vex128, EXx, XMVexI4 } },
10868     { "(bad)",          { XX } },
10869   },
10870   {
10871     /* VEX_W_3A60_P_2 */
10872     { "vpcmpestrm",     { XM, EXx, Ib } },
10873     { "(bad)",          { XX } },
10874   },
10875   {
10876     /* VEX_W_3A61_P_2 */
10877     { "vpcmpestri",     { XM, EXx, Ib } },
10878     { "(bad)",          { XX } },
10879   },
10880   {
10881     /* VEX_W_3A62_P_2 */
10882     { "vpcmpistrm",     { XM, EXx, Ib } },
10883     { "(bad)",          { XX } },
10884   },
10885   {
10886     /* VEX_W_3A63_P_2 */
10887     { "vpcmpistri",     { XM, EXx, Ib } },
10888     { "(bad)",          { XX } },
10889   },
10890   {
10891     /* VEX_W_3ADF_P_2 */
10892     { "vaeskeygenassist", { XM, EXx, Ib } },
10893     { "(bad)",          { XX } },
10894   },
10895 };
10896
10897 static const struct dis386 mod_table[][2] = {
10898   {
10899     /* MOD_8D */
10900     { "leaS",           { Gv, M } },
10901     { "(bad)",          { XX } },
10902   },
10903   {
10904     /* MOD_0F01_REG_0 */
10905     { X86_64_TABLE (X86_64_0F01_REG_0) },
10906     { RM_TABLE (RM_0F01_REG_0) },
10907   },
10908   {
10909     /* MOD_0F01_REG_1 */
10910     { X86_64_TABLE (X86_64_0F01_REG_1) },
10911     { RM_TABLE (RM_0F01_REG_1) },
10912   },
10913   {
10914     /* MOD_0F01_REG_2 */
10915     { X86_64_TABLE (X86_64_0F01_REG_2) },
10916     { RM_TABLE (RM_0F01_REG_2) },
10917   },
10918   {
10919     /* MOD_0F01_REG_3 */
10920     { X86_64_TABLE (X86_64_0F01_REG_3) },
10921     { RM_TABLE (RM_0F01_REG_3) },
10922   },
10923   {
10924     /* MOD_0F01_REG_7 */
10925     { "invlpg",         { Mb } },
10926     { RM_TABLE (RM_0F01_REG_7) },
10927   },
10928   {
10929     /* MOD_0F12_PREFIX_0 */
10930     { "movlps",         { XM, EXq } },
10931     { "movhlps",        { XM, EXq } },
10932   },
10933   {
10934     /* MOD_0F13 */
10935     { "movlpX",         { EXq, XM } },
10936     { "(bad)",          { XX } },
10937   },
10938   {
10939     /* MOD_0F16_PREFIX_0 */
10940     { "movhps",         { XM, EXq } },
10941     { "movlhps",        { XM, EXq } },
10942   },
10943   {
10944     /* MOD_0F17 */
10945     { "movhpX",         { EXq, XM } },
10946     { "(bad)",          { XX } },
10947   },
10948   {
10949     /* MOD_0F18_REG_0 */
10950     { "prefetchnta",    { Mb } },
10951     { "(bad)",          { XX } },
10952   },
10953   {
10954     /* MOD_0F18_REG_1 */
10955     { "prefetcht0",     { Mb } },
10956     { "(bad)",          { XX } },
10957   },
10958   {
10959     /* MOD_0F18_REG_2 */
10960     { "prefetcht1",     { Mb } },
10961     { "(bad)",          { XX } },
10962   },
10963   {
10964     /* MOD_0F18_REG_3 */
10965     { "prefetcht2",     { Mb } },
10966     { "(bad)",          { XX } },
10967   },
10968   {
10969     /* MOD_0F20 */
10970     { "(bad)",          { XX } },
10971     { "movZ",           { Rm, Cm } },
10972   },
10973   {
10974     /* MOD_0F21 */
10975     { "(bad)",          { XX } },
10976     { "movZ",           { Rm, Dm } },
10977   },
10978   {
10979     /* MOD_0F22 */
10980     { "(bad)",          { XX } },
10981     { "movZ",           { Cm, Rm } },
10982   },
10983   {
10984     /* MOD_0F23 */
10985     { "(bad)",          { XX } },
10986     { "movZ",           { Dm, Rm } },
10987   },
10988   {
10989     /* MOD_0F24 */
10990     { "(bad)",          { XX } },    
10991     { "movL",           { Rd, Td } },
10992   },
10993   {
10994     /* MOD_0F26 */
10995     { "(bad)",          { XX } },
10996     { "movL",           { Td, Rd } },
10997   },
10998   {
10999     /* MOD_0F2B_PREFIX_0 */
11000     {"movntps",         { Mx, XM } },
11001     { "(bad)",          { XX } },
11002   },
11003   {
11004     /* MOD_0F2B_PREFIX_1 */
11005     {"movntss",         { Md, XM } },
11006     { "(bad)",          { XX } },
11007   },
11008   {
11009     /* MOD_0F2B_PREFIX_2 */
11010     {"movntpd",         { Mx, XM } },
11011     { "(bad)",          { XX } },
11012   },
11013   {
11014     /* MOD_0F2B_PREFIX_3 */
11015     {"movntsd",         { Mq, XM } },
11016     { "(bad)",          { XX } },
11017   },
11018   {
11019     /* MOD_0F51 */
11020     { "(bad)",          { XX } },
11021     { "movmskpX",       { Gdq, XS } },
11022   },
11023   {
11024     /* MOD_0F71_REG_2 */
11025     { "(bad)",          { XX } },
11026     { "psrlw",          { MS, Ib } },
11027   },
11028   {
11029     /* MOD_0F71_REG_4 */
11030     { "(bad)",          { XX } },
11031     { "psraw",          { MS, Ib } },
11032   },
11033   {
11034     /* MOD_0F71_REG_6 */
11035     { "(bad)",          { XX } },
11036     { "psllw",          { MS, Ib } },
11037   },
11038   {
11039     /* MOD_0F72_REG_2 */
11040     { "(bad)",          { XX } },
11041     { "psrld",          { MS, Ib } },
11042   },
11043   {
11044     /* MOD_0F72_REG_4 */
11045     { "(bad)",          { XX } },
11046     { "psrad",          { MS, Ib } },
11047   },
11048   {
11049     /* MOD_0F72_REG_6 */
11050     { "(bad)",          { XX } },
11051     { "pslld",          { MS, Ib } },
11052   },
11053   {
11054     /* MOD_0F73_REG_2 */
11055     { "(bad)",          { XX } },
11056     { "psrlq",          { MS, Ib } },
11057   },
11058   {
11059     /* MOD_0F73_REG_3 */
11060     { "(bad)",          { XX } },
11061     { PREFIX_TABLE (PREFIX_0F73_REG_3) },
11062   },
11063   {
11064     /* MOD_0F73_REG_6 */
11065     { "(bad)",          { XX } },
11066     { "psllq",          { MS, Ib } },
11067   },
11068   {
11069     /* MOD_0F73_REG_7 */
11070     { "(bad)",          { XX } },
11071     { PREFIX_TABLE (PREFIX_0F73_REG_7) },
11072   },
11073   {
11074     /* MOD_0FAE_REG_0 */
11075     { "fxsave",         { FXSAVE } },
11076     { "(bad)",          { XX } },
11077   },
11078   {
11079     /* MOD_0FAE_REG_1 */
11080     { "fxrstor",        { FXSAVE } },
11081     { "(bad)",          { XX } },
11082   },
11083   {
11084     /* MOD_0FAE_REG_2 */
11085     { "ldmxcsr",        { Md } },
11086     { "(bad)",          { XX } },
11087   },
11088   {
11089     /* MOD_0FAE_REG_3 */
11090     { "stmxcsr",        { Md } },
11091     { "(bad)",          { XX } },
11092   },
11093   {
11094     /* MOD_0FAE_REG_4 */
11095     { "xsave",          { M } },
11096     { "(bad)",          { XX } },
11097   },
11098   {
11099     /* MOD_0FAE_REG_5 */
11100     { "xrstor",         { M } },
11101     { RM_TABLE (RM_0FAE_REG_5) },
11102   },
11103   {
11104     /* MOD_0FAE_REG_6 */
11105     { "xsaveopt",       { M } },
11106     { RM_TABLE (RM_0FAE_REG_6) },
11107   },
11108   {
11109     /* MOD_0FAE_REG_7 */
11110     { "clflush",        { Mb } },
11111     { RM_TABLE (RM_0FAE_REG_7) },
11112   },
11113   {
11114     /* MOD_0FB2 */
11115     { "lssS",           { Gv, Mp } },
11116     { "(bad)",          { XX } },
11117   },
11118   {
11119     /* MOD_0FB4 */
11120     { "lfsS",           { Gv, Mp } },
11121     { "(bad)",          { XX } },
11122   },
11123   {
11124     /* MOD_0FB5 */
11125     { "lgsS",           { Gv, Mp } },
11126     { "(bad)",          { XX } },
11127   },
11128   {
11129     /* MOD_0FC7_REG_6 */
11130     { PREFIX_TABLE (PREFIX_0FC7_REG_6) },
11131     { "(bad)",          { XX } },
11132   },
11133   {
11134     /* MOD_0FC7_REG_7 */
11135     { "vmptrst",        { Mq } },
11136     { "(bad)",          { XX } },
11137   },
11138   {
11139     /* MOD_0FD7 */
11140     { "(bad)",          { XX } },
11141     { "pmovmskb",       { Gdq, MS } },
11142   },
11143   {
11144     /* MOD_0FE7_PREFIX_2 */
11145     { "movntdq",        { Mx, XM } },
11146     { "(bad)",          { XX } },
11147   },
11148   {
11149     /* MOD_0FF0_PREFIX_3 */
11150     { "lddqu",          { XM, M } },
11151     { "(bad)",          { XX } },
11152   },
11153   {
11154     /* MOD_0F382A_PREFIX_2 */
11155     { "movntdqa",       { XM, Mx } },
11156     { "(bad)",          { XX } },
11157   },
11158   {
11159     /* MOD_62_32BIT */
11160     { "bound{S|}",      { Gv, Ma } },
11161     { "(bad)",          { XX } },
11162   },
11163   {
11164     /* MOD_C4_32BIT */
11165     { "lesS",           { Gv, Mp } },
11166     { VEX_C4_TABLE (VEX_0F) },
11167   },
11168   {
11169     /* MOD_C5_32BIT */
11170     { "ldsS",           { Gv, Mp } },
11171     { VEX_C5_TABLE (VEX_0F) },
11172   },
11173   {
11174     /* MOD_VEX_12_PREFIX_0 */
11175     { VEX_LEN_TABLE (VEX_LEN_12_P_0_M_0) },
11176     { VEX_LEN_TABLE (VEX_LEN_12_P_0_M_1) },
11177   },
11178   {
11179     /* MOD_VEX_13 */
11180     { VEX_LEN_TABLE (VEX_LEN_13_M_0) },
11181     { "(bad)",          { XX } },
11182   },
11183   {
11184     /* MOD_VEX_16_PREFIX_0 */
11185     { VEX_LEN_TABLE (VEX_LEN_16_P_0_M_0) },
11186     { VEX_LEN_TABLE (VEX_LEN_16_P_0_M_1) },
11187   },
11188   {
11189     /* MOD_VEX_17 */
11190     { VEX_LEN_TABLE (VEX_LEN_17_M_0) },
11191     { "(bad)",          { XX } },
11192   },
11193   {
11194     /* MOD_VEX_2B */
11195     { VEX_W_TABLE (VEX_W_2B_M_0) },
11196     { "(bad)",          { XX } },
11197   },
11198   {
11199     /* MOD_VEX_50 */
11200     { "(bad)",          { XX } },
11201     { VEX_W_TABLE (VEX_W_50_M_0) },
11202   },
11203   {
11204     /* MOD_VEX_71_REG_2 */
11205     { "(bad)",          { XX } },
11206     { PREFIX_TABLE (PREFIX_VEX_71_REG_2) },
11207   },
11208   {
11209     /* MOD_VEX_71_REG_4 */
11210     { "(bad)",          { XX } },
11211     { PREFIX_TABLE (PREFIX_VEX_71_REG_4) },
11212   },
11213   {
11214     /* MOD_VEX_71_REG_6 */
11215     { "(bad)",          { XX } },
11216     { PREFIX_TABLE (PREFIX_VEX_71_REG_6) },
11217   },
11218   {
11219     /* MOD_VEX_72_REG_2 */
11220     { "(bad)",          { XX } },
11221     { PREFIX_TABLE (PREFIX_VEX_72_REG_2) },
11222   },
11223   {
11224     /* MOD_VEX_72_REG_4 */
11225     { "(bad)",          { XX } },
11226     { PREFIX_TABLE (PREFIX_VEX_72_REG_4) },
11227   },
11228   {
11229     /* MOD_VEX_72_REG_6 */
11230     { "(bad)",          { XX } },
11231     { PREFIX_TABLE (PREFIX_VEX_72_REG_6) },
11232   },
11233   {
11234     /* MOD_VEX_73_REG_2 */
11235     { "(bad)",          { XX } },
11236     { PREFIX_TABLE (PREFIX_VEX_73_REG_2) },
11237   },
11238   {
11239     /* MOD_VEX_73_REG_3 */
11240     { "(bad)",          { XX } },
11241     { PREFIX_TABLE (PREFIX_VEX_73_REG_3) },
11242   },
11243   {
11244     /* MOD_VEX_73_REG_6 */
11245     { "(bad)",          { XX } },
11246     { PREFIX_TABLE (PREFIX_VEX_73_REG_6) },
11247   },
11248   {
11249     /* MOD_VEX_73_REG_7 */
11250     { "(bad)",          { XX } },
11251     { PREFIX_TABLE (PREFIX_VEX_73_REG_7) },
11252   },
11253   {
11254     /* MOD_VEX_AE_REG_2 */
11255     { VEX_LEN_TABLE (VEX_LEN_AE_R_2_M_0) },
11256     { "(bad)",          { XX } },
11257   },
11258   {
11259     /* MOD_VEX_AE_REG_3 */
11260     { VEX_LEN_TABLE (VEX_LEN_AE_R_3_M_0) },
11261     { "(bad)",          { XX } },
11262   },
11263   {
11264     /* MOD_VEX_D7_PREFIX_2 */
11265     { "(bad)",          { XX } },
11266     { VEX_LEN_TABLE (VEX_LEN_D7_P_2_M_1) },
11267   },
11268   {
11269     /* MOD_VEX_E7_PREFIX_2 */
11270     { VEX_W_TABLE (VEX_W_E7_P_2_M_0) },
11271     { "(bad)",          { XX } },
11272   },
11273   {
11274     /* MOD_VEX_F0_PREFIX_3 */
11275     { VEX_W_TABLE (VEX_W_F0_P_3_M_0) },
11276     { "(bad)",          { XX } },
11277   },
11278   {
11279     /* MOD_VEX_3818_PREFIX_2 */
11280     { VEX_W_TABLE (VEX_W_3818_P_2_M_0) },
11281     { "(bad)",          { XX } },
11282   },
11283   {
11284     /* MOD_VEX_3819_PREFIX_2 */
11285     { VEX_LEN_TABLE (VEX_LEN_3819_P_2_M_0) },
11286     { "(bad)",          { XX } },
11287   },
11288   {
11289     /* MOD_VEX_381A_PREFIX_2 */
11290     { VEX_LEN_TABLE (VEX_LEN_381A_P_2_M_0) },
11291     { "(bad)",          { XX } },
11292   },
11293   {
11294     /* MOD_VEX_382A_PREFIX_2 */
11295     { VEX_LEN_TABLE (VEX_LEN_382A_P_2_M_0) },
11296     { "(bad)",          { XX } },
11297   },
11298   {
11299     /* MOD_VEX_382C_PREFIX_2 */
11300     { VEX_W_TABLE (VEX_W_382C_P_2_M_0) },
11301     { "(bad)",          { XX } },
11302   },
11303   {
11304     /* MOD_VEX_382D_PREFIX_2 */
11305     { VEX_W_TABLE (VEX_W_382D_P_2_M_0) },
11306     { "(bad)",          { XX } },
11307   },
11308   {
11309     /* MOD_VEX_382E_PREFIX_2 */
11310     { VEX_W_TABLE (VEX_W_382E_P_2_M_0) },
11311     { "(bad)",          { XX } },
11312   },
11313   {
11314     /* MOD_VEX_382F_PREFIX_2 */
11315     { VEX_W_TABLE (VEX_W_382F_P_2_M_0) },
11316     { "(bad)",          { XX } },
11317   },
11318 };
11319
11320 static const struct dis386 rm_table[][8] = {
11321   {
11322     /* RM_0F01_REG_0 */
11323     { "(bad)",          { XX } },
11324     { "vmcall",         { Skip_MODRM } },
11325     { "vmlaunch",       { Skip_MODRM } },
11326     { "vmresume",       { Skip_MODRM } },
11327     { "vmxoff",         { Skip_MODRM } },
11328     { "(bad)",          { XX } },
11329     { "(bad)",          { XX } },
11330     { "(bad)",          { XX } },
11331   },
11332   {
11333     /* RM_0F01_REG_1 */
11334     { "monitor",        { { OP_Monitor, 0 } } },
11335     { "mwait",          { { OP_Mwait, 0 } } },
11336     { "(bad)",          { XX } },
11337     { "(bad)",          { XX } },
11338     { "(bad)",          { XX } },
11339     { "(bad)",          { XX } },
11340     { "(bad)",          { XX } },
11341     { "(bad)",          { XX } },
11342   },
11343   {
11344     /* RM_0F01_REG_2 */
11345     { "xgetbv",         { Skip_MODRM } },
11346     { "xsetbv",         { Skip_MODRM } },
11347     { "(bad)",          { XX } },
11348     { "(bad)",          { XX } },
11349     { "(bad)",          { XX } },
11350     { "(bad)",          { XX } },
11351     { "(bad)",          { XX } },
11352     { "(bad)",          { XX } },
11353   },
11354   {
11355     /* RM_0F01_REG_3 */
11356     { "vmrun",          { Skip_MODRM } },
11357     { "vmmcall",        { Skip_MODRM } },
11358     { "vmload",         { Skip_MODRM } },
11359     { "vmsave",         { Skip_MODRM } },
11360     { "stgi",           { Skip_MODRM } },
11361     { "clgi",           { Skip_MODRM } },
11362     { "skinit",         { Skip_MODRM } },
11363     { "invlpga",        { Skip_MODRM } },
11364   },
11365   {
11366     /* RM_0F01_REG_7 */
11367     { "swapgs",         { Skip_MODRM } },
11368     { "rdtscp",         { Skip_MODRM } },
11369     { "(bad)",          { XX } },
11370     { "(bad)",          { XX } },
11371     { "(bad)",          { XX } },
11372     { "(bad)",          { XX } },
11373     { "(bad)",          { XX } },
11374     { "(bad)",          { XX } },
11375   },
11376   {
11377     /* RM_0FAE_REG_5 */
11378     { "lfence",         { Skip_MODRM } },
11379     { "(bad)",          { XX } },
11380     { "(bad)",          { XX } },
11381     { "(bad)",          { XX } },
11382     { "(bad)",          { XX } },
11383     { "(bad)",          { XX } },
11384     { "(bad)",          { XX } },
11385     { "(bad)",          { XX } },
11386   },
11387   {
11388     /* RM_0FAE_REG_6 */
11389     { "mfence",         { Skip_MODRM } },
11390     { "(bad)",          { XX } },
11391     { "(bad)",          { XX } },
11392     { "(bad)",          { XX } },
11393     { "(bad)",          { XX } },
11394     { "(bad)",          { XX } },
11395     { "(bad)",          { XX } },
11396     { "(bad)",          { XX } },
11397   },
11398   {
11399     /* RM_0FAE_REG_7 */
11400     { "sfence",         { Skip_MODRM } },
11401     { "(bad)",          { XX } },
11402     { "(bad)",          { XX } },
11403     { "(bad)",          { XX } },
11404     { "(bad)",          { XX } },
11405     { "(bad)",          { XX } },
11406     { "(bad)",          { XX } },
11407     { "(bad)",          { XX } },
11408   },
11409 };
11410
11411 #define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
11412
11413 /* We use the high bit to indicate different name for the same
11414    prefix.  */
11415 #define ADDR16_PREFIX   (0x67 | 0x100)
11416 #define ADDR32_PREFIX   (0x67 | 0x200)
11417 #define DATA16_PREFIX   (0x66 | 0x100)
11418 #define DATA32_PREFIX   (0x66 | 0x200)
11419 #define REP_PREFIX      (0xf3 | 0x100)
11420
11421 static int
11422 ckprefix (void)
11423 {
11424   int newrex, i, length;
11425   rex = 0;
11426   rex_original = 0;
11427   rex_ignored = 0;
11428   prefixes = 0;
11429   used_prefixes = 0;
11430   rex_used = 0;
11431   last_lock_prefix = -1;
11432   last_repz_prefix = -1;
11433   last_repnz_prefix = -1;
11434   last_data_prefix = -1;
11435   last_addr_prefix = -1;
11436   last_rex_prefix = -1;
11437   last_seg_prefix = -1;
11438   for (i = 0; i < (int) ARRAY_SIZE (all_prefixes); i++)
11439     all_prefixes[i] = 0;
11440   i = 0;
11441   length = 0;
11442   /* The maximum instruction length is 15bytes.  */
11443   while (length < MAX_CODE_LENGTH - 1)
11444     {
11445       FETCH_DATA (the_info, codep + 1);
11446       newrex = 0;
11447       switch (*codep)
11448         {
11449         /* REX prefixes family.  */
11450         case 0x40:
11451         case 0x41:
11452         case 0x42:
11453         case 0x43:
11454         case 0x44:
11455         case 0x45:
11456         case 0x46:
11457         case 0x47:
11458         case 0x48:
11459         case 0x49:
11460         case 0x4a:
11461         case 0x4b:
11462         case 0x4c:
11463         case 0x4d:
11464         case 0x4e:
11465         case 0x4f:
11466           if (address_mode == mode_64bit)
11467             newrex = *codep;
11468           else
11469             return 1;
11470           last_rex_prefix = i;
11471           break;
11472         case 0xf3:
11473           prefixes |= PREFIX_REPZ;
11474           last_repz_prefix = i;
11475           break;
11476         case 0xf2:
11477           prefixes |= PREFIX_REPNZ;
11478           last_repnz_prefix = i;
11479           break;
11480         case 0xf0:
11481           prefixes |= PREFIX_LOCK;
11482           last_lock_prefix = i;
11483           break;
11484         case 0x2e:
11485           prefixes |= PREFIX_CS;
11486           last_seg_prefix = i;
11487           break;
11488         case 0x36:
11489           prefixes |= PREFIX_SS;
11490           last_seg_prefix = i;
11491           break;
11492         case 0x3e:
11493           prefixes |= PREFIX_DS;
11494           last_seg_prefix = i;
11495           break;
11496         case 0x26:
11497           prefixes |= PREFIX_ES;
11498           last_seg_prefix = i;
11499           break;
11500         case 0x64:
11501           prefixes |= PREFIX_FS;
11502           last_seg_prefix = i;
11503           break;
11504         case 0x65:
11505           prefixes |= PREFIX_GS;
11506           last_seg_prefix = i;
11507           break;
11508         case 0x66:
11509           prefixes |= PREFIX_DATA;
11510           last_data_prefix = i;
11511           break;
11512         case 0x67:
11513           prefixes |= PREFIX_ADDR;
11514           last_addr_prefix = i;
11515           break;
11516         case FWAIT_OPCODE:
11517           /* fwait is really an instruction.  If there are prefixes
11518              before the fwait, they belong to the fwait, *not* to the
11519              following instruction.  */
11520           if (prefixes || rex)
11521             {
11522               prefixes |= PREFIX_FWAIT;
11523               codep++;
11524               return 1;
11525             }
11526           prefixes = PREFIX_FWAIT;
11527           break;
11528         default:
11529           return 1;
11530         }
11531       /* Rex is ignored when followed by another prefix.  */
11532       if (rex)
11533         {
11534           rex_used = rex;
11535           return 1;
11536         }
11537       if (*codep != FWAIT_OPCODE)
11538         all_prefixes[i++] = *codep;
11539       rex = newrex;
11540       rex_original = rex;
11541       codep++;
11542       length++;
11543     }
11544   return 0;
11545 }
11546
11547 static int
11548 seg_prefix (int pref)
11549 {
11550   switch (pref)
11551     {
11552     case 0x2e:
11553       return PREFIX_CS;
11554     case 0x36:
11555       return PREFIX_SS;
11556     case 0x3e:
11557       return PREFIX_DS;
11558     case 0x26:
11559       return PREFIX_ES;
11560     case 0x64:
11561       return PREFIX_FS;
11562     case 0x65:
11563       return PREFIX_GS;
11564     default:
11565       return 0;
11566     }
11567 }
11568
11569 /* Return the name of the prefix byte PREF, or NULL if PREF is not a
11570    prefix byte.  */
11571
11572 static const char *
11573 prefix_name (int pref, int sizeflag)
11574 {
11575   static const char *rexes [16] =
11576     {
11577       "rex",            /* 0x40 */
11578       "rex.B",          /* 0x41 */
11579       "rex.X",          /* 0x42 */
11580       "rex.XB",         /* 0x43 */
11581       "rex.R",          /* 0x44 */
11582       "rex.RB",         /* 0x45 */
11583       "rex.RX",         /* 0x46 */
11584       "rex.RXB",        /* 0x47 */
11585       "rex.W",          /* 0x48 */
11586       "rex.WB",         /* 0x49 */
11587       "rex.WX",         /* 0x4a */
11588       "rex.WXB",        /* 0x4b */
11589       "rex.WR",         /* 0x4c */
11590       "rex.WRB",        /* 0x4d */
11591       "rex.WRX",        /* 0x4e */
11592       "rex.WRXB",       /* 0x4f */
11593     };
11594
11595   switch (pref)
11596     {
11597     /* REX prefixes family.  */
11598     case 0x40:
11599     case 0x41:
11600     case 0x42:
11601     case 0x43:
11602     case 0x44:
11603     case 0x45:
11604     case 0x46:
11605     case 0x47:
11606     case 0x48:
11607     case 0x49:
11608     case 0x4a:
11609     case 0x4b:
11610     case 0x4c:
11611     case 0x4d:
11612     case 0x4e:
11613     case 0x4f:
11614       return rexes [pref - 0x40];
11615     case 0xf3:
11616       return "repz";
11617     case 0xf2:
11618       return "repnz";
11619     case 0xf0:
11620       return "lock";
11621     case 0x2e:
11622       return "cs";
11623     case 0x36:
11624       return "ss";
11625     case 0x3e:
11626       return "ds";
11627     case 0x26:
11628       return "es";
11629     case 0x64:
11630       return "fs";
11631     case 0x65:
11632       return "gs";
11633     case 0x66:
11634       return (sizeflag & DFLAG) ? "data16" : "data32";
11635     case 0x67:
11636       if (address_mode == mode_64bit)
11637         return (sizeflag & AFLAG) ? "addr32" : "addr64";
11638       else
11639         return (sizeflag & AFLAG) ? "addr16" : "addr32";
11640     case FWAIT_OPCODE:
11641       return "fwait";
11642     case ADDR16_PREFIX:
11643       return "addr16";
11644     case ADDR32_PREFIX:
11645       return "addr32";
11646     case DATA16_PREFIX:
11647       return "data16";
11648     case DATA32_PREFIX:
11649       return "data32";
11650     case REP_PREFIX:
11651       return "rep";
11652     default:
11653       return NULL;
11654     }
11655 }
11656
11657 static char op_out[MAX_OPERANDS][100];
11658 static int op_ad, op_index[MAX_OPERANDS];
11659 static int two_source_ops;
11660 static bfd_vma op_address[MAX_OPERANDS];
11661 static bfd_vma op_riprel[MAX_OPERANDS];
11662 static bfd_vma start_pc;
11663
11664 /*
11665  *   On the 386's of 1988, the maximum length of an instruction is 15 bytes.
11666  *   (see topic "Redundant prefixes" in the "Differences from 8086"
11667  *   section of the "Virtual 8086 Mode" chapter.)
11668  * 'pc' should be the address of this instruction, it will
11669  *   be used to print the target address if this is a relative jump or call
11670  * The function returns the length of this instruction in bytes.
11671  */
11672
11673 static char intel_syntax;
11674 static char intel_mnemonic = !SYSV386_COMPAT;
11675 static char open_char;
11676 static char close_char;
11677 static char separator_char;
11678 static char scale_char;
11679
11680 /* Here for backwards compatibility.  When gdb stops using
11681    print_insn_i386_att and print_insn_i386_intel these functions can
11682    disappear, and print_insn_i386 be merged into print_insn.  */
11683 int
11684 print_insn_i386_att (bfd_vma pc, disassemble_info *info)
11685 {
11686   intel_syntax = 0;
11687
11688   return print_insn (pc, info);
11689 }
11690
11691 int
11692 print_insn_i386_intel (bfd_vma pc, disassemble_info *info)
11693 {
11694   intel_syntax = 1;
11695
11696   return print_insn (pc, info);
11697 }
11698
11699 int
11700 print_insn_i386 (bfd_vma pc, disassemble_info *info)
11701 {
11702   intel_syntax = -1;
11703
11704   return print_insn (pc, info);
11705 }
11706
11707 void
11708 print_i386_disassembler_options (FILE *stream)
11709 {
11710   fprintf (stream, _("\n\
11711 The following i386/x86-64 specific disassembler options are supported for use\n\
11712 with the -M switch (multiple options should be separated by commas):\n"));
11713
11714   fprintf (stream, _("  x86-64      Disassemble in 64bit mode\n"));
11715   fprintf (stream, _("  i386        Disassemble in 32bit mode\n"));
11716   fprintf (stream, _("  i8086       Disassemble in 16bit mode\n"));
11717   fprintf (stream, _("  att         Display instruction in AT&T syntax\n"));
11718   fprintf (stream, _("  intel       Display instruction in Intel syntax\n"));
11719   fprintf (stream, _("  att-mnemonic\n"
11720                      "              Display instruction in AT&T mnemonic\n"));
11721   fprintf (stream, _("  intel-mnemonic\n"
11722                      "              Display instruction in Intel mnemonic\n"));
11723   fprintf (stream, _("  addr64      Assume 64bit address size\n"));
11724   fprintf (stream, _("  addr32      Assume 32bit address size\n"));
11725   fprintf (stream, _("  addr16      Assume 16bit address size\n"));
11726   fprintf (stream, _("  data32      Assume 32bit data size\n"));
11727   fprintf (stream, _("  data16      Assume 16bit data size\n"));
11728   fprintf (stream, _("  suffix      Always display instruction suffix in AT&T syntax\n"));
11729 }
11730
11731 /* Get a pointer to struct dis386 with a valid name.  */
11732
11733 static const struct dis386 *
11734 get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
11735 {
11736   int vindex, vex_table_index;
11737
11738   if (dp->name != NULL)
11739     return dp;
11740
11741   switch (dp->op[0].bytemode)
11742     {
11743     case USE_REG_TABLE:
11744       dp = &reg_table[dp->op[1].bytemode][modrm.reg];
11745       break;
11746
11747     case USE_MOD_TABLE:
11748       vindex = modrm.mod == 0x3 ? 1 : 0;
11749       dp = &mod_table[dp->op[1].bytemode][vindex];
11750       break;
11751
11752     case USE_RM_TABLE:
11753       dp = &rm_table[dp->op[1].bytemode][modrm.rm];
11754       break;
11755
11756     case USE_PREFIX_TABLE:
11757       if (need_vex)
11758         {
11759           /* The prefix in VEX is implicit.  */
11760           switch (vex.prefix)
11761             {
11762             case 0:
11763               vindex = 0;
11764               break;
11765             case REPE_PREFIX_OPCODE:
11766               vindex = 1;
11767               break;
11768             case DATA_PREFIX_OPCODE:
11769               vindex = 2;
11770               break;
11771             case REPNE_PREFIX_OPCODE:
11772               vindex = 3;
11773               break;
11774             default:
11775               abort ();
11776               break;
11777             }
11778         }
11779       else 
11780         {
11781           vindex = 0;
11782           used_prefixes |= (prefixes & PREFIX_REPZ);
11783           if (prefixes & PREFIX_REPZ)
11784             {
11785               vindex = 1;
11786               all_prefixes[last_repz_prefix] = 0;
11787             }
11788           else
11789             {
11790               /* We should check PREFIX_REPNZ and PREFIX_REPZ before
11791                  PREFIX_DATA.  */
11792               used_prefixes |= (prefixes & PREFIX_REPNZ);
11793               if (prefixes & PREFIX_REPNZ)
11794                 {
11795                   vindex = 3;
11796                   all_prefixes[last_repnz_prefix] = 0;
11797                 }
11798               else
11799                 {
11800                   used_prefixes |= (prefixes & PREFIX_DATA);
11801                   if (prefixes & PREFIX_DATA)
11802                     {
11803                       vindex = 2;
11804                       all_prefixes[last_data_prefix] = 0;
11805                     }
11806                 }
11807             }
11808         }
11809       dp = &prefix_table[dp->op[1].bytemode][vindex];
11810       break;
11811
11812     case USE_X86_64_TABLE:
11813       vindex = address_mode == mode_64bit ? 1 : 0;
11814       dp = &x86_64_table[dp->op[1].bytemode][vindex];
11815       break;
11816
11817     case USE_3BYTE_TABLE:
11818       FETCH_DATA (info, codep + 2);
11819       vindex = *codep++;
11820       dp = &three_byte_table[dp->op[1].bytemode][vindex];
11821       modrm.mod = (*codep >> 6) & 3;
11822       modrm.reg = (*codep >> 3) & 7;
11823       modrm.rm = *codep & 7;
11824       break;
11825
11826     case USE_VEX_LEN_TABLE:
11827       if (!need_vex)
11828         abort ();
11829
11830       switch (vex.length)
11831         {
11832         case 128:
11833           vindex = 0;
11834           break;
11835         case 256:
11836           vindex = 1;
11837           break;
11838         default:
11839           abort ();
11840           break;
11841         }
11842
11843       dp = &vex_len_table[dp->op[1].bytemode][vindex];
11844       break;
11845
11846     case USE_XOP_8F_TABLE:
11847       FETCH_DATA (info, codep + 3);
11848       /* All bits in the REX prefix are ignored.  */
11849       rex_ignored = rex;
11850       rex = ~(*codep >> 5) & 0x7;
11851
11852       /* VEX_TABLE_INDEX is the mmmmm part of the XOP byte 1 "RCB.mmmmm".  */
11853       switch ((*codep & 0x1f))
11854         {
11855         default:
11856           BadOp ();
11857         case 0x8:
11858           vex_table_index = XOP_08;
11859           break;
11860         case 0x9:
11861           vex_table_index = XOP_09;
11862           break;
11863         case 0xa:
11864           vex_table_index = XOP_0A;
11865           break;
11866         }
11867       codep++;
11868       vex.w = *codep & 0x80;
11869       if (vex.w && address_mode == mode_64bit)
11870         rex |= REX_W;
11871
11872       vex.register_specifier = (~(*codep >> 3)) & 0xf;
11873       if (address_mode != mode_64bit
11874           && vex.register_specifier > 0x7)
11875         BadOp ();
11876
11877       vex.length = (*codep & 0x4) ? 256 : 128;
11878       switch ((*codep & 0x3))
11879         {
11880         case 0:
11881           vex.prefix = 0;
11882           break;
11883         case 1:
11884           vex.prefix = DATA_PREFIX_OPCODE;
11885           break;
11886         case 2:
11887           vex.prefix = REPE_PREFIX_OPCODE;
11888           break;
11889         case 3:
11890           vex.prefix = REPNE_PREFIX_OPCODE;
11891           break;
11892         }
11893       need_vex = 1;
11894       need_vex_reg = 1;
11895       codep++;
11896       vindex = *codep++;
11897       dp = &xop_table[vex_table_index][vindex];
11898
11899       FETCH_DATA (info, codep + 1);
11900       modrm.mod = (*codep >> 6) & 3;
11901       modrm.reg = (*codep >> 3) & 7;
11902       modrm.rm = *codep & 7;
11903       break;
11904
11905     case USE_VEX_C4_TABLE:
11906       FETCH_DATA (info, codep + 3);
11907       /* All bits in the REX prefix are ignored.  */
11908       rex_ignored = rex;
11909       rex = ~(*codep >> 5) & 0x7;
11910       switch ((*codep & 0x1f))
11911         {
11912         default:
11913           BadOp ();
11914         case 0x1:
11915           vex_table_index = VEX_0F;
11916           break;
11917         case 0x2:
11918           vex_table_index = VEX_0F38;
11919           break;
11920         case 0x3:
11921           vex_table_index = VEX_0F3A;
11922           break;
11923         }
11924       codep++;
11925       vex.w = *codep & 0x80;
11926       if (vex.w && address_mode == mode_64bit)
11927         rex |= REX_W;
11928
11929       vex.register_specifier = (~(*codep >> 3)) & 0xf;
11930       if (address_mode != mode_64bit
11931           && vex.register_specifier > 0x7)
11932         BadOp ();
11933
11934       vex.length = (*codep & 0x4) ? 256 : 128;
11935       switch ((*codep & 0x3))
11936         {
11937         case 0:
11938           vex.prefix = 0;
11939           break;
11940         case 1:
11941           vex.prefix = DATA_PREFIX_OPCODE;
11942           break;
11943         case 2:
11944           vex.prefix = REPE_PREFIX_OPCODE;
11945           break;
11946         case 3:
11947           vex.prefix = REPNE_PREFIX_OPCODE;
11948           break;
11949         }
11950       need_vex = 1;
11951       need_vex_reg = 1;
11952       codep++;
11953       vindex = *codep++;
11954       dp = &vex_table[vex_table_index][vindex];
11955       /* There is no MODRM byte for VEX [82|77].  */
11956       if (vindex != 0x77 && vindex != 0x82)
11957         {
11958           FETCH_DATA (info, codep + 1);
11959           modrm.mod = (*codep >> 6) & 3;
11960           modrm.reg = (*codep >> 3) & 7;
11961           modrm.rm = *codep & 7;
11962         }
11963       break;
11964
11965     case USE_VEX_C5_TABLE:
11966       FETCH_DATA (info, codep + 2);
11967       /* All bits in the REX prefix are ignored.  */
11968       rex_ignored = rex;
11969       rex = (*codep & 0x80) ? 0 : REX_R;
11970
11971       vex.register_specifier = (~(*codep >> 3)) & 0xf;
11972       if (address_mode != mode_64bit
11973           && vex.register_specifier > 0x7)
11974         BadOp ();
11975
11976       vex.w = 0;
11977
11978       vex.length = (*codep & 0x4) ? 256 : 128;
11979       switch ((*codep & 0x3))
11980         {
11981         case 0:
11982           vex.prefix = 0;
11983           break;
11984         case 1:
11985           vex.prefix = DATA_PREFIX_OPCODE;
11986           break;
11987         case 2:
11988           vex.prefix = REPE_PREFIX_OPCODE;
11989           break;
11990         case 3:
11991           vex.prefix = REPNE_PREFIX_OPCODE;
11992           break;
11993         }
11994       need_vex = 1;
11995       need_vex_reg = 1;
11996       codep++;
11997       vindex = *codep++;
11998       dp = &vex_table[dp->op[1].bytemode][vindex];
11999       /* There is no MODRM byte for VEX [82|77].  */
12000       if (vindex != 0x77 && vindex != 0x82)
12001         {
12002           FETCH_DATA (info, codep + 1);
12003           modrm.mod = (*codep >> 6) & 3;
12004           modrm.reg = (*codep >> 3) & 7;
12005           modrm.rm = *codep & 7;
12006         }
12007       break;
12008
12009     case USE_VEX_W_TABLE:
12010       if (!need_vex)
12011         abort ();
12012
12013       dp = &vex_w_table[dp->op[1].bytemode][vex.w ? 1 : 0];
12014       break;
12015
12016     default:
12017       abort ();
12018     }
12019
12020   if (dp->name != NULL)
12021     return dp;
12022   else
12023     return get_valid_dis386 (dp, info);
12024 }
12025
12026 static int
12027 print_insn (bfd_vma pc, disassemble_info *info)
12028 {
12029   const struct dis386 *dp;
12030   int i;
12031   char *op_txt[MAX_OPERANDS];
12032   int needcomma;
12033   int sizeflag;
12034   const char *p;
12035   struct dis_private priv;
12036   unsigned char op;
12037   int prefix_length;
12038   int default_prefixes;
12039
12040   if (info->mach == bfd_mach_x86_64_intel_syntax
12041       || info->mach == bfd_mach_x86_64
12042       || info->mach == bfd_mach_l1om
12043       || info->mach == bfd_mach_l1om_intel_syntax)
12044     address_mode = mode_64bit;
12045   else
12046     address_mode = mode_32bit;
12047
12048   if (intel_syntax == (char) -1)
12049     intel_syntax = (info->mach == bfd_mach_i386_i386_intel_syntax
12050                     || info->mach == bfd_mach_x86_64_intel_syntax
12051                     || info->mach == bfd_mach_l1om_intel_syntax);
12052
12053   if (info->mach == bfd_mach_i386_i386
12054       || info->mach == bfd_mach_x86_64
12055       || info->mach == bfd_mach_l1om
12056       || info->mach == bfd_mach_i386_i386_intel_syntax
12057       || info->mach == bfd_mach_x86_64_intel_syntax
12058       || info->mach == bfd_mach_l1om_intel_syntax)
12059     priv.orig_sizeflag = AFLAG | DFLAG;
12060   else if (info->mach == bfd_mach_i386_i8086)
12061     priv.orig_sizeflag = 0;
12062   else
12063     abort ();
12064
12065   for (p = info->disassembler_options; p != NULL; )
12066     {
12067       if (CONST_STRNEQ (p, "x86-64"))
12068         {
12069           address_mode = mode_64bit;
12070           priv.orig_sizeflag = AFLAG | DFLAG;
12071         }
12072       else if (CONST_STRNEQ (p, "i386"))
12073         {
12074           address_mode = mode_32bit;
12075           priv.orig_sizeflag = AFLAG | DFLAG;
12076         }
12077       else if (CONST_STRNEQ (p, "i8086"))
12078         {
12079           address_mode = mode_16bit;
12080           priv.orig_sizeflag = 0;
12081         }
12082       else if (CONST_STRNEQ (p, "intel"))
12083         {
12084           intel_syntax = 1;
12085           if (CONST_STRNEQ (p + 5, "-mnemonic"))
12086             intel_mnemonic = 1;
12087         }
12088       else if (CONST_STRNEQ (p, "att"))
12089         {
12090           intel_syntax = 0;
12091           if (CONST_STRNEQ (p + 3, "-mnemonic"))
12092             intel_mnemonic = 0;
12093         }
12094       else if (CONST_STRNEQ (p, "addr"))
12095         {
12096           if (address_mode == mode_64bit)
12097             {
12098               if (p[4] == '3' && p[5] == '2')
12099                 priv.orig_sizeflag &= ~AFLAG;
12100               else if (p[4] == '6' && p[5] == '4')
12101                 priv.orig_sizeflag |= AFLAG;
12102             }
12103           else
12104             {
12105               if (p[4] == '1' && p[5] == '6')
12106                 priv.orig_sizeflag &= ~AFLAG;
12107               else if (p[4] == '3' && p[5] == '2')
12108                 priv.orig_sizeflag |= AFLAG;
12109             }
12110         }
12111       else if (CONST_STRNEQ (p, "data"))
12112         {
12113           if (p[4] == '1' && p[5] == '6')
12114             priv.orig_sizeflag &= ~DFLAG;
12115           else if (p[4] == '3' && p[5] == '2')
12116             priv.orig_sizeflag |= DFLAG;
12117         }
12118       else if (CONST_STRNEQ (p, "suffix"))
12119         priv.orig_sizeflag |= SUFFIX_ALWAYS;
12120
12121       p = strchr (p, ',');
12122       if (p != NULL)
12123         p++;
12124     }
12125
12126   if (intel_syntax)
12127     {
12128       names64 = intel_names64;
12129       names32 = intel_names32;
12130       names16 = intel_names16;
12131       names8 = intel_names8;
12132       names8rex = intel_names8rex;
12133       names_seg = intel_names_seg;
12134       index64 = intel_index64;
12135       index32 = intel_index32;
12136       index16 = intel_index16;
12137       open_char = '[';
12138       close_char = ']';
12139       separator_char = '+';
12140       scale_char = '*';
12141     }
12142   else
12143     {
12144       names64 = att_names64;
12145       names32 = att_names32;
12146       names16 = att_names16;
12147       names8 = att_names8;
12148       names8rex = att_names8rex;
12149       names_seg = att_names_seg;
12150       index64 = att_index64;
12151       index32 = att_index32;
12152       index16 = att_index16;
12153       open_char = '(';
12154       close_char =  ')';
12155       separator_char = ',';
12156       scale_char = ',';
12157     }
12158
12159   /* The output looks better if we put 7 bytes on a line, since that
12160      puts most long word instructions on a single line.  Use 8 bytes
12161      for Intel L1OM.  */
12162   if (info->mach == bfd_mach_l1om
12163       || info->mach == bfd_mach_l1om_intel_syntax)
12164     info->bytes_per_line = 8;
12165   else
12166     info->bytes_per_line = 7;
12167
12168   info->private_data = &priv;
12169   priv.max_fetched = priv.the_buffer;
12170   priv.insn_start = pc;
12171
12172   obuf[0] = 0;
12173   for (i = 0; i < MAX_OPERANDS; ++i)
12174     {
12175       op_out[i][0] = 0;
12176       op_index[i] = -1;
12177     }
12178
12179   the_info = info;
12180   start_pc = pc;
12181   start_codep = priv.the_buffer;
12182   codep = priv.the_buffer;
12183
12184   if (setjmp (priv.bailout) != 0)
12185     {
12186       const char *name;
12187
12188       /* Getting here means we tried for data but didn't get it.  That
12189          means we have an incomplete instruction of some sort.  Just
12190          print the first byte as a prefix or a .byte pseudo-op.  */
12191       if (codep > priv.the_buffer)
12192         {
12193           name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
12194           if (name != NULL)
12195             (*info->fprintf_func) (info->stream, "%s", name);
12196           else
12197             {
12198               /* Just print the first byte as a .byte instruction.  */
12199               (*info->fprintf_func) (info->stream, ".byte 0x%x",
12200                                      (unsigned int) priv.the_buffer[0]);
12201             }
12202
12203           return 1;
12204         }
12205
12206       return -1;
12207     }
12208
12209   obufp = obuf;
12210   sizeflag = priv.orig_sizeflag;
12211
12212   if (!ckprefix () || rex_used)
12213     {
12214       /* Too many prefixes or unused REX prefixes.  */
12215       for (i = 0;
12216            all_prefixes[i] && i < (int) ARRAY_SIZE (all_prefixes);
12217            i++)
12218         (*info->fprintf_func) (info->stream, "%s",
12219                                prefix_name (all_prefixes[i], sizeflag));
12220       return 1;
12221     }
12222
12223   insn_codep = codep;
12224
12225   FETCH_DATA (info, codep + 1);
12226   two_source_ops = (*codep == 0x62) || (*codep == 0xc8);
12227
12228   if (((prefixes & PREFIX_FWAIT)
12229        && ((*codep < 0xd8) || (*codep > 0xdf))))
12230     {
12231       (*info->fprintf_func) (info->stream, "fwait");
12232       return 1;
12233     }
12234
12235   op = 0;
12236
12237   if (*codep == 0x0f)
12238     {
12239       unsigned char threebyte;
12240       FETCH_DATA (info, codep + 2);
12241       threebyte = *++codep;
12242       dp = &dis386_twobyte[threebyte];
12243       need_modrm = twobyte_has_modrm[*codep];
12244       codep++;
12245     }
12246   else
12247     {
12248       dp = &dis386[*codep];
12249       need_modrm = onebyte_has_modrm[*codep];
12250       codep++;
12251     }
12252
12253   if ((prefixes & PREFIX_REPZ))
12254     used_prefixes |= PREFIX_REPZ;
12255   if ((prefixes & PREFIX_REPNZ))
12256     used_prefixes |= PREFIX_REPNZ;
12257   if ((prefixes & PREFIX_LOCK))
12258     used_prefixes |= PREFIX_LOCK;
12259
12260   default_prefixes = 0;
12261   if (prefixes & PREFIX_ADDR)
12262     {
12263       sizeflag ^= AFLAG;
12264       if (dp->op[2].bytemode != loop_jcxz_mode || intel_syntax)
12265         {
12266           if ((sizeflag & AFLAG) || address_mode == mode_64bit)
12267             all_prefixes[last_addr_prefix] = ADDR32_PREFIX;
12268           else
12269             all_prefixes[last_addr_prefix] = ADDR16_PREFIX;
12270           default_prefixes |= PREFIX_ADDR;
12271         }
12272     }
12273
12274   if ((prefixes & PREFIX_DATA))
12275     {
12276       sizeflag ^= DFLAG;
12277       if (dp->op[2].bytemode == cond_jump_mode
12278           && dp->op[0].bytemode == v_mode
12279           && !intel_syntax)
12280         {
12281           if (sizeflag & DFLAG)
12282             all_prefixes[last_data_prefix] = DATA32_PREFIX;
12283           else
12284             all_prefixes[last_data_prefix] = DATA16_PREFIX;
12285           default_prefixes |= PREFIX_DATA;
12286         }
12287       else if (rex & REX_W)
12288         {
12289           /* REX_W will override PREFIX_DATA.  */
12290           default_prefixes |= PREFIX_DATA;
12291         }
12292     }
12293
12294   if (need_modrm)
12295     {
12296       FETCH_DATA (info, codep + 1);
12297       modrm.mod = (*codep >> 6) & 3;
12298       modrm.reg = (*codep >> 3) & 7;
12299       modrm.rm = *codep & 7;
12300     }
12301
12302    need_vex = 0;
12303    need_vex_reg = 0;
12304    vex_w_done = 0;
12305
12306   if (dp->name == NULL && dp->op[0].bytemode == FLOATCODE)
12307     {
12308       dofloat (sizeflag);
12309     }
12310   else
12311     {
12312       dp = get_valid_dis386 (dp, info);
12313       if (dp != NULL && putop (dp->name, sizeflag) == 0)
12314         {
12315           for (i = 0; i < MAX_OPERANDS; ++i)
12316             {
12317               obufp = op_out[i];
12318               op_ad = MAX_OPERANDS - 1 - i;
12319               if (dp->op[i].rtn)
12320                 (*dp->op[i].rtn) (dp->op[i].bytemode, sizeflag);
12321             }
12322         }
12323     }
12324
12325   /* See if any prefixes were not used.  If so, print the first one
12326      separately.  If we don't do this, we'll wind up printing an
12327      instruction stream which does not precisely correspond to the
12328      bytes we are disassembling.  */
12329   if ((prefixes & ~(used_prefixes | default_prefixes)) != 0)
12330     {
12331       for (i = 0; i < (int) ARRAY_SIZE (all_prefixes); i++)
12332         if (all_prefixes[i])
12333           {
12334             const char *name;
12335             name = prefix_name (all_prefixes[i], priv.orig_sizeflag);
12336             if (name == NULL)
12337               name = INTERNAL_DISASSEMBLER_ERROR;
12338             (*info->fprintf_func) (info->stream, "%s", name);
12339             return 1;
12340           }
12341     }
12342
12343   /* Check if the REX prefix used.  */
12344   if (rex_ignored == 0 && (rex ^ rex_used) == 0)
12345     all_prefixes[last_rex_prefix] = 0;
12346
12347   /* Check if the SEG prefix used.  */
12348   if ((prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS | PREFIX_ES
12349                    | PREFIX_FS | PREFIX_GS)) != 0
12350       && (used_prefixes
12351           & seg_prefix (all_prefixes[last_seg_prefix])) != 0)
12352     all_prefixes[last_seg_prefix] = 0;
12353
12354   /* Check if the ADDR prefix used.  */
12355   if ((prefixes & PREFIX_ADDR) != 0
12356       && (used_prefixes & PREFIX_ADDR) != 0)
12357     all_prefixes[last_addr_prefix] = 0;
12358
12359   /* Check if the DATA prefix used.  */
12360   if ((prefixes & PREFIX_DATA) != 0
12361       && (used_prefixes & PREFIX_DATA) != 0)
12362     all_prefixes[last_data_prefix] = 0;
12363
12364   prefix_length = 0;
12365   for (i = 0; i < (int) ARRAY_SIZE (all_prefixes); i++)
12366     if (all_prefixes[i])
12367       {
12368         const char *name;
12369         name = prefix_name (all_prefixes[i], sizeflag);
12370         if (name == NULL)
12371           abort ();
12372         prefix_length += strlen (name) + 1;
12373         (*info->fprintf_func) (info->stream, "%s ", name);
12374       }
12375
12376   /* Check maximum code length.  */
12377   if ((codep - start_codep) > MAX_CODE_LENGTH)
12378     {
12379       (*info->fprintf_func) (info->stream, "(bad)");
12380       return MAX_CODE_LENGTH;
12381     }
12382
12383   obufp = mnemonicendp;
12384   for (i = strlen (obuf) + prefix_length; i < 6; i++)
12385     oappend (" ");
12386   oappend (" ");
12387   (*info->fprintf_func) (info->stream, "%s", obuf);
12388
12389   /* The enter and bound instructions are printed with operands in the same
12390      order as the intel book; everything else is printed in reverse order.  */
12391   if (intel_syntax || two_source_ops)
12392     {
12393       bfd_vma riprel;
12394
12395       for (i = 0; i < MAX_OPERANDS; ++i)
12396         op_txt[i] = op_out[i];
12397
12398       for (i = 0; i < (MAX_OPERANDS >> 1); ++i)
12399         {
12400           op_ad = op_index[i];
12401           op_index[i] = op_index[MAX_OPERANDS - 1 - i];
12402           op_index[MAX_OPERANDS - 1 - i] = op_ad;
12403           riprel = op_riprel[i];
12404           op_riprel[i] = op_riprel [MAX_OPERANDS - 1 - i];
12405           op_riprel[MAX_OPERANDS - 1 - i] = riprel;
12406         }
12407     }
12408   else
12409     {
12410       for (i = 0; i < MAX_OPERANDS; ++i)
12411         op_txt[MAX_OPERANDS - 1 - i] = op_out[i];
12412     }
12413
12414   needcomma = 0;
12415   for (i = 0; i < MAX_OPERANDS; ++i)
12416     if (*op_txt[i])
12417       {
12418         if (needcomma)
12419           (*info->fprintf_func) (info->stream, ",");
12420         if (op_index[i] != -1 && !op_riprel[i])
12421           (*info->print_address_func) ((bfd_vma) op_address[op_index[i]], info);
12422         else
12423           (*info->fprintf_func) (info->stream, "%s", op_txt[i]);
12424         needcomma = 1;
12425       }
12426
12427   for (i = 0; i < MAX_OPERANDS; i++)
12428     if (op_index[i] != -1 && op_riprel[i])
12429       {
12430         (*info->fprintf_func) (info->stream, "        # ");
12431         (*info->print_address_func) ((bfd_vma) (start_pc + codep - start_codep
12432                                                 + op_address[op_index[i]]), info);
12433         break;
12434       }
12435   return codep - priv.the_buffer;
12436 }
12437
12438 static const char *float_mem[] = {
12439   /* d8 */
12440   "fadd{s|}",
12441   "fmul{s|}",
12442   "fcom{s|}",
12443   "fcomp{s|}",
12444   "fsub{s|}",
12445   "fsubr{s|}",
12446   "fdiv{s|}",
12447   "fdivr{s|}",
12448   /* d9 */
12449   "fld{s|}",
12450   "(bad)",
12451   "fst{s|}",
12452   "fstp{s|}",
12453   "fldenvIC",
12454   "fldcw",
12455   "fNstenvIC",
12456   "fNstcw",
12457   /* da */
12458   "fiadd{l|}",
12459   "fimul{l|}",
12460   "ficom{l|}",
12461   "ficomp{l|}",
12462   "fisub{l|}",
12463   "fisubr{l|}",
12464   "fidiv{l|}",
12465   "fidivr{l|}",
12466   /* db */
12467   "fild{l|}",
12468   "fisttp{l|}",
12469   "fist{l|}",
12470   "fistp{l|}",
12471   "(bad)",
12472   "fld{t||t|}",
12473   "(bad)",
12474   "fstp{t||t|}",
12475   /* dc */
12476   "fadd{l|}",
12477   "fmul{l|}",
12478   "fcom{l|}",
12479   "fcomp{l|}",
12480   "fsub{l|}",
12481   "fsubr{l|}",
12482   "fdiv{l|}",
12483   "fdivr{l|}",
12484   /* dd */
12485   "fld{l|}",
12486   "fisttp{ll|}",
12487   "fst{l||}",
12488   "fstp{l|}",
12489   "frstorIC",
12490   "(bad)",
12491   "fNsaveIC",
12492   "fNstsw",
12493   /* de */
12494   "fiadd",
12495   "fimul",
12496   "ficom",
12497   "ficomp",
12498   "fisub",
12499   "fisubr",
12500   "fidiv",
12501   "fidivr",
12502   /* df */
12503   "fild",
12504   "fisttp",
12505   "fist",
12506   "fistp",
12507   "fbld",
12508   "fild{ll|}",
12509   "fbstp",
12510   "fistp{ll|}",
12511 };
12512
12513 static const unsigned char float_mem_mode[] = {
12514   /* d8 */
12515   d_mode,
12516   d_mode,
12517   d_mode,
12518   d_mode,
12519   d_mode,
12520   d_mode,
12521   d_mode,
12522   d_mode,
12523   /* d9 */
12524   d_mode,
12525   0,
12526   d_mode,
12527   d_mode,
12528   0,
12529   w_mode,
12530   0,
12531   w_mode,
12532   /* da */
12533   d_mode,
12534   d_mode,
12535   d_mode,
12536   d_mode,
12537   d_mode,
12538   d_mode,
12539   d_mode,
12540   d_mode,
12541   /* db */
12542   d_mode,
12543   d_mode,
12544   d_mode,
12545   d_mode,
12546   0,
12547   t_mode,
12548   0,
12549   t_mode,
12550   /* dc */
12551   q_mode,
12552   q_mode,
12553   q_mode,
12554   q_mode,
12555   q_mode,
12556   q_mode,
12557   q_mode,
12558   q_mode,
12559   /* dd */
12560   q_mode,
12561   q_mode,
12562   q_mode,
12563   q_mode,
12564   0,
12565   0,
12566   0,
12567   w_mode,
12568   /* de */
12569   w_mode,
12570   w_mode,
12571   w_mode,
12572   w_mode,
12573   w_mode,
12574   w_mode,
12575   w_mode,
12576   w_mode,
12577   /* df */
12578   w_mode,
12579   w_mode,
12580   w_mode,
12581   w_mode,
12582   t_mode,
12583   q_mode,
12584   t_mode,
12585   q_mode
12586 };
12587
12588 #define ST { OP_ST, 0 }
12589 #define STi { OP_STi, 0 }
12590
12591 #define FGRPd9_2 NULL, { { NULL, 0 } }
12592 #define FGRPd9_4 NULL, { { NULL, 1 } }
12593 #define FGRPd9_5 NULL, { { NULL, 2 } }
12594 #define FGRPd9_6 NULL, { { NULL, 3 } }
12595 #define FGRPd9_7 NULL, { { NULL, 4 } }
12596 #define FGRPda_5 NULL, { { NULL, 5 } }
12597 #define FGRPdb_4 NULL, { { NULL, 6 } }
12598 #define FGRPde_3 NULL, { { NULL, 7 } }
12599 #define FGRPdf_4 NULL, { { NULL, 8 } }
12600
12601 static const struct dis386 float_reg[][8] = {
12602   /* d8 */
12603   {
12604     { "fadd",   { ST, STi } },
12605     { "fmul",   { ST, STi } },
12606     { "fcom",   { STi } },
12607     { "fcomp",  { STi } },
12608     { "fsub",   { ST, STi } },
12609     { "fsubr",  { ST, STi } },
12610     { "fdiv",   { ST, STi } },
12611     { "fdivr",  { ST, STi } },
12612   },
12613   /* d9 */
12614   {
12615     { "fld",    { STi } },
12616     { "fxch",   { STi } },
12617     { FGRPd9_2 },
12618     { "(bad)",  { XX } },
12619     { FGRPd9_4 },
12620     { FGRPd9_5 },
12621     { FGRPd9_6 },
12622     { FGRPd9_7 },
12623   },
12624   /* da */
12625   {
12626     { "fcmovb", { ST, STi } },
12627     { "fcmove", { ST, STi } },
12628     { "fcmovbe",{ ST, STi } },
12629     { "fcmovu", { ST, STi } },
12630     { "(bad)",  { XX } },
12631     { FGRPda_5 },
12632     { "(bad)",  { XX } },
12633     { "(bad)",  { XX } },
12634   },
12635   /* db */
12636   {
12637     { "fcmovnb",{ ST, STi } },
12638     { "fcmovne",{ ST, STi } },
12639     { "fcmovnbe",{ ST, STi } },
12640     { "fcmovnu",{ ST, STi } },
12641     { FGRPdb_4 },
12642     { "fucomi", { ST, STi } },
12643     { "fcomi",  { ST, STi } },
12644     { "(bad)",  { XX } },
12645   },
12646   /* dc */
12647   {
12648     { "fadd",   { STi, ST } },
12649     { "fmul",   { STi, ST } },
12650     { "(bad)",  { XX } },
12651     { "(bad)",  { XX } },
12652     { "fsub!M", { STi, ST } },
12653     { "fsubM",  { STi, ST } },
12654     { "fdiv!M", { STi, ST } },
12655     { "fdivM",  { STi, ST } },
12656   },
12657   /* dd */
12658   {
12659     { "ffree",  { STi } },
12660     { "(bad)",  { XX } },
12661     { "fst",    { STi } },
12662     { "fstp",   { STi } },
12663     { "fucom",  { STi } },
12664     { "fucomp", { STi } },
12665     { "(bad)",  { XX } },
12666     { "(bad)",  { XX } },
12667   },
12668   /* de */
12669   {
12670     { "faddp",  { STi, ST } },
12671     { "fmulp",  { STi, ST } },
12672     { "(bad)",  { XX } },
12673     { FGRPde_3 },
12674     { "fsub!Mp", { STi, ST } },
12675     { "fsubMp", { STi, ST } },
12676     { "fdiv!Mp", { STi, ST } },
12677     { "fdivMp", { STi, ST } },
12678   },
12679   /* df */
12680   {
12681     { "ffreep", { STi } },
12682     { "(bad)",  { XX } },
12683     { "(bad)",  { XX } },
12684     { "(bad)",  { XX } },
12685     { FGRPdf_4 },
12686     { "fucomip", { ST, STi } },
12687     { "fcomip", { ST, STi } },
12688     { "(bad)",  { XX } },
12689   },
12690 };
12691
12692 static char *fgrps[][8] = {
12693   /* d9_2  0 */
12694   {
12695     "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
12696   },
12697
12698   /* d9_4  1 */
12699   {
12700     "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)",
12701   },
12702
12703   /* d9_5  2 */
12704   {
12705     "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)",
12706   },
12707
12708   /* d9_6  3 */
12709   {
12710     "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp",
12711   },
12712
12713   /* d9_7  4 */
12714   {
12715     "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos",
12716   },
12717
12718   /* da_5  5 */
12719   {
12720     "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
12721   },
12722
12723   /* db_4  6 */
12724   {
12725     "fNeni(8087 only)","fNdisi(8087 only)","fNclex","fNinit",
12726     "fNsetpm(287 only)","frstpm(287 only)","(bad)","(bad)",
12727   },
12728
12729   /* de_3  7 */
12730   {
12731     "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
12732   },
12733
12734   /* df_4  8 */
12735   {
12736     "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
12737   },
12738 };
12739
12740 static void
12741 swap_operand (void)
12742 {
12743   mnemonicendp[0] = '.';
12744   mnemonicendp[1] = 's';
12745   mnemonicendp += 2;
12746 }
12747
12748 static void
12749 OP_Skip_MODRM (int bytemode ATTRIBUTE_UNUSED,
12750                int sizeflag ATTRIBUTE_UNUSED)
12751 {
12752   /* Skip mod/rm byte.  */
12753   MODRM_CHECK;
12754   codep++;
12755 }
12756
12757 static void
12758 dofloat (int sizeflag)
12759 {
12760   const struct dis386 *dp;
12761   unsigned char floatop;
12762
12763   floatop = codep[-1];
12764
12765   if (modrm.mod != 3)
12766     {
12767       int fp_indx = (floatop - 0xd8) * 8 + modrm.reg;
12768
12769       putop (float_mem[fp_indx], sizeflag);
12770       obufp = op_out[0];
12771       op_ad = 2;
12772       OP_E (float_mem_mode[fp_indx], sizeflag);
12773       return;
12774     }
12775   /* Skip mod/rm byte.  */
12776   MODRM_CHECK;
12777   codep++;
12778
12779   dp = &float_reg[floatop - 0xd8][modrm.reg];
12780   if (dp->name == NULL)
12781     {
12782       putop (fgrps[dp->op[0].bytemode][modrm.rm], sizeflag);
12783
12784       /* Instruction fnstsw is only one with strange arg.  */
12785       if (floatop == 0xdf && codep[-1] == 0xe0)
12786         strcpy (op_out[0], names16[0]);
12787     }
12788   else
12789     {
12790       putop (dp->name, sizeflag);
12791
12792       obufp = op_out[0];
12793       op_ad = 2;
12794       if (dp->op[0].rtn)
12795         (*dp->op[0].rtn) (dp->op[0].bytemode, sizeflag);
12796
12797       obufp = op_out[1];
12798       op_ad = 1;
12799       if (dp->op[1].rtn)
12800         (*dp->op[1].rtn) (dp->op[1].bytemode, sizeflag);
12801     }
12802 }
12803
12804 static void
12805 OP_ST (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
12806 {
12807   oappend ("%st" + intel_syntax);
12808 }
12809
12810 static void
12811 OP_STi (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
12812 {
12813   sprintf (scratchbuf, "%%st(%d)", modrm.rm);
12814   oappend (scratchbuf + intel_syntax);
12815 }
12816
12817 /* Capital letters in template are macros.  */
12818 static int
12819 putop (const char *in_template, int sizeflag)
12820 {
12821   const char *p;
12822   int alt = 0;
12823   int cond = 1;
12824   unsigned int l = 0, len = 1;
12825   char last[4];
12826
12827 #define SAVE_LAST(c)                    \
12828   if (l < len && l < sizeof (last))     \
12829     last[l++] = c;                      \
12830   else                                  \
12831     abort ();
12832
12833   for (p = in_template; *p; p++)
12834     {
12835       switch (*p)
12836         {
12837         default:
12838           *obufp++ = *p;
12839           break;
12840         case '%':
12841           len++;
12842           break;
12843         case '!':
12844           cond = 0;
12845           break;
12846         case '{':
12847           alt = 0;
12848           if (intel_syntax)
12849             {
12850               while (*++p != '|')
12851                 if (*p == '}' || *p == '\0')
12852                   abort ();
12853             }
12854           /* Fall through.  */
12855         case 'I':
12856           alt = 1;
12857           continue;
12858         case '|':
12859           while (*++p != '}')
12860             {
12861               if (*p == '\0')
12862                 abort ();
12863             }
12864           break;
12865         case '}':
12866           break;
12867         case 'A':
12868           if (intel_syntax)
12869             break;
12870           if (modrm.mod != 3 || (sizeflag & SUFFIX_ALWAYS))
12871             *obufp++ = 'b';
12872           break;
12873         case 'B':
12874           if (l == 0 && len == 1)
12875             {
12876 case_B:
12877               if (intel_syntax)
12878                 break;
12879               if (sizeflag & SUFFIX_ALWAYS)
12880                 *obufp++ = 'b';
12881             }
12882           else
12883             {
12884               if (l != 1
12885                   || len != 2
12886                   || last[0] != 'L')
12887                 {
12888                   SAVE_LAST (*p);
12889                   break;
12890                 }
12891
12892               if (address_mode == mode_64bit
12893                   && !(prefixes & PREFIX_ADDR))
12894                 {
12895                   *obufp++ = 'a';
12896                   *obufp++ = 'b';
12897                   *obufp++ = 's';
12898                 }
12899
12900               goto case_B;
12901             }
12902           break;
12903         case 'C':
12904           if (intel_syntax && !alt)
12905             break;
12906           if ((prefixes & PREFIX_DATA) || (sizeflag & SUFFIX_ALWAYS))
12907             {
12908               if (sizeflag & DFLAG)
12909                 *obufp++ = intel_syntax ? 'd' : 'l';
12910               else
12911                 *obufp++ = intel_syntax ? 'w' : 's';
12912               used_prefixes |= (prefixes & PREFIX_DATA);
12913             }
12914           break;
12915         case 'D':
12916           if (intel_syntax || !(sizeflag & SUFFIX_ALWAYS))
12917             break;
12918           USED_REX (REX_W);
12919           if (modrm.mod == 3)
12920             {
12921               if (rex & REX_W)
12922                 *obufp++ = 'q';
12923               else
12924                 {
12925                   if (sizeflag & DFLAG)
12926                     *obufp++ = intel_syntax ? 'd' : 'l';
12927                   else
12928                     *obufp++ = 'w';
12929                   used_prefixes |= (prefixes & PREFIX_DATA);
12930                 }
12931             }
12932           else
12933             *obufp++ = 'w';
12934           break;
12935         case 'E':               /* For jcxz/jecxz */
12936           if (address_mode == mode_64bit)
12937             {
12938               if (sizeflag & AFLAG)
12939                 *obufp++ = 'r';
12940               else
12941                 *obufp++ = 'e';
12942             }
12943           else
12944             if (sizeflag & AFLAG)
12945               *obufp++ = 'e';
12946           used_prefixes |= (prefixes & PREFIX_ADDR);
12947           break;
12948         case 'F':
12949           if (intel_syntax)
12950             break;
12951           if ((prefixes & PREFIX_ADDR) || (sizeflag & SUFFIX_ALWAYS))
12952             {
12953               if (sizeflag & AFLAG)
12954                 *obufp++ = address_mode == mode_64bit ? 'q' : 'l';
12955               else
12956                 *obufp++ = address_mode == mode_64bit ? 'l' : 'w';
12957               used_prefixes |= (prefixes & PREFIX_ADDR);
12958             }
12959           break;
12960         case 'G':
12961           if (intel_syntax || (obufp[-1] != 's' && !(sizeflag & SUFFIX_ALWAYS)))
12962             break;
12963           if ((rex & REX_W) || (sizeflag & DFLAG))
12964             *obufp++ = 'l';
12965           else
12966             *obufp++ = 'w';
12967           if (!(rex & REX_W))
12968             used_prefixes |= (prefixes & PREFIX_DATA);
12969           break;
12970         case 'H':
12971           if (intel_syntax)
12972             break;
12973           if ((prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_CS
12974               || (prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_DS)
12975             {
12976               used_prefixes |= prefixes & (PREFIX_CS | PREFIX_DS);
12977               *obufp++ = ',';
12978               *obufp++ = 'p';
12979               if (prefixes & PREFIX_DS)
12980                 *obufp++ = 't';
12981               else
12982                 *obufp++ = 'n';
12983             }
12984           break;
12985         case 'J':
12986           if (intel_syntax)
12987             break;
12988           *obufp++ = 'l';
12989           break;
12990         case 'K':
12991           USED_REX (REX_W);
12992           if (rex & REX_W)
12993             *obufp++ = 'q';
12994           else
12995             *obufp++ = 'd';
12996           break;
12997         case 'Z':
12998           if (intel_syntax)
12999             break;
13000           if (address_mode == mode_64bit && (sizeflag & SUFFIX_ALWAYS))
13001             {
13002               *obufp++ = 'q';
13003               break;
13004             }
13005           /* Fall through.  */
13006           goto case_L;
13007         case 'L':
13008           if (l != 0 || len != 1)
13009             {
13010               SAVE_LAST (*p);
13011               break;
13012             }
13013 case_L:
13014           if (intel_syntax)
13015             break;
13016           if (sizeflag & SUFFIX_ALWAYS)
13017             *obufp++ = 'l';
13018           break;
13019         case 'M':
13020           if (intel_mnemonic != cond)
13021             *obufp++ = 'r';
13022           break;
13023         case 'N':
13024           if ((prefixes & PREFIX_FWAIT) == 0)
13025             *obufp++ = 'n';
13026           else
13027             used_prefixes |= PREFIX_FWAIT;
13028           break;
13029         case 'O':
13030           USED_REX (REX_W);
13031           if (rex & REX_W)
13032             *obufp++ = 'o';
13033           else if (intel_syntax && (sizeflag & DFLAG))
13034             *obufp++ = 'q';
13035           else
13036             *obufp++ = 'd';
13037           if (!(rex & REX_W))
13038             used_prefixes |= (prefixes & PREFIX_DATA);
13039           break;
13040         case 'T':
13041           if (intel_syntax)
13042             break;
13043           if (address_mode == mode_64bit && (sizeflag & DFLAG))
13044             {
13045               *obufp++ = 'q';
13046               break;
13047             }
13048           /* Fall through.  */
13049         case 'P':
13050           if (intel_syntax)
13051             break;
13052           if ((prefixes & PREFIX_DATA)
13053               || (rex & REX_W)
13054               || (sizeflag & SUFFIX_ALWAYS))
13055             {
13056               USED_REX (REX_W);
13057               if (rex & REX_W)
13058                 *obufp++ = 'q';
13059               else
13060                 {
13061                    if (sizeflag & DFLAG)
13062                       *obufp++ = 'l';
13063                    else
13064                      *obufp++ = 'w';
13065                    used_prefixes |= (prefixes & PREFIX_DATA);
13066                 }
13067             }
13068           break;
13069         case 'U':
13070           if (intel_syntax)
13071             break;
13072           if (address_mode == mode_64bit && (sizeflag & DFLAG))
13073             {
13074               if (modrm.mod != 3 || (sizeflag & SUFFIX_ALWAYS))
13075                 *obufp++ = 'q';
13076               break;
13077             }
13078           /* Fall through.  */
13079           goto case_Q;
13080         case 'Q':
13081           if (l == 0 && len == 1)
13082             {
13083 case_Q:
13084               if (intel_syntax && !alt)
13085                 break;
13086               USED_REX (REX_W);
13087               if (modrm.mod != 3 || (sizeflag & SUFFIX_ALWAYS))
13088                 {
13089                   if (rex & REX_W)
13090                     *obufp++ = 'q';
13091                   else
13092                     {
13093                       if (sizeflag & DFLAG)
13094                         *obufp++ = intel_syntax ? 'd' : 'l';
13095                       else
13096                         *obufp++ = 'w';
13097                       used_prefixes |= (prefixes & PREFIX_DATA);
13098                     }
13099                 }
13100             }
13101           else
13102             {
13103               if (l != 1 || len != 2 || last[0] != 'L')
13104                 {
13105                   SAVE_LAST (*p);
13106                   break;
13107                 }
13108               if (intel_syntax
13109                   || (modrm.mod == 3 && !(sizeflag & SUFFIX_ALWAYS)))
13110                 break;
13111               if ((rex & REX_W))
13112                 {
13113                   USED_REX (REX_W);
13114                   *obufp++ = 'q';
13115                 }
13116               else
13117                 *obufp++ = 'l';
13118             }
13119           break;
13120         case 'R':
13121           USED_REX (REX_W);
13122           if (rex & REX_W)
13123             *obufp++ = 'q';
13124           else if (sizeflag & DFLAG)
13125             {
13126               if (intel_syntax)
13127                   *obufp++ = 'd';
13128               else
13129                   *obufp++ = 'l';
13130             }
13131           else
13132             *obufp++ = 'w';
13133           if (intel_syntax && !p[1]
13134               && ((rex & REX_W) || (sizeflag & DFLAG)))
13135             *obufp++ = 'e';
13136           if (!(rex & REX_W))
13137             used_prefixes |= (prefixes & PREFIX_DATA);
13138           break;
13139         case 'V':
13140           if (l == 0 && len == 1)
13141             {
13142               if (intel_syntax)
13143                 break;
13144               if (address_mode == mode_64bit && (sizeflag & DFLAG))
13145                 {
13146                   if (sizeflag & SUFFIX_ALWAYS)
13147                     *obufp++ = 'q';
13148                   break;
13149                 }
13150             }
13151           else
13152             {
13153               if (l != 1
13154                   || len != 2
13155                   || last[0] != 'L')
13156                 {
13157                   SAVE_LAST (*p);
13158                   break;
13159                 }
13160
13161               if (rex & REX_W)
13162                 {
13163                   *obufp++ = 'a';
13164                   *obufp++ = 'b';
13165                   *obufp++ = 's';
13166                 }
13167             }
13168           /* Fall through.  */
13169           goto case_S;
13170         case 'S':
13171           if (l == 0 && len == 1)
13172             {
13173 case_S:
13174               if (intel_syntax)
13175                 break;
13176               if (sizeflag & SUFFIX_ALWAYS)
13177                 {
13178                   if (rex & REX_W)
13179                     *obufp++ = 'q';
13180                   else
13181                     {
13182                       if (sizeflag & DFLAG)
13183                         *obufp++ = 'l';
13184                       else
13185                         *obufp++ = 'w';
13186                       used_prefixes |= (prefixes & PREFIX_DATA);
13187                     }
13188                 }
13189             }
13190           else
13191             {
13192               if (l != 1
13193                   || len != 2
13194                   || last[0] != 'L')
13195                 {
13196                   SAVE_LAST (*p);
13197                   break;
13198                 }
13199
13200               if (address_mode == mode_64bit
13201                   && !(prefixes & PREFIX_ADDR))
13202                 {
13203                   *obufp++ = 'a';
13204                   *obufp++ = 'b';
13205                   *obufp++ = 's';
13206                 }
13207
13208               goto case_S;
13209             }
13210           break;
13211         case 'X':
13212           if (l != 0 || len != 1)
13213             {
13214               SAVE_LAST (*p);
13215               break;
13216             }
13217           if (need_vex && vex.prefix)
13218             {
13219               if (vex.prefix == DATA_PREFIX_OPCODE)
13220                 *obufp++ = 'd';
13221               else
13222                 *obufp++ = 's';
13223             }
13224           else
13225             {
13226               if (prefixes & PREFIX_DATA)
13227                 *obufp++ = 'd';
13228               else
13229                 *obufp++ = 's';
13230               used_prefixes |= (prefixes & PREFIX_DATA);
13231             }
13232           break;
13233         case 'Y':
13234           if (l == 0 && len == 1)
13235             {
13236               if (intel_syntax || !(sizeflag & SUFFIX_ALWAYS))
13237                 break;
13238               if (rex & REX_W)
13239                 {
13240                   USED_REX (REX_W);
13241                   *obufp++ = 'q';
13242                 }
13243               break;
13244             }
13245           else
13246             {
13247               if (l != 1 || len != 2 || last[0] != 'X')
13248                 {
13249                   SAVE_LAST (*p);
13250                   break;
13251                 }
13252               if (!need_vex)
13253                 abort ();
13254               if (intel_syntax
13255                   || (modrm.mod == 3 && !(sizeflag & SUFFIX_ALWAYS)))
13256                 break;
13257               switch (vex.length)
13258                 {
13259                 case 128:
13260                   *obufp++ = 'x';
13261                   break;
13262                 case 256:
13263                   *obufp++ = 'y';
13264                   break;
13265                 default:
13266                   abort ();
13267                 }
13268             }
13269           break;
13270         case 'W':
13271           if (l == 0 && len == 1)
13272             {
13273               /* operand size flag for cwtl, cbtw */
13274               USED_REX (REX_W);
13275               if (rex & REX_W)
13276                 {
13277                   if (intel_syntax)
13278                     *obufp++ = 'd';
13279                   else
13280                     *obufp++ = 'l';
13281                 }
13282               else if (sizeflag & DFLAG)
13283                 *obufp++ = 'w';
13284               else
13285                 *obufp++ = 'b';
13286               if (!(rex & REX_W))
13287                 used_prefixes |= (prefixes & PREFIX_DATA);
13288             }
13289           else
13290             {
13291               if (l != 1 || len != 2 || last[0] != 'X')
13292                 {
13293                   SAVE_LAST (*p);
13294                   break;
13295                 }
13296               if (!need_vex)
13297                 abort ();
13298               *obufp++ = vex.w ? 'd': 's';
13299             }
13300           break;
13301         }
13302       alt = 0;
13303     }
13304   *obufp = 0;
13305   mnemonicendp = obufp;
13306   return 0;
13307 }
13308
13309 static void
13310 oappend (const char *s)
13311 {
13312   obufp = stpcpy (obufp, s);
13313 }
13314
13315 static void
13316 append_seg (void)
13317 {
13318   if (prefixes & PREFIX_CS)
13319     {
13320       used_prefixes |= PREFIX_CS;
13321       oappend ("%cs:" + intel_syntax);
13322     }
13323   if (prefixes & PREFIX_DS)
13324     {
13325       used_prefixes |= PREFIX_DS;
13326       oappend ("%ds:" + intel_syntax);
13327     }
13328   if (prefixes & PREFIX_SS)
13329     {
13330       used_prefixes |= PREFIX_SS;
13331       oappend ("%ss:" + intel_syntax);
13332     }
13333   if (prefixes & PREFIX_ES)
13334     {
13335       used_prefixes |= PREFIX_ES;
13336       oappend ("%es:" + intel_syntax);
13337     }
13338   if (prefixes & PREFIX_FS)
13339     {
13340       used_prefixes |= PREFIX_FS;
13341       oappend ("%fs:" + intel_syntax);
13342     }
13343   if (prefixes & PREFIX_GS)
13344     {
13345       used_prefixes |= PREFIX_GS;
13346       oappend ("%gs:" + intel_syntax);
13347     }
13348 }
13349
13350 static void
13351 OP_indirE (int bytemode, int sizeflag)
13352 {
13353   if (!intel_syntax)
13354     oappend ("*");
13355   OP_E (bytemode, sizeflag);
13356 }
13357
13358 static void
13359 print_operand_value (char *buf, int hex, bfd_vma disp)
13360 {
13361   if (address_mode == mode_64bit)
13362     {
13363       if (hex)
13364         {
13365           char tmp[30];
13366           int i;
13367           buf[0] = '0';
13368           buf[1] = 'x';
13369           sprintf_vma (tmp, disp);
13370           for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++);
13371           strcpy (buf + 2, tmp + i);
13372         }
13373       else
13374         {
13375           bfd_signed_vma v = disp;
13376           char tmp[30];
13377           int i;
13378           if (v < 0)
13379             {
13380               *(buf++) = '-';
13381               v = -disp;
13382               /* Check for possible overflow on 0x8000000000000000.  */
13383               if (v < 0)
13384                 {
13385                   strcpy (buf, "9223372036854775808");
13386                   return;
13387                 }
13388             }
13389           if (!v)
13390             {
13391               strcpy (buf, "0");
13392               return;
13393             }
13394
13395           i = 0;
13396           tmp[29] = 0;
13397           while (v)
13398             {
13399               tmp[28 - i] = (v % 10) + '0';
13400               v /= 10;
13401               i++;
13402             }
13403           strcpy (buf, tmp + 29 - i);
13404         }
13405     }
13406   else
13407     {
13408       if (hex)
13409         sprintf (buf, "0x%x", (unsigned int) disp);
13410       else
13411         sprintf (buf, "%d", (int) disp);
13412     }
13413 }
13414
13415 /* Put DISP in BUF as signed hex number.  */
13416
13417 static void
13418 print_displacement (char *buf, bfd_vma disp)
13419 {
13420   bfd_signed_vma val = disp;
13421   char tmp[30];
13422   int i, j = 0;
13423
13424   if (val < 0)
13425     {
13426       buf[j++] = '-';
13427       val = -disp;
13428
13429       /* Check for possible overflow.  */
13430       if (val < 0)
13431         {
13432           switch (address_mode)
13433             {
13434             case mode_64bit:
13435               strcpy (buf + j, "0x8000000000000000");
13436               break;
13437             case mode_32bit:
13438               strcpy (buf + j, "0x80000000");
13439               break;
13440             case mode_16bit:
13441               strcpy (buf + j, "0x8000");
13442               break;
13443             }
13444           return;
13445         }
13446     }
13447
13448   buf[j++] = '0';
13449   buf[j++] = 'x';
13450
13451   sprintf_vma (tmp, (bfd_vma) val);
13452   for (i = 0; tmp[i] == '0'; i++)
13453     continue;
13454   if (tmp[i] == '\0')
13455     i--;
13456   strcpy (buf + j, tmp + i);
13457 }
13458
13459 static void
13460 intel_operand_size (int bytemode, int sizeflag)
13461 {
13462   switch (bytemode)
13463     {
13464     case b_mode:
13465     case b_swap_mode:
13466     case dqb_mode:
13467       oappend ("BYTE PTR ");
13468       break;
13469     case w_mode:
13470     case dqw_mode:
13471       oappend ("WORD PTR ");
13472       break;
13473     case stack_v_mode:
13474       if (address_mode == mode_64bit && (sizeflag & DFLAG))
13475         {
13476           oappend ("QWORD PTR ");
13477           break;
13478         }
13479       /* FALLTHRU */
13480     case v_mode:
13481     case v_swap_mode:
13482     case dq_mode:
13483       USED_REX (REX_W);
13484       if (rex & REX_W)
13485         oappend ("QWORD PTR ");
13486       else
13487         {
13488           if ((sizeflag & DFLAG) || bytemode == dq_mode)
13489             oappend ("DWORD PTR ");
13490           else
13491             oappend ("WORD PTR ");
13492           used_prefixes |= (prefixes & PREFIX_DATA);
13493         }
13494       break;
13495     case z_mode:
13496       if ((rex & REX_W) || (sizeflag & DFLAG))
13497         *obufp++ = 'D';
13498       oappend ("WORD PTR ");
13499       if (!(rex & REX_W))
13500         used_prefixes |= (prefixes & PREFIX_DATA);
13501       break;
13502     case a_mode:
13503       if (sizeflag & DFLAG)
13504         oappend ("QWORD PTR ");
13505       else
13506         oappend ("DWORD PTR ");
13507       used_prefixes |= (prefixes & PREFIX_DATA);
13508       break;
13509     case d_mode:
13510     case d_swap_mode:
13511     case dqd_mode:
13512       oappend ("DWORD PTR ");
13513       break;
13514     case q_mode:
13515     case q_swap_mode:
13516       oappend ("QWORD PTR ");
13517       break;
13518     case m_mode:
13519       if (address_mode == mode_64bit)
13520         oappend ("QWORD PTR ");
13521       else
13522         oappend ("DWORD PTR ");
13523       break;
13524     case f_mode:
13525       if (sizeflag & DFLAG)
13526         oappend ("FWORD PTR ");
13527       else
13528         oappend ("DWORD PTR ");
13529       used_prefixes |= (prefixes & PREFIX_DATA);
13530       break;
13531     case t_mode:
13532       oappend ("TBYTE PTR ");
13533       break;
13534     case x_mode:
13535     case x_swap_mode:
13536       if (need_vex)
13537         {
13538           switch (vex.length)
13539             {
13540             case 128:
13541               oappend ("XMMWORD PTR ");
13542               break;
13543             case 256:
13544               oappend ("YMMWORD PTR ");
13545               break;
13546             default:
13547               abort ();
13548             }
13549         }
13550       else
13551         oappend ("XMMWORD PTR ");
13552       break;
13553     case xmm_mode:
13554       oappend ("XMMWORD PTR ");
13555       break;
13556     case xmmq_mode:
13557       if (!need_vex)
13558         abort ();
13559
13560       switch (vex.length)
13561         {
13562         case 128:
13563           oappend ("QWORD PTR ");
13564           break;
13565         case 256:
13566           oappend ("XMMWORD PTR ");
13567           break;
13568         default:
13569           abort ();
13570         }
13571       break;
13572     case ymmq_mode:
13573       if (!need_vex)
13574         abort ();
13575
13576       switch (vex.length)
13577         {
13578         case 128:
13579           oappend ("QWORD PTR ");
13580           break;
13581         case 256:
13582           oappend ("YMMWORD PTR ");
13583           break;
13584         default:
13585           abort ();
13586         }
13587       break;
13588     case o_mode:
13589       oappend ("OWORD PTR ");
13590       break;
13591     case vex_w_dq_mode:
13592       if (!need_vex)
13593         abort ();
13594
13595       if (vex.w)
13596         oappend ("QWORD PTR ");
13597       else
13598         oappend ("DWORD PTR ");
13599       break;
13600     default:
13601       break;
13602     }
13603 }
13604
13605 static void
13606 OP_E_register (int bytemode, int sizeflag)
13607 {
13608   int reg = modrm.rm;
13609   const char **names;
13610
13611   USED_REX (REX_B);
13612   if ((rex & REX_B))
13613     reg += 8;
13614
13615   if ((sizeflag & SUFFIX_ALWAYS)
13616       && (bytemode == b_swap_mode || bytemode == v_swap_mode))
13617     swap_operand ();
13618
13619   switch (bytemode)
13620     {
13621     case b_mode:
13622     case b_swap_mode:
13623       USED_REX (0);
13624       if (rex)
13625         names = names8rex;
13626       else
13627         names = names8;
13628       break;
13629     case w_mode:
13630       names = names16;
13631       break;
13632     case d_mode:
13633       names = names32;
13634       break;
13635     case q_mode:
13636       names = names64;
13637       break;
13638     case m_mode:
13639       names = address_mode == mode_64bit ? names64 : names32;
13640       break;
13641     case stack_v_mode:
13642       if (address_mode == mode_64bit && (sizeflag & DFLAG))
13643         {
13644           names = names64;
13645           break;
13646         }
13647       bytemode = v_mode;
13648       /* FALLTHRU */
13649     case v_mode:
13650     case v_swap_mode:
13651     case dq_mode:
13652     case dqb_mode:
13653     case dqd_mode:
13654     case dqw_mode:
13655       USED_REX (REX_W);
13656       if (rex & REX_W)
13657         names = names64;
13658       else
13659         {
13660           if ((sizeflag & DFLAG) 
13661               || (bytemode != v_mode
13662                   && bytemode != v_swap_mode))
13663             names = names32;
13664           else
13665             names = names16;
13666           used_prefixes |= (prefixes & PREFIX_DATA);
13667         }
13668       break;
13669     case 0:
13670       return;
13671     default:
13672       oappend (INTERNAL_DISASSEMBLER_ERROR);
13673       return;
13674     }
13675   oappend (names[reg]);
13676 }
13677
13678 static void
13679 OP_E_memory (int bytemode, int sizeflag)
13680 {
13681   bfd_vma disp = 0;
13682   int add = (rex & REX_B) ? 8 : 0;
13683   int riprel = 0;
13684
13685   USED_REX (REX_B);
13686   if (intel_syntax)
13687     intel_operand_size (bytemode, sizeflag);
13688   append_seg ();
13689
13690   if ((sizeflag & AFLAG) || address_mode == mode_64bit)
13691     {
13692       /* 32/64 bit address mode */
13693       int havedisp;
13694       int havesib;
13695       int havebase;
13696       int haveindex;
13697       int needindex;
13698       int base, rbase;
13699       int vindex = 0;
13700       int scale = 0;
13701
13702       havesib = 0;
13703       havebase = 1;
13704       haveindex = 0;
13705       base = modrm.rm;
13706
13707       if (base == 4)
13708         {
13709           havesib = 1;
13710           FETCH_DATA (the_info, codep + 1);
13711           vindex = (*codep >> 3) & 7;
13712           scale = (*codep >> 6) & 3;
13713           base = *codep & 7;
13714           USED_REX (REX_X);
13715           if (rex & REX_X)
13716             vindex += 8;
13717           haveindex = vindex != 4;
13718           codep++;
13719         }
13720       rbase = base + add;
13721
13722       switch (modrm.mod)
13723         {
13724         case 0:
13725           if (base == 5)
13726             {
13727               havebase = 0;
13728               if (address_mode == mode_64bit && !havesib)
13729                 riprel = 1;
13730               disp = get32s ();
13731             }
13732           break;
13733         case 1:
13734           FETCH_DATA (the_info, codep + 1);
13735           disp = *codep++;
13736           if ((disp & 0x80) != 0)
13737             disp -= 0x100;
13738           break;
13739         case 2:
13740           disp = get32s ();
13741           break;
13742         }
13743
13744       /* In 32bit mode, we need index register to tell [offset] from
13745          [eiz*1 + offset].  */
13746       needindex = (havesib
13747                    && !havebase
13748                    && !haveindex
13749                    && address_mode == mode_32bit);
13750       havedisp = (havebase
13751                   || needindex
13752                   || (havesib && (haveindex || scale != 0)));
13753
13754       if (!intel_syntax)
13755         if (modrm.mod != 0 || base == 5)
13756           {
13757             if (havedisp || riprel)
13758               print_displacement (scratchbuf, disp);
13759             else
13760               print_operand_value (scratchbuf, 1, disp);
13761             oappend (scratchbuf);
13762             if (riprel)
13763               {
13764                 set_op (disp, 1);
13765                 oappend (sizeflag & AFLAG ? "(%rip)" : "(%eip)");
13766               }
13767           }
13768
13769       if (havebase || haveindex || riprel)
13770         used_prefixes |= PREFIX_ADDR;
13771
13772       if (havedisp || (intel_syntax && riprel))
13773         {
13774           *obufp++ = open_char;
13775           if (intel_syntax && riprel)
13776             {
13777               set_op (disp, 1);
13778               oappend (sizeflag & AFLAG ? "rip" : "eip");
13779             }
13780           *obufp = '\0';
13781           if (havebase)
13782             oappend (address_mode == mode_64bit && (sizeflag & AFLAG)
13783                      ? names64[rbase] : names32[rbase]);
13784           if (havesib)
13785             {
13786               /* ESP/RSP won't allow index.  If base isn't ESP/RSP,
13787                  print index to tell base + index from base.  */
13788               if (scale != 0
13789                   || needindex
13790                   || haveindex
13791                   || (havebase && base != ESP_REG_NUM))
13792                 {
13793                   if (!intel_syntax || havebase)
13794                     {
13795                       *obufp++ = separator_char;
13796                       *obufp = '\0';
13797                     }
13798                   if (haveindex)
13799                     oappend (address_mode == mode_64bit 
13800                              && (sizeflag & AFLAG)
13801                              ? names64[vindex] : names32[vindex]);
13802                   else
13803                     oappend (address_mode == mode_64bit 
13804                              && (sizeflag & AFLAG)
13805                              ? index64 : index32);
13806
13807                   *obufp++ = scale_char;
13808                   *obufp = '\0';
13809                   sprintf (scratchbuf, "%d", 1 << scale);
13810                   oappend (scratchbuf);
13811                 }
13812             }
13813           if (intel_syntax
13814               && (disp || modrm.mod != 0 || base == 5))
13815             {
13816               if (!havedisp || (bfd_signed_vma) disp >= 0)
13817                 {
13818                   *obufp++ = '+';
13819                   *obufp = '\0';
13820                 }
13821               else if (modrm.mod != 1 && disp != -disp)
13822                 {
13823                   *obufp++ = '-';
13824                   *obufp = '\0';
13825                   disp = - (bfd_signed_vma) disp;
13826                 }
13827
13828               if (havedisp)
13829                 print_displacement (scratchbuf, disp);
13830               else
13831                 print_operand_value (scratchbuf, 1, disp);
13832               oappend (scratchbuf);
13833             }
13834
13835           *obufp++ = close_char;
13836           *obufp = '\0';
13837         }
13838       else if (intel_syntax)
13839         {
13840           if (modrm.mod != 0 || base == 5)
13841             {
13842               if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
13843                               | PREFIX_ES | PREFIX_FS | PREFIX_GS))
13844                 ;
13845               else
13846                 {
13847                   oappend (names_seg[ds_reg - es_reg]);
13848                   oappend (":");
13849                 }
13850               print_operand_value (scratchbuf, 1, disp);
13851               oappend (scratchbuf);
13852             }
13853         }
13854     }
13855   else
13856     {
13857       /* 16 bit address mode */
13858       used_prefixes |= prefixes & PREFIX_ADDR;
13859       switch (modrm.mod)
13860         {
13861         case 0:
13862           if (modrm.rm == 6)
13863             {
13864               disp = get16 ();
13865               if ((disp & 0x8000) != 0)
13866                 disp -= 0x10000;
13867             }
13868           break;
13869         case 1:
13870           FETCH_DATA (the_info, codep + 1);
13871           disp = *codep++;
13872           if ((disp & 0x80) != 0)
13873             disp -= 0x100;
13874           break;
13875         case 2:
13876           disp = get16 ();
13877           if ((disp & 0x8000) != 0)
13878             disp -= 0x10000;
13879           break;
13880         }
13881
13882       if (!intel_syntax)
13883         if (modrm.mod != 0 || modrm.rm == 6)
13884           {
13885             print_displacement (scratchbuf, disp);
13886             oappend (scratchbuf);
13887           }
13888
13889       if (modrm.mod != 0 || modrm.rm != 6)
13890         {
13891           *obufp++ = open_char;
13892           *obufp = '\0';
13893           oappend (index16[modrm.rm]);
13894           if (intel_syntax
13895               && (disp || modrm.mod != 0 || modrm.rm == 6))
13896             {
13897               if ((bfd_signed_vma) disp >= 0)
13898                 {
13899                   *obufp++ = '+';
13900                   *obufp = '\0';
13901                 }
13902               else if (modrm.mod != 1)
13903                 {
13904                   *obufp++ = '-';
13905                   *obufp = '\0';
13906                   disp = - (bfd_signed_vma) disp;
13907                 }
13908
13909               print_displacement (scratchbuf, disp);
13910               oappend (scratchbuf);
13911             }
13912
13913           *obufp++ = close_char;
13914           *obufp = '\0';
13915         }
13916       else if (intel_syntax)
13917         {
13918           if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
13919                           | PREFIX_ES | PREFIX_FS | PREFIX_GS))
13920             ;
13921           else
13922             {
13923               oappend (names_seg[ds_reg - es_reg]);
13924               oappend (":");
13925             }
13926           print_operand_value (scratchbuf, 1, disp & 0xffff);
13927           oappend (scratchbuf);
13928         }
13929     }
13930 }
13931
13932 static void
13933 OP_E (int bytemode, int sizeflag)
13934 {
13935   /* Skip mod/rm byte.  */
13936   MODRM_CHECK;
13937   codep++;
13938
13939   if (modrm.mod == 3)
13940     OP_E_register (bytemode, sizeflag);
13941   else
13942     OP_E_memory (bytemode, sizeflag);
13943 }
13944
13945 static void
13946 OP_G (int bytemode, int sizeflag)
13947 {
13948   int add = 0;
13949   USED_REX (REX_R);
13950   if (rex & REX_R)
13951     add += 8;
13952   switch (bytemode)
13953     {
13954     case b_mode:
13955       USED_REX (0);
13956       if (rex)
13957         oappend (names8rex[modrm.reg + add]);
13958       else
13959         oappend (names8[modrm.reg + add]);
13960       break;
13961     case w_mode:
13962       oappend (names16[modrm.reg + add]);
13963       break;
13964     case d_mode:
13965       oappend (names32[modrm.reg + add]);
13966       break;
13967     case q_mode:
13968       oappend (names64[modrm.reg + add]);
13969       break;
13970     case v_mode:
13971     case dq_mode:
13972     case dqb_mode:
13973     case dqd_mode:
13974     case dqw_mode:
13975       USED_REX (REX_W);
13976       if (rex & REX_W)
13977         oappend (names64[modrm.reg + add]);
13978       else
13979         {
13980           if ((sizeflag & DFLAG) || bytemode != v_mode)
13981             oappend (names32[modrm.reg + add]);
13982           else
13983             oappend (names16[modrm.reg + add]);
13984           used_prefixes |= (prefixes & PREFIX_DATA);
13985         }
13986       break;
13987     case m_mode:
13988       if (address_mode == mode_64bit)
13989         oappend (names64[modrm.reg + add]);
13990       else
13991         oappend (names32[modrm.reg + add]);
13992       break;
13993     default:
13994       oappend (INTERNAL_DISASSEMBLER_ERROR);
13995       break;
13996     }
13997 }
13998
13999 static bfd_vma
14000 get64 (void)
14001 {
14002   bfd_vma x;
14003 #ifdef BFD64
14004   unsigned int a;
14005   unsigned int b;
14006
14007   FETCH_DATA (the_info, codep + 8);
14008   a = *codep++ & 0xff;
14009   a |= (*codep++ & 0xff) << 8;
14010   a |= (*codep++ & 0xff) << 16;
14011   a |= (*codep++ & 0xff) << 24;
14012   b = *codep++ & 0xff;
14013   b |= (*codep++ & 0xff) << 8;
14014   b |= (*codep++ & 0xff) << 16;
14015   b |= (*codep++ & 0xff) << 24;
14016   x = a + ((bfd_vma) b << 32);
14017 #else
14018   abort ();
14019   x = 0;
14020 #endif
14021   return x;
14022 }
14023
14024 static bfd_signed_vma
14025 get32 (void)
14026 {
14027   bfd_signed_vma x = 0;
14028
14029   FETCH_DATA (the_info, codep + 4);
14030   x = *codep++ & (bfd_signed_vma) 0xff;
14031   x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
14032   x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
14033   x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
14034   return x;
14035 }
14036
14037 static bfd_signed_vma
14038 get32s (void)
14039 {
14040   bfd_signed_vma x = 0;
14041
14042   FETCH_DATA (the_info, codep + 4);
14043   x = *codep++ & (bfd_signed_vma) 0xff;
14044   x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
14045   x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
14046   x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
14047
14048   x = (x ^ ((bfd_signed_vma) 1 << 31)) - ((bfd_signed_vma) 1 << 31);
14049
14050   return x;
14051 }
14052
14053 static int
14054 get16 (void)
14055 {
14056   int x = 0;
14057
14058   FETCH_DATA (the_info, codep + 2);
14059   x = *codep++ & 0xff;
14060   x |= (*codep++ & 0xff) << 8;
14061   return x;
14062 }
14063
14064 static void
14065 set_op (bfd_vma op, int riprel)
14066 {
14067   op_index[op_ad] = op_ad;
14068   if (address_mode == mode_64bit)
14069     {
14070       op_address[op_ad] = op;
14071       op_riprel[op_ad] = riprel;
14072     }
14073   else
14074     {
14075       /* Mask to get a 32-bit address.  */
14076       op_address[op_ad] = op & 0xffffffff;
14077       op_riprel[op_ad] = riprel & 0xffffffff;
14078     }
14079 }
14080
14081 static void
14082 OP_REG (int code, int sizeflag)
14083 {
14084   const char *s;
14085   int add;
14086   USED_REX (REX_B);
14087   if (rex & REX_B)
14088     add = 8;
14089   else
14090     add = 0;
14091
14092   switch (code)
14093     {
14094     case ax_reg: case cx_reg: case dx_reg: case bx_reg:
14095     case sp_reg: case bp_reg: case si_reg: case di_reg:
14096       s = names16[code - ax_reg + add];
14097       break;
14098     case es_reg: case ss_reg: case cs_reg:
14099     case ds_reg: case fs_reg: case gs_reg:
14100       s = names_seg[code - es_reg + add];
14101       break;
14102     case al_reg: case ah_reg: case cl_reg: case ch_reg:
14103     case dl_reg: case dh_reg: case bl_reg: case bh_reg:
14104       USED_REX (0);
14105       if (rex)
14106         s = names8rex[code - al_reg + add];
14107       else
14108         s = names8[code - al_reg];
14109       break;
14110     case rAX_reg: case rCX_reg: case rDX_reg: case rBX_reg:
14111     case rSP_reg: case rBP_reg: case rSI_reg: case rDI_reg:
14112       if (address_mode == mode_64bit && (sizeflag & DFLAG))
14113         {
14114           s = names64[code - rAX_reg + add];
14115           break;
14116         }
14117       code += eAX_reg - rAX_reg;
14118       /* Fall through.  */
14119     case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
14120     case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
14121       USED_REX (REX_W);
14122       if (rex & REX_W)
14123         s = names64[code - eAX_reg + add];
14124       else
14125         {
14126           if (sizeflag & DFLAG)
14127             s = names32[code - eAX_reg + add];
14128           else
14129             s = names16[code - eAX_reg + add];
14130           used_prefixes |= (prefixes & PREFIX_DATA);
14131         }
14132       break;
14133     default:
14134       s = INTERNAL_DISASSEMBLER_ERROR;
14135       break;
14136     }
14137   oappend (s);
14138 }
14139
14140 static void
14141 OP_IMREG (int code, int sizeflag)
14142 {
14143   const char *s;
14144
14145   switch (code)
14146     {
14147     case indir_dx_reg:
14148       if (intel_syntax)
14149         s = "dx";
14150       else
14151         s = "(%dx)";
14152       break;
14153     case ax_reg: case cx_reg: case dx_reg: case bx_reg:
14154     case sp_reg: case bp_reg: case si_reg: case di_reg:
14155       s = names16[code - ax_reg];
14156       break;
14157     case es_reg: case ss_reg: case cs_reg:
14158     case ds_reg: case fs_reg: case gs_reg:
14159       s = names_seg[code - es_reg];
14160       break;
14161     case al_reg: case ah_reg: case cl_reg: case ch_reg:
14162     case dl_reg: case dh_reg: case bl_reg: case bh_reg:
14163       USED_REX (0);
14164       if (rex)
14165         s = names8rex[code - al_reg];
14166       else
14167         s = names8[code - al_reg];
14168       break;
14169     case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
14170     case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
14171       USED_REX (REX_W);
14172       if (rex & REX_W)
14173         s = names64[code - eAX_reg];
14174       else
14175         {
14176           if (sizeflag & DFLAG)
14177             s = names32[code - eAX_reg];
14178           else
14179             s = names16[code - eAX_reg];
14180           used_prefixes |= (prefixes & PREFIX_DATA);
14181         }
14182       break;
14183     case z_mode_ax_reg:
14184       if ((rex & REX_W) || (sizeflag & DFLAG))
14185         s = *names32;
14186       else
14187         s = *names16;
14188       if (!(rex & REX_W))
14189         used_prefixes |= (prefixes & PREFIX_DATA);
14190       break;
14191     default:
14192       s = INTERNAL_DISASSEMBLER_ERROR;
14193       break;
14194     }
14195   oappend (s);
14196 }
14197
14198 static void
14199 OP_I (int bytemode, int sizeflag)
14200 {
14201   bfd_signed_vma op;
14202   bfd_signed_vma mask = -1;
14203
14204   switch (bytemode)
14205     {
14206     case b_mode:
14207       FETCH_DATA (the_info, codep + 1);
14208       op = *codep++;
14209       mask = 0xff;
14210       break;
14211     case q_mode:
14212       if (address_mode == mode_64bit)
14213         {
14214           op = get32s ();
14215           break;
14216         }
14217       /* Fall through.  */
14218     case v_mode:
14219       USED_REX (REX_W);
14220       if (rex & REX_W)
14221         op = get32s ();
14222       else
14223         {
14224           if (sizeflag & DFLAG)
14225             {
14226               op = get32 ();
14227               mask = 0xffffffff;
14228             }
14229           else
14230             {
14231               op = get16 ();
14232               mask = 0xfffff;
14233             }
14234           used_prefixes |= (prefixes & PREFIX_DATA);
14235         }
14236       break;
14237     case w_mode:
14238       mask = 0xfffff;
14239       op = get16 ();
14240       break;
14241     case const_1_mode:
14242       if (intel_syntax)
14243         oappend ("1");
14244       return;
14245     default:
14246       oappend (INTERNAL_DISASSEMBLER_ERROR);
14247       return;
14248     }
14249
14250   op &= mask;
14251   scratchbuf[0] = '$';
14252   print_operand_value (scratchbuf + 1, 1, op);
14253   oappend (scratchbuf + intel_syntax);
14254   scratchbuf[0] = '\0';
14255 }
14256
14257 static void
14258 OP_I64 (int bytemode, int sizeflag)
14259 {
14260   bfd_signed_vma op;
14261   bfd_signed_vma mask = -1;
14262
14263   if (address_mode != mode_64bit)
14264     {
14265       OP_I (bytemode, sizeflag);
14266       return;
14267     }
14268
14269   switch (bytemode)
14270     {
14271     case b_mode:
14272       FETCH_DATA (the_info, codep + 1);
14273       op = *codep++;
14274       mask = 0xff;
14275       break;
14276     case v_mode:
14277       USED_REX (REX_W);
14278       if (rex & REX_W)
14279         op = get64 ();
14280       else
14281         {
14282           if (sizeflag & DFLAG)
14283             {
14284               op = get32 ();
14285               mask = 0xffffffff;
14286             }
14287           else
14288             {
14289               op = get16 ();
14290               mask = 0xfffff;
14291             }
14292           used_prefixes |= (prefixes & PREFIX_DATA);
14293         }
14294       break;
14295     case w_mode:
14296       mask = 0xfffff;
14297       op = get16 ();
14298       break;
14299     default:
14300       oappend (INTERNAL_DISASSEMBLER_ERROR);
14301       return;
14302     }
14303
14304   op &= mask;
14305   scratchbuf[0] = '$';
14306   print_operand_value (scratchbuf + 1, 1, op);
14307   oappend (scratchbuf + intel_syntax);
14308   scratchbuf[0] = '\0';
14309 }
14310
14311 static void
14312 OP_sI (int bytemode, int sizeflag)
14313 {
14314   bfd_signed_vma op;
14315   bfd_signed_vma mask = -1;
14316
14317   switch (bytemode)
14318     {
14319     case b_mode:
14320       FETCH_DATA (the_info, codep + 1);
14321       op = *codep++;
14322       if ((op & 0x80) != 0)
14323         op -= 0x100;
14324       mask = 0xffffffff;
14325       break;
14326     case v_mode:
14327       USED_REX (REX_W);
14328       if (rex & REX_W)
14329         op = get32s ();
14330       else
14331         {
14332           if (sizeflag & DFLAG)
14333             {
14334               op = get32s ();
14335               mask = 0xffffffff;
14336             }
14337           else
14338             {
14339               mask = 0xffffffff;
14340               op = get16 ();
14341               if ((op & 0x8000) != 0)
14342                 op -= 0x10000;
14343             }
14344           used_prefixes |= (prefixes & PREFIX_DATA);
14345         }
14346       break;
14347     case w_mode:
14348       op = get16 ();
14349       mask = 0xffffffff;
14350       if ((op & 0x8000) != 0)
14351         op -= 0x10000;
14352       break;
14353     default:
14354       oappend (INTERNAL_DISASSEMBLER_ERROR);
14355       return;
14356     }
14357
14358   scratchbuf[0] = '$';
14359   print_operand_value (scratchbuf + 1, 1, op);
14360   oappend (scratchbuf + intel_syntax);
14361 }
14362
14363 static void
14364 OP_J (int bytemode, int sizeflag)
14365 {
14366   bfd_vma disp;
14367   bfd_vma mask = -1;
14368   bfd_vma segment = 0;
14369
14370   switch (bytemode)
14371     {
14372     case b_mode:
14373       FETCH_DATA (the_info, codep + 1);
14374       disp = *codep++;
14375       if ((disp & 0x80) != 0)
14376         disp -= 0x100;
14377       break;
14378     case v_mode:
14379       USED_REX (REX_W);
14380       if ((sizeflag & DFLAG) || (rex & REX_W))
14381         disp = get32s ();
14382       else
14383         {
14384           disp = get16 ();
14385           if ((disp & 0x8000) != 0)
14386             disp -= 0x10000;
14387           /* In 16bit mode, address is wrapped around at 64k within
14388              the same segment.  Otherwise, a data16 prefix on a jump
14389              instruction means that the pc is masked to 16 bits after
14390              the displacement is added!  */
14391           mask = 0xffff;
14392           if ((prefixes & PREFIX_DATA) == 0)
14393             segment = ((start_pc + codep - start_codep)
14394                        & ~((bfd_vma) 0xffff));
14395         }
14396       if (!(rex & REX_W))
14397         used_prefixes |= (prefixes & PREFIX_DATA);
14398       break;
14399     default:
14400       oappend (INTERNAL_DISASSEMBLER_ERROR);
14401       return;
14402     }
14403   disp = ((start_pc + codep - start_codep + disp) & mask) | segment;
14404   set_op (disp, 0);
14405   print_operand_value (scratchbuf, 1, disp);
14406   oappend (scratchbuf);
14407 }
14408
14409 static void
14410 OP_SEG (int bytemode, int sizeflag)
14411 {
14412   if (bytemode == w_mode)
14413     oappend (names_seg[modrm.reg]);
14414   else
14415     OP_E (modrm.mod == 3 ? bytemode : w_mode, sizeflag);
14416 }
14417
14418 static void
14419 OP_DIR (int dummy ATTRIBUTE_UNUSED, int sizeflag)
14420 {
14421   int seg, offset;
14422
14423   if (sizeflag & DFLAG)
14424     {
14425       offset = get32 ();
14426       seg = get16 ();
14427     }
14428   else
14429     {
14430       offset = get16 ();
14431       seg = get16 ();
14432     }
14433   used_prefixes |= (prefixes & PREFIX_DATA);
14434   if (intel_syntax)
14435     sprintf (scratchbuf, "0x%x:0x%x", seg, offset);
14436   else
14437     sprintf (scratchbuf, "$0x%x,$0x%x", seg, offset);
14438   oappend (scratchbuf);
14439 }
14440
14441 static void
14442 OP_OFF (int bytemode, int sizeflag)
14443 {
14444   bfd_vma off;
14445
14446   if (intel_syntax && (sizeflag & SUFFIX_ALWAYS))
14447     intel_operand_size (bytemode, sizeflag);
14448   append_seg ();
14449
14450   if ((sizeflag & AFLAG) || address_mode == mode_64bit)
14451     off = get32 ();
14452   else
14453     off = get16 ();
14454
14455   if (intel_syntax)
14456     {
14457       if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
14458                         | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
14459         {
14460           oappend (names_seg[ds_reg - es_reg]);
14461           oappend (":");
14462         }
14463     }
14464   print_operand_value (scratchbuf, 1, off);
14465   oappend (scratchbuf);
14466 }
14467
14468 static void
14469 OP_OFF64 (int bytemode, int sizeflag)
14470 {
14471   bfd_vma off;
14472
14473   if (address_mode != mode_64bit
14474       || (prefixes & PREFIX_ADDR))
14475     {
14476       OP_OFF (bytemode, sizeflag);
14477       return;
14478     }
14479
14480   if (intel_syntax && (sizeflag & SUFFIX_ALWAYS))
14481     intel_operand_size (bytemode, sizeflag);
14482   append_seg ();
14483
14484   off = get64 ();
14485
14486   if (intel_syntax)
14487     {
14488       if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
14489                         | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
14490         {
14491           oappend (names_seg[ds_reg - es_reg]);
14492           oappend (":");
14493         }
14494     }
14495   print_operand_value (scratchbuf, 1, off);
14496   oappend (scratchbuf);
14497 }
14498
14499 static void
14500 ptr_reg (int code, int sizeflag)
14501 {
14502   const char *s;
14503
14504   *obufp++ = open_char;
14505   used_prefixes |= (prefixes & PREFIX_ADDR);
14506   if (address_mode == mode_64bit)
14507     {
14508       if (!(sizeflag & AFLAG))
14509         s = names32[code - eAX_reg];
14510       else
14511         s = names64[code - eAX_reg];
14512     }
14513   else if (sizeflag & AFLAG)
14514     s = names32[code - eAX_reg];
14515   else
14516     s = names16[code - eAX_reg];
14517   oappend (s);
14518   *obufp++ = close_char;
14519   *obufp = 0;
14520 }
14521
14522 static void
14523 OP_ESreg (int code, int sizeflag)
14524 {
14525   if (intel_syntax)
14526     {
14527       switch (codep[-1])
14528         {
14529         case 0x6d:      /* insw/insl */
14530           intel_operand_size (z_mode, sizeflag);
14531           break;
14532         case 0xa5:      /* movsw/movsl/movsq */
14533         case 0xa7:      /* cmpsw/cmpsl/cmpsq */
14534         case 0xab:      /* stosw/stosl */
14535         case 0xaf:      /* scasw/scasl */
14536           intel_operand_size (v_mode, sizeflag);
14537           break;
14538         default:
14539           intel_operand_size (b_mode, sizeflag);
14540         }
14541     }
14542   oappend ("%es:" + intel_syntax);
14543   ptr_reg (code, sizeflag);
14544 }
14545
14546 static void
14547 OP_DSreg (int code, int sizeflag)
14548 {
14549   if (intel_syntax)
14550     {
14551       switch (codep[-1])
14552         {
14553         case 0x6f:      /* outsw/outsl */
14554           intel_operand_size (z_mode, sizeflag);
14555           break;
14556         case 0xa5:      /* movsw/movsl/movsq */
14557         case 0xa7:      /* cmpsw/cmpsl/cmpsq */
14558         case 0xad:      /* lodsw/lodsl/lodsq */
14559           intel_operand_size (v_mode, sizeflag);
14560           break;
14561         default:
14562           intel_operand_size (b_mode, sizeflag);
14563         }
14564     }
14565   if ((prefixes
14566        & (PREFIX_CS
14567           | PREFIX_DS
14568           | PREFIX_SS
14569           | PREFIX_ES
14570           | PREFIX_FS
14571           | PREFIX_GS)) == 0)
14572     prefixes |= PREFIX_DS;
14573   append_seg ();
14574   ptr_reg (code, sizeflag);
14575 }
14576
14577 static void
14578 OP_C (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14579 {
14580   int add;
14581   if (rex & REX_R)
14582     {
14583       USED_REX (REX_R);
14584       add = 8;
14585     }
14586   else if (address_mode != mode_64bit && (prefixes & PREFIX_LOCK))
14587     {
14588       all_prefixes[last_lock_prefix] = 0;
14589       used_prefixes |= PREFIX_LOCK;
14590       add = 8;
14591     }
14592   else
14593     add = 0;
14594   sprintf (scratchbuf, "%%cr%d", modrm.reg + add);
14595   oappend (scratchbuf + intel_syntax);
14596 }
14597
14598 static void
14599 OP_D (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14600 {
14601   int add;
14602   USED_REX (REX_R);
14603   if (rex & REX_R)
14604     add = 8;
14605   else
14606     add = 0;
14607   if (intel_syntax)
14608     sprintf (scratchbuf, "db%d", modrm.reg + add);
14609   else
14610     sprintf (scratchbuf, "%%db%d", modrm.reg + add);
14611   oappend (scratchbuf);
14612 }
14613
14614 static void
14615 OP_T (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14616 {
14617   sprintf (scratchbuf, "%%tr%d", modrm.reg);
14618   oappend (scratchbuf + intel_syntax);
14619 }
14620
14621 static void
14622 OP_R (int bytemode, int sizeflag)
14623 {
14624   if (modrm.mod == 3)
14625     OP_E (bytemode, sizeflag);
14626   else
14627     BadOp ();
14628 }
14629
14630 static void
14631 OP_MMX (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14632 {
14633   used_prefixes |= (prefixes & PREFIX_DATA);
14634   if (prefixes & PREFIX_DATA)
14635     {
14636       int add;
14637       USED_REX (REX_R);
14638       if (rex & REX_R)
14639         add = 8;
14640       else
14641         add = 0;
14642       sprintf (scratchbuf, "%%xmm%d", modrm.reg + add);
14643     }
14644   else
14645     sprintf (scratchbuf, "%%mm%d", modrm.reg);
14646   oappend (scratchbuf + intel_syntax);
14647 }
14648
14649 static void
14650 OP_XMM (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
14651 {
14652   int add;
14653   USED_REX (REX_R);
14654   if (rex & REX_R)
14655     add = 8;
14656   else
14657     add = 0;
14658   if (need_vex && bytemode != xmm_mode)
14659     {
14660       switch (vex.length)
14661         {
14662         case 128:
14663           sprintf (scratchbuf, "%%xmm%d", modrm.reg + add);
14664           break;
14665         case 256:
14666           sprintf (scratchbuf, "%%ymm%d", modrm.reg + add);
14667           break;
14668         default:
14669           abort ();
14670         }
14671     }
14672   else
14673     sprintf (scratchbuf, "%%xmm%d", modrm.reg + add);
14674   oappend (scratchbuf + intel_syntax);
14675 }
14676
14677 static void
14678 OP_EM (int bytemode, int sizeflag)
14679 {
14680   if (modrm.mod != 3)
14681     {
14682       if (intel_syntax
14683           && (bytemode == v_mode || bytemode == v_swap_mode))
14684         {
14685           bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode;
14686           used_prefixes |= (prefixes & PREFIX_DATA);
14687         }
14688       OP_E (bytemode, sizeflag);
14689       return;
14690     }
14691
14692   if ((sizeflag & SUFFIX_ALWAYS) && bytemode == v_swap_mode)
14693     swap_operand ();
14694
14695   /* Skip mod/rm byte.  */
14696   MODRM_CHECK;
14697   codep++;
14698   used_prefixes |= (prefixes & PREFIX_DATA);
14699   if (prefixes & PREFIX_DATA)
14700     {
14701       int add;
14702
14703       USED_REX (REX_B);
14704       if (rex & REX_B)
14705         add = 8;
14706       else
14707         add = 0;
14708       sprintf (scratchbuf, "%%xmm%d", modrm.rm + add);
14709     }
14710   else
14711     sprintf (scratchbuf, "%%mm%d", modrm.rm);
14712   oappend (scratchbuf + intel_syntax);
14713 }
14714
14715 /* cvt* are the only instructions in sse2 which have
14716    both SSE and MMX operands and also have 0x66 prefix
14717    in their opcode. 0x66 was originally used to differentiate
14718    between SSE and MMX instruction(operands). So we have to handle the
14719    cvt* separately using OP_EMC and OP_MXC */
14720 static void
14721 OP_EMC (int bytemode, int sizeflag)
14722 {
14723   if (modrm.mod != 3)
14724     {
14725       if (intel_syntax && bytemode == v_mode)
14726         {
14727           bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode;
14728           used_prefixes |= (prefixes & PREFIX_DATA);
14729         }
14730       OP_E (bytemode, sizeflag);
14731       return;
14732     }
14733
14734   /* Skip mod/rm byte.  */
14735   MODRM_CHECK;
14736   codep++;
14737   used_prefixes |= (prefixes & PREFIX_DATA);
14738   sprintf (scratchbuf, "%%mm%d", modrm.rm);
14739   oappend (scratchbuf + intel_syntax);
14740 }
14741
14742 static void
14743 OP_MXC (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14744 {
14745   used_prefixes |= (prefixes & PREFIX_DATA);
14746   sprintf (scratchbuf, "%%mm%d", modrm.reg);
14747   oappend (scratchbuf + intel_syntax);
14748 }
14749
14750 static void
14751 OP_EX (int bytemode, int sizeflag)
14752 {
14753   int add;
14754
14755   /* Skip mod/rm byte.  */
14756   MODRM_CHECK;
14757   codep++;
14758
14759   if (modrm.mod != 3)
14760     {
14761       OP_E_memory (bytemode, sizeflag);
14762       return;
14763     }
14764
14765   USED_REX (REX_B);
14766   if (rex & REX_B)
14767     add = 8;
14768   else
14769     add = 0;
14770
14771   if ((sizeflag & SUFFIX_ALWAYS)
14772       && (bytemode == x_swap_mode
14773           || bytemode == d_swap_mode
14774           || bytemode == q_swap_mode))
14775     swap_operand ();
14776
14777   if (need_vex
14778       && bytemode != xmm_mode
14779       && bytemode != xmmq_mode)
14780     {
14781       switch (vex.length)
14782         {
14783         case 128:
14784           sprintf (scratchbuf, "%%xmm%d", modrm.rm + add);
14785           break;
14786         case 256:
14787           sprintf (scratchbuf, "%%ymm%d", modrm.rm + add);
14788           break;
14789         default:
14790           abort ();
14791         }
14792     }
14793   else
14794     sprintf (scratchbuf, "%%xmm%d", modrm.rm + add);
14795   oappend (scratchbuf + intel_syntax);
14796 }
14797
14798 static void
14799 OP_MS (int bytemode, int sizeflag)
14800 {
14801   if (modrm.mod == 3)
14802     OP_EM (bytemode, sizeflag);
14803   else
14804     BadOp ();
14805 }
14806
14807 static void
14808 OP_XS (int bytemode, int sizeflag)
14809 {
14810   if (modrm.mod == 3)
14811     OP_EX (bytemode, sizeflag);
14812   else
14813     BadOp ();
14814 }
14815
14816 static void
14817 OP_M (int bytemode, int sizeflag)
14818 {
14819   if (modrm.mod == 3)
14820     /* bad bound,lea,lds,les,lfs,lgs,lss,cmpxchg8b,vmptrst modrm */
14821     BadOp ();
14822   else
14823     OP_E (bytemode, sizeflag);
14824 }
14825
14826 static void
14827 OP_0f07 (int bytemode, int sizeflag)
14828 {
14829   if (modrm.mod != 3 || modrm.rm != 0)
14830     BadOp ();
14831   else
14832     OP_E (bytemode, sizeflag);
14833 }
14834
14835 /* NOP is an alias of "xchg %ax,%ax" in 16bit mode, "xchg %eax,%eax" in
14836    32bit mode and "xchg %rax,%rax" in 64bit mode.  */
14837
14838 static void
14839 NOP_Fixup1 (int bytemode, int sizeflag)
14840 {
14841   if ((prefixes & PREFIX_DATA) != 0
14842       || (rex != 0
14843           && rex != 0x48
14844           && address_mode == mode_64bit))
14845     OP_REG (bytemode, sizeflag);
14846   else
14847     strcpy (obuf, "nop");
14848 }
14849
14850 static void
14851 NOP_Fixup2 (int bytemode, int sizeflag)
14852 {
14853   if ((prefixes & PREFIX_DATA) != 0
14854       || (rex != 0
14855           && rex != 0x48
14856           && address_mode == mode_64bit))
14857     OP_IMREG (bytemode, sizeflag);
14858 }
14859
14860 static const char *const Suffix3DNow[] = {
14861 /* 00 */        NULL,           NULL,           NULL,           NULL,
14862 /* 04 */        NULL,           NULL,           NULL,           NULL,
14863 /* 08 */        NULL,           NULL,           NULL,           NULL,
14864 /* 0C */        "pi2fw",        "pi2fd",        NULL,           NULL,
14865 /* 10 */        NULL,           NULL,           NULL,           NULL,
14866 /* 14 */        NULL,           NULL,           NULL,           NULL,
14867 /* 18 */        NULL,           NULL,           NULL,           NULL,
14868 /* 1C */        "pf2iw",        "pf2id",        NULL,           NULL,
14869 /* 20 */        NULL,           NULL,           NULL,           NULL,
14870 /* 24 */        NULL,           NULL,           NULL,           NULL,
14871 /* 28 */        NULL,           NULL,           NULL,           NULL,
14872 /* 2C */        NULL,           NULL,           NULL,           NULL,
14873 /* 30 */        NULL,           NULL,           NULL,           NULL,
14874 /* 34 */        NULL,           NULL,           NULL,           NULL,
14875 /* 38 */        NULL,           NULL,           NULL,           NULL,
14876 /* 3C */        NULL,           NULL,           NULL,           NULL,
14877 /* 40 */        NULL,           NULL,           NULL,           NULL,
14878 /* 44 */        NULL,           NULL,           NULL,           NULL,
14879 /* 48 */        NULL,           NULL,           NULL,           NULL,
14880 /* 4C */        NULL,           NULL,           NULL,           NULL,
14881 /* 50 */        NULL,           NULL,           NULL,           NULL,
14882 /* 54 */        NULL,           NULL,           NULL,           NULL,
14883 /* 58 */        NULL,           NULL,           NULL,           NULL,
14884 /* 5C */        NULL,           NULL,           NULL,           NULL,
14885 /* 60 */        NULL,           NULL,           NULL,           NULL,
14886 /* 64 */        NULL,           NULL,           NULL,           NULL,
14887 /* 68 */        NULL,           NULL,           NULL,           NULL,
14888 /* 6C */        NULL,           NULL,           NULL,           NULL,
14889 /* 70 */        NULL,           NULL,           NULL,           NULL,
14890 /* 74 */        NULL,           NULL,           NULL,           NULL,
14891 /* 78 */        NULL,           NULL,           NULL,           NULL,
14892 /* 7C */        NULL,           NULL,           NULL,           NULL,
14893 /* 80 */        NULL,           NULL,           NULL,           NULL,
14894 /* 84 */        NULL,           NULL,           NULL,           NULL,
14895 /* 88 */        NULL,           NULL,           "pfnacc",       NULL,
14896 /* 8C */        NULL,           NULL,           "pfpnacc",      NULL,
14897 /* 90 */        "pfcmpge",      NULL,           NULL,           NULL,
14898 /* 94 */        "pfmin",        NULL,           "pfrcp",        "pfrsqrt",
14899 /* 98 */        NULL,           NULL,           "pfsub",        NULL,
14900 /* 9C */        NULL,           NULL,           "pfadd",        NULL,
14901 /* A0 */        "pfcmpgt",      NULL,           NULL,           NULL,
14902 /* A4 */        "pfmax",        NULL,           "pfrcpit1",     "pfrsqit1",
14903 /* A8 */        NULL,           NULL,           "pfsubr",       NULL,
14904 /* AC */        NULL,           NULL,           "pfacc",        NULL,
14905 /* B0 */        "pfcmpeq",      NULL,           NULL,           NULL,
14906 /* B4 */        "pfmul",        NULL,           "pfrcpit2",     "pmulhrw",
14907 /* B8 */        NULL,           NULL,           NULL,           "pswapd",
14908 /* BC */        NULL,           NULL,           NULL,           "pavgusb",
14909 /* C0 */        NULL,           NULL,           NULL,           NULL,
14910 /* C4 */        NULL,           NULL,           NULL,           NULL,
14911 /* C8 */        NULL,           NULL,           NULL,           NULL,
14912 /* CC */        NULL,           NULL,           NULL,           NULL,
14913 /* D0 */        NULL,           NULL,           NULL,           NULL,
14914 /* D4 */        NULL,           NULL,           NULL,           NULL,
14915 /* D8 */        NULL,           NULL,           NULL,           NULL,
14916 /* DC */        NULL,           NULL,           NULL,           NULL,
14917 /* E0 */        NULL,           NULL,           NULL,           NULL,
14918 /* E4 */        NULL,           NULL,           NULL,           NULL,
14919 /* E8 */        NULL,           NULL,           NULL,           NULL,
14920 /* EC */        NULL,           NULL,           NULL,           NULL,
14921 /* F0 */        NULL,           NULL,           NULL,           NULL,
14922 /* F4 */        NULL,           NULL,           NULL,           NULL,
14923 /* F8 */        NULL,           NULL,           NULL,           NULL,
14924 /* FC */        NULL,           NULL,           NULL,           NULL,
14925 };
14926
14927 static void
14928 OP_3DNowSuffix (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14929 {
14930   const char *mnemonic;
14931
14932   FETCH_DATA (the_info, codep + 1);
14933   /* AMD 3DNow! instructions are specified by an opcode suffix in the
14934      place where an 8-bit immediate would normally go.  ie. the last
14935      byte of the instruction.  */
14936   obufp = mnemonicendp;
14937   mnemonic = Suffix3DNow[*codep++ & 0xff];
14938   if (mnemonic)
14939     oappend (mnemonic);
14940   else
14941     {
14942       /* Since a variable sized modrm/sib chunk is between the start
14943          of the opcode (0x0f0f) and the opcode suffix, we need to do
14944          all the modrm processing first, and don't know until now that
14945          we have a bad opcode.  This necessitates some cleaning up.  */
14946       op_out[0][0] = '\0';
14947       op_out[1][0] = '\0';
14948       BadOp ();
14949     }
14950   mnemonicendp = obufp;
14951 }
14952
14953 static struct op simd_cmp_op[] =
14954 {
14955   { STRING_COMMA_LEN ("eq") },
14956   { STRING_COMMA_LEN ("lt") },
14957   { STRING_COMMA_LEN ("le") },
14958   { STRING_COMMA_LEN ("unord") },
14959   { STRING_COMMA_LEN ("neq") },
14960   { STRING_COMMA_LEN ("nlt") },
14961   { STRING_COMMA_LEN ("nle") },
14962   { STRING_COMMA_LEN ("ord") }
14963 };
14964
14965 static void
14966 CMP_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14967 {
14968   unsigned int cmp_type;
14969
14970   FETCH_DATA (the_info, codep + 1);
14971   cmp_type = *codep++ & 0xff;
14972   if (cmp_type < ARRAY_SIZE (simd_cmp_op))
14973     {
14974       char suffix [3];
14975       char *p = mnemonicendp - 2;
14976       suffix[0] = p[0];
14977       suffix[1] = p[1];
14978       suffix[2] = '\0';
14979       sprintf (p, "%s%s", simd_cmp_op[cmp_type].name, suffix);
14980       mnemonicendp += simd_cmp_op[cmp_type].len;
14981     }
14982   else
14983     {
14984       /* We have a reserved extension byte.  Output it directly.  */
14985       scratchbuf[0] = '$';
14986       print_operand_value (scratchbuf + 1, 1, cmp_type);
14987       oappend (scratchbuf + intel_syntax);
14988       scratchbuf[0] = '\0';
14989     }
14990 }
14991
14992 static void
14993 OP_Mwait (int bytemode ATTRIBUTE_UNUSED,
14994           int sizeflag ATTRIBUTE_UNUSED)
14995 {
14996   /* mwait %eax,%ecx  */
14997   if (!intel_syntax)
14998     {
14999       const char **names = (address_mode == mode_64bit
15000                             ? names64 : names32);
15001       strcpy (op_out[0], names[0]);
15002       strcpy (op_out[1], names[1]);
15003       two_source_ops = 1;
15004     }
15005   /* Skip mod/rm byte.  */
15006   MODRM_CHECK;
15007   codep++;
15008 }
15009
15010 static void
15011 OP_Monitor (int bytemode ATTRIBUTE_UNUSED,
15012             int sizeflag ATTRIBUTE_UNUSED)
15013 {
15014   /* monitor %eax,%ecx,%edx"  */
15015   if (!intel_syntax)
15016     {
15017       const char **op1_names;
15018       const char **names = (address_mode == mode_64bit
15019                             ? names64 : names32);
15020
15021       if (!(prefixes & PREFIX_ADDR))
15022         op1_names = (address_mode == mode_16bit
15023                      ? names16 : names);
15024       else
15025         {
15026           /* Remove "addr16/addr32".  */
15027           all_prefixes[last_addr_prefix] = 0;
15028           op1_names = (address_mode != mode_32bit
15029                        ? names32 : names16);
15030           used_prefixes |= PREFIX_ADDR;
15031         }
15032       strcpy (op_out[0], op1_names[0]);
15033       strcpy (op_out[1], names[1]);
15034       strcpy (op_out[2], names[2]);
15035       two_source_ops = 1;
15036     }
15037   /* Skip mod/rm byte.  */
15038   MODRM_CHECK;
15039   codep++;
15040 }
15041
15042 static void
15043 BadOp (void)
15044 {
15045   /* Throw away prefixes and 1st. opcode byte.  */
15046   codep = insn_codep + 1;
15047   oappend ("(bad)");
15048 }
15049
15050 static void
15051 REP_Fixup (int bytemode, int sizeflag)
15052 {
15053   /* The 0xf3 prefix should be displayed as "rep" for ins, outs, movs,
15054      lods and stos.  */
15055   if (prefixes & PREFIX_REPZ)
15056     all_prefixes[last_repz_prefix] = REP_PREFIX;
15057
15058   switch (bytemode)
15059     {
15060     case al_reg:
15061     case eAX_reg:
15062     case indir_dx_reg:
15063       OP_IMREG (bytemode, sizeflag);
15064       break;
15065     case eDI_reg:
15066       OP_ESreg (bytemode, sizeflag);
15067       break;
15068     case eSI_reg:
15069       OP_DSreg (bytemode, sizeflag);
15070       break;
15071     default:
15072       abort ();
15073       break;
15074     }
15075 }
15076
15077 static void
15078 CMPXCHG8B_Fixup (int bytemode, int sizeflag)
15079 {
15080   USED_REX (REX_W);
15081   if (rex & REX_W)
15082     {
15083       /* Change cmpxchg8b to cmpxchg16b.  */
15084       char *p = mnemonicendp - 2;
15085       mnemonicendp = stpcpy (p, "16b");
15086       bytemode = o_mode;
15087     }
15088   OP_M (bytemode, sizeflag);
15089 }
15090
15091 static void
15092 XMM_Fixup (int reg, int sizeflag ATTRIBUTE_UNUSED)
15093 {
15094   if (need_vex)
15095     {
15096       switch (vex.length)
15097         {
15098         case 128:
15099           sprintf (scratchbuf, "%%xmm%d", reg);
15100           break;
15101         case 256:
15102           sprintf (scratchbuf, "%%ymm%d", reg);
15103           break;
15104         default:
15105           abort ();
15106         }
15107     }
15108   else
15109     sprintf (scratchbuf, "%%xmm%d", reg);
15110   oappend (scratchbuf + intel_syntax);
15111 }
15112
15113 static void
15114 CRC32_Fixup (int bytemode, int sizeflag)
15115 {
15116   /* Add proper suffix to "crc32".  */
15117   char *p = mnemonicendp;
15118
15119   switch (bytemode)
15120     {
15121     case b_mode:
15122       if (intel_syntax)
15123         goto skip;
15124
15125       *p++ = 'b';
15126       break;
15127     case v_mode:
15128       if (intel_syntax)
15129         goto skip;
15130
15131       USED_REX (REX_W);
15132       if (rex & REX_W)
15133         *p++ = 'q';
15134       else 
15135         {
15136           if (sizeflag & DFLAG)
15137             *p++ = 'l';
15138           else
15139             *p++ = 'w';
15140           used_prefixes |= (prefixes & PREFIX_DATA);
15141         }
15142       break;
15143     default:
15144       oappend (INTERNAL_DISASSEMBLER_ERROR);
15145       break;
15146     }
15147   mnemonicendp = p;
15148   *p = '\0';
15149
15150 skip:
15151   if (modrm.mod == 3)
15152     {
15153       int add;
15154
15155       /* Skip mod/rm byte.  */
15156       MODRM_CHECK;
15157       codep++;
15158
15159       USED_REX (REX_B);
15160       add = (rex & REX_B) ? 8 : 0;
15161       if (bytemode == b_mode)
15162         {
15163           USED_REX (0);
15164           if (rex)
15165             oappend (names8rex[modrm.rm + add]);
15166           else
15167             oappend (names8[modrm.rm + add]);
15168         }
15169       else
15170         {
15171           USED_REX (REX_W);
15172           if (rex & REX_W)
15173             oappend (names64[modrm.rm + add]);
15174           else if ((prefixes & PREFIX_DATA))
15175             oappend (names16[modrm.rm + add]);
15176           else
15177             oappend (names32[modrm.rm + add]);
15178         }
15179     }
15180   else
15181     OP_E (bytemode, sizeflag);
15182 }
15183
15184 static void
15185 FXSAVE_Fixup (int bytemode, int sizeflag)
15186 {
15187   /* Add proper suffix to "fxsave" and "fxrstor".  */
15188   USED_REX (REX_W);
15189   if (rex & REX_W)
15190     {
15191       char *p = mnemonicendp;
15192       *p++ = '6';
15193       *p++ = '4';
15194       *p = '\0';
15195       mnemonicendp = p;
15196     }
15197   OP_M (bytemode, sizeflag);
15198 }
15199
15200 /* Display the destination register operand for instructions with
15201    VEX. */
15202
15203 static void
15204 OP_VEX (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
15205 {
15206   if (!need_vex)
15207     abort ();
15208
15209   if (!need_vex_reg)
15210     return;
15211
15212   switch (vex.length)
15213     {
15214     case 128:
15215       switch (bytemode)
15216         {
15217         case vex_mode:
15218         case vex128_mode:
15219           break;
15220         default:
15221           abort ();
15222           return;
15223         }
15224
15225       sprintf (scratchbuf, "%%xmm%d", vex.register_specifier);
15226       break;
15227     case 256:
15228       switch (bytemode)
15229         {
15230         case vex_mode:
15231         case vex256_mode:
15232           break;
15233         default:
15234           abort ();
15235           return;
15236         }
15237
15238       sprintf (scratchbuf, "%%ymm%d", vex.register_specifier);
15239       break;
15240     default:
15241       abort ();
15242       break;
15243     }
15244   oappend (scratchbuf + intel_syntax);
15245 }
15246
15247 /* Get the VEX immediate byte without moving codep.  */
15248
15249 static unsigned char
15250 get_vex_imm8 (int sizeflag, int opnum)
15251 {
15252   int bytes_before_imm = 0;
15253
15254   if (modrm.mod != 3)
15255     {
15256       /* There are SIB/displacement bytes.  */
15257       if ((sizeflag & AFLAG) || address_mode == mode_64bit)
15258         {
15259           /* 32/64 bit address mode */
15260           int base = modrm.rm;
15261
15262           /* Check SIB byte.  */
15263           if (base == 4)
15264             {
15265               FETCH_DATA (the_info, codep + 1);
15266               base = *codep & 7;
15267               /* When decoding the third source, don't increase
15268                  bytes_before_imm as this has already been incremented
15269                  by one in OP_E_memory while decoding the second
15270                  source operand.  */
15271               if (opnum == 0)
15272                 bytes_before_imm++;
15273             }
15274
15275           /* Don't increase bytes_before_imm when decoding the third source,
15276              it has already been incremented by OP_E_memory while decoding
15277              the second source operand.  */
15278           if (opnum == 0)
15279             {
15280               switch (modrm.mod)
15281                 {
15282                   case 0:
15283                     /* When modrm.rm == 5 or modrm.rm == 4 and base in
15284                        SIB == 5, there is a 4 byte displacement.  */
15285                     if (base != 5)
15286                       /* No displacement. */
15287                       break;
15288                   case 2:
15289                     /* 4 byte displacement.  */
15290                     bytes_before_imm += 4;
15291                     break;
15292                   case 1:
15293                     /* 1 byte displacement.  */
15294                     bytes_before_imm++;
15295                     break;
15296                 }
15297             }
15298         }
15299       else
15300         {
15301           /* 16 bit address mode */
15302           /* Don't increase bytes_before_imm when decoding the third source,
15303              it has already been incremented by OP_E_memory while decoding
15304              the second source operand.  */
15305           if (opnum == 0)
15306             {
15307               switch (modrm.mod)
15308                 {
15309                 case 0:
15310                   /* When modrm.rm == 6, there is a 2 byte displacement.  */
15311                   if (modrm.rm != 6)
15312                     /* No displacement. */
15313                     break;
15314                 case 2:
15315                   /* 2 byte displacement.  */
15316                   bytes_before_imm += 2;
15317                   break;
15318                 case 1:
15319                   /* 1 byte displacement: when decoding the third source,
15320                      don't increase bytes_before_imm as this has already
15321                      been incremented by one in OP_E_memory while decoding
15322                      the second source operand.  */
15323                   if (opnum == 0)
15324                     bytes_before_imm++;
15325
15326                   break;
15327                 }
15328             }
15329         }
15330     }
15331
15332   FETCH_DATA (the_info, codep + bytes_before_imm + 1);
15333   return codep [bytes_before_imm];
15334 }
15335
15336 static void
15337 OP_EX_VexReg (int bytemode, int sizeflag, int reg)
15338 {
15339   if (reg == -1 && modrm.mod != 3)
15340     {
15341       OP_E_memory (bytemode, sizeflag);
15342       return;
15343     }
15344   else
15345     {
15346       if (reg == -1)
15347         {
15348           reg = modrm.rm;
15349           USED_REX (REX_B);
15350           if (rex & REX_B)
15351             reg += 8;
15352         }
15353       else if (reg > 7 && address_mode != mode_64bit)
15354         BadOp ();
15355     }
15356
15357   switch (vex.length)
15358     {
15359     case 128:
15360       sprintf (scratchbuf, "%%xmm%d", reg);
15361       break;
15362     case 256:
15363       sprintf (scratchbuf, "%%ymm%d", reg);
15364       break;
15365     default:
15366       abort ();
15367     }
15368   oappend (scratchbuf + intel_syntax);
15369 }
15370
15371 static void
15372 OP_Vex_2src (int bytemode, int sizeflag)
15373 {
15374   if (modrm.mod == 3)
15375     {
15376       USED_REX (REX_B);
15377       sprintf (scratchbuf, "%%xmm%d", rex & REX_B ? modrm.rm + 8 : modrm.rm);
15378       oappend (scratchbuf + intel_syntax);
15379     }
15380   else
15381     {
15382       if (intel_syntax
15383           && (bytemode == v_mode || bytemode == v_swap_mode))
15384         {
15385           bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode;
15386           used_prefixes |= (prefixes & PREFIX_DATA);
15387         }
15388       OP_E (bytemode, sizeflag);
15389     }
15390 }
15391
15392 static void
15393 OP_Vex_2src_1 (int bytemode, int sizeflag)
15394 {
15395   if (modrm.mod == 3)
15396     {
15397       /* Skip mod/rm byte.   */
15398       MODRM_CHECK;
15399       codep++;
15400     }
15401
15402   if (vex.w)
15403     {
15404       sprintf (scratchbuf, "%%xmm%d", vex.register_specifier);
15405       oappend (scratchbuf + intel_syntax);
15406     }
15407   else
15408     OP_Vex_2src (bytemode, sizeflag);
15409 }
15410
15411 static void
15412 OP_Vex_2src_2 (int bytemode, int sizeflag)
15413 {
15414   if (vex.w)
15415     OP_Vex_2src (bytemode, sizeflag);
15416   else
15417     {
15418       sprintf (scratchbuf, "%%xmm%d", vex.register_specifier);
15419       oappend (scratchbuf + intel_syntax);
15420     }
15421 }
15422
15423 static void
15424 OP_EX_VexW (int bytemode, int sizeflag)
15425 {
15426   int reg = -1;
15427
15428   if (!vex_w_done)
15429     {
15430       vex_w_done = 1;
15431
15432       /* Skip mod/rm byte.  */
15433       MODRM_CHECK;
15434       codep++;
15435
15436       if (vex.w)
15437         reg = get_vex_imm8 (sizeflag, 0) >> 4;
15438     }
15439   else
15440     {
15441       if (!vex.w)
15442         reg = get_vex_imm8 (sizeflag, 1) >> 4;
15443     }
15444
15445   OP_EX_VexReg (bytemode, sizeflag, reg);
15446 }
15447
15448 static void
15449 VEXI4_Fixup (int bytemode ATTRIBUTE_UNUSED,
15450              int sizeflag ATTRIBUTE_UNUSED)
15451 {
15452   /* Skip the immediate byte and check for invalid bits.  */
15453   FETCH_DATA (the_info, codep + 1);
15454   if (*codep++ & 0xf)
15455     BadOp ();
15456 }
15457
15458 static void
15459 OP_REG_VexI4 (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
15460 {
15461   int reg;
15462   FETCH_DATA (the_info, codep + 1);
15463   reg = *codep++;
15464
15465   if (bytemode != x_mode)
15466     abort ();
15467
15468   if (reg & 0xf)
15469       BadOp ();
15470
15471   reg >>= 4;
15472   if (reg > 7 && address_mode != mode_64bit)
15473     BadOp ();
15474
15475   switch (vex.length)
15476     {
15477     case 128:
15478       sprintf (scratchbuf, "%%xmm%d", reg);
15479       break;
15480     case 256:
15481       sprintf (scratchbuf, "%%ymm%d", reg);
15482       break;
15483     default:
15484       abort ();
15485     }
15486   oappend (scratchbuf + intel_syntax);
15487 }
15488
15489 static void
15490 OP_XMM_VexW (int bytemode, int sizeflag)
15491 {
15492   /* Turn off the REX.W bit since it is used for swapping operands
15493      now.  */
15494   rex &= ~REX_W;
15495   OP_XMM (bytemode, sizeflag);
15496 }
15497
15498 static void
15499 OP_EX_Vex (int bytemode, int sizeflag)
15500 {
15501   if (modrm.mod != 3)
15502     {
15503       if (vex.register_specifier != 0)
15504         BadOp ();
15505       need_vex_reg = 0;
15506     }
15507   OP_EX (bytemode, sizeflag);
15508 }
15509
15510 static void
15511 OP_XMM_Vex (int bytemode, int sizeflag)
15512 {
15513   if (modrm.mod != 3)
15514     {
15515       if (vex.register_specifier != 0)
15516         BadOp ();
15517       need_vex_reg = 0;
15518     }
15519   OP_XMM (bytemode, sizeflag);
15520 }
15521
15522 static void
15523 VZERO_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
15524 {
15525   switch (vex.length)
15526     {
15527     case 128:
15528       mnemonicendp = stpcpy (obuf, "vzeroupper");
15529       break;
15530     case 256:
15531       mnemonicendp = stpcpy (obuf, "vzeroall");
15532       break;
15533     default:
15534       abort ();
15535     }
15536 }
15537
15538 static struct op vex_cmp_op[] =
15539 {
15540   { STRING_COMMA_LEN ("eq") },
15541   { STRING_COMMA_LEN ("lt") },
15542   { STRING_COMMA_LEN ("le") },
15543   { STRING_COMMA_LEN ("unord") },
15544   { STRING_COMMA_LEN ("neq") },
15545   { STRING_COMMA_LEN ("nlt") },
15546   { STRING_COMMA_LEN ("nle") },
15547   { STRING_COMMA_LEN ("ord") },
15548   { STRING_COMMA_LEN ("eq_uq") },
15549   { STRING_COMMA_LEN ("nge") },
15550   { STRING_COMMA_LEN ("ngt") },
15551   { STRING_COMMA_LEN ("false") },
15552   { STRING_COMMA_LEN ("neq_oq") },
15553   { STRING_COMMA_LEN ("ge") },
15554   { STRING_COMMA_LEN ("gt") },
15555   { STRING_COMMA_LEN ("true") },
15556   { STRING_COMMA_LEN ("eq_os") },
15557   { STRING_COMMA_LEN ("lt_oq") },
15558   { STRING_COMMA_LEN ("le_oq") },
15559   { STRING_COMMA_LEN ("unord_s") },
15560   { STRING_COMMA_LEN ("neq_us") },
15561   { STRING_COMMA_LEN ("nlt_uq") },
15562   { STRING_COMMA_LEN ("nle_uq") },
15563   { STRING_COMMA_LEN ("ord_s") },
15564   { STRING_COMMA_LEN ("eq_us") },
15565   { STRING_COMMA_LEN ("nge_uq") },
15566   { STRING_COMMA_LEN ("ngt_uq") },
15567   { STRING_COMMA_LEN ("false_os") },
15568   { STRING_COMMA_LEN ("neq_os") },
15569   { STRING_COMMA_LEN ("ge_oq") },
15570   { STRING_COMMA_LEN ("gt_oq") },
15571   { STRING_COMMA_LEN ("true_us") },
15572 };
15573
15574 static void
15575 VCMP_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
15576 {
15577   unsigned int cmp_type;
15578
15579   FETCH_DATA (the_info, codep + 1);
15580   cmp_type = *codep++ & 0xff;
15581   if (cmp_type < ARRAY_SIZE (vex_cmp_op))
15582     {
15583       char suffix [3];
15584       char *p = mnemonicendp - 2;
15585       suffix[0] = p[0];
15586       suffix[1] = p[1];
15587       suffix[2] = '\0';
15588       sprintf (p, "%s%s", vex_cmp_op[cmp_type].name, suffix);
15589       mnemonicendp += vex_cmp_op[cmp_type].len;
15590     }
15591   else
15592     {
15593       /* We have a reserved extension byte.  Output it directly.  */
15594       scratchbuf[0] = '$';
15595       print_operand_value (scratchbuf + 1, 1, cmp_type);
15596       oappend (scratchbuf + intel_syntax);
15597       scratchbuf[0] = '\0';
15598     }
15599 }
15600
15601 static const struct op pclmul_op[] =
15602 {
15603   { STRING_COMMA_LEN ("lql") },
15604   { STRING_COMMA_LEN ("hql") },
15605   { STRING_COMMA_LEN ("lqh") },
15606   { STRING_COMMA_LEN ("hqh") }
15607 };
15608
15609 static void
15610 PCLMUL_Fixup (int bytemode ATTRIBUTE_UNUSED,
15611               int sizeflag ATTRIBUTE_UNUSED)
15612 {
15613   unsigned int pclmul_type;
15614
15615   FETCH_DATA (the_info, codep + 1);
15616   pclmul_type = *codep++ & 0xff;
15617   switch (pclmul_type)
15618     {
15619     case 0x10:
15620       pclmul_type = 2;
15621       break;
15622     case 0x11:
15623       pclmul_type = 3;
15624       break;
15625     default:
15626       break;
15627     } 
15628   if (pclmul_type < ARRAY_SIZE (pclmul_op))
15629     {
15630       char suffix [4];
15631       char *p = mnemonicendp - 3;
15632       suffix[0] = p[0];
15633       suffix[1] = p[1];
15634       suffix[2] = p[2];
15635       suffix[3] = '\0';
15636       sprintf (p, "%s%s", pclmul_op[pclmul_type].name, suffix);
15637       mnemonicendp += pclmul_op[pclmul_type].len;
15638     }
15639   else
15640     {
15641       /* We have a reserved extension byte.  Output it directly.  */
15642       scratchbuf[0] = '$';
15643       print_operand_value (scratchbuf + 1, 1, pclmul_type);
15644       oappend (scratchbuf + intel_syntax);
15645       scratchbuf[0] = '\0';
15646     }
15647 }
15648
15649 static void
15650 MOVBE_Fixup (int bytemode, int sizeflag)
15651 {
15652   /* Add proper suffix to "movbe".  */
15653   char *p = mnemonicendp;
15654
15655   switch (bytemode)
15656     {
15657     case v_mode:
15658       if (intel_syntax)
15659         goto skip;
15660
15661       USED_REX (REX_W);
15662       if (sizeflag & SUFFIX_ALWAYS)
15663         {
15664           if (rex & REX_W)
15665             *p++ = 'q';
15666           else
15667             {
15668               if (sizeflag & DFLAG)
15669                 *p++ = 'l';
15670               else
15671                 *p++ = 'w';
15672               used_prefixes |= (prefixes & PREFIX_DATA);
15673             }
15674         }
15675       break;
15676     default:
15677       oappend (INTERNAL_DISASSEMBLER_ERROR);
15678       break;
15679     }
15680   mnemonicendp = p;
15681   *p = '\0';
15682
15683 skip:
15684   OP_M (bytemode, sizeflag);
15685 }
15686
15687 static void
15688 OP_LWPCB_E (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
15689 {
15690   int reg;
15691   const char **names;
15692
15693   /* Skip mod/rm byte.  */
15694   MODRM_CHECK;
15695   codep++;
15696
15697   if (vex.w)
15698     names = names64;
15699   else if (vex.length == 256)
15700     names = names32;
15701   else
15702     names = names16;
15703
15704   reg = modrm.rm;
15705   USED_REX (REX_B);
15706   if (rex & REX_B)
15707     reg += 8;
15708
15709   oappend (names[reg]);
15710 }
15711
15712 static void
15713 OP_LWP_E (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
15714 {
15715   const char **names;
15716
15717   if (vex.w)
15718     names = names64;
15719   else if (vex.length == 256)
15720     names = names32;
15721   else
15722     names = names16;
15723
15724   oappend (names[vex.register_specifier]);
15725 }
15726
15727 static void
15728 OP_LWP_I (int bytemode ATTRIBUTE_UNUSED, int sizeflag)
15729 {
15730   if (vex.w || vex.length == 256)
15731     OP_I (q_mode, sizeflag);
15732   else
15733     OP_I (w_mode, sizeflag);
15734 }
15735