Add USE_VEX_W_TABLE, VEX_W_TABLE and VEX_W_XXX.
[external/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_3819_P_2_M_0,
1489   VEX_W_381A_P_2_M_0,
1490   VEX_W_381C_P_2,
1491   VEX_W_381D_P_2,
1492   VEX_W_381E_P_2,
1493   VEX_W_3820_P_2,
1494   VEX_W_3821_P_2,
1495   VEX_W_3822_P_2,
1496   VEX_W_3823_P_2,
1497   VEX_W_3824_P_2,
1498   VEX_W_3825_P_2,
1499   VEX_W_3828_P_2,
1500   VEX_W_3829_P_2,
1501   VEX_W_382A_P_2_M_0,
1502   VEX_W_382B_P_2,
1503   VEX_W_3830_P_2,
1504   VEX_W_3831_P_2,
1505   VEX_W_3832_P_2,
1506   VEX_W_3833_P_2,
1507   VEX_W_3834_P_2,
1508   VEX_W_3835_P_2,
1509   VEX_W_3837_P_2,
1510   VEX_W_3838_P_2,
1511   VEX_W_3839_P_2,
1512   VEX_W_383A_P_2,
1513   VEX_W_383B_P_2,
1514   VEX_W_383C_P_2,
1515   VEX_W_383D_P_2,
1516   VEX_W_383E_P_2,
1517   VEX_W_383F_P_2,
1518   VEX_W_3840_P_2,
1519   VEX_W_3841_P_2,
1520   VEX_W_38DB_P_2,
1521   VEX_W_38DC_P_2,
1522   VEX_W_38DD_P_2,
1523   VEX_W_38DE_P_2,
1524   VEX_W_38DF_P_2,
1525   VEX_W_3A04_P_2,
1526   VEX_W_3A05_P_2,
1527   VEX_W_3A06_P_2,
1528   VEX_W_3A08_P_2,
1529   VEX_W_3A09_P_2,
1530   VEX_W_3A0A_P_2,
1531   VEX_W_3A0B_P_2,
1532   VEX_W_3A0C_P_2,
1533   VEX_W_3A0D_P_2,
1534   VEX_W_3A0E_P_2,
1535   VEX_W_3A0F_P_2,
1536   VEX_W_3A14_P_2,
1537   VEX_W_3A15_P_2,
1538   VEX_W_3A18_P_2,
1539   VEX_W_3A19_P_2,
1540   VEX_W_3A20_P_2,
1541   VEX_W_3A21_P_2,
1542   VEX_W_3A40_P_2,
1543   VEX_W_3A41_P_2,
1544   VEX_W_3A42_P_2,
1545   VEX_W_3A44_P_2,
1546   VEX_W_3A4A_P_2,
1547   VEX_W_3A4B_P_2,
1548   VEX_W_3A4C_P_2,
1549   VEX_W_3A60_P_2,
1550   VEX_W_3A61_P_2,
1551   VEX_W_3A62_P_2,
1552   VEX_W_3A63_P_2,
1553   VEX_W_3ADF_P_2
1554 };
1555
1556 typedef void (*op_rtn) (int bytemode, int sizeflag);
1557
1558 struct dis386 {
1559   const char *name;
1560   struct
1561     {
1562       op_rtn rtn;
1563       int bytemode;
1564     } op[MAX_OPERANDS];
1565 };
1566
1567 /* Upper case letters in the instruction names here are macros.
1568    'A' => print 'b' if no register operands or suffix_always is true
1569    'B' => print 'b' if suffix_always is true
1570    'C' => print 's' or 'l' ('w' or 'd' in Intel mode) depending on operand
1571           size prefix
1572    'D' => print 'w' if no register operands or 'w', 'l' or 'q', if
1573           suffix_always is true
1574    'E' => print 'e' if 32-bit form of jcxz
1575    'F' => print 'w' or 'l' depending on address size prefix (loop insns)
1576    'G' => print 'w' or 'l' depending on operand size prefix (i/o insns)
1577    'H' => print ",pt" or ",pn" branch hint
1578    'I' => honor following macro letter even in Intel mode (implemented only
1579           for some of the macro letters)
1580    'J' => print 'l'
1581    'K' => print 'd' or 'q' if rex prefix is present.
1582    'L' => print 'l' if suffix_always is true
1583    'M' => print 'r' if intel_mnemonic is false.
1584    'N' => print 'n' if instruction has no wait "prefix"
1585    'O' => print 'd' or 'o' (or 'q' in Intel mode)
1586    'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix,
1587           or suffix_always is true.  print 'q' if rex prefix is present.
1588    'Q' => print 'w', 'l' or 'q' for memory operand or suffix_always
1589           is true
1590    'R' => print 'w', 'l' or 'q' ('d' for 'l' and 'e' in Intel mode)
1591    'S' => print 'w', 'l' or 'q' if suffix_always is true
1592    'T' => print 'q' in 64bit mode and behave as 'P' otherwise
1593    'U' => print 'q' in 64bit mode and behave as 'Q' otherwise
1594    'V' => print 'q' in 64bit mode and behave as 'S' otherwise
1595    'W' => print 'b', 'w' or 'l' ('d' in Intel mode)
1596    'X' => print 's', 'd' depending on data16 prefix (for XMM)
1597    'Y' => 'q' if instruction has an REX 64bit overwrite prefix and
1598           suffix_always is true.
1599    'Z' => print 'q' in 64bit mode and behave as 'L' otherwise
1600    '!' => change condition from true to false or from false to true.
1601    '%' => add 1 upper case letter to the macro.
1602
1603    2 upper case letter macros:
1604    "XY" => print 'x' or 'y' if no register operands or suffix_always
1605            is true.
1606    "XW" => print 's', 'd' depending on the VEX.W bit (for FMA)
1607    "LQ" => print 'l' ('d' in Intel mode) or 'q' for memory operand
1608            or suffix_always is true
1609    "LB" => print "abs" in 64bit mode and behave as 'B' otherwise
1610    "LS" => print "abs" in 64bit mode and behave as 'S' otherwise
1611    "LV" => print "abs" for 64bit operand and behave as 'S' otherwise
1612
1613    Many of the above letters print nothing in Intel mode.  See "putop"
1614    for the details.
1615
1616    Braces '{' and '}', and vertical bars '|', indicate alternative
1617    mnemonic strings for AT&T and Intel.  */
1618
1619 static const struct dis386 dis386[] = {
1620   /* 00 */
1621   { "addB",             { Eb, Gb } },
1622   { "addS",             { Ev, Gv } },
1623   { "addB",             { Gb, EbS } },
1624   { "addS",             { Gv, EvS } },
1625   { "addB",             { AL, Ib } },
1626   { "addS",             { eAX, Iv } },
1627   { X86_64_TABLE (X86_64_06) },
1628   { X86_64_TABLE (X86_64_07) },
1629   /* 08 */
1630   { "orB",              { Eb, Gb } },
1631   { "orS",              { Ev, Gv } },
1632   { "orB",              { Gb, EbS } },
1633   { "orS",              { Gv, EvS } },
1634   { "orB",              { AL, Ib } },
1635   { "orS",              { eAX, Iv } },
1636   { X86_64_TABLE (X86_64_0D) },
1637   { "(bad)",            { XX } },       /* 0x0f extended opcode escape */
1638   /* 10 */
1639   { "adcB",             { Eb, Gb } },
1640   { "adcS",             { Ev, Gv } },
1641   { "adcB",             { Gb, EbS } },
1642   { "adcS",             { Gv, EvS } },
1643   { "adcB",             { AL, Ib } },
1644   { "adcS",             { eAX, Iv } },
1645   { X86_64_TABLE (X86_64_16) },
1646   { X86_64_TABLE (X86_64_17) },
1647   /* 18 */
1648   { "sbbB",             { Eb, Gb } },
1649   { "sbbS",             { Ev, Gv } },
1650   { "sbbB",             { Gb, EbS } },
1651   { "sbbS",             { Gv, EvS } },
1652   { "sbbB",             { AL, Ib } },
1653   { "sbbS",             { eAX, Iv } },
1654   { X86_64_TABLE (X86_64_1E) },
1655   { X86_64_TABLE (X86_64_1F) },
1656   /* 20 */
1657   { "andB",             { Eb, Gb } },
1658   { "andS",             { Ev, Gv } },
1659   { "andB",             { Gb, EbS } },
1660   { "andS",             { Gv, EvS } },
1661   { "andB",             { AL, Ib } },
1662   { "andS",             { eAX, Iv } },
1663   { "(bad)",            { XX } },       /* SEG ES prefix */
1664   { X86_64_TABLE (X86_64_27) },
1665   /* 28 */
1666   { "subB",             { Eb, Gb } },
1667   { "subS",             { Ev, Gv } },
1668   { "subB",             { Gb, EbS } },
1669   { "subS",             { Gv, EvS } },
1670   { "subB",             { AL, Ib } },
1671   { "subS",             { eAX, Iv } },
1672   { "(bad)",            { XX } },       /* SEG CS prefix */
1673   { X86_64_TABLE (X86_64_2F) },
1674   /* 30 */
1675   { "xorB",             { Eb, Gb } },
1676   { "xorS",             { Ev, Gv } },
1677   { "xorB",             { Gb, EbS } },
1678   { "xorS",             { Gv, EvS } },
1679   { "xorB",             { AL, Ib } },
1680   { "xorS",             { eAX, Iv } },
1681   { "(bad)",            { XX } },       /* SEG SS prefix */
1682   { X86_64_TABLE (X86_64_37) },
1683   /* 38 */
1684   { "cmpB",             { Eb, Gb } },
1685   { "cmpS",             { Ev, Gv } },
1686   { "cmpB",             { Gb, EbS } },
1687   { "cmpS",             { Gv, EvS } },
1688   { "cmpB",             { AL, Ib } },
1689   { "cmpS",             { eAX, Iv } },
1690   { "(bad)",            { XX } },       /* SEG DS prefix */
1691   { X86_64_TABLE (X86_64_3F) },
1692   /* 40 */
1693   { "inc{S|}",          { RMeAX } },
1694   { "inc{S|}",          { RMeCX } },
1695   { "inc{S|}",          { RMeDX } },
1696   { "inc{S|}",          { RMeBX } },
1697   { "inc{S|}",          { RMeSP } },
1698   { "inc{S|}",          { RMeBP } },
1699   { "inc{S|}",          { RMeSI } },
1700   { "inc{S|}",          { RMeDI } },
1701   /* 48 */
1702   { "dec{S|}",          { RMeAX } },
1703   { "dec{S|}",          { RMeCX } },
1704   { "dec{S|}",          { RMeDX } },
1705   { "dec{S|}",          { RMeBX } },
1706   { "dec{S|}",          { RMeSP } },
1707   { "dec{S|}",          { RMeBP } },
1708   { "dec{S|}",          { RMeSI } },
1709   { "dec{S|}",          { RMeDI } },
1710   /* 50 */
1711   { "pushV",            { RMrAX } },
1712   { "pushV",            { RMrCX } },
1713   { "pushV",            { RMrDX } },
1714   { "pushV",            { RMrBX } },
1715   { "pushV",            { RMrSP } },
1716   { "pushV",            { RMrBP } },
1717   { "pushV",            { RMrSI } },
1718   { "pushV",            { RMrDI } },
1719   /* 58 */
1720   { "popV",             { RMrAX } },
1721   { "popV",             { RMrCX } },
1722   { "popV",             { RMrDX } },
1723   { "popV",             { RMrBX } },
1724   { "popV",             { RMrSP } },
1725   { "popV",             { RMrBP } },
1726   { "popV",             { RMrSI } },
1727   { "popV",             { RMrDI } },
1728   /* 60 */
1729   { X86_64_TABLE (X86_64_60) },
1730   { X86_64_TABLE (X86_64_61) },
1731   { X86_64_TABLE (X86_64_62) },
1732   { X86_64_TABLE (X86_64_63) },
1733   { "(bad)",            { XX } },       /* seg fs */
1734   { "(bad)",            { XX } },       /* seg gs */
1735   { "(bad)",            { XX } },       /* op size prefix */
1736   { "(bad)",            { XX } },       /* adr size prefix */
1737   /* 68 */
1738   { "pushT",            { Iq } },
1739   { "imulS",            { Gv, Ev, Iv } },
1740   { "pushT",            { sIb } },
1741   { "imulS",            { Gv, Ev, sIb } },
1742   { "ins{b|}",          { Ybr, indirDX } },
1743   { X86_64_TABLE (X86_64_6D) },
1744   { "outs{b|}",         { indirDXr, Xb } },
1745   { X86_64_TABLE (X86_64_6F) },
1746   /* 70 */
1747   { "joH",              { Jb, XX, cond_jump_flag } },
1748   { "jnoH",             { Jb, XX, cond_jump_flag } },
1749   { "jbH",              { Jb, XX, cond_jump_flag } },
1750   { "jaeH",             { Jb, XX, cond_jump_flag } },
1751   { "jeH",              { Jb, XX, cond_jump_flag } },
1752   { "jneH",             { Jb, XX, cond_jump_flag } },
1753   { "jbeH",             { Jb, XX, cond_jump_flag } },
1754   { "jaH",              { Jb, XX, cond_jump_flag } },
1755   /* 78 */
1756   { "jsH",              { Jb, XX, cond_jump_flag } },
1757   { "jnsH",             { Jb, XX, cond_jump_flag } },
1758   { "jpH",              { Jb, XX, cond_jump_flag } },
1759   { "jnpH",             { Jb, XX, cond_jump_flag } },
1760   { "jlH",              { Jb, XX, cond_jump_flag } },
1761   { "jgeH",             { Jb, XX, cond_jump_flag } },
1762   { "jleH",             { Jb, XX, cond_jump_flag } },
1763   { "jgH",              { Jb, XX, cond_jump_flag } },
1764   /* 80 */
1765   { REG_TABLE (REG_80) },
1766   { REG_TABLE (REG_81) },
1767   { "(bad)",            { XX } },
1768   { REG_TABLE (REG_82) },
1769   { "testB",            { Eb, Gb } },
1770   { "testS",            { Ev, Gv } },
1771   { "xchgB",            { Eb, Gb } },
1772   { "xchgS",            { Ev, Gv } },
1773   /* 88 */
1774   { "movB",             { Eb, Gb } },
1775   { "movS",             { Ev, Gv } },
1776   { "movB",             { Gb, EbS } },
1777   { "movS",             { Gv, EvS } },
1778   { "movD",             { Sv, Sw } },
1779   { MOD_TABLE (MOD_8D) },
1780   { "movD",             { Sw, Sv } },
1781   { REG_TABLE (REG_8F) },
1782   /* 90 */
1783   { PREFIX_TABLE (PREFIX_90) },
1784   { "xchgS",            { RMeCX, eAX } },
1785   { "xchgS",            { RMeDX, eAX } },
1786   { "xchgS",            { RMeBX, eAX } },
1787   { "xchgS",            { RMeSP, eAX } },
1788   { "xchgS",            { RMeBP, eAX } },
1789   { "xchgS",            { RMeSI, eAX } },
1790   { "xchgS",            { RMeDI, eAX } },
1791   /* 98 */
1792   { "cW{t|}R",          { XX } },
1793   { "cR{t|}O",          { XX } },
1794   { X86_64_TABLE (X86_64_9A) },
1795   { "(bad)",            { XX } },       /* fwait */
1796   { "pushfT",           { XX } },
1797   { "popfT",            { XX } },
1798   { "sahf",             { XX } },
1799   { "lahf",             { XX } },
1800   /* a0 */
1801   { "mov%LB",           { AL, Ob } },
1802   { "mov%LS",           { eAX, Ov } },
1803   { "mov%LB",           { Ob, AL } },
1804   { "mov%LS",           { Ov, eAX } },
1805   { "movs{b|}",         { Ybr, Xb } },
1806   { "movs{R|}",         { Yvr, Xv } },
1807   { "cmps{b|}",         { Xb, Yb } },
1808   { "cmps{R|}",         { Xv, Yv } },
1809   /* a8 */
1810   { "testB",            { AL, Ib } },
1811   { "testS",            { eAX, Iv } },
1812   { "stosB",            { Ybr, AL } },
1813   { "stosS",            { Yvr, eAX } },
1814   { "lodsB",            { ALr, Xb } },
1815   { "lodsS",            { eAXr, Xv } },
1816   { "scasB",            { AL, Yb } },
1817   { "scasS",            { eAX, Yv } },
1818   /* b0 */
1819   { "movB",             { RMAL, Ib } },
1820   { "movB",             { RMCL, Ib } },
1821   { "movB",             { RMDL, Ib } },
1822   { "movB",             { RMBL, Ib } },
1823   { "movB",             { RMAH, Ib } },
1824   { "movB",             { RMCH, Ib } },
1825   { "movB",             { RMDH, Ib } },
1826   { "movB",             { RMBH, Ib } },
1827   /* b8 */
1828   { "mov%LV",           { RMeAX, Iv64 } },
1829   { "mov%LV",           { RMeCX, Iv64 } },
1830   { "mov%LV",           { RMeDX, Iv64 } },
1831   { "mov%LV",           { RMeBX, Iv64 } },
1832   { "mov%LV",           { RMeSP, Iv64 } },
1833   { "mov%LV",           { RMeBP, Iv64 } },
1834   { "mov%LV",           { RMeSI, Iv64 } },
1835   { "mov%LV",           { RMeDI, Iv64 } },
1836   /* c0 */
1837   { REG_TABLE (REG_C0) },
1838   { REG_TABLE (REG_C1) },
1839   { "retT",             { Iw } },
1840   { "retT",             { XX } },
1841   { X86_64_TABLE (X86_64_C4) },
1842   { X86_64_TABLE (X86_64_C5) },
1843   { REG_TABLE (REG_C6) },
1844   { REG_TABLE (REG_C7) },
1845   /* c8 */
1846   { "enterT",           { Iw, Ib } },
1847   { "leaveT",           { XX } },
1848   { "Jret{|f}P",        { Iw } },
1849   { "Jret{|f}P",        { XX } },
1850   { "int3",             { XX } },
1851   { "int",              { Ib } },
1852   { X86_64_TABLE (X86_64_CE) },
1853   { "iretP",            { XX } },
1854   /* d0 */
1855   { REG_TABLE (REG_D0) },
1856   { REG_TABLE (REG_D1) },
1857   { REG_TABLE (REG_D2) },
1858   { REG_TABLE (REG_D3) },
1859   { X86_64_TABLE (X86_64_D4) },
1860   { X86_64_TABLE (X86_64_D5) },
1861   { "(bad)",            { XX } },
1862   { "xlat",             { DSBX } },
1863   /* d8 */
1864   { FLOAT },
1865   { FLOAT },
1866   { FLOAT },
1867   { FLOAT },
1868   { FLOAT },
1869   { FLOAT },
1870   { FLOAT },
1871   { FLOAT },
1872   /* e0 */
1873   { "loopneFH",         { Jb, XX, loop_jcxz_flag } },
1874   { "loopeFH",          { Jb, XX, loop_jcxz_flag } },
1875   { "loopFH",           { Jb, XX, loop_jcxz_flag } },
1876   { "jEcxzH",           { Jb, XX, loop_jcxz_flag } },
1877   { "inB",              { AL, Ib } },
1878   { "inG",              { zAX, Ib } },
1879   { "outB",             { Ib, AL } },
1880   { "outG",             { Ib, zAX } },
1881   /* e8 */
1882   { "callT",            { Jv } },
1883   { "jmpT",             { Jv } },
1884   { X86_64_TABLE (X86_64_EA) },
1885   { "jmp",              { Jb } },
1886   { "inB",              { AL, indirDX } },
1887   { "inG",              { zAX, indirDX } },
1888   { "outB",             { indirDX, AL } },
1889   { "outG",             { indirDX, zAX } },
1890   /* f0 */
1891   { "(bad)",            { XX } },       /* lock prefix */
1892   { "icebp",            { XX } },
1893   { "(bad)",            { XX } },       /* repne */
1894   { "(bad)",            { XX } },       /* repz */
1895   { "hlt",              { XX } },
1896   { "cmc",              { XX } },
1897   { REG_TABLE (REG_F6) },
1898   { REG_TABLE (REG_F7) },
1899   /* f8 */
1900   { "clc",              { XX } },
1901   { "stc",              { XX } },
1902   { "cli",              { XX } },
1903   { "sti",              { XX } },
1904   { "cld",              { XX } },
1905   { "std",              { XX } },
1906   { REG_TABLE (REG_FE) },
1907   { REG_TABLE (REG_FF) },
1908 };
1909
1910 static const struct dis386 dis386_twobyte[] = {
1911   /* 00 */
1912   { REG_TABLE (REG_0F00 ) },
1913   { REG_TABLE (REG_0F01 ) },
1914   { "larS",             { Gv, Ew } },
1915   { "lslS",             { Gv, Ew } },
1916   { "(bad)",            { XX } },
1917   { "syscall",          { XX } },
1918   { "clts",             { XX } },
1919   { "sysretP",          { XX } },
1920   /* 08 */
1921   { "invd",             { XX } },
1922   { "wbinvd",           { XX } },
1923   { "(bad)",            { XX } },
1924   { "ud2a",             { XX } },
1925   { "(bad)",            { XX } },
1926   { REG_TABLE (REG_0F0D) },
1927   { "femms",            { XX } },
1928   { "",                 { MX, EM, OPSUF } }, /* See OP_3DNowSuffix.  */
1929   /* 10 */
1930   { PREFIX_TABLE (PREFIX_0F10) },
1931   { PREFIX_TABLE (PREFIX_0F11) },
1932   { PREFIX_TABLE (PREFIX_0F12) },
1933   { MOD_TABLE (MOD_0F13) },
1934   { "unpcklpX",         { XM, EXx } },
1935   { "unpckhpX",         { XM, EXx } },
1936   { PREFIX_TABLE (PREFIX_0F16) },
1937   { MOD_TABLE (MOD_0F17) },
1938   /* 18 */
1939   { REG_TABLE (REG_0F18) },
1940   { "nopQ",             { Ev } },
1941   { "nopQ",             { Ev } },
1942   { "nopQ",             { Ev } },
1943   { "nopQ",             { Ev } },
1944   { "nopQ",             { Ev } },
1945   { "nopQ",             { Ev } },
1946   { "nopQ",             { Ev } },
1947   /* 20 */
1948   { MOD_TABLE (MOD_0F20) },
1949   { MOD_TABLE (MOD_0F21) },
1950   { MOD_TABLE (MOD_0F22) },
1951   { MOD_TABLE (MOD_0F23) },
1952   { MOD_TABLE (MOD_0F24) },
1953   { "(bad)",            { XX } },
1954   { MOD_TABLE (MOD_0F26) },
1955   { "(bad)",            { XX } },
1956   /* 28 */
1957   { "movapX",           { XM, EXx } },
1958   { "movapX",           { EXxS, XM } },
1959   { PREFIX_TABLE (PREFIX_0F2A) },
1960   { PREFIX_TABLE (PREFIX_0F2B) },
1961   { PREFIX_TABLE (PREFIX_0F2C) },
1962   { PREFIX_TABLE (PREFIX_0F2D) },
1963   { PREFIX_TABLE (PREFIX_0F2E) },
1964   { PREFIX_TABLE (PREFIX_0F2F) },
1965   /* 30 */
1966   { "wrmsr",            { XX } },
1967   { "rdtsc",            { XX } },
1968   { "rdmsr",            { XX } },
1969   { "rdpmc",            { XX } },
1970   { "sysenter",         { XX } },
1971   { "sysexit",          { XX } },
1972   { "(bad)",            { XX } },
1973   { "getsec",           { XX } },
1974   /* 38 */
1975   { THREE_BYTE_TABLE (THREE_BYTE_0F38) },
1976   { "(bad)",            { XX } },
1977   { THREE_BYTE_TABLE (THREE_BYTE_0F3A) },
1978   { "(bad)",            { XX } },
1979   { "(bad)",            { XX } },
1980   { "(bad)",            { XX } },
1981   { "(bad)",            { XX } },
1982   { "(bad)",            { XX } },
1983   /* 40 */
1984   { "cmovoS",           { Gv, Ev } },
1985   { "cmovnoS",          { Gv, Ev } },
1986   { "cmovbS",           { Gv, Ev } },
1987   { "cmovaeS",          { Gv, Ev } },
1988   { "cmoveS",           { Gv, Ev } },
1989   { "cmovneS",          { Gv, Ev } },
1990   { "cmovbeS",          { Gv, Ev } },
1991   { "cmovaS",           { Gv, Ev } },
1992   /* 48 */
1993   { "cmovsS",           { Gv, Ev } },
1994   { "cmovnsS",          { Gv, Ev } },
1995   { "cmovpS",           { Gv, Ev } },
1996   { "cmovnpS",          { Gv, Ev } },
1997   { "cmovlS",           { Gv, Ev } },
1998   { "cmovgeS",          { Gv, Ev } },
1999   { "cmovleS",          { Gv, Ev } },
2000   { "cmovgS",           { Gv, Ev } },
2001   /* 50 */
2002   { MOD_TABLE (MOD_0F51) },
2003   { PREFIX_TABLE (PREFIX_0F51) },
2004   { PREFIX_TABLE (PREFIX_0F52) },
2005   { PREFIX_TABLE (PREFIX_0F53) },
2006   { "andpX",            { XM, EXx } },
2007   { "andnpX",           { XM, EXx } },
2008   { "orpX",             { XM, EXx } },
2009   { "xorpX",            { XM, EXx } },
2010   /* 58 */
2011   { PREFIX_TABLE (PREFIX_0F58) },
2012   { PREFIX_TABLE (PREFIX_0F59) },
2013   { PREFIX_TABLE (PREFIX_0F5A) },
2014   { PREFIX_TABLE (PREFIX_0F5B) },
2015   { PREFIX_TABLE (PREFIX_0F5C) },
2016   { PREFIX_TABLE (PREFIX_0F5D) },
2017   { PREFIX_TABLE (PREFIX_0F5E) },
2018   { PREFIX_TABLE (PREFIX_0F5F) },
2019   /* 60 */
2020   { PREFIX_TABLE (PREFIX_0F60) },
2021   { PREFIX_TABLE (PREFIX_0F61) },
2022   { PREFIX_TABLE (PREFIX_0F62) },
2023   { "packsswb",         { MX, EM } },
2024   { "pcmpgtb",          { MX, EM } },
2025   { "pcmpgtw",          { MX, EM } },
2026   { "pcmpgtd",          { MX, EM } },
2027   { "packuswb",         { MX, EM } },
2028   /* 68 */
2029   { "punpckhbw",        { MX, EM } },
2030   { "punpckhwd",        { MX, EM } },
2031   { "punpckhdq",        { MX, EM } },
2032   { "packssdw",         { MX, EM } },
2033   { PREFIX_TABLE (PREFIX_0F6C) },
2034   { PREFIX_TABLE (PREFIX_0F6D) },
2035   { "movK",             { MX, Edq } },
2036   { PREFIX_TABLE (PREFIX_0F6F) },
2037   /* 70 */
2038   { PREFIX_TABLE (PREFIX_0F70) },
2039   { REG_TABLE (REG_0F71) },
2040   { REG_TABLE (REG_0F72) },
2041   { REG_TABLE (REG_0F73) },
2042   { "pcmpeqb",          { MX, EM } },
2043   { "pcmpeqw",          { MX, EM } },
2044   { "pcmpeqd",          { MX, EM } },
2045   { "emms",             { XX } },
2046   /* 78 */
2047   { PREFIX_TABLE (PREFIX_0F78) },
2048   { PREFIX_TABLE (PREFIX_0F79) },
2049   { THREE_BYTE_TABLE (THREE_BYTE_0F7A) },
2050   { "(bad)",            { XX } },
2051   { PREFIX_TABLE (PREFIX_0F7C) },
2052   { PREFIX_TABLE (PREFIX_0F7D) },
2053   { PREFIX_TABLE (PREFIX_0F7E) },
2054   { PREFIX_TABLE (PREFIX_0F7F) },
2055   /* 80 */
2056   { "joH",              { Jv, XX, cond_jump_flag } },
2057   { "jnoH",             { Jv, XX, cond_jump_flag } },
2058   { "jbH",              { Jv, XX, cond_jump_flag } },
2059   { "jaeH",             { Jv, XX, cond_jump_flag } },
2060   { "jeH",              { Jv, XX, cond_jump_flag } },
2061   { "jneH",             { Jv, XX, cond_jump_flag } },
2062   { "jbeH",             { Jv, XX, cond_jump_flag } },
2063   { "jaH",              { Jv, XX, cond_jump_flag } },
2064   /* 88 */
2065   { "jsH",              { Jv, XX, cond_jump_flag } },
2066   { "jnsH",             { Jv, XX, cond_jump_flag } },
2067   { "jpH",              { Jv, XX, cond_jump_flag } },
2068   { "jnpH",             { Jv, XX, cond_jump_flag } },
2069   { "jlH",              { Jv, XX, cond_jump_flag } },
2070   { "jgeH",             { Jv, XX, cond_jump_flag } },
2071   { "jleH",             { Jv, XX, cond_jump_flag } },
2072   { "jgH",              { Jv, XX, cond_jump_flag } },
2073   /* 90 */
2074   { "seto",             { Eb } },
2075   { "setno",            { Eb } },
2076   { "setb",             { Eb } },
2077   { "setae",            { Eb } },
2078   { "sete",             { Eb } },
2079   { "setne",            { Eb } },
2080   { "setbe",            { Eb } },
2081   { "seta",             { Eb } },
2082   /* 98 */
2083   { "sets",             { Eb } },
2084   { "setns",            { Eb } },
2085   { "setp",             { Eb } },
2086   { "setnp",            { Eb } },
2087   { "setl",             { Eb } },
2088   { "setge",            { Eb } },
2089   { "setle",            { Eb } },
2090   { "setg",             { Eb } },
2091   /* a0 */
2092   { "pushT",            { fs } },
2093   { "popT",             { fs } },
2094   { "cpuid",            { XX } },
2095   { "btS",              { Ev, Gv } },
2096   { "shldS",            { Ev, Gv, Ib } },
2097   { "shldS",            { Ev, Gv, CL } },
2098   { REG_TABLE (REG_0FA6) },
2099   { REG_TABLE (REG_0FA7) },
2100   /* a8 */
2101   { "pushT",            { gs } },
2102   { "popT",             { gs } },
2103   { "rsm",              { XX } },
2104   { "btsS",             { Ev, Gv } },
2105   { "shrdS",            { Ev, Gv, Ib } },
2106   { "shrdS",            { Ev, Gv, CL } },
2107   { REG_TABLE (REG_0FAE) },
2108   { "imulS",            { Gv, Ev } },
2109   /* b0 */
2110   { "cmpxchgB",         { Eb, Gb } },
2111   { "cmpxchgS",         { Ev, Gv } },
2112   { MOD_TABLE (MOD_0FB2) },
2113   { "btrS",             { Ev, Gv } },
2114   { MOD_TABLE (MOD_0FB4) },
2115   { MOD_TABLE (MOD_0FB5) },
2116   { "movz{bR|x}",       { Gv, Eb } },
2117   { "movz{wR|x}",       { Gv, Ew } }, /* yes, there really is movzww ! */
2118   /* b8 */
2119   { PREFIX_TABLE (PREFIX_0FB8) },
2120   { "ud2b",             { XX } },
2121   { REG_TABLE (REG_0FBA) },
2122   { "btcS",             { Ev, Gv } },
2123   { "bsfS",             { Gv, Ev } },
2124   { PREFIX_TABLE (PREFIX_0FBD) },
2125   { "movs{bR|x}",       { Gv, Eb } },
2126   { "movs{wR|x}",       { Gv, Ew } }, /* yes, there really is movsww ! */
2127   /* c0 */
2128   { "xaddB",            { Eb, Gb } },
2129   { "xaddS",            { Ev, Gv } },
2130   { PREFIX_TABLE (PREFIX_0FC2) },
2131   { PREFIX_TABLE (PREFIX_0FC3) },
2132   { "pinsrw",           { MX, Edqw, Ib } },
2133   { "pextrw",           { Gdq, MS, Ib } },
2134   { "shufpX",           { XM, EXx, Ib } },
2135   { REG_TABLE (REG_0FC7) },
2136   /* c8 */
2137   { "bswap",            { RMeAX } },
2138   { "bswap",            { RMeCX } },
2139   { "bswap",            { RMeDX } },
2140   { "bswap",            { RMeBX } },
2141   { "bswap",            { RMeSP } },
2142   { "bswap",            { RMeBP } },
2143   { "bswap",            { RMeSI } },
2144   { "bswap",            { RMeDI } },
2145   /* d0 */
2146   { PREFIX_TABLE (PREFIX_0FD0) },
2147   { "psrlw",            { MX, EM } },
2148   { "psrld",            { MX, EM } },
2149   { "psrlq",            { MX, EM } },
2150   { "paddq",            { MX, EM } },
2151   { "pmullw",           { MX, EM } },
2152   { PREFIX_TABLE (PREFIX_0FD6) },
2153   { MOD_TABLE (MOD_0FD7) },
2154   /* d8 */
2155   { "psubusb",          { MX, EM } },
2156   { "psubusw",          { MX, EM } },
2157   { "pminub",           { MX, EM } },
2158   { "pand",             { MX, EM } },
2159   { "paddusb",          { MX, EM } },
2160   { "paddusw",          { MX, EM } },
2161   { "pmaxub",           { MX, EM } },
2162   { "pandn",            { MX, EM } },
2163   /* e0 */
2164   { "pavgb",            { MX, EM } },
2165   { "psraw",            { MX, EM } },
2166   { "psrad",            { MX, EM } },
2167   { "pavgw",            { MX, EM } },
2168   { "pmulhuw",          { MX, EM } },
2169   { "pmulhw",           { MX, EM } },
2170   { PREFIX_TABLE (PREFIX_0FE6) },
2171   { PREFIX_TABLE (PREFIX_0FE7) },
2172   /* e8 */
2173   { "psubsb",           { MX, EM } },
2174   { "psubsw",           { MX, EM } },
2175   { "pminsw",           { MX, EM } },
2176   { "por",              { MX, EM } },
2177   { "paddsb",           { MX, EM } },
2178   { "paddsw",           { MX, EM } },
2179   { "pmaxsw",           { MX, EM } },
2180   { "pxor",             { MX, EM } },
2181   /* f0 */
2182   { PREFIX_TABLE (PREFIX_0FF0) },
2183   { "psllw",            { MX, EM } },
2184   { "pslld",            { MX, EM } },
2185   { "psllq",            { MX, EM } },
2186   { "pmuludq",          { MX, EM } },
2187   { "pmaddwd",          { MX, EM } },
2188   { "psadbw",           { MX, EM } },
2189   { PREFIX_TABLE (PREFIX_0FF7) },
2190   /* f8 */
2191   { "psubb",            { MX, EM } },
2192   { "psubw",            { MX, EM } },
2193   { "psubd",            { MX, EM } },
2194   { "psubq",            { MX, EM } },
2195   { "paddb",            { MX, EM } },
2196   { "paddw",            { MX, EM } },
2197   { "paddd",            { MX, EM } },
2198   { "(bad)",            { XX } },
2199 };
2200
2201 static const unsigned char onebyte_has_modrm[256] = {
2202   /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
2203   /*       -------------------------------        */
2204   /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
2205   /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
2206   /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
2207   /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
2208   /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
2209   /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
2210   /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
2211   /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
2212   /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
2213   /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
2214   /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
2215   /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
2216   /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
2217   /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
2218   /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
2219   /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1  /* f0 */
2220   /*       -------------------------------        */
2221   /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
2222 };
2223
2224 static const unsigned char twobyte_has_modrm[256] = {
2225   /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
2226   /*       -------------------------------        */
2227   /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
2228   /* 10 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 1f */
2229   /* 20 */ 1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1, /* 2f */
2230   /* 30 */ 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, /* 3f */
2231   /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
2232   /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */
2233   /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */
2234   /* 70 */ 1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1, /* 7f */
2235   /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
2236   /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
2237   /* a0 */ 0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1, /* af */
2238   /* b0 */ 1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1, /* bf */
2239   /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
2240   /* d0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
2241   /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
2242   /* f0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0  /* ff */
2243   /*       -------------------------------        */
2244   /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
2245 };
2246
2247 static char obuf[100];
2248 static char *obufp;
2249 static char *mnemonicendp;
2250 static char scratchbuf[100];
2251 static unsigned char *start_codep;
2252 static unsigned char *insn_codep;
2253 static unsigned char *codep;
2254 static int last_lock_prefix;
2255 static int last_repz_prefix;
2256 static int last_repnz_prefix;
2257 static int last_data_prefix;
2258 static int last_addr_prefix;
2259 static int last_rex_prefix;
2260 static int last_seg_prefix;
2261 #define MAX_CODE_LENGTH 15
2262 /* We can up to 14 prefixes since the maximum instruction length is
2263    15bytes.  */
2264 static int all_prefixes[MAX_CODE_LENGTH - 1];
2265 static disassemble_info *the_info;
2266 static struct
2267   {
2268     int mod;
2269     int reg;
2270     int rm;
2271   }
2272 modrm;
2273 static unsigned char need_modrm;
2274 static struct
2275   {
2276     int register_specifier;
2277     int length;
2278     int prefix;
2279     int w;
2280   }
2281 vex;
2282 static unsigned char need_vex;
2283 static unsigned char need_vex_reg;
2284 static unsigned char vex_w_done;
2285
2286 struct op
2287   {
2288     const char *name;
2289     unsigned int len;
2290   };
2291
2292 /* If we are accessing mod/rm/reg without need_modrm set, then the
2293    values are stale.  Hitting this abort likely indicates that you
2294    need to update onebyte_has_modrm or twobyte_has_modrm.  */
2295 #define MODRM_CHECK  if (!need_modrm) abort ()
2296
2297 static const char **names64;
2298 static const char **names32;
2299 static const char **names16;
2300 static const char **names8;
2301 static const char **names8rex;
2302 static const char **names_seg;
2303 static const char *index64;
2304 static const char *index32;
2305 static const char **index16;
2306
2307 static const char *intel_names64[] = {
2308   "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
2309   "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
2310 };
2311 static const char *intel_names32[] = {
2312   "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
2313   "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
2314 };
2315 static const char *intel_names16[] = {
2316   "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
2317   "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
2318 };
2319 static const char *intel_names8[] = {
2320   "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
2321 };
2322 static const char *intel_names8rex[] = {
2323   "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil",
2324   "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"
2325 };
2326 static const char *intel_names_seg[] = {
2327   "es", "cs", "ss", "ds", "fs", "gs", "?", "?",
2328 };
2329 static const char *intel_index64 = "riz";
2330 static const char *intel_index32 = "eiz";
2331 static const char *intel_index16[] = {
2332   "bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx"
2333 };
2334
2335 static const char *att_names64[] = {
2336   "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
2337   "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
2338 };
2339 static const char *att_names32[] = {
2340   "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
2341   "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
2342 };
2343 static const char *att_names16[] = {
2344   "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
2345   "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
2346 };
2347 static const char *att_names8[] = {
2348   "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh",
2349 };
2350 static const char *att_names8rex[] = {
2351   "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
2352   "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
2353 };
2354 static const char *att_names_seg[] = {
2355   "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "%?", "%?",
2356 };
2357 static const char *att_index64 = "%riz";
2358 static const char *att_index32 = "%eiz";
2359 static const char *att_index16[] = {
2360   "%bx,%si", "%bx,%di", "%bp,%si", "%bp,%di", "%si", "%di", "%bp", "%bx"
2361 };
2362
2363 static const struct dis386 reg_table[][8] = {
2364   /* REG_80 */
2365   {
2366     { "addA",   { Eb, Ib } },
2367     { "orA",    { Eb, Ib } },
2368     { "adcA",   { Eb, Ib } },
2369     { "sbbA",   { Eb, Ib } },
2370     { "andA",   { Eb, Ib } },
2371     { "subA",   { Eb, Ib } },
2372     { "xorA",   { Eb, Ib } },
2373     { "cmpA",   { Eb, Ib } },
2374   },
2375   /* REG_81 */
2376   {
2377     { "addQ",   { Ev, Iv } },
2378     { "orQ",    { Ev, Iv } },
2379     { "adcQ",   { Ev, Iv } },
2380     { "sbbQ",   { Ev, Iv } },
2381     { "andQ",   { Ev, Iv } },
2382     { "subQ",   { Ev, Iv } },
2383     { "xorQ",   { Ev, Iv } },
2384     { "cmpQ",   { Ev, Iv } },
2385   },
2386   /* REG_82 */
2387   {
2388     { "addQ",   { Ev, sIb } },
2389     { "orQ",    { Ev, sIb } },
2390     { "adcQ",   { Ev, sIb } },
2391     { "sbbQ",   { Ev, sIb } },
2392     { "andQ",   { Ev, sIb } },
2393     { "subQ",   { Ev, sIb } },
2394     { "xorQ",   { Ev, sIb } },
2395     { "cmpQ",   { Ev, sIb } },
2396   },
2397   /* REG_8F */
2398   {
2399     { "popU",   { stackEv } },
2400     { XOP_8F_TABLE (XOP_09) },
2401     { "(bad)",  { XX } },
2402     { "(bad)",  { XX } },
2403     { "(bad)",  { XX } },
2404     { XOP_8F_TABLE (XOP_09) },
2405     { "(bad)",  { XX } },
2406     { "(bad)",  { XX } },
2407   },
2408   /* REG_C0 */
2409   {
2410     { "rolA",   { Eb, Ib } },
2411     { "rorA",   { Eb, Ib } },
2412     { "rclA",   { Eb, Ib } },
2413     { "rcrA",   { Eb, Ib } },
2414     { "shlA",   { Eb, Ib } },
2415     { "shrA",   { Eb, Ib } },
2416     { "(bad)",  { XX } },
2417     { "sarA",   { Eb, Ib } },
2418   },
2419   /* REG_C1 */
2420   {
2421     { "rolQ",   { Ev, Ib } },
2422     { "rorQ",   { Ev, Ib } },
2423     { "rclQ",   { Ev, Ib } },
2424     { "rcrQ",   { Ev, Ib } },
2425     { "shlQ",   { Ev, Ib } },
2426     { "shrQ",   { Ev, Ib } },
2427     { "(bad)",  { XX } },
2428     { "sarQ",   { Ev, Ib } },
2429   },
2430   /* REG_C6 */
2431   {
2432     { "movA",   { Eb, Ib } },
2433     { "(bad)",  { XX } },
2434     { "(bad)",  { XX } },
2435     { "(bad)",  { XX } },
2436     { "(bad)",  { XX } },
2437     { "(bad)",  { XX } },
2438     { "(bad)",  { XX } },
2439     { "(bad)",  { XX } },
2440   },
2441   /* REG_C7 */
2442   {
2443     { "movQ",   { Ev, Iv } },
2444     { "(bad)",  { XX } },
2445     { "(bad)",  { XX } },
2446     { "(bad)",  { XX } },
2447     { "(bad)",  { XX } },
2448     { "(bad)",  { XX } },
2449     { "(bad)",  { XX } },
2450     { "(bad)",  { XX } },
2451   },
2452   /* REG_D0 */
2453   {
2454     { "rolA",   { Eb, I1 } },
2455     { "rorA",   { Eb, I1 } },
2456     { "rclA",   { Eb, I1 } },
2457     { "rcrA",   { Eb, I1 } },
2458     { "shlA",   { Eb, I1 } },
2459     { "shrA",   { Eb, I1 } },
2460     { "(bad)",  { XX } },
2461     { "sarA",   { Eb, I1 } },
2462   },
2463   /* REG_D1 */
2464   {
2465     { "rolQ",   { Ev, I1 } },
2466     { "rorQ",   { Ev, I1 } },
2467     { "rclQ",   { Ev, I1 } },
2468     { "rcrQ",   { Ev, I1 } },
2469     { "shlQ",   { Ev, I1 } },
2470     { "shrQ",   { Ev, I1 } },
2471     { "(bad)",  { XX } },
2472     { "sarQ",   { Ev, I1 } },
2473   },
2474   /* REG_D2 */
2475   {
2476     { "rolA",   { Eb, CL } },
2477     { "rorA",   { Eb, CL } },
2478     { "rclA",   { Eb, CL } },
2479     { "rcrA",   { Eb, CL } },
2480     { "shlA",   { Eb, CL } },
2481     { "shrA",   { Eb, CL } },
2482     { "(bad)",  { XX } },
2483     { "sarA",   { Eb, CL } },
2484   },
2485   /* REG_D3 */
2486   {
2487     { "rolQ",   { Ev, CL } },
2488     { "rorQ",   { Ev, CL } },
2489     { "rclQ",   { Ev, CL } },
2490     { "rcrQ",   { Ev, CL } },
2491     { "shlQ",   { Ev, CL } },
2492     { "shrQ",   { Ev, CL } },
2493     { "(bad)",  { XX } },
2494     { "sarQ",   { Ev, CL } },
2495   },
2496   /* REG_F6 */
2497   {
2498     { "testA",  { Eb, Ib } },
2499     { "(bad)",  { XX } },
2500     { "notA",   { Eb } },
2501     { "negA",   { Eb } },
2502     { "mulA",   { Eb } },       /* Don't print the implicit %al register,  */
2503     { "imulA",  { Eb } },       /* to distinguish these opcodes from other */
2504     { "divA",   { Eb } },       /* mul/imul opcodes.  Do the same for div  */
2505     { "idivA",  { Eb } },       /* and idiv for consistency.               */
2506   },
2507   /* REG_F7 */
2508   {
2509     { "testQ",  { Ev, Iv } },
2510     { "(bad)",  { XX } },
2511     { "notQ",   { Ev } },
2512     { "negQ",   { Ev } },
2513     { "mulQ",   { Ev } },       /* Don't print the implicit register.  */
2514     { "imulQ",  { Ev } },
2515     { "divQ",   { Ev } },
2516     { "idivQ",  { Ev } },
2517   },
2518   /* REG_FE */
2519   {
2520     { "incA",   { Eb } },
2521     { "decA",   { Eb } },
2522     { "(bad)",  { XX } },
2523     { "(bad)",  { XX } },
2524     { "(bad)",  { XX } },
2525     { "(bad)",  { XX } },
2526     { "(bad)",  { XX } },
2527     { "(bad)",  { XX } },
2528   },
2529   /* REG_FF */
2530   {
2531     { "incQ",   { Ev } },
2532     { "decQ",   { Ev } },
2533     { "callT",  { indirEv } },
2534     { "JcallT", { indirEp } },
2535     { "jmpT",   { indirEv } },
2536     { "JjmpT",  { indirEp } },
2537     { "pushU",  { stackEv } },
2538     { "(bad)",  { XX } },
2539   },
2540   /* REG_0F00 */
2541   {
2542     { "sldtD",  { Sv } },
2543     { "strD",   { Sv } },
2544     { "lldt",   { Ew } },
2545     { "ltr",    { Ew } },
2546     { "verr",   { Ew } },
2547     { "verw",   { Ew } },
2548     { "(bad)",  { XX } },
2549     { "(bad)",  { XX } },
2550   },
2551   /* REG_0F01 */
2552   {
2553     { MOD_TABLE (MOD_0F01_REG_0) },
2554     { MOD_TABLE (MOD_0F01_REG_1) },
2555     { MOD_TABLE (MOD_0F01_REG_2) },
2556     { MOD_TABLE (MOD_0F01_REG_3) },
2557     { "smswD",  { Sv } },
2558     { "(bad)",  { XX } },
2559     { "lmsw",   { Ew } },
2560     { MOD_TABLE (MOD_0F01_REG_7) },
2561   },
2562   /* REG_0F0D */
2563   {
2564     { "prefetch",       { Eb } },
2565     { "prefetchw",      { Eb } },
2566     { "(bad)",          { XX } },
2567     { "(bad)",          { XX } },
2568     { "(bad)",          { XX } },
2569     { "(bad)",          { XX } },
2570     { "(bad)",          { XX } },
2571     { "(bad)",          { XX } },
2572   },
2573   /* REG_0F18 */
2574   {
2575     { MOD_TABLE (MOD_0F18_REG_0) },
2576     { MOD_TABLE (MOD_0F18_REG_1) },
2577     { MOD_TABLE (MOD_0F18_REG_2) },
2578     { MOD_TABLE (MOD_0F18_REG_3) },
2579     { "(bad)",  { XX } },
2580     { "(bad)",  { XX } },
2581     { "(bad)",  { XX } },
2582     { "(bad)",  { XX } },
2583   },
2584   /* REG_0F71 */
2585   {
2586     { "(bad)",  { XX } },
2587     { "(bad)",  { XX } },
2588     { MOD_TABLE (MOD_0F71_REG_2) },
2589     { "(bad)",  { XX } },
2590     { MOD_TABLE (MOD_0F71_REG_4) },
2591     { "(bad)",  { XX } },
2592     { MOD_TABLE (MOD_0F71_REG_6) },
2593     { "(bad)",  { XX } },
2594   },
2595   /* REG_0F72 */
2596   {
2597     { "(bad)",  { XX } },
2598     { "(bad)",  { XX } },
2599     { MOD_TABLE (MOD_0F72_REG_2) },
2600     { "(bad)",  { XX } },
2601     { MOD_TABLE (MOD_0F72_REG_4) },
2602     { "(bad)",  { XX } },
2603     { MOD_TABLE (MOD_0F72_REG_6) },
2604     { "(bad)",  { XX } },
2605   },
2606   /* REG_0F73 */
2607   {
2608     { "(bad)",  { XX } },
2609     { "(bad)",  { XX } },
2610     { MOD_TABLE (MOD_0F73_REG_2) },
2611     { MOD_TABLE (MOD_0F73_REG_3) },
2612     { "(bad)",  { XX } },
2613     { "(bad)",  { XX } },
2614     { MOD_TABLE (MOD_0F73_REG_6) },
2615     { MOD_TABLE (MOD_0F73_REG_7) },
2616   },
2617   /* REG_0FA6 */
2618   {
2619     { "montmul",        { { OP_0f07, 0 } } },
2620     { "xsha1",          { { OP_0f07, 0 } } },
2621     { "xsha256",        { { OP_0f07, 0 } } },
2622     { "(bad)",          { { OP_0f07, 0 } } },
2623     { "(bad)",          { { OP_0f07, 0 } } },
2624     { "(bad)",          { { OP_0f07, 0 } } },
2625     { "(bad)",          { { OP_0f07, 0 } } },
2626     { "(bad)",          { { OP_0f07, 0 } } },
2627   },
2628   /* REG_0FA7 */
2629   {
2630     { "xstore-rng",     { { OP_0f07, 0 } } },
2631     { "xcrypt-ecb",     { { OP_0f07, 0 } } },
2632     { "xcrypt-cbc",     { { OP_0f07, 0 } } },
2633     { "xcrypt-ctr",     { { OP_0f07, 0 } } },
2634     { "xcrypt-cfb",     { { OP_0f07, 0 } } },
2635     { "xcrypt-ofb",     { { OP_0f07, 0 } } },
2636     { "(bad)",          { { OP_0f07, 0 } } },
2637     { "(bad)",          { { OP_0f07, 0 } } },
2638   },
2639   /* REG_0FAE */
2640   {
2641     { MOD_TABLE (MOD_0FAE_REG_0) },
2642     { MOD_TABLE (MOD_0FAE_REG_1) },
2643     { MOD_TABLE (MOD_0FAE_REG_2) },
2644     { MOD_TABLE (MOD_0FAE_REG_3) },
2645     { MOD_TABLE (MOD_0FAE_REG_4) },
2646     { MOD_TABLE (MOD_0FAE_REG_5) },
2647     { MOD_TABLE (MOD_0FAE_REG_6) },
2648     { MOD_TABLE (MOD_0FAE_REG_7) },
2649   },
2650   /* REG_0FBA */
2651   {
2652     { "(bad)",  { XX } },
2653     { "(bad)",  { XX } },
2654     { "(bad)",  { XX } },
2655     { "(bad)",  { XX } },
2656     { "btQ",    { Ev, Ib } },
2657     { "btsQ",   { Ev, Ib } },
2658     { "btrQ",   { Ev, Ib } },
2659     { "btcQ",   { Ev, Ib } },
2660   },
2661   /* REG_0FC7 */
2662   {
2663     { "(bad)",  { XX } },
2664     { "cmpxchg8b", { { CMPXCHG8B_Fixup, q_mode } } },
2665     { "(bad)",  { XX } },
2666     { "(bad)",  { XX } },
2667     { "(bad)",  { XX } },
2668     { "(bad)",  { XX } },
2669     { MOD_TABLE (MOD_0FC7_REG_6) },
2670     { MOD_TABLE (MOD_0FC7_REG_7) },
2671   },
2672   /* REG_VEX_71 */
2673   {
2674     { "(bad)",  { XX } },
2675     { "(bad)",  { XX } },
2676     { MOD_TABLE (MOD_VEX_71_REG_2) },
2677     { "(bad)",  { XX } },
2678     { MOD_TABLE (MOD_VEX_71_REG_4) },
2679     { "(bad)",  { XX } },
2680     { MOD_TABLE (MOD_VEX_71_REG_6) },
2681     { "(bad)",  { XX } },
2682   },
2683   /* REG_VEX_72 */
2684   {
2685     { "(bad)",  { XX } },
2686     { "(bad)",  { XX } },
2687     { MOD_TABLE (MOD_VEX_72_REG_2) },
2688     { "(bad)",  { XX } },
2689     { MOD_TABLE (MOD_VEX_72_REG_4) },
2690     { "(bad)",  { XX } },
2691     { MOD_TABLE (MOD_VEX_72_REG_6) },
2692     { "(bad)",  { XX } },
2693   },
2694   /* REG_VEX_73 */
2695   {
2696     { "(bad)",  { XX } },
2697     { "(bad)",  { XX } },
2698     { MOD_TABLE (MOD_VEX_73_REG_2) },
2699     { MOD_TABLE (MOD_VEX_73_REG_3) },
2700     { "(bad)",  { XX } },
2701     { "(bad)",  { XX } },
2702     { MOD_TABLE (MOD_VEX_73_REG_6) },
2703     { MOD_TABLE (MOD_VEX_73_REG_7) },
2704   },
2705   /* REG_VEX_AE */
2706   {
2707     { "(bad)",  { XX } },
2708     { "(bad)",  { XX } },
2709     { MOD_TABLE (MOD_VEX_AE_REG_2) },
2710     { MOD_TABLE (MOD_VEX_AE_REG_3) },
2711     { "(bad)",  { XX } },
2712     { "(bad)",  { XX } },
2713     { "(bad)",  { XX } },
2714     { "(bad)",  { XX } },
2715   },
2716   /* REG_XOP_LWPCB */
2717   {
2718     { "llwpcb", { { OP_LWPCB_E, 0 } } },
2719     { "slwpcb", { { OP_LWPCB_E, 0 } } },
2720     { "(bad)",  { XX } },
2721     { "(bad)",  { XX } },
2722     { "(bad)",  { XX } },
2723     { "(bad)",  { XX } },
2724     { "(bad)",  { XX } },
2725     { "(bad)",  { XX } },
2726   },
2727   /* REG_XOP_LWP */
2728   {
2729     { "lwpins", { { OP_LWP_E, 0 }, Ed, { OP_LWP_I, 0 } } },
2730     { "lwpval", { { OP_LWP_E, 0 }, Ed, { OP_LWP_I, 0 } } },
2731     { "(bad)",  { XX } },
2732     { "(bad)",  { XX } },
2733     { "(bad)",  { XX } },
2734     { "(bad)",  { XX } },
2735     { "(bad)",  { XX } },
2736     { "(bad)",  { XX } },
2737   },
2738 };
2739
2740 static const struct dis386 prefix_table[][4] = {
2741   /* PREFIX_90 */
2742   {
2743     { "xchgS", { { NOP_Fixup1, eAX_reg }, { NOP_Fixup2, eAX_reg } } },
2744     { "pause", { XX } },
2745     { "xchgS", { { NOP_Fixup1, eAX_reg }, { NOP_Fixup2, eAX_reg } } },
2746     { "(bad)", { XX } },
2747   },
2748
2749   /* PREFIX_0F10 */
2750   {
2751     { "movups", { XM, EXx } },
2752     { "movss",  { XM, EXd } },
2753     { "movupd", { XM, EXx } },
2754     { "movsd",  { XM, EXq } },
2755   },
2756
2757   /* PREFIX_0F11 */
2758   {
2759     { "movups", { EXxS, XM } },
2760     { "movss",  { EXdS, XM } },
2761     { "movupd", { EXxS, XM } },
2762     { "movsd",  { EXqS, XM } },
2763   },
2764
2765   /* PREFIX_0F12 */
2766   {
2767     { MOD_TABLE (MOD_0F12_PREFIX_0) },
2768     { "movsldup", { XM, EXx } },
2769     { "movlpd", { XM, EXq } },
2770     { "movddup", { XM, EXq } },
2771   },
2772
2773   /* PREFIX_0F16 */
2774   {
2775     { MOD_TABLE (MOD_0F16_PREFIX_0) },
2776     { "movshdup", { XM, EXx } },
2777     { "movhpd", { XM, EXq } },
2778     { "(bad)",  { XX } },
2779   },
2780
2781   /* PREFIX_0F2A */
2782   {
2783     { "cvtpi2ps", { XM, EMCq } },
2784     { "cvtsi2ss%LQ", { XM, Ev } },
2785     { "cvtpi2pd", { XM, EMCq } },
2786     { "cvtsi2sd%LQ", { XM, Ev } },
2787   },
2788
2789   /* PREFIX_0F2B */
2790   {
2791     { MOD_TABLE (MOD_0F2B_PREFIX_0) },
2792     { MOD_TABLE (MOD_0F2B_PREFIX_1) },
2793     { MOD_TABLE (MOD_0F2B_PREFIX_2) },
2794     { MOD_TABLE (MOD_0F2B_PREFIX_3) },
2795   },
2796
2797   /* PREFIX_0F2C */
2798   {
2799     { "cvttps2pi", { MXC, EXq } },
2800     { "cvttss2siY", { Gv, EXd } },
2801     { "cvttpd2pi", { MXC, EXx } },
2802     { "cvttsd2siY", { Gv, EXq } },
2803   },
2804
2805   /* PREFIX_0F2D */
2806   {
2807     { "cvtps2pi", { MXC, EXq } },
2808     { "cvtss2siY", { Gv, EXd } },
2809     { "cvtpd2pi", { MXC, EXx } },
2810     { "cvtsd2siY", { Gv, EXq } },
2811   },
2812
2813   /* PREFIX_0F2E */
2814   {
2815     { "ucomiss",{ XM, EXd } }, 
2816     { "(bad)",  { XX } },
2817     { "ucomisd",{ XM, EXq } }, 
2818     { "(bad)",  { XX } },
2819   },
2820
2821   /* PREFIX_0F2F */
2822   {
2823     { "comiss", { XM, EXd } },
2824     { "(bad)",  { XX } },
2825     { "comisd", { XM, EXq } },
2826     { "(bad)",  { XX } },
2827   },
2828
2829   /* PREFIX_0F51 */
2830   {
2831     { "sqrtps", { XM, EXx } },
2832     { "sqrtss", { XM, EXd } },
2833     { "sqrtpd", { XM, EXx } },
2834     { "sqrtsd", { XM, EXq } },
2835   },
2836
2837   /* PREFIX_0F52 */
2838   {
2839     { "rsqrtps",{ XM, EXx } },
2840     { "rsqrtss",{ XM, EXd } },
2841     { "(bad)",  { XX } },
2842     { "(bad)",  { XX } },
2843   },
2844
2845   /* PREFIX_0F53 */
2846   {
2847     { "rcpps",  { XM, EXx } },
2848     { "rcpss",  { XM, EXd } },
2849     { "(bad)",  { XX } },
2850     { "(bad)",  { XX } },
2851   },
2852
2853   /* PREFIX_0F58 */
2854   {
2855     { "addps", { XM, EXx } },
2856     { "addss", { XM, EXd } },
2857     { "addpd", { XM, EXx } },
2858     { "addsd", { XM, EXq } },
2859   },
2860
2861   /* PREFIX_0F59 */
2862   {
2863     { "mulps",  { XM, EXx } },
2864     { "mulss",  { XM, EXd } },
2865     { "mulpd",  { XM, EXx } },
2866     { "mulsd",  { XM, EXq } },
2867   },
2868
2869   /* PREFIX_0F5A */
2870   {
2871     { "cvtps2pd", { XM, EXq } },
2872     { "cvtss2sd", { XM, EXd } },
2873     { "cvtpd2ps", { XM, EXx } },
2874     { "cvtsd2ss", { XM, EXq } },
2875   },
2876
2877   /* PREFIX_0F5B */
2878   {
2879     { "cvtdq2ps", { XM, EXx } },
2880     { "cvttps2dq", { XM, EXx } },
2881     { "cvtps2dq", { XM, EXx } },
2882     { "(bad)",  { XX } },
2883   },
2884
2885   /* PREFIX_0F5C */
2886   {
2887     { "subps",  { XM, EXx } },
2888     { "subss",  { XM, EXd } },
2889     { "subpd",  { XM, EXx } },
2890     { "subsd",  { XM, EXq } },
2891   },
2892
2893   /* PREFIX_0F5D */
2894   {
2895     { "minps",  { XM, EXx } },
2896     { "minss",  { XM, EXd } },
2897     { "minpd",  { XM, EXx } },
2898     { "minsd",  { XM, EXq } },
2899   },
2900
2901   /* PREFIX_0F5E */
2902   {
2903     { "divps",  { XM, EXx } },
2904     { "divss",  { XM, EXd } },
2905     { "divpd",  { XM, EXx } },
2906     { "divsd",  { XM, EXq } },
2907   },
2908
2909   /* PREFIX_0F5F */
2910   {
2911     { "maxps",  { XM, EXx } },
2912     { "maxss",  { XM, EXd } },
2913     { "maxpd",  { XM, EXx } },
2914     { "maxsd",  { XM, EXq } },
2915   },
2916
2917   /* PREFIX_0F60 */
2918   {
2919     { "punpcklbw",{ MX, EMd } },
2920     { "(bad)",  { XX } },
2921     { "punpcklbw",{ MX, EMx } },
2922     { "(bad)",  { XX } },
2923   },
2924
2925   /* PREFIX_0F61 */
2926   {
2927     { "punpcklwd",{ MX, EMd } },
2928     { "(bad)",  { XX } },
2929     { "punpcklwd",{ MX, EMx } },
2930     { "(bad)",  { XX } },
2931   },
2932
2933   /* PREFIX_0F62 */
2934   {
2935     { "punpckldq",{ MX, EMd } },
2936     { "(bad)",  { XX } },
2937     { "punpckldq",{ MX, EMx } },
2938     { "(bad)",  { XX } },
2939   },
2940
2941   /* PREFIX_0F6C */
2942   {
2943     { "(bad)",  { XX } },
2944     { "(bad)",  { XX } },
2945     { "punpcklqdq", { XM, EXx } },
2946     { "(bad)",  { XX } },
2947   },
2948
2949   /* PREFIX_0F6D */
2950   {
2951     { "(bad)",  { XX } },
2952     { "(bad)",  { XX } },
2953     { "punpckhqdq", { XM, EXx } },
2954     { "(bad)",  { XX } },
2955   },
2956
2957   /* PREFIX_0F6F */
2958   {
2959     { "movq",   { MX, EM } },
2960     { "movdqu", { XM, EXx } },
2961     { "movdqa", { XM, EXx } },
2962     { "(bad)",  { XX } },
2963   },
2964
2965   /* PREFIX_0F70 */
2966   {
2967     { "pshufw", { MX, EM, Ib } },
2968     { "pshufhw",{ XM, EXx, Ib } },
2969     { "pshufd", { XM, EXx, Ib } },
2970     { "pshuflw",{ XM, EXx, Ib } },
2971   },
2972
2973   /* PREFIX_0F73_REG_3 */
2974   {
2975     { "(bad)",  { XX } },
2976     { "(bad)",  { XX } },
2977     { "psrldq", { XS, Ib } },
2978     { "(bad)",  { XX } },
2979   },
2980
2981   /* PREFIX_0F73_REG_7 */
2982   {
2983     { "(bad)",  { XX } },
2984     { "(bad)",  { XX } },
2985     { "pslldq", { XS, Ib } },
2986     { "(bad)",  { XX } },
2987   },
2988
2989   /* PREFIX_0F78 */
2990   {
2991     {"vmread",  { Em, Gm } },
2992     {"(bad)",   { XX } },
2993     {"extrq",   { XS, Ib, Ib } },
2994     {"insertq", { XM, XS, Ib, Ib } },
2995   },
2996
2997   /* PREFIX_0F79 */
2998   {
2999     {"vmwrite", { Gm, Em } },
3000     {"(bad)",   { XX } },
3001     {"extrq",   { XM, XS } },
3002     {"insertq", { XM, XS } },
3003   },
3004
3005   /* PREFIX_0F7C */
3006   {
3007     { "(bad)",  { XX } },
3008     { "(bad)",  { XX } },
3009     { "haddpd", { XM, EXx } },
3010     { "haddps", { XM, EXx } },
3011   },
3012
3013   /* PREFIX_0F7D */
3014   {
3015     { "(bad)",  { XX } },
3016     { "(bad)",  { XX } },
3017     { "hsubpd", { XM, EXx } },
3018     { "hsubps", { XM, EXx } },
3019   },
3020
3021   /* PREFIX_0F7E */
3022   {
3023     { "movK",   { Edq, MX } },
3024     { "movq",   { XM, EXq } },
3025     { "movK",   { Edq, XM } },
3026     { "(bad)",  { XX } },
3027   },
3028
3029   /* PREFIX_0F7F */
3030   {
3031     { "movq",   { EMS, MX } },
3032     { "movdqu", { EXxS, XM } },
3033     { "movdqa", { EXxS, XM } },
3034     { "(bad)",  { XX } },
3035   },
3036
3037   /* PREFIX_0FB8 */
3038   {
3039     { "(bad)", { XX } },
3040     { "popcntS", { Gv, Ev } },
3041     { "(bad)", { XX } },
3042     { "(bad)", { XX } },
3043   },
3044
3045   /* PREFIX_0FBD */
3046   {
3047     { "bsrS",   { Gv, Ev } },
3048     { "lzcntS", { Gv, Ev } },
3049     { "bsrS",   { Gv, Ev } },
3050     { "(bad)",  { XX } },
3051   },
3052
3053   /* PREFIX_0FC2 */
3054   {
3055     { "cmpps",  { XM, EXx, CMP } },
3056     { "cmpss",  { XM, EXd, CMP } },
3057     { "cmppd",  { XM, EXx, CMP } },
3058     { "cmpsd",  { XM, EXq, CMP } },
3059   },
3060
3061   /* PREFIX_0FC3 */
3062   {
3063     { "movntiS", { Ma, Gv } },
3064     { "(bad)",  { XX } },
3065     { "(bad)",  { XX } },
3066     { "(bad)",  { XX } },
3067   },
3068
3069   /* PREFIX_0FC7_REG_6 */
3070   {
3071     { "vmptrld",{ Mq } },
3072     { "vmxon",  { Mq } },
3073     { "vmclear",{ Mq } },
3074     { "(bad)",  { XX } },
3075   },
3076
3077   /* PREFIX_0FD0 */
3078   {
3079     { "(bad)",  { XX } },
3080     { "(bad)",  { XX } },
3081     { "addsubpd", { XM, EXx } },
3082     { "addsubps", { XM, EXx } },
3083   },
3084
3085   /* PREFIX_0FD6 */
3086   {
3087     { "(bad)",  { XX } },
3088     { "movq2dq",{ XM, MS } },
3089     { "movq",   { EXqS, XM } },
3090     { "movdq2q",{ MX, XS } },
3091   },
3092
3093   /* PREFIX_0FE6 */
3094   {
3095     { "(bad)",  { XX } },
3096     { "cvtdq2pd", { XM, EXq } },
3097     { "cvttpd2dq", { XM, EXx } },
3098     { "cvtpd2dq", { XM, EXx } },
3099   },
3100
3101   /* PREFIX_0FE7 */
3102   {
3103     { "movntq", { Mq, MX } },
3104     { "(bad)",  { XX } },
3105     { MOD_TABLE (MOD_0FE7_PREFIX_2) },
3106     { "(bad)",  { XX } },
3107   },
3108
3109   /* PREFIX_0FF0 */
3110   {
3111     { "(bad)",  { XX } },
3112     { "(bad)",  { XX } },
3113     { "(bad)",  { XX } },
3114     { MOD_TABLE (MOD_0FF0_PREFIX_3) },
3115   },
3116
3117   /* PREFIX_0FF7 */
3118   {
3119     { "maskmovq", { MX, MS } },
3120     { "(bad)",  { XX } },
3121     { "maskmovdqu", { XM, XS } },
3122     { "(bad)",  { XX } },
3123   },
3124
3125   /* PREFIX_0F3810 */
3126   {
3127     { "(bad)",  { XX } },
3128     { "(bad)",  { XX } },
3129     { "pblendvb", { XM, EXx, XMM0 } },
3130     { "(bad)",  { XX } },
3131   },
3132
3133   /* PREFIX_0F3814 */
3134   {
3135     { "(bad)",  { XX } },
3136     { "(bad)",  { XX } },
3137     { "blendvps", { XM, EXx, XMM0 } },
3138     { "(bad)",  { XX } },
3139   },
3140
3141   /* PREFIX_0F3815 */
3142   {
3143     { "(bad)",  { XX } },
3144     { "(bad)",  { XX } },
3145     { "blendvpd", { XM, EXx, XMM0 } },
3146     { "(bad)",  { XX } },
3147   },
3148
3149   /* PREFIX_0F3817 */
3150   {
3151     { "(bad)",  { XX } },
3152     { "(bad)",  { XX } },
3153     { "ptest",  { XM, EXx } },
3154     { "(bad)",  { XX } },
3155   },
3156
3157   /* PREFIX_0F3820 */
3158   {
3159     { "(bad)",  { XX } },
3160     { "(bad)",  { XX } },
3161     { "pmovsxbw", { XM, EXq } },
3162     { "(bad)",  { XX } },
3163   },
3164
3165   /* PREFIX_0F3821 */
3166   {
3167     { "(bad)",  { XX } },
3168     { "(bad)",  { XX } },
3169     { "pmovsxbd", { XM, EXd } },
3170     { "(bad)",  { XX } },
3171   },
3172
3173   /* PREFIX_0F3822 */
3174   {
3175     { "(bad)",  { XX } },
3176     { "(bad)",  { XX } },
3177     { "pmovsxbq", { XM, EXw } },
3178     { "(bad)",  { XX } },
3179   },
3180
3181   /* PREFIX_0F3823 */
3182   {
3183     { "(bad)",  { XX } },
3184     { "(bad)",  { XX } },
3185     { "pmovsxwd", { XM, EXq } },
3186     { "(bad)",  { XX } },
3187   },
3188
3189   /* PREFIX_0F3824 */
3190   {
3191     { "(bad)",  { XX } },
3192     { "(bad)",  { XX } },
3193     { "pmovsxwq", { XM, EXd } },
3194     { "(bad)",  { XX } },
3195   },
3196
3197   /* PREFIX_0F3825 */
3198   {
3199     { "(bad)",  { XX } },
3200     { "(bad)",  { XX } },
3201     { "pmovsxdq", { XM, EXq } },
3202     { "(bad)",  { XX } },
3203   },
3204
3205   /* PREFIX_0F3828 */
3206   {
3207     { "(bad)",  { XX } },
3208     { "(bad)",  { XX } },
3209     { "pmuldq", { XM, EXx } },
3210     { "(bad)",  { XX } },
3211   },
3212
3213   /* PREFIX_0F3829 */
3214   {
3215     { "(bad)",  { XX } },
3216     { "(bad)",  { XX } },
3217     { "pcmpeqq", { XM, EXx } },
3218     { "(bad)",  { XX } },
3219   },
3220
3221   /* PREFIX_0F382A */
3222   {
3223     { "(bad)",  { XX } },
3224     { "(bad)",  { XX } },
3225     { MOD_TABLE (MOD_0F382A_PREFIX_2) },
3226     { "(bad)",  { XX } },
3227   },
3228
3229   /* PREFIX_0F382B */
3230   {
3231     { "(bad)",  { XX } },
3232     { "(bad)",  { XX } },
3233     { "packusdw", { XM, EXx } },
3234     { "(bad)",  { XX } },
3235   },
3236
3237   /* PREFIX_0F3830 */
3238   {
3239     { "(bad)",  { XX } },
3240     { "(bad)",  { XX } },
3241     { "pmovzxbw", { XM, EXq } },
3242     { "(bad)",  { XX } },
3243   },
3244
3245   /* PREFIX_0F3831 */
3246   {
3247     { "(bad)",  { XX } },
3248     { "(bad)",  { XX } },
3249     { "pmovzxbd", { XM, EXd } },
3250     { "(bad)",  { XX } },
3251   },
3252
3253   /* PREFIX_0F3832 */
3254   {
3255     { "(bad)",  { XX } },
3256     { "(bad)",  { XX } },
3257     { "pmovzxbq", { XM, EXw } },
3258     { "(bad)",  { XX } },
3259   },
3260
3261   /* PREFIX_0F3833 */
3262   {
3263     { "(bad)",  { XX } },
3264     { "(bad)",  { XX } },
3265     { "pmovzxwd", { XM, EXq } },
3266     { "(bad)",  { XX } },
3267   },
3268
3269   /* PREFIX_0F3834 */
3270   {
3271     { "(bad)",  { XX } },
3272     { "(bad)",  { XX } },
3273     { "pmovzxwq", { XM, EXd } },
3274     { "(bad)",  { XX } },
3275   },
3276
3277   /* PREFIX_0F3835 */
3278   {
3279     { "(bad)",  { XX } },
3280     { "(bad)",  { XX } },
3281     { "pmovzxdq", { XM, EXq } },
3282     { "(bad)",  { XX } },
3283   },
3284
3285   /* PREFIX_0F3837 */
3286   {
3287     { "(bad)",  { XX } },
3288     { "(bad)",  { XX } },
3289     { "pcmpgtq", { XM, EXx } },
3290     { "(bad)",  { XX } },
3291   },
3292
3293   /* PREFIX_0F3838 */
3294   {
3295     { "(bad)",  { XX } },
3296     { "(bad)",  { XX } },
3297     { "pminsb", { XM, EXx } },
3298     { "(bad)",  { XX } },
3299   },
3300
3301   /* PREFIX_0F3839 */
3302   {
3303     { "(bad)",  { XX } },
3304     { "(bad)",  { XX } },
3305     { "pminsd", { XM, EXx } },
3306     { "(bad)",  { XX } },
3307   },
3308
3309   /* PREFIX_0F383A */
3310   {
3311     { "(bad)",  { XX } },
3312     { "(bad)",  { XX } },
3313     { "pminuw", { XM, EXx } },
3314     { "(bad)",  { XX } },
3315   },
3316
3317   /* PREFIX_0F383B */
3318   {
3319     { "(bad)",  { XX } },
3320     { "(bad)",  { XX } },
3321     { "pminud", { XM, EXx } },
3322     { "(bad)",  { XX } },
3323   },
3324
3325   /* PREFIX_0F383C */
3326   {
3327     { "(bad)",  { XX } },
3328     { "(bad)",  { XX } },
3329     { "pmaxsb", { XM, EXx } },
3330     { "(bad)",  { XX } },
3331   },
3332
3333   /* PREFIX_0F383D */
3334   {
3335     { "(bad)",  { XX } },
3336     { "(bad)",  { XX } },
3337     { "pmaxsd", { XM, EXx } },
3338     { "(bad)",  { XX } },
3339   },
3340
3341   /* PREFIX_0F383E */
3342   {
3343     { "(bad)",  { XX } },
3344     { "(bad)",  { XX } },
3345     { "pmaxuw", { XM, EXx } },
3346     { "(bad)",  { XX } },
3347   },
3348
3349   /* PREFIX_0F383F */
3350   {
3351     { "(bad)",  { XX } },
3352     { "(bad)",  { XX } },
3353     { "pmaxud", { XM, EXx } },
3354     { "(bad)",  { XX } },
3355   },
3356
3357   /* PREFIX_0F3840 */
3358   {
3359     { "(bad)",  { XX } },
3360     { "(bad)",  { XX } },
3361     { "pmulld", { XM, EXx } },
3362     { "(bad)",  { XX } },
3363   },
3364
3365   /* PREFIX_0F3841 */
3366   {
3367     { "(bad)",  { XX } },
3368     { "(bad)",  { XX } },
3369     { "phminposuw", { XM, EXx } },
3370     { "(bad)",  { XX } },
3371   },
3372
3373   /* PREFIX_0F3880 */
3374   {
3375     { "(bad)",  { XX } },
3376     { "(bad)",  { XX } },
3377     { "invept", { Gm, Mo } },
3378     { "(bad)",  { XX } },
3379   },
3380
3381   /* PREFIX_0F3881 */
3382   {
3383     { "(bad)",  { XX } },
3384     { "(bad)",  { XX } },
3385     { "invvpid", { Gm, Mo } },
3386     { "(bad)",  { XX } },
3387   },
3388
3389   /* PREFIX_0F38DB */
3390   {
3391     { "(bad)",  { XX } },
3392     { "(bad)",  { XX } },
3393     { "aesimc", { XM, EXx } },
3394     { "(bad)",  { XX } },
3395   },
3396
3397   /* PREFIX_0F38DC */
3398   {
3399     { "(bad)",  { XX } },
3400     { "(bad)",  { XX } },
3401     { "aesenc", { XM, EXx } },
3402     { "(bad)",  { XX } },
3403   },
3404
3405   /* PREFIX_0F38DD */
3406   {
3407     { "(bad)",  { XX } },
3408     { "(bad)",  { XX } },
3409     { "aesenclast", { XM, EXx } },
3410     { "(bad)",  { XX } },
3411   },
3412
3413   /* PREFIX_0F38DE */
3414   {
3415     { "(bad)",  { XX } },
3416     { "(bad)",  { XX } },
3417     { "aesdec", { XM, EXx } },
3418     { "(bad)",  { XX } },
3419   },
3420
3421   /* PREFIX_0F38DF */
3422   {
3423     { "(bad)",  { XX } },
3424     { "(bad)",  { XX } },
3425     { "aesdeclast", { XM, EXx } },
3426     { "(bad)",  { XX } },
3427   },
3428
3429   /* PREFIX_0F38F0 */
3430   {
3431     { "movbeS", { Gv, { MOVBE_Fixup, v_mode } } },
3432     { "(bad)",  { XX } },
3433     { "movbeS", { Gv, { MOVBE_Fixup, v_mode } } },
3434     { "crc32",  { Gdq, { CRC32_Fixup, b_mode } } },     
3435   },
3436
3437   /* PREFIX_0F38F1 */
3438   {
3439     { "movbeS", { { MOVBE_Fixup, v_mode }, Gv } },
3440     { "(bad)",  { XX } },
3441     { "movbeS", { { MOVBE_Fixup, v_mode }, Gv } },
3442     { "crc32",  { Gdq, { CRC32_Fixup, v_mode } } },     
3443   },
3444
3445   /* PREFIX_0F3A08 */
3446   {
3447     { "(bad)",  { XX } },
3448     { "(bad)",  { XX } },
3449     { "roundps", { XM, EXx, Ib } },
3450     { "(bad)",  { XX } },
3451   },
3452
3453   /* PREFIX_0F3A09 */
3454   {
3455     { "(bad)",  { XX } },
3456     { "(bad)",  { XX } },
3457     { "roundpd", { XM, EXx, Ib } },
3458     { "(bad)",  { XX } },
3459   },
3460
3461   /* PREFIX_0F3A0A */
3462   {
3463     { "(bad)",  { XX } },
3464     { "(bad)",  { XX } },
3465     { "roundss", { XM, EXd, Ib } },
3466     { "(bad)",  { XX } },
3467   },
3468
3469   /* PREFIX_0F3A0B */
3470   {
3471     { "(bad)",  { XX } },
3472     { "(bad)",  { XX } },
3473     { "roundsd", { XM, EXq, Ib } },
3474     { "(bad)",  { XX } },
3475   },
3476
3477   /* PREFIX_0F3A0C */
3478   {
3479     { "(bad)",  { XX } },
3480     { "(bad)",  { XX } },
3481     { "blendps", { XM, EXx, Ib } },
3482     { "(bad)",  { XX } },
3483   },
3484
3485   /* PREFIX_0F3A0D */
3486   {
3487     { "(bad)",  { XX } },
3488     { "(bad)",  { XX } },
3489     { "blendpd", { XM, EXx, Ib } },
3490     { "(bad)",  { XX } },
3491   },
3492
3493   /* PREFIX_0F3A0E */
3494   {
3495     { "(bad)",  { XX } },
3496     { "(bad)",  { XX } },
3497     { "pblendw", { XM, EXx, Ib } },
3498     { "(bad)",  { XX } },
3499   },
3500
3501   /* PREFIX_0F3A14 */
3502   {
3503     { "(bad)",  { XX } },
3504     { "(bad)",  { XX } },
3505     { "pextrb", { Edqb, XM, Ib } },
3506     { "(bad)",  { XX } },
3507   },
3508
3509   /* PREFIX_0F3A15 */
3510   {
3511     { "(bad)",  { XX } },
3512     { "(bad)",  { XX } },
3513     { "pextrw", { Edqw, XM, Ib } },
3514     { "(bad)",  { XX } },
3515   },
3516
3517   /* PREFIX_0F3A16 */
3518   {
3519     { "(bad)",  { XX } },
3520     { "(bad)",  { XX } },
3521     { "pextrK", { Edq, XM, Ib } },
3522     { "(bad)",  { XX } },
3523   },
3524
3525   /* PREFIX_0F3A17 */
3526   {
3527     { "(bad)",  { XX } },
3528     { "(bad)",  { XX } },
3529     { "extractps", { Edqd, XM, Ib } },
3530     { "(bad)",  { XX } },
3531   },
3532
3533   /* PREFIX_0F3A20 */
3534   {
3535     { "(bad)",  { XX } },
3536     { "(bad)",  { XX } },
3537     { "pinsrb", { XM, Edqb, Ib } },
3538     { "(bad)",  { XX } },
3539   },
3540
3541   /* PREFIX_0F3A21 */
3542   {
3543     { "(bad)",  { XX } },
3544     { "(bad)",  { XX } },
3545     { "insertps", { XM, EXd, Ib } },
3546     { "(bad)",  { XX } },
3547   },
3548
3549   /* PREFIX_0F3A22 */
3550   {
3551     { "(bad)",  { XX } },
3552     { "(bad)",  { XX } },
3553     { "pinsrK", { XM, Edq, Ib } },
3554     { "(bad)",  { XX } },
3555   },
3556
3557   /* PREFIX_0F3A40 */
3558   {
3559     { "(bad)",  { XX } },
3560     { "(bad)",  { XX } },
3561     { "dpps",   { XM, EXx, Ib } },
3562     { "(bad)",  { XX } },
3563   },
3564
3565   /* PREFIX_0F3A41 */
3566   {
3567     { "(bad)",  { XX } },
3568     { "(bad)",  { XX } },
3569     { "dppd",   { XM, EXx, Ib } },
3570     { "(bad)",  { XX } },
3571   },
3572
3573   /* PREFIX_0F3A42 */
3574   {
3575     { "(bad)",  { XX } },
3576     { "(bad)",  { XX } },
3577     { "mpsadbw", { XM, EXx, Ib } },
3578     { "(bad)",  { XX } },
3579   },
3580
3581   /* PREFIX_0F3A44 */
3582   {
3583     { "(bad)",  { XX } },
3584     { "(bad)",  { XX } },
3585     { "pclmulqdq", { XM, EXx, PCLMUL } },
3586     { "(bad)",  { XX } },
3587   },
3588
3589   /* PREFIX_0F3A60 */
3590   {
3591     { "(bad)",  { XX } },
3592     { "(bad)",  { XX } },
3593     { "pcmpestrm", { XM, EXx, Ib } },
3594     { "(bad)",  { XX } },
3595   },
3596
3597   /* PREFIX_0F3A61 */
3598   {
3599     { "(bad)",  { XX } },
3600     { "(bad)",  { XX } },
3601     { "pcmpestri", { XM, EXx, Ib } },
3602     { "(bad)",  { XX } },
3603   },
3604
3605   /* PREFIX_0F3A62 */
3606   {
3607     { "(bad)",  { XX } },
3608     { "(bad)",  { XX } },
3609     { "pcmpistrm", { XM, EXx, Ib } },
3610     { "(bad)",  { XX } },
3611   },
3612
3613   /* PREFIX_0F3A63 */
3614   {
3615     { "(bad)",  { XX } },
3616     { "(bad)",  { XX } },
3617     { "pcmpistri", { XM, EXx, Ib } },
3618     { "(bad)",  { XX } },
3619   },
3620
3621   /* PREFIX_0F3ADF */
3622   {
3623     { "(bad)",  { XX } },
3624     { "(bad)",  { XX } },
3625     { "aeskeygenassist", { XM, EXx, Ib } },
3626     { "(bad)",  { XX } },
3627   },
3628
3629   /* PREFIX_VEX_10 */
3630   {
3631     { VEX_W_TABLE (VEX_W_10_P_0) },
3632     { VEX_LEN_TABLE (VEX_LEN_10_P_1) },
3633     { VEX_W_TABLE (VEX_W_10_P_2) },
3634     { VEX_LEN_TABLE (VEX_LEN_10_P_3) },
3635   },
3636
3637   /* PREFIX_VEX_11 */
3638   {
3639     { VEX_W_TABLE (VEX_W_11_P_0) },
3640     { VEX_LEN_TABLE (VEX_LEN_11_P_1) },
3641     { VEX_W_TABLE (VEX_W_11_P_2) },
3642     { VEX_LEN_TABLE (VEX_LEN_11_P_3) },
3643   },
3644
3645   /* PREFIX_VEX_12 */
3646   {
3647     { MOD_TABLE (MOD_VEX_12_PREFIX_0) },
3648     { VEX_W_TABLE (VEX_W_12_P_1) },
3649     { VEX_LEN_TABLE (VEX_LEN_12_P_2) },
3650     { VEX_W_TABLE (VEX_W_12_P_3) },
3651   },
3652
3653   /* PREFIX_VEX_16 */
3654   {
3655     { MOD_TABLE (MOD_VEX_16_PREFIX_0) },
3656     { VEX_W_TABLE (VEX_W_16_P_1) },
3657     { VEX_LEN_TABLE (VEX_LEN_16_P_2) },
3658     { "(bad)",  { XX } },
3659   },
3660
3661   /* PREFIX_VEX_2A */
3662   {
3663     { "(bad)",  { XX } },
3664     { VEX_LEN_TABLE (VEX_LEN_2A_P_1) },
3665     { "(bad)",  { XX } },
3666     { VEX_LEN_TABLE (VEX_LEN_2A_P_3) },
3667   },
3668
3669   /* PREFIX_VEX_2C */
3670   {
3671     { "(bad)",  { XX } },
3672     { VEX_LEN_TABLE (VEX_LEN_2C_P_1) },
3673     { "(bad)",  { XX } },
3674     { VEX_LEN_TABLE (VEX_LEN_2C_P_3) },
3675   },
3676
3677   /* PREFIX_VEX_2D */
3678   {
3679     { "(bad)",  { XX } },
3680     { VEX_LEN_TABLE (VEX_LEN_2D_P_1) },
3681     { "(bad)",  { XX } },
3682     { VEX_LEN_TABLE (VEX_LEN_2D_P_3) },
3683   },
3684
3685   /* PREFIX_VEX_2E */
3686   {
3687     { VEX_LEN_TABLE (VEX_LEN_2E_P_0) },
3688     { "(bad)",  { XX } },
3689     { VEX_LEN_TABLE (VEX_LEN_2E_P_2) },
3690     { "(bad)",  { XX } },
3691   },
3692
3693   /* PREFIX_VEX_2F */
3694   {
3695     { VEX_LEN_TABLE (VEX_LEN_2F_P_0) },
3696     { "(bad)",  { XX } },
3697     { VEX_LEN_TABLE (VEX_LEN_2F_P_2) },
3698     { "(bad)",  { XX } },
3699   },
3700
3701   /* PREFIX_VEX_51 */
3702   {
3703     { VEX_W_TABLE (VEX_W_51_P_0) },
3704     { VEX_LEN_TABLE (VEX_LEN_51_P_1) },
3705     { VEX_W_TABLE (VEX_W_51_P_2) },
3706     { VEX_LEN_TABLE (VEX_LEN_51_P_3) },
3707   },
3708
3709   /* PREFIX_VEX_52 */
3710   {
3711     { VEX_W_TABLE (VEX_W_52_P_0) },
3712     { VEX_LEN_TABLE (VEX_LEN_52_P_1) },
3713     { "(bad)",  { XX } },
3714     { "(bad)",  { XX } },
3715   },
3716
3717   /* PREFIX_VEX_53 */
3718   {
3719     { VEX_W_TABLE (VEX_W_53_P_0) },
3720     { VEX_LEN_TABLE (VEX_LEN_53_P_1) },
3721     { "(bad)",  { XX } },
3722     { "(bad)",  { XX } },
3723   },
3724
3725   /* PREFIX_VEX_58 */
3726   {
3727     { VEX_W_TABLE (VEX_W_58_P_0) },
3728     { VEX_LEN_TABLE (VEX_LEN_58_P_1) },
3729     { VEX_W_TABLE (VEX_W_58_P_2) },
3730     { VEX_LEN_TABLE (VEX_LEN_58_P_3) },
3731   },
3732
3733   /* PREFIX_VEX_59 */
3734   {
3735     { VEX_W_TABLE (VEX_W_59_P_0) },
3736     { VEX_LEN_TABLE (VEX_LEN_59_P_1) },
3737     { VEX_W_TABLE (VEX_W_59_P_2) },
3738     { VEX_LEN_TABLE (VEX_LEN_59_P_3) },
3739   },
3740
3741   /* PREFIX_VEX_5A */
3742   {
3743     { VEX_W_TABLE (VEX_W_5A_P_0) },
3744     { VEX_LEN_TABLE (VEX_LEN_5A_P_1) },
3745     { "vcvtpd2ps%XY", { XMM, EXx } },
3746     { VEX_LEN_TABLE (VEX_LEN_5A_P_3) },
3747   },
3748
3749   /* PREFIX_VEX_5B */
3750   {
3751     { VEX_W_TABLE (VEX_W_5B_P_0) },
3752     { VEX_W_TABLE (VEX_W_5B_P_1) },
3753     { VEX_W_TABLE (VEX_W_5B_P_2) },
3754     { "(bad)",  { XX } },
3755   },
3756
3757   /* PREFIX_VEX_5C */
3758   {
3759     { VEX_W_TABLE (VEX_W_5C_P_0) },
3760     { VEX_LEN_TABLE (VEX_LEN_5C_P_1) },
3761     { VEX_W_TABLE (VEX_W_5C_P_2) },
3762     { VEX_LEN_TABLE (VEX_LEN_5C_P_3) },
3763   },
3764
3765   /* PREFIX_VEX_5D */
3766   {
3767     { VEX_W_TABLE (VEX_W_5D_P_0) },
3768     { VEX_LEN_TABLE (VEX_LEN_5D_P_1) },
3769     { VEX_W_TABLE (VEX_W_5D_P_2) },
3770     { VEX_LEN_TABLE (VEX_LEN_5D_P_3) },
3771   },
3772
3773   /* PREFIX_VEX_5E */
3774   {
3775     { VEX_W_TABLE (VEX_W_5E_P_0) },
3776     { VEX_LEN_TABLE (VEX_LEN_5E_P_1) },
3777     { VEX_W_TABLE (VEX_W_5E_P_2) },
3778     { VEX_LEN_TABLE (VEX_LEN_5E_P_3) },
3779   },
3780
3781   /* PREFIX_VEX_5F */
3782   {
3783     { VEX_W_TABLE (VEX_W_5F_P_0) },
3784     { VEX_LEN_TABLE (VEX_LEN_5F_P_1) },
3785     { VEX_W_TABLE (VEX_W_5F_P_2) },
3786     { VEX_LEN_TABLE (VEX_LEN_5F_P_3) },
3787   },
3788
3789   /* PREFIX_VEX_60 */
3790   {
3791     { "(bad)",  { XX } },
3792     { "(bad)",  { XX } },
3793     { VEX_LEN_TABLE (VEX_LEN_60_P_2) },
3794     { "(bad)",  { XX } },
3795   },
3796
3797   /* PREFIX_VEX_61 */
3798   {
3799     { "(bad)",  { XX } },
3800     { "(bad)",  { XX } },
3801     { VEX_LEN_TABLE (VEX_LEN_61_P_2) },
3802     { "(bad)",  { XX } },
3803   },
3804
3805   /* PREFIX_VEX_62 */
3806   {
3807     { "(bad)",  { XX } },
3808     { "(bad)",  { XX } },
3809     { VEX_LEN_TABLE (VEX_LEN_62_P_2) },
3810     { "(bad)",  { XX } },
3811   },
3812
3813   /* PREFIX_VEX_63 */
3814   {
3815     { "(bad)",  { XX } },
3816     { "(bad)",  { XX } },
3817     { VEX_LEN_TABLE (VEX_LEN_63_P_2) },
3818     { "(bad)",  { XX } },
3819   },
3820
3821   /* PREFIX_VEX_64 */
3822   {
3823     { "(bad)",  { XX } },
3824     { "(bad)",  { XX } },
3825     { VEX_LEN_TABLE (VEX_LEN_64_P_2) },
3826     { "(bad)",  { XX } },
3827   },
3828
3829   /* PREFIX_VEX_65 */
3830   {
3831     { "(bad)",  { XX } },
3832     { "(bad)",  { XX } },
3833     { VEX_LEN_TABLE (VEX_LEN_65_P_2) },
3834     { "(bad)",  { XX } },
3835   },
3836
3837   /* PREFIX_VEX_66 */
3838   {
3839     { "(bad)",  { XX } },
3840     { "(bad)",  { XX } },
3841     { VEX_LEN_TABLE (VEX_LEN_66_P_2) },
3842     { "(bad)",  { XX } },
3843   },
3844
3845   /* PREFIX_VEX_67 */
3846   {
3847     { "(bad)",  { XX } },
3848     { "(bad)",  { XX } },
3849     { VEX_LEN_TABLE (VEX_LEN_67_P_2) },
3850     { "(bad)",  { XX } },
3851   },
3852
3853   /* PREFIX_VEX_68 */
3854   {
3855     { "(bad)",  { XX } },
3856     { "(bad)",  { XX } },
3857     { VEX_LEN_TABLE (VEX_LEN_68_P_2) },
3858     { "(bad)",  { XX } },
3859   },
3860
3861   /* PREFIX_VEX_69 */
3862   {
3863     { "(bad)",  { XX } },
3864     { "(bad)",  { XX } },
3865     { VEX_LEN_TABLE (VEX_LEN_69_P_2) },
3866     { "(bad)",  { XX } },
3867   },
3868
3869   /* PREFIX_VEX_6A */
3870   {
3871     { "(bad)",  { XX } },
3872     { "(bad)",  { XX } },
3873     { VEX_LEN_TABLE (VEX_LEN_6A_P_2) },
3874     { "(bad)",  { XX } },
3875   },
3876
3877   /* PREFIX_VEX_6B */
3878   {
3879     { "(bad)",  { XX } },
3880     { "(bad)",  { XX } },
3881     { VEX_LEN_TABLE (VEX_LEN_6B_P_2) },
3882     { "(bad)",  { XX } },
3883   },
3884
3885   /* PREFIX_VEX_6C */
3886   {
3887     { "(bad)",  { XX } },
3888     { "(bad)",  { XX } },
3889     { VEX_LEN_TABLE (VEX_LEN_6C_P_2) },
3890     { "(bad)",  { XX } },
3891   },
3892
3893   /* PREFIX_VEX_6D */
3894   {
3895     { "(bad)",  { XX } },
3896     { "(bad)",  { XX } },
3897     { VEX_LEN_TABLE (VEX_LEN_6D_P_2) },
3898     { "(bad)",  { XX } },
3899   },
3900
3901   /* PREFIX_VEX_6E */
3902   {
3903     { "(bad)",  { XX } },
3904     { "(bad)",  { XX } },
3905     { VEX_LEN_TABLE (VEX_LEN_6E_P_2) },
3906     { "(bad)",  { XX } },
3907   },
3908
3909   /* PREFIX_VEX_6F */
3910   {
3911     { "(bad)",  { XX } },
3912     { VEX_W_TABLE (VEX_W_6F_P_1) },
3913     { VEX_W_TABLE (VEX_W_6F_P_2) },
3914     { "(bad)",  { XX } },
3915   },
3916
3917   /* PREFIX_VEX_70 */
3918   {
3919     { "(bad)",  { XX } },
3920     { VEX_LEN_TABLE (VEX_LEN_70_P_1) },
3921     { VEX_LEN_TABLE (VEX_LEN_70_P_2) },
3922     { VEX_LEN_TABLE (VEX_LEN_70_P_3) },
3923   },
3924
3925   /* PREFIX_VEX_71_REG_2 */
3926   {
3927     { "(bad)",  { XX } },
3928     { "(bad)",  { XX } },
3929     { VEX_LEN_TABLE (VEX_LEN_71_R_2_P_2) },
3930     { "(bad)",  { XX } },
3931   },
3932
3933   /* PREFIX_VEX_71_REG_4 */
3934   {
3935     { "(bad)",  { XX } },
3936     { "(bad)",  { XX } },
3937     { VEX_LEN_TABLE (VEX_LEN_71_R_4_P_2) },
3938     { "(bad)",  { XX } },
3939   },
3940
3941   /* PREFIX_VEX_71_REG_6 */
3942   {
3943     { "(bad)",  { XX } },
3944     { "(bad)",  { XX } },
3945     { VEX_LEN_TABLE (VEX_LEN_71_R_6_P_2) },
3946     { "(bad)",  { XX } },
3947   },
3948
3949   /* PREFIX_VEX_72_REG_2 */
3950   {
3951     { "(bad)",  { XX } },
3952     { "(bad)",  { XX } },
3953     { VEX_LEN_TABLE (VEX_LEN_72_R_2_P_2) },
3954     { "(bad)",  { XX } },
3955   },
3956
3957   /* PREFIX_VEX_72_REG_4 */
3958   {
3959     { "(bad)",  { XX } },
3960     { "(bad)",  { XX } },
3961     { VEX_LEN_TABLE (VEX_LEN_72_R_4_P_2) },
3962     { "(bad)",  { XX } },
3963   },
3964
3965   /* PREFIX_VEX_72_REG_6 */
3966   {
3967     { "(bad)",  { XX } },
3968     { "(bad)",  { XX } },
3969     { VEX_LEN_TABLE (VEX_LEN_72_R_6_P_2) },
3970     { "(bad)",  { XX } },
3971   },
3972
3973   /* PREFIX_VEX_73_REG_2 */
3974   {
3975     { "(bad)",  { XX } },
3976     { "(bad)",  { XX } },
3977     { VEX_LEN_TABLE (VEX_LEN_73_R_2_P_2) },
3978     { "(bad)",  { XX } },
3979   },
3980
3981   /* PREFIX_VEX_73_REG_3 */
3982   {
3983     { "(bad)",  { XX } },
3984     { "(bad)",  { XX } },
3985     { VEX_LEN_TABLE (VEX_LEN_73_R_3_P_2) },
3986     { "(bad)",  { XX } },
3987   },
3988
3989   /* PREFIX_VEX_73_REG_6 */
3990   {
3991     { "(bad)",  { XX } },
3992     { "(bad)",  { XX } },
3993     { VEX_LEN_TABLE (VEX_LEN_73_R_6_P_2) },
3994     { "(bad)",  { XX } },
3995   },
3996
3997   /* PREFIX_VEX_73_REG_7 */
3998   {
3999     { "(bad)",  { XX } },
4000     { "(bad)",  { XX } },
4001     { VEX_LEN_TABLE (VEX_LEN_73_R_7_P_2) },
4002     { "(bad)",  { XX } },
4003   },
4004
4005   /* PREFIX_VEX_74 */
4006   {
4007     { "(bad)",  { XX } },
4008     { "(bad)",  { XX } },
4009     { VEX_LEN_TABLE (VEX_LEN_74_P_2) },
4010     { "(bad)",  { XX } },
4011   },
4012
4013   /* PREFIX_VEX_75 */
4014   {
4015     { "(bad)",  { XX } },
4016     { "(bad)",  { XX } },
4017     { VEX_LEN_TABLE (VEX_LEN_75_P_2) },
4018     { "(bad)",  { XX } },
4019   },
4020
4021   /* PREFIX_VEX_76 */
4022   {
4023     { "(bad)",  { XX } },
4024     { "(bad)",  { XX } },
4025     { VEX_LEN_TABLE (VEX_LEN_76_P_2) },
4026     { "(bad)",  { XX } },
4027   },
4028
4029   /* PREFIX_VEX_77 */
4030   {
4031     { VEX_W_TABLE (VEX_W_77_P_0) },
4032     { "(bad)",  { XX } },
4033     { "(bad)",  { XX } },
4034     { "(bad)",  { XX } },
4035   },
4036
4037   /* PREFIX_VEX_7C */
4038   {
4039     { "(bad)",  { XX } },
4040     { "(bad)",  { XX } },
4041     { VEX_W_TABLE (VEX_W_7C_P_2) },
4042     { VEX_W_TABLE (VEX_W_7C_P_3) },
4043   },
4044
4045   /* PREFIX_VEX_7D */
4046   {
4047     { "(bad)",  { XX } },
4048     { "(bad)",  { XX } },
4049     { VEX_W_TABLE (VEX_W_7D_P_2) },
4050     { VEX_W_TABLE (VEX_W_7D_P_3) },
4051   },
4052
4053   /* PREFIX_VEX_7E */
4054   {
4055     { "(bad)",  { XX } },
4056     { VEX_LEN_TABLE (VEX_LEN_7E_P_1) },
4057     { VEX_LEN_TABLE (VEX_LEN_7E_P_2) },
4058     { "(bad)",  { XX } },
4059   },
4060
4061   /* PREFIX_VEX_7F */
4062   {
4063     { "(bad)",  { XX } },
4064     { VEX_W_TABLE (VEX_W_7F_P_1) },
4065     { VEX_W_TABLE (VEX_W_7F_P_2) },
4066     { "(bad)",  { XX } },
4067   },
4068
4069   /* PREFIX_VEX_C2 */
4070   {
4071     { VEX_W_TABLE (VEX_W_C2_P_0) },
4072     { VEX_LEN_TABLE (VEX_LEN_C2_P_1) },
4073     { VEX_W_TABLE (VEX_W_C2_P_2) },
4074     { VEX_LEN_TABLE (VEX_LEN_C2_P_3) },
4075   },
4076
4077   /* PREFIX_VEX_C4 */
4078   {
4079     { "(bad)",  { XX } },
4080     { "(bad)",  { XX } },
4081     { VEX_LEN_TABLE (VEX_LEN_C4_P_2) },
4082     { "(bad)",  { XX } },
4083   },
4084
4085   /* PREFIX_VEX_C5 */
4086   {
4087     { "(bad)",  { XX } },
4088     { "(bad)",  { XX } },
4089     { VEX_LEN_TABLE (VEX_LEN_C5_P_2) },
4090     { "(bad)",  { XX } },
4091   },
4092
4093   /* PREFIX_VEX_D0 */
4094   {
4095     { "(bad)",  { XX } },
4096     { "(bad)",  { XX } },
4097     { VEX_W_TABLE (VEX_W_D0_P_2) },
4098     { VEX_W_TABLE (VEX_W_D0_P_3) },
4099   },
4100
4101   /* PREFIX_VEX_D1 */
4102   {
4103     { "(bad)",  { XX } },
4104     { "(bad)",  { XX } },
4105     { VEX_LEN_TABLE (VEX_LEN_D1_P_2) },
4106     { "(bad)",  { XX } },
4107   },
4108
4109   /* PREFIX_VEX_D2 */
4110   {
4111     { "(bad)",  { XX } },
4112     { "(bad)",  { XX } },
4113     { VEX_LEN_TABLE (VEX_LEN_D2_P_2) },
4114     { "(bad)",  { XX } },
4115   },
4116
4117   /* PREFIX_VEX_D3 */
4118   {
4119     { "(bad)",  { XX } },
4120     { "(bad)",  { XX } },
4121     { VEX_LEN_TABLE (VEX_LEN_D3_P_2) },
4122     { "(bad)",  { XX } },
4123   },
4124
4125   /* PREFIX_VEX_D4 */
4126   {
4127     { "(bad)",  { XX } },
4128     { "(bad)",  { XX } },
4129     { VEX_LEN_TABLE (VEX_LEN_D4_P_2) },
4130     { "(bad)",  { XX } },
4131   },
4132
4133   /* PREFIX_VEX_D5 */
4134   {
4135     { "(bad)",  { XX } },
4136     { "(bad)",  { XX } },
4137     { VEX_LEN_TABLE (VEX_LEN_D5_P_2) },
4138     { "(bad)",  { XX } },
4139   },
4140
4141   /* PREFIX_VEX_D6 */
4142   {
4143     { "(bad)",  { XX } },
4144     { "(bad)",  { XX } },
4145     { VEX_LEN_TABLE (VEX_LEN_D6_P_2) },
4146     { "(bad)",  { XX } },
4147   },
4148
4149   /* PREFIX_VEX_D7 */
4150   {
4151     { "(bad)",  { XX } },
4152     { "(bad)",  { XX } },
4153     { MOD_TABLE (MOD_VEX_D7_PREFIX_2) },
4154     { "(bad)",  { XX } },
4155   },
4156
4157   /* PREFIX_VEX_D8 */
4158   {
4159     { "(bad)",  { XX } },
4160     { "(bad)",  { XX } },
4161     { VEX_LEN_TABLE (VEX_LEN_D8_P_2) },
4162     { "(bad)",  { XX } },
4163   },
4164
4165   /* PREFIX_VEX_D9 */
4166   {
4167     { "(bad)",  { XX } },
4168     { "(bad)",  { XX } },
4169     { VEX_LEN_TABLE (VEX_LEN_D9_P_2) },
4170     { "(bad)",  { XX } },
4171   },
4172
4173   /* PREFIX_VEX_DA */
4174   {
4175     { "(bad)",  { XX } },
4176     { "(bad)",  { XX } },
4177     { VEX_LEN_TABLE (VEX_LEN_DA_P_2) },
4178     { "(bad)",  { XX } },
4179   },
4180
4181   /* PREFIX_VEX_DB */
4182   {
4183     { "(bad)",  { XX } },
4184     { "(bad)",  { XX } },
4185     { VEX_LEN_TABLE (VEX_LEN_DB_P_2) },
4186     { "(bad)",  { XX } },
4187   },
4188
4189   /* PREFIX_VEX_DC */
4190   {
4191     { "(bad)",  { XX } },
4192     { "(bad)",  { XX } },
4193     { VEX_LEN_TABLE (VEX_LEN_DC_P_2) },
4194     { "(bad)",  { XX } },
4195   },
4196
4197   /* PREFIX_VEX_DD */
4198   {
4199     { "(bad)",  { XX } },
4200     { "(bad)",  { XX } },
4201     { VEX_LEN_TABLE (VEX_LEN_DD_P_2) },
4202     { "(bad)",  { XX } },
4203   },
4204
4205   /* PREFIX_VEX_DE */
4206   {
4207     { "(bad)",  { XX } },
4208     { "(bad)",  { XX } },
4209     { VEX_LEN_TABLE (VEX_LEN_DE_P_2) },
4210     { "(bad)",  { XX } },
4211   },
4212
4213   /* PREFIX_VEX_DF */
4214   {
4215     { "(bad)",  { XX } },
4216     { "(bad)",  { XX } },
4217     { VEX_LEN_TABLE (VEX_LEN_DF_P_2) },
4218     { "(bad)",  { XX } },
4219   },
4220
4221   /* PREFIX_VEX_E0 */
4222   {
4223     { "(bad)",  { XX } },
4224     { "(bad)",  { XX } },
4225     { VEX_LEN_TABLE (VEX_LEN_E0_P_2) },
4226     { "(bad)",  { XX } },
4227   },
4228
4229   /* PREFIX_VEX_E1 */
4230   {
4231     { "(bad)",  { XX } },
4232     { "(bad)",  { XX } },
4233     { VEX_LEN_TABLE (VEX_LEN_E1_P_2) },
4234     { "(bad)",  { XX } },
4235   },
4236
4237   /* PREFIX_VEX_E2 */
4238   {
4239     { "(bad)",  { XX } },
4240     { "(bad)",  { XX } },
4241     { VEX_LEN_TABLE (VEX_LEN_E2_P_2) },
4242     { "(bad)",  { XX } },
4243   },
4244
4245   /* PREFIX_VEX_E3 */
4246   {
4247     { "(bad)",  { XX } },
4248     { "(bad)",  { XX } },
4249     { VEX_LEN_TABLE (VEX_LEN_E3_P_2) },
4250     { "(bad)",  { XX } },
4251   },
4252
4253   /* PREFIX_VEX_E4 */
4254   {
4255     { "(bad)",  { XX } },
4256     { "(bad)",  { XX } },
4257     { VEX_LEN_TABLE (VEX_LEN_E4_P_2) },
4258     { "(bad)",  { XX } },
4259   },
4260
4261   /* PREFIX_VEX_E5 */
4262   {
4263     { "(bad)",  { XX } },
4264     { "(bad)",  { XX } },
4265     { VEX_LEN_TABLE (VEX_LEN_E5_P_2) },
4266     { "(bad)",  { XX } },
4267   },
4268
4269   /* PREFIX_VEX_E6 */
4270   {
4271     { "(bad)",  { XX } },
4272     { VEX_W_TABLE (VEX_W_E6_P_1) },
4273     { VEX_W_TABLE (VEX_W_E6_P_2) },
4274     { VEX_W_TABLE (VEX_W_E6_P_3) },
4275   },
4276
4277   /* PREFIX_VEX_E7 */
4278   {
4279     { "(bad)",  { XX } },
4280     { "(bad)",  { XX } },
4281     { MOD_TABLE (MOD_VEX_E7_PREFIX_2) },
4282     { "(bad)",  { XX } },
4283   },
4284
4285   /* PREFIX_VEX_E8 */
4286   {
4287     { "(bad)",  { XX } },
4288     { "(bad)",  { XX } },
4289     { VEX_LEN_TABLE (VEX_LEN_E8_P_2) },
4290     { "(bad)",  { XX } },
4291   },
4292
4293   /* PREFIX_VEX_E9 */
4294   {
4295     { "(bad)",  { XX } },
4296     { "(bad)",  { XX } },
4297     { VEX_LEN_TABLE (VEX_LEN_E9_P_2) },
4298     { "(bad)",  { XX } },
4299   },
4300
4301   /* PREFIX_VEX_EA */
4302   {
4303     { "(bad)",  { XX } },
4304     { "(bad)",  { XX } },
4305     { VEX_LEN_TABLE (VEX_LEN_EA_P_2) },
4306     { "(bad)",  { XX } },
4307   },
4308
4309   /* PREFIX_VEX_EB */
4310   {
4311     { "(bad)",  { XX } },
4312     { "(bad)",  { XX } },
4313     { VEX_LEN_TABLE (VEX_LEN_EB_P_2) },
4314     { "(bad)",  { XX } },
4315   },
4316
4317   /* PREFIX_VEX_EC */
4318   {
4319     { "(bad)",  { XX } },
4320     { "(bad)",  { XX } },
4321     { VEX_LEN_TABLE (VEX_LEN_EC_P_2) },
4322     { "(bad)",  { XX } },
4323   },
4324
4325   /* PREFIX_VEX_ED */
4326   {
4327     { "(bad)",  { XX } },
4328     { "(bad)",  { XX } },
4329     { VEX_LEN_TABLE (VEX_LEN_ED_P_2) },
4330     { "(bad)",  { XX } },
4331   },
4332
4333   /* PREFIX_VEX_EE */
4334   {
4335     { "(bad)",  { XX } },
4336     { "(bad)",  { XX } },
4337     { VEX_LEN_TABLE (VEX_LEN_EE_P_2) },
4338     { "(bad)",  { XX } },
4339   },
4340
4341   /* PREFIX_VEX_EF */
4342   {
4343     { "(bad)",  { XX } },
4344     { "(bad)",  { XX } },
4345     { VEX_LEN_TABLE (VEX_LEN_EF_P_2) },
4346     { "(bad)",  { XX } },
4347   },
4348
4349   /* PREFIX_VEX_F0 */
4350   {
4351     { "(bad)",  { XX } },
4352     { "(bad)",  { XX } },
4353     { "(bad)",  { XX } },
4354     { MOD_TABLE (MOD_VEX_F0_PREFIX_3) },
4355   },
4356
4357   /* PREFIX_VEX_F1 */
4358   {
4359     { "(bad)",  { XX } },
4360     { "(bad)",  { XX } },
4361     { VEX_LEN_TABLE (VEX_LEN_F1_P_2) },
4362     { "(bad)",  { XX } },
4363   },
4364
4365   /* PREFIX_VEX_F2 */
4366   {
4367     { "(bad)",  { XX } },
4368     { "(bad)",  { XX } },
4369     { VEX_LEN_TABLE (VEX_LEN_F2_P_2) },
4370     { "(bad)",  { XX } },
4371   },
4372
4373   /* PREFIX_VEX_F3 */
4374   {
4375     { "(bad)",  { XX } },
4376     { "(bad)",  { XX } },
4377     { VEX_LEN_TABLE (VEX_LEN_F3_P_2) },
4378     { "(bad)",  { XX } },
4379   },
4380
4381   /* PREFIX_VEX_F4 */
4382   {
4383     { "(bad)",  { XX } },
4384     { "(bad)",  { XX } },
4385     { VEX_LEN_TABLE (VEX_LEN_F4_P_2) },
4386     { "(bad)",  { XX } },
4387   },
4388
4389   /* PREFIX_VEX_F5 */
4390   {
4391     { "(bad)",  { XX } },
4392     { "(bad)",  { XX } },
4393     { VEX_LEN_TABLE (VEX_LEN_F5_P_2) },
4394     { "(bad)",  { XX } },
4395   },
4396
4397   /* PREFIX_VEX_F6 */
4398   {
4399     { "(bad)",  { XX } },
4400     { "(bad)",  { XX } },
4401     { VEX_LEN_TABLE (VEX_LEN_F6_P_2) },
4402     { "(bad)",  { XX } },
4403   },
4404
4405   /* PREFIX_VEX_F7 */
4406   {
4407     { "(bad)",  { XX } },
4408     { "(bad)",  { XX } },
4409     { VEX_LEN_TABLE (VEX_LEN_F7_P_2) },
4410     { "(bad)",  { XX } },
4411   },
4412
4413   /* PREFIX_VEX_F8 */
4414   {
4415     { "(bad)",  { XX } },
4416     { "(bad)",  { XX } },
4417     { VEX_LEN_TABLE (VEX_LEN_F8_P_2) },
4418     { "(bad)",  { XX } },
4419   },
4420
4421   /* PREFIX_VEX_F9 */
4422   {
4423     { "(bad)",  { XX } },
4424     { "(bad)",  { XX } },
4425     { VEX_LEN_TABLE (VEX_LEN_F9_P_2) },
4426     { "(bad)",  { XX } },
4427   },
4428
4429   /* PREFIX_VEX_FA */
4430   {
4431     { "(bad)",  { XX } },
4432     { "(bad)",  { XX } },
4433     { VEX_LEN_TABLE (VEX_LEN_FA_P_2) },
4434     { "(bad)",  { XX } },
4435   },
4436
4437   /* PREFIX_VEX_FB */
4438   {
4439     { "(bad)",  { XX } },
4440     { "(bad)",  { XX } },
4441     { VEX_LEN_TABLE (VEX_LEN_FB_P_2) },
4442     { "(bad)",  { XX } },
4443   },
4444
4445   /* PREFIX_VEX_FC */
4446   {
4447     { "(bad)",  { XX } },
4448     { "(bad)",  { XX } },
4449     { VEX_LEN_TABLE (VEX_LEN_FC_P_2) },
4450     { "(bad)",  { XX } },
4451   },
4452
4453   /* PREFIX_VEX_FD */
4454   {
4455     { "(bad)",  { XX } },
4456     { "(bad)",  { XX } },
4457     { VEX_LEN_TABLE (VEX_LEN_FD_P_2) },
4458     { "(bad)",  { XX } },
4459   },
4460
4461   /* PREFIX_VEX_FE */
4462   {
4463     { "(bad)",  { XX } },
4464     { "(bad)",  { XX } },
4465     { VEX_LEN_TABLE (VEX_LEN_FE_P_2) },
4466     { "(bad)",  { XX } },
4467   },
4468
4469   /* PREFIX_VEX_3800 */
4470   {
4471     { "(bad)",  { XX } },
4472     { "(bad)",  { XX } },
4473     { VEX_LEN_TABLE (VEX_LEN_3800_P_2) },
4474     { "(bad)",  { XX } },
4475   },
4476
4477   /* PREFIX_VEX_3801 */
4478   {
4479     { "(bad)",  { XX } },
4480     { "(bad)",  { XX } },
4481     { VEX_LEN_TABLE (VEX_LEN_3801_P_2) },
4482     { "(bad)",  { XX } },
4483   },
4484
4485   /* PREFIX_VEX_3802 */
4486   {
4487     { "(bad)",  { XX } },
4488     { "(bad)",  { XX } },
4489     { VEX_LEN_TABLE (VEX_LEN_3802_P_2) },
4490     { "(bad)",  { XX } },
4491   },
4492
4493   /* PREFIX_VEX_3803 */
4494   {
4495     { "(bad)",  { XX } },
4496     { "(bad)",  { XX } },
4497     { VEX_LEN_TABLE (VEX_LEN_3803_P_2) },
4498     { "(bad)",  { XX } },
4499   },
4500
4501   /* PREFIX_VEX_3804 */
4502   {
4503     { "(bad)",  { XX } },
4504     { "(bad)",  { XX } },
4505     { VEX_LEN_TABLE (VEX_LEN_3804_P_2) },
4506     { "(bad)",  { XX } },
4507   },
4508
4509   /* PREFIX_VEX_3805 */
4510   {
4511     { "(bad)",  { XX } },
4512     { "(bad)",  { XX } },
4513     { VEX_LEN_TABLE (VEX_LEN_3805_P_2) },
4514     { "(bad)",  { XX } },
4515   },
4516
4517   /* PREFIX_VEX_3806 */
4518   {
4519     { "(bad)",  { XX } },
4520     { "(bad)",  { XX } },
4521     { VEX_LEN_TABLE (VEX_LEN_3806_P_2) },
4522     { "(bad)",  { XX } },
4523   },
4524
4525   /* PREFIX_VEX_3807 */
4526   {
4527     { "(bad)",  { XX } },
4528     { "(bad)",  { XX } },
4529     { VEX_LEN_TABLE (VEX_LEN_3807_P_2) },
4530     { "(bad)",  { XX } },
4531   },
4532
4533   /* PREFIX_VEX_3808 */
4534   {
4535     { "(bad)",  { XX } },
4536     { "(bad)",  { XX } },
4537     { VEX_LEN_TABLE (VEX_LEN_3808_P_2) },
4538     { "(bad)",  { XX } },
4539   },
4540
4541   /* PREFIX_VEX_3809 */
4542   {
4543     { "(bad)",  { XX } },
4544     { "(bad)",  { XX } },
4545     { VEX_LEN_TABLE (VEX_LEN_3809_P_2) },
4546     { "(bad)",  { XX } },
4547   },
4548
4549   /* PREFIX_VEX_380A */
4550   {
4551     { "(bad)",  { XX } },
4552     { "(bad)",  { XX } },
4553     { VEX_LEN_TABLE (VEX_LEN_380A_P_2) },
4554     { "(bad)",  { XX } },
4555   },
4556
4557   /* PREFIX_VEX_380B */
4558   {
4559     { "(bad)",  { XX } },
4560     { "(bad)",  { XX } },
4561     { VEX_LEN_TABLE (VEX_LEN_380B_P_2) },
4562     { "(bad)",  { XX } },
4563   },
4564
4565   /* PREFIX_VEX_380C */
4566   {
4567     { "(bad)",  { XX } },
4568     { "(bad)",  { XX } },
4569     { VEX_W_TABLE (VEX_W_380C_P_2) },
4570     { "(bad)",  { XX } },
4571   },
4572
4573   /* PREFIX_VEX_380D */
4574   {
4575     { "(bad)",  { XX } },
4576     { "(bad)",  { XX } },
4577     { VEX_W_TABLE (VEX_W_380D_P_2) },
4578     { "(bad)",  { XX } },
4579   },
4580
4581   /* PREFIX_VEX_380E */
4582   {
4583     { "(bad)",  { XX } },
4584     { "(bad)",  { XX } },
4585     { VEX_W_TABLE (VEX_W_380E_P_2) },
4586     { "(bad)",  { XX } },
4587   },
4588
4589   /* PREFIX_VEX_380F */
4590   {
4591     { "(bad)",  { XX } },
4592     { "(bad)",  { XX } },
4593     { VEX_W_TABLE (VEX_W_380F_P_2) },
4594     { "(bad)",  { XX } },
4595   },
4596
4597   /* PREFIX_VEX_3817 */
4598   {
4599     { "(bad)",  { XX } },
4600     { "(bad)",  { XX } },
4601     { VEX_W_TABLE (VEX_W_3817_P_2) },
4602     { "(bad)",  { XX } },
4603   },
4604
4605   /* PREFIX_VEX_3818 */
4606   {
4607     { "(bad)",  { XX } },
4608     { "(bad)",  { XX } },
4609     { MOD_TABLE (MOD_VEX_3818_PREFIX_2) },
4610     { "(bad)",  { XX } },
4611   },
4612
4613   /* PREFIX_VEX_3819 */
4614   {
4615     { "(bad)",  { XX } },
4616     { "(bad)",  { XX } },
4617     { MOD_TABLE (MOD_VEX_3819_PREFIX_2) },
4618     { "(bad)",  { XX } },
4619   },
4620
4621   /* PREFIX_VEX_381A */
4622   {
4623     { "(bad)",  { XX } },
4624     { "(bad)",  { XX } },
4625     { MOD_TABLE (MOD_VEX_381A_PREFIX_2) },
4626     { "(bad)",  { XX } },
4627   },
4628
4629   /* PREFIX_VEX_381C */
4630   {
4631     { "(bad)",  { XX } },
4632     { "(bad)",  { XX } },
4633     { VEX_LEN_TABLE (VEX_LEN_381C_P_2) },
4634     { "(bad)",  { XX } },
4635   },
4636
4637   /* PREFIX_VEX_381D */
4638   {
4639     { "(bad)",  { XX } },
4640     { "(bad)",  { XX } },
4641     { VEX_LEN_TABLE (VEX_LEN_381D_P_2) },
4642     { "(bad)",  { XX } },
4643   },
4644
4645   /* PREFIX_VEX_381E */
4646   {
4647     { "(bad)",  { XX } },
4648     { "(bad)",  { XX } },
4649     { VEX_LEN_TABLE (VEX_LEN_381E_P_2) },
4650     { "(bad)",  { XX } },
4651   },
4652
4653   /* PREFIX_VEX_3820 */
4654   {
4655     { "(bad)",  { XX } },
4656     { "(bad)",  { XX } },
4657     { VEX_LEN_TABLE (VEX_LEN_3820_P_2) },
4658     { "(bad)",  { XX } },
4659   },
4660
4661   /* PREFIX_VEX_3821 */
4662   {
4663     { "(bad)",  { XX } },
4664     { "(bad)",  { XX } },
4665     { VEX_LEN_TABLE (VEX_LEN_3821_P_2) },
4666     { "(bad)",  { XX } },
4667   },
4668
4669   /* PREFIX_VEX_3822 */
4670   {
4671     { "(bad)",  { XX } },
4672     { "(bad)",  { XX } },
4673     { VEX_LEN_TABLE (VEX_LEN_3822_P_2) },
4674     { "(bad)",  { XX } },
4675   },
4676
4677   /* PREFIX_VEX_3823 */
4678   {
4679     { "(bad)",  { XX } },
4680     { "(bad)",  { XX } },
4681     { VEX_LEN_TABLE (VEX_LEN_3823_P_2) },
4682     { "(bad)",  { XX } },
4683   },
4684
4685   /* PREFIX_VEX_3824 */
4686   {
4687     { "(bad)",  { XX } },
4688     { "(bad)",  { XX } },
4689     { VEX_LEN_TABLE (VEX_LEN_3824_P_2) },
4690     { "(bad)",  { XX } },
4691   },
4692
4693   /* PREFIX_VEX_3825 */
4694   {
4695     { "(bad)",  { XX } },
4696     { "(bad)",  { XX } },
4697     { VEX_LEN_TABLE (VEX_LEN_3825_P_2) },
4698     { "(bad)",  { XX } },
4699   },
4700
4701   /* PREFIX_VEX_3828 */
4702   {
4703     { "(bad)",  { XX } },
4704     { "(bad)",  { XX } },
4705     { VEX_LEN_TABLE (VEX_LEN_3828_P_2) },
4706     { "(bad)",  { XX } },
4707   },
4708
4709   /* PREFIX_VEX_3829 */
4710   {
4711     { "(bad)",  { XX } },
4712     { "(bad)",  { XX } },
4713     { VEX_LEN_TABLE (VEX_LEN_3829_P_2) },
4714     { "(bad)",  { XX } },
4715   },
4716
4717   /* PREFIX_VEX_382A */
4718   {
4719     { "(bad)",  { XX } },
4720     { "(bad)",  { XX } },
4721     { MOD_TABLE (MOD_VEX_382A_PREFIX_2) },
4722     { "(bad)",  { XX } },
4723   },
4724
4725   /* PREFIX_VEX_382B */
4726   {
4727     { "(bad)",  { XX } },
4728     { "(bad)",  { XX } },
4729     { VEX_LEN_TABLE (VEX_LEN_382B_P_2) },
4730     { "(bad)",  { XX } },
4731   },
4732
4733   /* PREFIX_VEX_382C */
4734   {
4735     { "(bad)",  { XX } },
4736     { "(bad)",  { XX } },
4737      { MOD_TABLE (MOD_VEX_382C_PREFIX_2) },
4738     { "(bad)",  { XX } },
4739   },
4740
4741   /* PREFIX_VEX_382D */
4742   {
4743     { "(bad)",  { XX } },
4744     { "(bad)",  { XX } },
4745      { MOD_TABLE (MOD_VEX_382D_PREFIX_2) },
4746     { "(bad)",  { XX } },
4747   },
4748
4749   /* PREFIX_VEX_382E */
4750   {
4751     { "(bad)",  { XX } },
4752     { "(bad)",  { XX } },
4753      { MOD_TABLE (MOD_VEX_382E_PREFIX_2) },
4754     { "(bad)",  { XX } },
4755   },
4756
4757   /* PREFIX_VEX_382F */
4758   {
4759     { "(bad)",  { XX } },
4760     { "(bad)",  { XX } },
4761      { MOD_TABLE (MOD_VEX_382F_PREFIX_2) },
4762     { "(bad)",  { XX } },
4763   },
4764
4765   /* PREFIX_VEX_3830 */
4766   {
4767     { "(bad)",  { XX } },
4768     { "(bad)",  { XX } },
4769     { VEX_LEN_TABLE (VEX_LEN_3830_P_2) },
4770     { "(bad)",  { XX } },
4771   },
4772
4773   /* PREFIX_VEX_3831 */
4774   {
4775     { "(bad)",  { XX } },
4776     { "(bad)",  { XX } },
4777     { VEX_LEN_TABLE (VEX_LEN_3831_P_2) },
4778     { "(bad)",  { XX } },
4779   },
4780
4781   /* PREFIX_VEX_3832 */
4782   {
4783     { "(bad)",  { XX } },
4784     { "(bad)",  { XX } },
4785     { VEX_LEN_TABLE (VEX_LEN_3832_P_2) },
4786     { "(bad)",  { XX } },
4787   },
4788
4789   /* PREFIX_VEX_3833 */
4790   {
4791     { "(bad)",  { XX } },
4792     { "(bad)",  { XX } },
4793     { VEX_LEN_TABLE (VEX_LEN_3833_P_2) },
4794     { "(bad)",  { XX } },
4795   },
4796
4797   /* PREFIX_VEX_3834 */
4798   {
4799     { "(bad)",  { XX } },
4800     { "(bad)",  { XX } },
4801     { VEX_LEN_TABLE (VEX_LEN_3834_P_2) },
4802     { "(bad)",  { XX } },
4803   },
4804
4805   /* PREFIX_VEX_3835 */
4806   {
4807     { "(bad)",  { XX } },
4808     { "(bad)",  { XX } },
4809     { VEX_LEN_TABLE (VEX_LEN_3835_P_2) },
4810     { "(bad)",  { XX } },
4811   },
4812
4813   /* PREFIX_VEX_3837 */
4814   {
4815     { "(bad)",  { XX } },
4816     { "(bad)",  { XX } },
4817     { VEX_LEN_TABLE (VEX_LEN_3837_P_2) },
4818     { "(bad)",  { XX } },
4819   },
4820
4821   /* PREFIX_VEX_3838 */
4822   {
4823     { "(bad)",  { XX } },
4824     { "(bad)",  { XX } },
4825     { VEX_LEN_TABLE (VEX_LEN_3838_P_2) },
4826     { "(bad)",  { XX } },
4827   },
4828
4829   /* PREFIX_VEX_3839 */
4830   {
4831     { "(bad)",  { XX } },
4832     { "(bad)",  { XX } },
4833     { VEX_LEN_TABLE (VEX_LEN_3839_P_2) },
4834     { "(bad)",  { XX } },
4835   },
4836
4837   /* PREFIX_VEX_383A */
4838   {
4839     { "(bad)",  { XX } },
4840     { "(bad)",  { XX } },
4841     { VEX_LEN_TABLE (VEX_LEN_383A_P_2) },
4842     { "(bad)",  { XX } },
4843   },
4844
4845   /* PREFIX_VEX_383B */
4846   {
4847     { "(bad)",  { XX } },
4848     { "(bad)",  { XX } },
4849     { VEX_LEN_TABLE (VEX_LEN_383B_P_2) },
4850     { "(bad)",  { XX } },
4851   },
4852
4853   /* PREFIX_VEX_383C */
4854   {
4855     { "(bad)",  { XX } },
4856     { "(bad)",  { XX } },
4857     { VEX_LEN_TABLE (VEX_LEN_383C_P_2) },
4858     { "(bad)",  { XX } },
4859   },
4860
4861   /* PREFIX_VEX_383D */
4862   {
4863     { "(bad)",  { XX } },
4864     { "(bad)",  { XX } },
4865     { VEX_LEN_TABLE (VEX_LEN_383D_P_2) },
4866     { "(bad)",  { XX } },
4867   },
4868
4869   /* PREFIX_VEX_383E */
4870   {
4871     { "(bad)",  { XX } },
4872     { "(bad)",  { XX } },
4873     { VEX_LEN_TABLE (VEX_LEN_383E_P_2) },
4874     { "(bad)",  { XX } },
4875   },
4876
4877   /* PREFIX_VEX_383F */
4878   {
4879     { "(bad)",  { XX } },
4880     { "(bad)",  { XX } },
4881     { VEX_LEN_TABLE (VEX_LEN_383F_P_2) },
4882     { "(bad)",  { XX } },
4883   },
4884
4885   /* PREFIX_VEX_3840 */
4886   {
4887     { "(bad)",  { XX } },
4888     { "(bad)",  { XX } },
4889     { VEX_LEN_TABLE (VEX_LEN_3840_P_2) },
4890     { "(bad)",  { XX } },
4891   },
4892
4893   /* PREFIX_VEX_3841 */
4894   {
4895     { "(bad)",  { XX } },
4896     { "(bad)",  { XX } },
4897     { VEX_LEN_TABLE (VEX_LEN_3841_P_2) },
4898     { "(bad)",  { XX } },
4899   },
4900
4901   /* PREFIX_VEX_3896 */
4902   {
4903     { "(bad)",  { XX } },
4904     { "(bad)",  { XX } },
4905     { "vfmaddsub132p%XW", { XM, Vex, EXx } },
4906     { "(bad)",  { XX } },
4907   },
4908
4909   /* PREFIX_VEX_3897 */
4910   {
4911     { "(bad)",  { XX } },
4912     { "(bad)",  { XX } },
4913     { "vfmsubadd132p%XW", { XM, Vex, EXx } },
4914     { "(bad)",  { XX } },
4915   },
4916
4917   /* PREFIX_VEX_3898 */
4918   {
4919     { "(bad)",  { XX } },
4920     { "(bad)",  { XX } },
4921     { "vfmadd132p%XW", { XM, Vex, EXx } },
4922     { "(bad)",  { XX } },
4923   },
4924
4925   /* PREFIX_VEX_3899 */
4926   {
4927     { "(bad)",  { XX } },
4928     { "(bad)",  { XX } },
4929     { "vfmadd132s%XW", { XM, Vex, EXVexWdq } },
4930     { "(bad)",  { XX } },
4931   },
4932
4933   /* PREFIX_VEX_389A */
4934   {
4935     { "(bad)",  { XX } },
4936     { "(bad)",  { XX } },
4937     { "vfmsub132p%XW", { XM, Vex, EXx } },
4938     { "(bad)",  { XX } },
4939   },
4940
4941   /* PREFIX_VEX_389B */
4942   {
4943     { "(bad)",  { XX } },
4944     { "(bad)",  { XX } },
4945     { "vfmsub132s%XW", { XM, Vex, EXVexWdq } },
4946     { "(bad)",  { XX } },
4947   },
4948
4949   /* PREFIX_VEX_389C */
4950   {
4951     { "(bad)",  { XX } },
4952     { "(bad)",  { XX } },
4953     { "vfnmadd132p%XW", { XM, Vex, EXx } },
4954     { "(bad)",  { XX } },
4955   },
4956
4957   /* PREFIX_VEX_389D */
4958   {
4959     { "(bad)",  { XX } },
4960     { "(bad)",  { XX } },
4961     { "vfnmadd132s%XW", { XM, Vex, EXVexWdq } },
4962     { "(bad)",  { XX } },
4963   },
4964
4965   /* PREFIX_VEX_389E */
4966   {
4967     { "(bad)",  { XX } },
4968     { "(bad)",  { XX } },
4969     { "vfnmsub132p%XW", { XM, Vex, EXx } },
4970     { "(bad)",  { XX } },
4971   },
4972
4973   /* PREFIX_VEX_389F */
4974   {
4975     { "(bad)",  { XX } },
4976     { "(bad)",  { XX } },
4977     { "vfnmsub132s%XW", { XM, Vex, EXVexWdq } },
4978     { "(bad)",  { XX } },
4979   },
4980
4981   /* PREFIX_VEX_38A6 */
4982   {
4983     { "(bad)",  { XX } },
4984     { "(bad)",  { XX } },
4985     { "vfmaddsub213p%XW", { XM, Vex, EXx } },
4986     { "(bad)",  { XX } },
4987   },
4988
4989   /* PREFIX_VEX_38A7 */
4990   {
4991     { "(bad)",  { XX } },
4992     { "(bad)",  { XX } },
4993     { "vfmsubadd213p%XW", { XM, Vex, EXx } },
4994     { "(bad)",  { XX } },
4995   },
4996
4997   /* PREFIX_VEX_38A8 */
4998   {
4999     { "(bad)",  { XX } },
5000     { "(bad)",  { XX } },
5001     { "vfmadd213p%XW", { XM, Vex, EXx } },
5002     { "(bad)",  { XX } },
5003   },
5004
5005   /* PREFIX_VEX_38A9 */
5006   {
5007     { "(bad)",  { XX } },
5008     { "(bad)",  { XX } },
5009     { "vfmadd213s%XW", { XM, Vex, EXVexWdq } },
5010     { "(bad)",  { XX } },
5011   },
5012
5013   /* PREFIX_VEX_38AA */
5014   {
5015     { "(bad)",  { XX } },
5016     { "(bad)",  { XX } },
5017     { "vfmsub213p%XW", { XM, Vex, EXx } },
5018     { "(bad)",  { XX } },
5019   },
5020
5021   /* PREFIX_VEX_38AB */
5022   {
5023     { "(bad)",  { XX } },
5024     { "(bad)",  { XX } },
5025     { "vfmsub213s%XW", { XM, Vex, EXVexWdq } },
5026     { "(bad)",  { XX } },
5027   },
5028
5029   /* PREFIX_VEX_38AC */
5030   {
5031     { "(bad)",  { XX } },
5032     { "(bad)",  { XX } },
5033     { "vfnmadd213p%XW", { XM, Vex, EXx } },
5034     { "(bad)",  { XX } },
5035   },
5036
5037   /* PREFIX_VEX_38AD */
5038   {
5039     { "(bad)",  { XX } },
5040     { "(bad)",  { XX } },
5041     { "vfnmadd213s%XW", { XM, Vex, EXVexWdq } },
5042     { "(bad)",  { XX } },
5043   },
5044
5045   /* PREFIX_VEX_38AE */
5046   {
5047     { "(bad)",  { XX } },
5048     { "(bad)",  { XX } },
5049     { "vfnmsub213p%XW", { XM, Vex, EXx } },
5050     { "(bad)",  { XX } },
5051   },
5052
5053   /* PREFIX_VEX_38AF */
5054   {
5055     { "(bad)",  { XX } },
5056     { "(bad)",  { XX } },
5057     { "vfnmsub213s%XW", { XM, Vex, EXVexWdq } },
5058     { "(bad)",  { XX } },
5059   },
5060
5061   /* PREFIX_VEX_38B6 */
5062   {
5063     { "(bad)",  { XX } },
5064     { "(bad)",  { XX } },
5065     { "vfmaddsub231p%XW", { XM, Vex, EXx } },
5066     { "(bad)",  { XX } },
5067   },
5068
5069   /* PREFIX_VEX_38B7 */
5070   {
5071     { "(bad)",  { XX } },
5072     { "(bad)",  { XX } },
5073     { "vfmsubadd231p%XW", { XM, Vex, EXx } },
5074     { "(bad)",  { XX } },
5075   },
5076
5077   /* PREFIX_VEX_38B8 */
5078   {
5079     { "(bad)",  { XX } },
5080     { "(bad)",  { XX } },
5081     { "vfmadd231p%XW", { XM, Vex, EXx } },
5082     { "(bad)",  { XX } },
5083   },
5084
5085   /* PREFIX_VEX_38B9 */
5086   {
5087     { "(bad)",  { XX } },
5088     { "(bad)",  { XX } },
5089     { "vfmadd231s%XW", { XM, Vex, EXVexWdq } },
5090     { "(bad)",  { XX } },
5091   },
5092
5093   /* PREFIX_VEX_38BA */
5094   {
5095     { "(bad)",  { XX } },
5096     { "(bad)",  { XX } },
5097     { "vfmsub231p%XW", { XM, Vex, EXx } },
5098     { "(bad)",  { XX } },
5099   },
5100
5101   /* PREFIX_VEX_38BB */
5102   {
5103     { "(bad)",  { XX } },
5104     { "(bad)",  { XX } },
5105     { "vfmsub231s%XW", { XM, Vex, EXVexWdq } },
5106     { "(bad)",  { XX } },
5107   },
5108
5109   /* PREFIX_VEX_38BC */
5110   {
5111     { "(bad)",  { XX } },
5112     { "(bad)",  { XX } },
5113     { "vfnmadd231p%XW", { XM, Vex, EXx } },
5114     { "(bad)",  { XX } },
5115   },
5116
5117   /* PREFIX_VEX_38BD */
5118   {
5119     { "(bad)",  { XX } },
5120     { "(bad)",  { XX } },
5121     { "vfnmadd231s%XW", { XM, Vex, EXVexWdq } },
5122     { "(bad)",  { XX } },
5123   },
5124
5125   /* PREFIX_VEX_38BE */
5126   {
5127     { "(bad)",  { XX } },
5128     { "(bad)",  { XX } },
5129     { "vfnmsub231p%XW", { XM, Vex, EXx } },
5130     { "(bad)",  { XX } },
5131   },
5132
5133   /* PREFIX_VEX_38BF */
5134   {
5135     { "(bad)",  { XX } },
5136     { "(bad)",  { XX } },
5137     { "vfnmsub231s%XW", { XM, Vex, EXVexWdq } },
5138     { "(bad)",  { XX } },
5139   },
5140
5141   /* PREFIX_VEX_38DB */
5142   {
5143     { "(bad)",  { XX } },
5144     { "(bad)",  { XX } },
5145     { VEX_LEN_TABLE (VEX_LEN_38DB_P_2) },
5146     { "(bad)",  { XX } },
5147   },
5148
5149   /* PREFIX_VEX_38DC */
5150   {
5151     { "(bad)",  { XX } },
5152     { "(bad)",  { XX } },
5153     { VEX_LEN_TABLE (VEX_LEN_38DC_P_2) },
5154     { "(bad)",  { XX } },
5155   },
5156
5157   /* PREFIX_VEX_38DD */
5158   {
5159     { "(bad)",  { XX } },
5160     { "(bad)",  { XX } },
5161     { VEX_LEN_TABLE (VEX_LEN_38DD_P_2) },
5162     { "(bad)",  { XX } },
5163   },
5164
5165   /* PREFIX_VEX_38DE */
5166   {
5167     { "(bad)",  { XX } },
5168     { "(bad)",  { XX } },
5169     { VEX_LEN_TABLE (VEX_LEN_38DE_P_2) },
5170     { "(bad)",  { XX } },
5171   },
5172
5173   /* PREFIX_VEX_38DF */
5174   {
5175     { "(bad)",  { XX } },
5176     { "(bad)",  { XX } },
5177     { VEX_LEN_TABLE (VEX_LEN_38DF_P_2) },
5178     { "(bad)",  { XX } },
5179   },
5180
5181   /* PREFIX_VEX_3A04 */
5182   {
5183     { "(bad)",  { XX } },
5184     { "(bad)",  { XX } },
5185     { VEX_W_TABLE (VEX_W_3A04_P_2) },
5186     { "(bad)",  { XX } },
5187   },
5188
5189   /* PREFIX_VEX_3A05 */
5190   {
5191     { "(bad)",  { XX } },
5192     { "(bad)",  { XX } },
5193     { VEX_W_TABLE (VEX_W_3A05_P_2) },
5194     { "(bad)",  { XX } },
5195   },
5196
5197   /* PREFIX_VEX_3A06 */
5198   {
5199     { "(bad)",  { XX } },
5200     { "(bad)",  { XX } },
5201     { VEX_LEN_TABLE (VEX_LEN_3A06_P_2) },
5202     { "(bad)",  { XX } },
5203   },
5204
5205   /* PREFIX_VEX_3A08 */
5206   {
5207     { "(bad)",  { XX } },
5208     { "(bad)",  { XX } },
5209     { VEX_W_TABLE (VEX_W_3A08_P_2) },
5210     { "(bad)",  { XX } },
5211   },
5212
5213   /* PREFIX_VEX_3A09 */
5214   {
5215     { "(bad)",  { XX } },
5216     { "(bad)",  { XX } },
5217     { VEX_W_TABLE (VEX_W_3A09_P_2) },
5218     { "(bad)",  { XX } },
5219   },
5220
5221   /* PREFIX_VEX_3A0A */
5222   {
5223     { "(bad)",  { XX } },
5224     { "(bad)",  { XX } },
5225     { VEX_LEN_TABLE (VEX_LEN_3A0A_P_2) },
5226     { "(bad)",  { XX } },
5227   },
5228
5229   /* PREFIX_VEX_3A0B */
5230   {
5231     { "(bad)",  { XX } },
5232     { "(bad)",  { XX } },
5233     { VEX_LEN_TABLE (VEX_LEN_3A0B_P_2) },
5234     { "(bad)",  { XX } },
5235   },
5236
5237   /* PREFIX_VEX_3A0C */
5238   {
5239     { "(bad)",  { XX } },
5240     { "(bad)",  { XX } },
5241     { VEX_W_TABLE (VEX_W_3A0C_P_2) },
5242     { "(bad)",  { XX } },
5243   },
5244
5245   /* PREFIX_VEX_3A0D */
5246   {
5247     { "(bad)",  { XX } },
5248     { "(bad)",  { XX } },
5249     { VEX_W_TABLE (VEX_W_3A0D_P_2) },
5250     { "(bad)",  { XX } },
5251   },
5252
5253   /* PREFIX_VEX_3A0E */
5254   {
5255     { "(bad)",  { XX } },
5256     { "(bad)",  { XX } },
5257     { VEX_LEN_TABLE (VEX_LEN_3A0E_P_2) },
5258     { "(bad)",  { XX } },
5259   },
5260
5261   /* PREFIX_VEX_3A0F */
5262   {
5263     { "(bad)",  { XX } },
5264     { "(bad)",  { XX } },
5265     { VEX_LEN_TABLE (VEX_LEN_3A0F_P_2) },
5266     { "(bad)",  { XX } },
5267   },
5268
5269   /* PREFIX_VEX_3A14 */
5270   {
5271     { "(bad)",  { XX } },
5272     { "(bad)",  { XX } },
5273     { VEX_LEN_TABLE (VEX_LEN_3A14_P_2) },
5274     { "(bad)",  { XX } },
5275   },
5276
5277   /* PREFIX_VEX_3A15 */
5278   {
5279     { "(bad)",  { XX } },
5280     { "(bad)",  { XX } },
5281     { VEX_LEN_TABLE (VEX_LEN_3A15_P_2) },
5282     { "(bad)",  { XX } },
5283   },
5284
5285   /* PREFIX_VEX_3A16 */
5286   {
5287     { "(bad)",  { XX } },
5288     { "(bad)",  { XX } },
5289     { VEX_LEN_TABLE (VEX_LEN_3A16_P_2) },
5290     { "(bad)",  { XX } },
5291   },
5292
5293   /* PREFIX_VEX_3A17 */
5294   {
5295     { "(bad)",  { XX } },
5296     { "(bad)",  { XX } },
5297     { VEX_LEN_TABLE (VEX_LEN_3A17_P_2) },
5298     { "(bad)",  { XX } },
5299   },
5300
5301   /* PREFIX_VEX_3A18 */
5302   {
5303     { "(bad)",  { XX } },
5304     { "(bad)",  { XX } },
5305     { VEX_LEN_TABLE (VEX_LEN_3A18_P_2) },
5306     { "(bad)",  { XX } },
5307   },
5308
5309   /* PREFIX_VEX_3A19 */
5310   {
5311     { "(bad)",  { XX } },
5312     { "(bad)",  { XX } },
5313     { VEX_LEN_TABLE (VEX_LEN_3A19_P_2) },
5314     { "(bad)",  { XX } },
5315   },
5316
5317   /* PREFIX_VEX_3A20 */
5318   {
5319     { "(bad)",  { XX } },
5320     { "(bad)",  { XX } },
5321     { VEX_LEN_TABLE (VEX_LEN_3A20_P_2) },
5322     { "(bad)",  { XX } },
5323   },
5324
5325   /* PREFIX_VEX_3A21 */
5326   {
5327     { "(bad)",  { XX } },
5328     { "(bad)",  { XX } },
5329     { VEX_LEN_TABLE (VEX_LEN_3A21_P_2) },
5330     { "(bad)",  { XX } },
5331   },
5332
5333   /* PREFIX_VEX_3A22 */
5334   {
5335     { "(bad)",  { XX } },
5336     { "(bad)",  { XX } },
5337     { VEX_LEN_TABLE (VEX_LEN_3A22_P_2) },
5338     { "(bad)",  { XX } },
5339   },
5340
5341   /* PREFIX_VEX_3A40 */
5342   {
5343     { "(bad)",  { XX } },
5344     { "(bad)",  { XX } },
5345     { VEX_W_TABLE (VEX_W_3A40_P_2) },
5346     { "(bad)",  { XX } },
5347   },
5348
5349   /* PREFIX_VEX_3A41 */
5350   {
5351     { "(bad)",  { XX } },
5352     { "(bad)",  { XX } },
5353     { VEX_LEN_TABLE (VEX_LEN_3A41_P_2) },
5354     { "(bad)",  { XX } },
5355   },
5356
5357   /* PREFIX_VEX_3A42 */
5358   {
5359     { "(bad)",  { XX } },
5360     { "(bad)",  { XX } },
5361     { VEX_LEN_TABLE (VEX_LEN_3A42_P_2) },
5362     { "(bad)",  { XX } },
5363   },
5364
5365   /* PREFIX_VEX_3A44 */
5366   {
5367     { "(bad)",  { XX } },
5368     { "(bad)",  { XX } },
5369     { VEX_LEN_TABLE (VEX_LEN_3A44_P_2) },
5370     { "(bad)",  { XX } },
5371   },
5372
5373   /* PREFIX_VEX_3A4A */
5374   {
5375     { "(bad)",  { XX } },
5376     { "(bad)",  { XX } },
5377     { VEX_W_TABLE (VEX_W_3A4A_P_2) },
5378     { "(bad)",  { XX } },
5379   },
5380
5381   /* PREFIX_VEX_3A4B */
5382   {
5383     { "(bad)",  { XX } },
5384     { "(bad)",  { XX } },
5385     { VEX_W_TABLE (VEX_W_3A4B_P_2) },
5386     { "(bad)",  { XX } },
5387   },
5388
5389   /* PREFIX_VEX_3A4C */
5390   {
5391     { "(bad)",  { XX } },
5392     { "(bad)",  { XX } },
5393     { VEX_LEN_TABLE (VEX_LEN_3A4C_P_2) },
5394     { "(bad)",  { XX } },
5395   },
5396
5397   /* PREFIX_VEX_3A5C */
5398   {
5399     { "(bad)",  { XX } },
5400     { "(bad)",  { XX } },
5401     { "vfmaddsubps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5402     { "(bad)",  { XX } },
5403   },
5404
5405   /* PREFIX_VEX_3A5D */
5406   {
5407     { "(bad)",  { XX } },
5408     { "(bad)",  { XX } },
5409     { "vfmaddsubpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5410     { "(bad)",  { XX } },
5411   },
5412
5413   /* PREFIX_VEX_3A5E */
5414   {
5415     { "(bad)",  { XX } },
5416     { "(bad)",  { XX } },
5417     { "vfmsubaddps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5418     { "(bad)",  { XX } },
5419   },
5420
5421   /* PREFIX_VEX_3A5F */
5422   {
5423     { "(bad)",  { XX } },
5424     { "(bad)",  { XX } },
5425     { "vfmsubaddpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5426     { "(bad)",  { XX } },
5427   },
5428
5429   /* PREFIX_VEX_3A60 */
5430   {
5431     { "(bad)",  { XX } },
5432     { "(bad)",  { XX } },
5433     { VEX_LEN_TABLE (VEX_LEN_3A60_P_2) },
5434     { "(bad)",  { XX } },
5435   },
5436
5437   /* PREFIX_VEX_3A61 */
5438   {
5439     { "(bad)",  { XX } },
5440     { "(bad)",  { XX } },
5441     { VEX_LEN_TABLE (VEX_LEN_3A61_P_2) },
5442     { "(bad)",  { XX } },
5443   },
5444
5445   /* PREFIX_VEX_3A62 */
5446   {
5447     { "(bad)",  { XX } },
5448     { "(bad)",  { XX } },
5449     { VEX_LEN_TABLE (VEX_LEN_3A62_P_2) },
5450     { "(bad)",  { XX } },
5451   },
5452
5453   /* PREFIX_VEX_3A63 */
5454   {
5455     { "(bad)",  { XX } },
5456     { "(bad)",  { XX } },
5457     { VEX_LEN_TABLE (VEX_LEN_3A63_P_2) },
5458     { "(bad)",  { XX } },
5459   },
5460
5461   /* PREFIX_VEX_3A68 */
5462   {
5463     { "(bad)",  { XX } },
5464     { "(bad)",  { XX } },
5465     { "vfmaddps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5466     { "(bad)",  { XX } },
5467   },
5468
5469   /* PREFIX_VEX_3A69 */
5470   {
5471     { "(bad)",  { XX } },
5472     { "(bad)",  { XX } },
5473     { "vfmaddpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5474     { "(bad)",  { XX } },
5475   },
5476
5477   /* PREFIX_VEX_3A6A */
5478   {
5479     { "(bad)",  { XX } },
5480     { "(bad)",  { XX } },
5481     { VEX_LEN_TABLE (VEX_LEN_3A6A_P_2) },
5482     { "(bad)",  { XX } },
5483   },
5484
5485   /* PREFIX_VEX_3A6B */
5486   {
5487     { "(bad)",  { XX } },
5488     { "(bad)",  { XX } },
5489     { VEX_LEN_TABLE (VEX_LEN_3A6B_P_2) },
5490     { "(bad)",  { XX } },
5491   },
5492
5493   /* PREFIX_VEX_3A6C */
5494   {
5495     { "(bad)",  { XX } },
5496     { "(bad)",  { XX } },
5497     { "vfmsubps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5498     { "(bad)",  { XX } },
5499   },
5500
5501   /* PREFIX_VEX_3A6D */
5502   {
5503     { "(bad)",  { XX } },
5504     { "(bad)",  { XX } },
5505     { "vfmsubpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5506     { "(bad)",  { XX } },
5507   },
5508
5509   /* PREFIX_VEX_3A6E */
5510   {
5511     { "(bad)",  { XX } },
5512     { "(bad)",  { XX } },
5513     { VEX_LEN_TABLE (VEX_LEN_3A6E_P_2) },
5514     { "(bad)",  { XX } },
5515   },
5516
5517   /* PREFIX_VEX_3A6F */
5518   {
5519     { "(bad)",  { XX } },
5520     { "(bad)",  { XX } },
5521     { VEX_LEN_TABLE (VEX_LEN_3A6F_P_2) },
5522     { "(bad)",  { XX } },
5523   },
5524
5525   /* PREFIX_VEX_3A78 */
5526   {
5527     { "(bad)",  { XX } },
5528     { "(bad)",  { XX } },
5529     { "vfnmaddps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5530     { "(bad)",  { XX } },
5531   },
5532
5533   /* PREFIX_VEX_3A79 */
5534   {
5535     { "(bad)",  { XX } },
5536     { "(bad)",  { XX } },
5537     { "vfnmaddpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5538     { "(bad)",  { XX } },
5539   },
5540
5541   /* PREFIX_VEX_3A7A */
5542   {
5543     { "(bad)",  { XX } },
5544     { "(bad)",  { XX } },
5545     { VEX_LEN_TABLE (VEX_LEN_3A7A_P_2) },
5546     { "(bad)",  { XX } },
5547   },
5548
5549   /* PREFIX_VEX_3A7B */
5550   {
5551     { "(bad)",  { XX } },
5552     { "(bad)",  { XX } },
5553     { VEX_LEN_TABLE (VEX_LEN_3A7B_P_2) },
5554     { "(bad)",  { XX } },
5555   },
5556
5557   /* PREFIX_VEX_3A7C */
5558   {
5559     { "(bad)",  { XX } },
5560     { "(bad)",  { XX } },
5561     { "vfnmsubps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5562     { "(bad)",  { XX } },
5563   },
5564
5565   /* PREFIX_VEX_3A7D */
5566   {
5567     { "(bad)",  { XX } },
5568     { "(bad)",  { XX } },
5569     { "vfnmsubpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5570     { "(bad)",  { XX } },
5571   },
5572
5573   /* PREFIX_VEX_3A7E */
5574   {
5575     { "(bad)",  { XX } },
5576     { "(bad)",  { XX } },
5577     { VEX_LEN_TABLE (VEX_LEN_3A7E_P_2) },
5578     { "(bad)",  { XX } },
5579   },
5580
5581   /* PREFIX_VEX_3A7F */
5582   {
5583     { "(bad)",  { XX } },
5584     { "(bad)",  { XX } },
5585     { VEX_LEN_TABLE (VEX_LEN_3A7F_P_2) },
5586     { "(bad)",  { XX } },
5587   },
5588
5589   /* PREFIX_VEX_3ADF */
5590   {
5591     { "(bad)",  { XX } },
5592     { "(bad)",  { XX } },
5593     { VEX_LEN_TABLE (VEX_LEN_3ADF_P_2) },
5594     { "(bad)",  { XX } },
5595   },
5596 };
5597
5598 static const struct dis386 x86_64_table[][2] = {
5599   /* X86_64_06 */
5600   {
5601     { "push{T|}", { es } },
5602     { "(bad)", { XX } },
5603   },
5604
5605   /* X86_64_07 */
5606   {
5607     { "pop{T|}", { es } },
5608     { "(bad)", { XX } },
5609   },
5610
5611   /* X86_64_0D */
5612   {
5613     { "push{T|}", { cs } },
5614     { "(bad)", { XX } },
5615   },
5616
5617   /* X86_64_16 */
5618   {
5619     { "push{T|}", { ss } },
5620     { "(bad)", { XX } },
5621   },
5622
5623   /* X86_64_17 */
5624   {
5625     { "pop{T|}", { ss } },
5626     { "(bad)", { XX } },
5627   },
5628
5629   /* X86_64_1E */
5630   {
5631     { "push{T|}", { ds } },
5632     { "(bad)", { XX } },
5633   },
5634
5635   /* X86_64_1F */
5636   {
5637     { "pop{T|}", { ds } },
5638     { "(bad)", { XX } },
5639   },
5640
5641   /* X86_64_27 */
5642   {
5643     { "daa", { XX } },
5644     { "(bad)", { XX } },
5645   },
5646
5647   /* X86_64_2F */
5648   {
5649     { "das", { XX } },
5650     { "(bad)", { XX } },
5651   },
5652
5653   /* X86_64_37 */
5654   {
5655     { "aaa", { XX } },
5656     { "(bad)", { XX } },
5657   },
5658
5659   /* X86_64_3F */
5660   {
5661     { "aas", { XX } },
5662     { "(bad)", { XX } },
5663   },
5664
5665   /* X86_64_60 */
5666   {
5667     { "pusha{P|}", { XX } },
5668     { "(bad)", { XX } },
5669   },
5670
5671   /* X86_64_61 */
5672   {
5673     { "popa{P|}", { XX } },
5674     { "(bad)", { XX } },
5675   },
5676
5677   /* X86_64_62 */
5678   {
5679     { MOD_TABLE (MOD_62_32BIT) },
5680     { "(bad)", { XX } },
5681   },
5682
5683   /* X86_64_63 */
5684   {
5685     { "arpl", { Ew, Gw } },
5686     { "movs{lq|xd}", { Gv, Ed } },
5687   },
5688
5689   /* X86_64_6D */
5690   {
5691     { "ins{R|}", { Yzr, indirDX } },
5692     { "ins{G|}", { Yzr, indirDX } },
5693   },
5694
5695   /* X86_64_6F */
5696   {
5697     { "outs{R|}", { indirDXr, Xz } },
5698     { "outs{G|}", { indirDXr, Xz } },
5699   },
5700
5701   /* X86_64_9A */
5702   {
5703     { "Jcall{T|}", { Ap } },
5704     { "(bad)", { XX } },
5705   },
5706
5707   /* X86_64_C4 */
5708   {
5709     { MOD_TABLE (MOD_C4_32BIT) },
5710     { VEX_C4_TABLE (VEX_0F) },
5711   },
5712
5713   /* X86_64_C5 */
5714   {
5715     { MOD_TABLE (MOD_C5_32BIT) },
5716     { VEX_C5_TABLE (VEX_0F) },
5717   },
5718
5719   /* X86_64_CE */
5720   {
5721     { "into", { XX } },
5722     { "(bad)", { XX } },
5723   },
5724
5725   /* X86_64_D4 */
5726   {
5727     { "aam", { sIb } },
5728     { "(bad)", { XX } },
5729   },
5730
5731   /* X86_64_D5 */
5732   {
5733     { "aad", { sIb } },
5734     { "(bad)", { XX } },
5735   },
5736
5737   /* X86_64_EA */
5738   {
5739     { "Jjmp{T|}", { Ap } },
5740     { "(bad)", { XX } },
5741   },
5742
5743   /* X86_64_0F01_REG_0 */
5744   {
5745     { "sgdt{Q|IQ}", { M } },
5746     { "sgdt", { M } },
5747   },
5748
5749   /* X86_64_0F01_REG_1 */
5750   {
5751     { "sidt{Q|IQ}", { M } },
5752     { "sidt", { M } },
5753   },
5754
5755   /* X86_64_0F01_REG_2 */
5756   {
5757     { "lgdt{Q|Q}", { M } },
5758     { "lgdt", { M } },
5759   },
5760
5761   /* X86_64_0F01_REG_3 */
5762   {
5763     { "lidt{Q|Q}", { M } },
5764     { "lidt", { M } },
5765   },
5766 };
5767
5768 static const struct dis386 three_byte_table[][256] = {
5769
5770   /* THREE_BYTE_0F38 */
5771   {
5772     /* 00 */
5773     { "pshufb",         { MX, EM } },
5774     { "phaddw",         { MX, EM } },
5775     { "phaddd",         { MX, EM } },
5776     { "phaddsw",        { MX, EM } },
5777     { "pmaddubsw",      { MX, EM } },
5778     { "phsubw",         { MX, EM } },
5779     { "phsubd",         { MX, EM } },
5780     { "phsubsw",        { MX, EM } },
5781     /* 08 */
5782     { "psignb",         { MX, EM } },
5783     { "psignw",         { MX, EM } },
5784     { "psignd",         { MX, EM } },
5785     { "pmulhrsw",       { MX, EM } },
5786     { "(bad)",          { XX } },
5787     { "(bad)",          { XX } },
5788     { "(bad)",          { XX } },
5789     { "(bad)",          { XX } },
5790     /* 10 */
5791     { PREFIX_TABLE (PREFIX_0F3810) },
5792     { "(bad)",          { XX } },
5793     { "(bad)",          { XX } },
5794     { "(bad)",          { XX } },
5795     { PREFIX_TABLE (PREFIX_0F3814) },
5796     { PREFIX_TABLE (PREFIX_0F3815) },
5797     { "(bad)",          { XX } },
5798     { PREFIX_TABLE (PREFIX_0F3817) },
5799     /* 18 */
5800     { "(bad)",          { XX } },
5801     { "(bad)",          { XX } },
5802     { "(bad)",          { XX } },
5803     { "(bad)",          { XX } },
5804     { "pabsb",          { MX, EM } },
5805     { "pabsw",          { MX, EM } },
5806     { "pabsd",          { MX, EM } },
5807     { "(bad)",          { XX } },
5808     /* 20 */
5809     { PREFIX_TABLE (PREFIX_0F3820) },
5810     { PREFIX_TABLE (PREFIX_0F3821) },
5811     { PREFIX_TABLE (PREFIX_0F3822) },
5812     { PREFIX_TABLE (PREFIX_0F3823) },
5813     { PREFIX_TABLE (PREFIX_0F3824) },
5814     { PREFIX_TABLE (PREFIX_0F3825) },
5815     { "(bad)",          { XX } },
5816     { "(bad)",          { XX } },
5817     /* 28 */
5818     { PREFIX_TABLE (PREFIX_0F3828) },
5819     { PREFIX_TABLE (PREFIX_0F3829) },
5820     { PREFIX_TABLE (PREFIX_0F382A) },
5821     { PREFIX_TABLE (PREFIX_0F382B) },
5822     { "(bad)",          { XX } },
5823     { "(bad)",          { XX } },
5824     { "(bad)",          { XX } },
5825     { "(bad)",          { XX } },
5826     /* 30 */
5827     { PREFIX_TABLE (PREFIX_0F3830) },
5828     { PREFIX_TABLE (PREFIX_0F3831) },
5829     { PREFIX_TABLE (PREFIX_0F3832) },
5830     { PREFIX_TABLE (PREFIX_0F3833) },
5831     { PREFIX_TABLE (PREFIX_0F3834) },
5832     { PREFIX_TABLE (PREFIX_0F3835) },
5833     { "(bad)",          { XX } },
5834     { PREFIX_TABLE (PREFIX_0F3837) },
5835     /* 38 */
5836     { PREFIX_TABLE (PREFIX_0F3838) },
5837     { PREFIX_TABLE (PREFIX_0F3839) },
5838     { PREFIX_TABLE (PREFIX_0F383A) },
5839     { PREFIX_TABLE (PREFIX_0F383B) },
5840     { PREFIX_TABLE (PREFIX_0F383C) },
5841     { PREFIX_TABLE (PREFIX_0F383D) },
5842     { PREFIX_TABLE (PREFIX_0F383E) },
5843     { PREFIX_TABLE (PREFIX_0F383F) },
5844     /* 40 */
5845     { PREFIX_TABLE (PREFIX_0F3840) },
5846     { PREFIX_TABLE (PREFIX_0F3841) },
5847     { "(bad)",          { XX } },
5848     { "(bad)",          { XX } },
5849     { "(bad)",          { XX } },
5850     { "(bad)",          { XX } },
5851     { "(bad)",          { XX } },
5852     { "(bad)",          { XX } },
5853     /* 48 */
5854     { "(bad)",          { XX } },
5855     { "(bad)",          { XX } },
5856     { "(bad)",          { XX } },
5857     { "(bad)",          { XX } },
5858     { "(bad)",          { XX } },
5859     { "(bad)",          { XX } },
5860     { "(bad)",          { XX } },
5861     { "(bad)",          { XX } },
5862     /* 50 */
5863     { "(bad)",          { XX } },
5864     { "(bad)",          { XX } },
5865     { "(bad)",          { XX } },
5866     { "(bad)",          { XX } },
5867     { "(bad)",          { XX } },
5868     { "(bad)",          { XX } },
5869     { "(bad)",          { XX } },
5870     { "(bad)",          { XX } },
5871     /* 58 */
5872     { "(bad)",          { XX } },
5873     { "(bad)",          { XX } },
5874     { "(bad)",          { XX } },
5875     { "(bad)",          { XX } },
5876     { "(bad)",          { XX } },
5877     { "(bad)",          { XX } },
5878     { "(bad)",          { XX } },
5879     { "(bad)",          { XX } },
5880     /* 60 */
5881     { "(bad)",          { XX } },
5882     { "(bad)",          { XX } },
5883     { "(bad)",          { XX } },
5884     { "(bad)",          { XX } },
5885     { "(bad)",          { XX } },
5886     { "(bad)",          { XX } },
5887     { "(bad)",          { XX } },
5888     { "(bad)",          { XX } },
5889     /* 68 */
5890     { "(bad)",          { XX } },
5891     { "(bad)",          { XX } },
5892     { "(bad)",          { XX } },
5893     { "(bad)",          { XX } },
5894     { "(bad)",          { XX } },
5895     { "(bad)",          { XX } },
5896     { "(bad)",          { XX } },
5897     { "(bad)",          { XX } },
5898     /* 70 */
5899     { "(bad)",          { XX } },
5900     { "(bad)",          { XX } },
5901     { "(bad)",          { XX } },
5902     { "(bad)",          { XX } },
5903     { "(bad)",          { XX } },
5904     { "(bad)",          { XX } },
5905     { "(bad)",          { XX } },
5906     { "(bad)",          { XX } },
5907     /* 78 */
5908     { "(bad)",          { XX } },
5909     { "(bad)",          { XX } },
5910     { "(bad)",          { XX } },
5911     { "(bad)",          { XX } },
5912     { "(bad)",          { XX } },
5913     { "(bad)",          { XX } },
5914     { "(bad)",          { XX } },
5915     { "(bad)",          { XX } },
5916     /* 80 */
5917     { PREFIX_TABLE (PREFIX_0F3880) },
5918     { PREFIX_TABLE (PREFIX_0F3881) },
5919     { "(bad)",          { XX } },
5920     { "(bad)",          { XX } },
5921     { "(bad)",          { XX } },
5922     { "(bad)",          { XX } },
5923     { "(bad)",          { XX } },
5924     { "(bad)",          { XX } },
5925     /* 88 */
5926     { "(bad)",          { XX } },
5927     { "(bad)",          { XX } },
5928     { "(bad)",          { XX } },
5929     { "(bad)",          { XX } },
5930     { "(bad)",          { XX } },
5931     { "(bad)",          { XX } },
5932     { "(bad)",          { XX } },
5933     { "(bad)",          { XX } },
5934     /* 90 */
5935     { "(bad)",          { XX } },
5936     { "(bad)",          { XX } },
5937     { "(bad)",          { XX } },
5938     { "(bad)",          { XX } },
5939     { "(bad)",          { XX } },
5940     { "(bad)",          { XX } },
5941     { "(bad)",          { XX } },
5942     { "(bad)",          { XX } },
5943     /* 98 */
5944     { "(bad)",          { XX } },
5945     { "(bad)",          { XX } },
5946     { "(bad)",          { XX } },
5947     { "(bad)",          { XX } },
5948     { "(bad)",          { XX } },
5949     { "(bad)",          { XX } },
5950     { "(bad)",          { XX } },
5951     { "(bad)",          { XX } },
5952     /* a0 */
5953     { "(bad)",          { XX } },
5954     { "(bad)",          { XX } },
5955     { "(bad)",          { XX } },
5956     { "(bad)",          { XX } },
5957     { "(bad)",          { XX } },
5958     { "(bad)",          { XX } },
5959     { "(bad)",          { XX } },
5960     { "(bad)",          { XX } },
5961     /* a8 */
5962     { "(bad)",          { XX } },
5963     { "(bad)",          { XX } },
5964     { "(bad)",          { XX } },
5965     { "(bad)",          { XX } },
5966     { "(bad)",          { XX } },
5967     { "(bad)",          { XX } },
5968     { "(bad)",          { XX } },
5969     { "(bad)",          { XX } },
5970     /* b0 */
5971     { "(bad)",          { XX } },
5972     { "(bad)",          { XX } },
5973     { "(bad)",          { XX } },
5974     { "(bad)",          { XX } },
5975     { "(bad)",          { XX } },
5976     { "(bad)",          { XX } },
5977     { "(bad)",          { XX } },
5978     { "(bad)",          { XX } },
5979     /* b8 */
5980     { "(bad)",          { XX } },
5981     { "(bad)",          { XX } },
5982     { "(bad)",          { XX } },
5983     { "(bad)",          { XX } },
5984     { "(bad)",          { XX } },
5985     { "(bad)",          { XX } },
5986     { "(bad)",          { XX } },
5987     { "(bad)",          { XX } },
5988     /* c0 */
5989     { "(bad)",          { XX } },
5990     { "(bad)",          { XX } },
5991     { "(bad)",          { XX } },
5992     { "(bad)",          { XX } },
5993     { "(bad)",          { XX } },
5994     { "(bad)",          { XX } },
5995     { "(bad)",          { XX } },
5996     { "(bad)",          { XX } },
5997     /* c8 */
5998     { "(bad)",          { XX } },
5999     { "(bad)",          { XX } },
6000     { "(bad)",          { XX } },
6001     { "(bad)",          { XX } },
6002     { "(bad)",          { XX } },
6003     { "(bad)",          { XX } },
6004     { "(bad)",          { XX } },
6005     { "(bad)",          { XX } },
6006     /* d0 */
6007     { "(bad)",          { XX } },
6008     { "(bad)",          { XX } },
6009     { "(bad)",          { XX } },
6010     { "(bad)",          { XX } },
6011     { "(bad)",          { XX } },
6012     { "(bad)",          { XX } },
6013     { "(bad)",          { XX } },
6014     { "(bad)",          { XX } },
6015     /* d8 */
6016     { "(bad)",          { XX } },
6017     { "(bad)",          { XX } },
6018     { "(bad)",          { XX } },
6019     { PREFIX_TABLE (PREFIX_0F38DB) },
6020     { PREFIX_TABLE (PREFIX_0F38DC) },
6021     { PREFIX_TABLE (PREFIX_0F38DD) },
6022     { PREFIX_TABLE (PREFIX_0F38DE) },
6023     { PREFIX_TABLE (PREFIX_0F38DF) },
6024     /* e0 */
6025     { "(bad)",          { XX } },
6026     { "(bad)",          { XX } },
6027     { "(bad)",          { XX } },
6028     { "(bad)",          { XX } },
6029     { "(bad)",          { XX } },
6030     { "(bad)",          { XX } },
6031     { "(bad)",          { XX } },
6032     { "(bad)",          { XX } },
6033     /* e8 */
6034     { "(bad)",          { XX } },
6035     { "(bad)",          { XX } },
6036     { "(bad)",          { XX } },
6037     { "(bad)",          { XX } },
6038     { "(bad)",          { XX } },
6039     { "(bad)",          { XX } },
6040     { "(bad)",          { XX } },
6041     { "(bad)",          { XX } },
6042     /* f0 */
6043     { PREFIX_TABLE (PREFIX_0F38F0) },
6044     { PREFIX_TABLE (PREFIX_0F38F1) },
6045     { "(bad)",          { XX } },
6046     { "(bad)",          { XX } },
6047     { "(bad)",          { XX } },
6048     { "(bad)",          { XX } },
6049     { "(bad)",          { XX } },
6050     { "(bad)",          { XX } },
6051     /* f8 */
6052     { "(bad)",          { XX } },
6053     { "(bad)",          { XX } },
6054     { "(bad)",          { XX } },
6055     { "(bad)",          { XX } },
6056     { "(bad)",          { XX } },
6057     { "(bad)",          { XX } },
6058     { "(bad)",          { XX } },
6059     { "(bad)",          { XX } },
6060   },
6061   /* THREE_BYTE_0F3A */
6062   {
6063     /* 00 */
6064     { "(bad)",          { XX } },
6065     { "(bad)",          { XX } },
6066     { "(bad)",          { XX } },
6067     { "(bad)",          { XX } },
6068     { "(bad)",          { XX } },
6069     { "(bad)",          { XX } },
6070     { "(bad)",          { XX } },
6071     { "(bad)",          { XX } },
6072     /* 08 */
6073     { PREFIX_TABLE (PREFIX_0F3A08) },
6074     { PREFIX_TABLE (PREFIX_0F3A09) },
6075     { PREFIX_TABLE (PREFIX_0F3A0A) },
6076     { PREFIX_TABLE (PREFIX_0F3A0B) },
6077     { PREFIX_TABLE (PREFIX_0F3A0C) },
6078     { PREFIX_TABLE (PREFIX_0F3A0D) },
6079     { PREFIX_TABLE (PREFIX_0F3A0E) },
6080     { "palignr",        { MX, EM, Ib } },
6081     /* 10 */
6082     { "(bad)",          { XX } },
6083     { "(bad)",          { XX } },
6084     { "(bad)",          { XX } },
6085     { "(bad)",          { XX } },
6086     { PREFIX_TABLE (PREFIX_0F3A14) },
6087     { PREFIX_TABLE (PREFIX_0F3A15) },
6088     { PREFIX_TABLE (PREFIX_0F3A16) },
6089     { PREFIX_TABLE (PREFIX_0F3A17) },
6090     /* 18 */
6091     { "(bad)",          { XX } },
6092     { "(bad)",          { XX } },
6093     { "(bad)",          { XX } },
6094     { "(bad)",          { XX } },
6095     { "(bad)",          { XX } },
6096     { "(bad)",          { XX } },
6097     { "(bad)",          { XX } },
6098     { "(bad)",          { XX } },
6099     /* 20 */
6100     { PREFIX_TABLE (PREFIX_0F3A20) },
6101     { PREFIX_TABLE (PREFIX_0F3A21) },
6102     { PREFIX_TABLE (PREFIX_0F3A22) },
6103     { "(bad)",          { XX } },
6104     { "(bad)",          { XX } },
6105     { "(bad)",          { XX } },
6106     { "(bad)",          { XX } },
6107     { "(bad)",          { XX } },
6108     /* 28 */
6109     { "(bad)",          { XX } },
6110     { "(bad)",          { XX } },
6111     { "(bad)",          { XX } },
6112     { "(bad)",          { XX } },
6113     { "(bad)",          { XX } },
6114     { "(bad)",          { XX } },
6115     { "(bad)",          { XX } },
6116     { "(bad)",          { XX } },
6117     /* 30 */
6118     { "(bad)",          { XX } },
6119     { "(bad)",          { XX } },
6120     { "(bad)",          { XX } },
6121     { "(bad)",          { XX } },
6122     { "(bad)",          { XX } },
6123     { "(bad)",          { XX } },
6124     { "(bad)",          { XX } },
6125     { "(bad)",          { XX } },
6126     /* 38 */
6127     { "(bad)",          { XX } },
6128     { "(bad)",          { XX } },
6129     { "(bad)",          { XX } },
6130     { "(bad)",          { XX } },
6131     { "(bad)",          { XX } },
6132     { "(bad)",          { XX } },
6133     { "(bad)",          { XX } },
6134     { "(bad)",          { XX } },
6135     /* 40 */
6136     { PREFIX_TABLE (PREFIX_0F3A40) },
6137     { PREFIX_TABLE (PREFIX_0F3A41) },
6138     { PREFIX_TABLE (PREFIX_0F3A42) },
6139     { "(bad)",          { XX } },
6140     { PREFIX_TABLE (PREFIX_0F3A44) },
6141     { "(bad)",          { XX } },
6142     { "(bad)",          { XX } },
6143     { "(bad)",          { XX } },
6144     /* 48 */
6145     { "(bad)",          { XX } },
6146     { "(bad)",          { XX } },
6147     { "(bad)",          { XX } },
6148     { "(bad)",          { XX } },
6149     { "(bad)",          { XX } },
6150     { "(bad)",          { XX } },
6151     { "(bad)",          { XX } },
6152     { "(bad)",          { XX } },
6153     /* 50 */
6154     { "(bad)",          { XX } },
6155     { "(bad)",          { XX } },
6156     { "(bad)",          { XX } },
6157     { "(bad)",          { XX } },
6158     { "(bad)",          { XX } },
6159     { "(bad)",          { XX } },
6160     { "(bad)",          { XX } },
6161     { "(bad)",          { XX } },
6162     /* 58 */
6163     { "(bad)",          { XX } },
6164     { "(bad)",          { XX } },
6165     { "(bad)",          { XX } },
6166     { "(bad)",          { XX } },
6167     { "(bad)",          { XX } },
6168     { "(bad)",          { XX } },
6169     { "(bad)",          { XX } },
6170     { "(bad)",          { XX } },
6171     /* 60 */
6172     { PREFIX_TABLE (PREFIX_0F3A60) },
6173     { PREFIX_TABLE (PREFIX_0F3A61) },
6174     { PREFIX_TABLE (PREFIX_0F3A62) },
6175     { PREFIX_TABLE (PREFIX_0F3A63) },
6176     { "(bad)",          { XX } },
6177     { "(bad)",          { XX } },
6178     { "(bad)",          { XX } },
6179     { "(bad)",          { XX } },
6180     /* 68 */
6181     { "(bad)",          { XX } },
6182     { "(bad)",          { XX } },
6183     { "(bad)",          { XX } },
6184     { "(bad)",          { XX } },
6185     { "(bad)",          { XX } },
6186     { "(bad)",          { XX } },
6187     { "(bad)",          { XX } },
6188     { "(bad)",          { XX } },
6189     /* 70 */
6190     { "(bad)",          { XX } },
6191     { "(bad)",          { XX } },
6192     { "(bad)",          { XX } },
6193     { "(bad)",          { XX } },
6194     { "(bad)",          { XX } },
6195     { "(bad)",          { XX } },
6196     { "(bad)",          { XX } },
6197     { "(bad)",          { XX } },
6198     /* 78 */
6199     { "(bad)",          { XX } },
6200     { "(bad)",          { XX } },
6201     { "(bad)",          { XX } },
6202     { "(bad)",          { XX } },
6203     { "(bad)",          { XX } },
6204     { "(bad)",          { XX } },
6205     { "(bad)",          { XX } },
6206     { "(bad)",          { XX } },
6207     /* 80 */
6208     { "(bad)",          { XX } },
6209     { "(bad)",          { XX } },
6210     { "(bad)",          { XX } },
6211     { "(bad)",          { XX } },
6212     { "(bad)",          { XX } },
6213     { "(bad)",          { XX } },
6214     { "(bad)",          { XX } },
6215     { "(bad)",          { XX } },
6216     /* 88 */
6217     { "(bad)",          { XX } },
6218     { "(bad)",          { XX } },
6219     { "(bad)",          { XX } },
6220     { "(bad)",          { XX } },
6221     { "(bad)",          { XX } },
6222     { "(bad)",          { XX } },
6223     { "(bad)",          { XX } },
6224     { "(bad)",          { XX } },
6225     /* 90 */
6226     { "(bad)",          { XX } },
6227     { "(bad)",          { XX } },
6228     { "(bad)",          { XX } },
6229     { "(bad)",          { XX } },
6230     { "(bad)",          { XX } },
6231     { "(bad)",          { XX } },
6232     { "(bad)",          { XX } },
6233     { "(bad)",          { XX } },
6234     /* 98 */
6235     { "(bad)",          { XX } },
6236     { "(bad)",          { XX } },
6237     { "(bad)",          { XX } },
6238     { "(bad)",          { XX } },
6239     { "(bad)",          { XX } },
6240     { "(bad)",          { XX } },
6241     { "(bad)",          { XX } },
6242     { "(bad)",          { XX } },
6243     /* a0 */
6244     { "(bad)",          { XX } },
6245     { "(bad)",          { XX } },
6246     { "(bad)",          { XX } },
6247     { "(bad)",          { XX } },
6248     { "(bad)",          { XX } },
6249     { "(bad)",          { XX } },
6250     { "(bad)",          { XX } },
6251     { "(bad)",          { XX } },
6252     /* a8 */
6253     { "(bad)",          { XX } },
6254     { "(bad)",          { XX } },
6255     { "(bad)",          { XX } },
6256     { "(bad)",          { XX } },
6257     { "(bad)",          { XX } },
6258     { "(bad)",          { XX } },
6259     { "(bad)",          { XX } },
6260     { "(bad)",          { XX } },
6261     /* b0 */
6262     { "(bad)",          { XX } },
6263     { "(bad)",          { XX } },
6264     { "(bad)",          { XX } },
6265     { "(bad)",          { XX } },
6266     { "(bad)",          { XX } },
6267     { "(bad)",          { XX } },
6268     { "(bad)",          { XX } },
6269     { "(bad)",          { XX } },
6270     /* b8 */
6271     { "(bad)",          { XX } },
6272     { "(bad)",          { XX } },
6273     { "(bad)",          { XX } },
6274     { "(bad)",          { XX } },
6275     { "(bad)",          { XX } },
6276     { "(bad)",          { XX } },
6277     { "(bad)",          { XX } },
6278     { "(bad)",          { XX } },
6279     /* c0 */
6280     { "(bad)",          { XX } },
6281     { "(bad)",          { XX } },
6282     { "(bad)",          { XX } },
6283     { "(bad)",          { XX } },
6284     { "(bad)",          { XX } },
6285     { "(bad)",          { XX } },
6286     { "(bad)",          { XX } },
6287     { "(bad)",          { XX } },
6288     /* c8 */
6289     { "(bad)",          { XX } },
6290     { "(bad)",          { XX } },
6291     { "(bad)",          { XX } },
6292     { "(bad)",          { XX } },
6293     { "(bad)",          { XX } },
6294     { "(bad)",          { XX } },
6295     { "(bad)",          { XX } },
6296     { "(bad)",          { XX } },
6297     /* d0 */
6298     { "(bad)",          { XX } },
6299     { "(bad)",          { XX } },
6300     { "(bad)",          { XX } },
6301     { "(bad)",          { XX } },
6302     { "(bad)",          { XX } },
6303     { "(bad)",          { XX } },
6304     { "(bad)",          { XX } },
6305     { "(bad)",          { XX } },
6306     /* d8 */
6307     { "(bad)",          { XX } },
6308     { "(bad)",          { XX } },
6309     { "(bad)",          { XX } },
6310     { "(bad)",          { XX } },
6311     { "(bad)",          { XX } },
6312     { "(bad)",          { XX } },
6313     { "(bad)",          { XX } },
6314     { PREFIX_TABLE (PREFIX_0F3ADF) },
6315     /* e0 */
6316     { "(bad)",          { XX } },
6317     { "(bad)",          { XX } },
6318     { "(bad)",          { XX } },
6319     { "(bad)",          { XX } },
6320     { "(bad)",          { XX } },
6321     { "(bad)",          { XX } },
6322     { "(bad)",          { XX } },
6323     { "(bad)",          { XX } },
6324     /* e8 */
6325     { "(bad)",          { XX } },
6326     { "(bad)",          { XX } },
6327     { "(bad)",          { XX } },
6328     { "(bad)",          { XX } },
6329     { "(bad)",          { XX } },
6330     { "(bad)",          { XX } },
6331     { "(bad)",          { XX } },
6332     { "(bad)",          { XX } },
6333     /* f0 */
6334     { "(bad)",          { XX } },
6335     { "(bad)",          { XX } },
6336     { "(bad)",          { XX } },
6337     { "(bad)",          { XX } },
6338     { "(bad)",          { XX } },
6339     { "(bad)",          { XX } },
6340     { "(bad)",          { XX } },
6341     { "(bad)",          { XX } },
6342     /* f8 */
6343     { "(bad)",          { XX } },
6344     { "(bad)",          { XX } },
6345     { "(bad)",          { XX } },
6346     { "(bad)",          { XX } },
6347     { "(bad)",          { XX } },
6348     { "(bad)",          { XX } },
6349     { "(bad)",          { XX } },
6350     { "(bad)",          { XX } },
6351   },
6352
6353   /* THREE_BYTE_0F7A */
6354   {
6355     /* 00 */
6356     { "(bad)",          { XX } },
6357     { "(bad)",          { XX } },
6358     { "(bad)",          { XX } },
6359     { "(bad)",          { XX } },
6360     { "(bad)",          { XX } },
6361     { "(bad)",          { XX } },
6362     { "(bad)",          { XX } },
6363     { "(bad)",          { XX } },
6364     /* 08 */
6365     { "(bad)",          { XX } },
6366     { "(bad)",          { XX } },
6367     { "(bad)",          { XX } },
6368     { "(bad)",          { XX } },
6369     { "(bad)",          { XX } },
6370     { "(bad)",          { XX } },
6371     { "(bad)",          { XX } },
6372     { "(bad)",          { XX } },
6373     /* 10 */
6374     { "(bad)",          { XX } },
6375     { "(bad)",          { XX } },
6376     { "(bad)",          { XX } },
6377     { "(bad)",          { XX } },
6378     { "(bad)",          { XX } },
6379     { "(bad)",          { XX } },
6380     { "(bad)",          { XX } },
6381     { "(bad)",          { XX } },
6382     /* 18 */
6383     { "(bad)",          { XX } },
6384     { "(bad)",          { XX } },
6385     { "(bad)",          { XX } },
6386     { "(bad)",          { XX } },
6387     { "(bad)",          { XX } },
6388     { "(bad)",          { XX } },
6389     { "(bad)",          { XX } },
6390     { "(bad)",          { XX } },
6391     /* 20 */
6392     { "ptest",          { XX } },
6393     { "(bad)",          { XX } },
6394     { "(bad)",          { XX } },
6395     { "(bad)",          { XX } },
6396     { "(bad)",          { XX } },
6397     { "(bad)",          { XX } },
6398     { "(bad)",          { XX } },
6399     { "(bad)",          { XX } },
6400     /* 28 */
6401     { "(bad)",          { XX } },
6402     { "(bad)",          { XX } },
6403     { "(bad)",          { XX } },
6404     { "(bad)",          { XX } },
6405     { "(bad)",          { XX } },
6406     { "(bad)",          { XX } },
6407     { "(bad)",          { XX } },
6408     { "(bad)",          { XX } },
6409     /* 30 */
6410     { "(bad)",          { XX } },
6411     { "(bad)",          { XX } },
6412     { "(bad)",          { XX } },
6413     { "(bad)",          { XX } },
6414     { "(bad)",          { XX } },
6415     { "(bad)",          { XX } },
6416     { "(bad)",          { XX } },
6417     { "(bad)",          { XX } },
6418     /* 38 */
6419     { "(bad)",          { XX } },
6420     { "(bad)",          { XX } },
6421     { "(bad)",          { XX } },
6422     { "(bad)",          { XX } },
6423     { "(bad)",          { XX } },
6424     { "(bad)",          { XX } },
6425     { "(bad)",          { XX } },
6426     { "(bad)",          { XX } },
6427     /* 40 */
6428     { "(bad)",          { XX } },
6429     { "phaddbw",        { XM, EXq } },
6430     { "phaddbd",        { XM, EXq } },
6431     { "phaddbq",        { XM, EXq } },
6432     { "(bad)",          { XX } },
6433     { "(bad)",          { XX } },
6434     { "phaddwd",        { XM, EXq } },
6435     { "phaddwq",        { XM, EXq } },
6436     /* 48 */
6437     { "(bad)",          { XX } },
6438     { "(bad)",          { XX } },
6439     { "(bad)",          { XX } },
6440     { "phadddq",        { XM, EXq } },
6441     { "(bad)",          { XX } },
6442     { "(bad)",          { XX } },
6443     { "(bad)",          { XX } },
6444     { "(bad)",          { XX } },
6445     /* 50 */
6446     { "(bad)",          { XX } },
6447     { "phaddubw",       { XM, EXq } },
6448     { "phaddubd",       { XM, EXq } },
6449     { "phaddubq",       { XM, EXq } },
6450     { "(bad)",          { XX } },
6451     { "(bad)",          { XX } },
6452     { "phadduwd",       { XM, EXq } },
6453     { "phadduwq",       { XM, EXq } },
6454     /* 58 */
6455     { "(bad)",          { XX } },
6456     { "(bad)",          { XX } },
6457     { "(bad)",          { XX } },
6458     { "phaddudq",       { XM, EXq } },
6459     { "(bad)",          { XX } },
6460     { "(bad)",          { XX } },
6461     { "(bad)",          { XX } },
6462     { "(bad)",          { XX } },
6463     /* 60 */
6464     { "(bad)",          { XX } },
6465     { "phsubbw",        { XM, EXq } },
6466     { "phsubbd",        { XM, EXq } },
6467     { "phsubbq",        { XM, EXq } },
6468     { "(bad)",          { XX } },
6469     { "(bad)",          { XX } },
6470     { "(bad)",          { XX } },
6471     { "(bad)",          { XX } },
6472     /* 68 */
6473     { "(bad)",          { XX } },
6474     { "(bad)",          { XX } },
6475     { "(bad)",          { XX } },
6476     { "(bad)",          { XX } },
6477     { "(bad)",          { XX } },
6478     { "(bad)",          { XX } },
6479     { "(bad)",          { XX } },
6480     { "(bad)",          { XX } },
6481     /* 70 */
6482     { "(bad)",          { XX } },
6483     { "(bad)",          { XX } },
6484     { "(bad)",          { XX } },
6485     { "(bad)",          { XX } },
6486     { "(bad)",          { XX } },
6487     { "(bad)",          { XX } },
6488     { "(bad)",          { XX } },
6489     { "(bad)",          { XX } },
6490     /* 78 */
6491     { "(bad)",          { XX } },
6492     { "(bad)",          { XX } },
6493     { "(bad)",          { XX } },
6494     { "(bad)",          { XX } },
6495     { "(bad)",          { XX } },
6496     { "(bad)",          { XX } },
6497     { "(bad)",          { XX } },
6498     { "(bad)",          { XX } },
6499     /* 80 */
6500     { "(bad)",          { XX } },
6501     { "(bad)",          { XX } },
6502     { "(bad)",          { XX } },
6503     { "(bad)",          { XX } },
6504     { "(bad)",          { XX } },
6505     { "(bad)",          { XX } },
6506     { "(bad)",          { XX } },
6507     { "(bad)",          { XX } },
6508     /* 88 */
6509     { "(bad)",          { XX } },
6510     { "(bad)",          { XX } },
6511     { "(bad)",          { XX } },
6512     { "(bad)",          { XX } },
6513     { "(bad)",          { XX } },
6514     { "(bad)",          { XX } },
6515     { "(bad)",          { XX } },
6516     { "(bad)",          { XX } },
6517     /* 90 */
6518     { "(bad)",          { XX } },
6519     { "(bad)",          { XX } },
6520     { "(bad)",          { XX } },
6521     { "(bad)",          { XX } },
6522     { "(bad)",          { XX } },
6523     { "(bad)",          { XX } },
6524     { "(bad)",          { XX } },
6525     { "(bad)",          { XX } },
6526     /* 98 */
6527     { "(bad)",          { XX } },
6528     { "(bad)",          { XX } },
6529     { "(bad)",          { XX } },
6530     { "(bad)",          { XX } },
6531     { "(bad)",          { XX } },
6532     { "(bad)",          { XX } },
6533     { "(bad)",          { XX } },
6534     { "(bad)",          { XX } },
6535     /* a0 */
6536     { "(bad)",          { XX } },
6537     { "(bad)",          { XX } },
6538     { "(bad)",          { XX } },
6539     { "(bad)",          { XX } },
6540     { "(bad)",          { XX } },
6541     { "(bad)",          { XX } },
6542     { "(bad)",          { XX } },
6543     { "(bad)",          { XX } },
6544     /* a8 */
6545     { "(bad)",          { XX } },
6546     { "(bad)",          { XX } },
6547     { "(bad)",          { XX } },
6548     { "(bad)",          { XX } },
6549     { "(bad)",          { XX } },
6550     { "(bad)",          { XX } },
6551     { "(bad)",          { XX } },
6552     { "(bad)",          { XX } },
6553     /* b0 */
6554     { "(bad)",          { XX } },
6555     { "(bad)",          { XX } },
6556     { "(bad)",          { XX } },
6557     { "(bad)",          { XX } },
6558     { "(bad)",          { XX } },
6559     { "(bad)",          { XX } },
6560     { "(bad)",          { XX } },
6561     { "(bad)",          { XX } },
6562     /* b8 */
6563     { "(bad)",          { XX } },
6564     { "(bad)",          { XX } },
6565     { "(bad)",          { XX } },
6566     { "(bad)",          { XX } },
6567     { "(bad)",          { XX } },
6568     { "(bad)",          { XX } },
6569     { "(bad)",          { XX } },
6570     { "(bad)",          { XX } },
6571     /* c0 */
6572     { "(bad)",          { XX } },
6573     { "(bad)",          { XX } },
6574     { "(bad)",          { XX } },
6575     { "(bad)",          { XX } },
6576     { "(bad)",          { XX } },
6577     { "(bad)",          { XX } },
6578     { "(bad)",          { XX } },
6579     { "(bad)",          { XX } },
6580     /* c8 */
6581     { "(bad)",          { XX } },
6582     { "(bad)",          { XX } },
6583     { "(bad)",          { XX } },
6584     { "(bad)",          { XX } },
6585     { "(bad)",          { XX } },
6586     { "(bad)",          { XX } },
6587     { "(bad)",          { XX } },
6588     { "(bad)",          { XX } },
6589     /* d0 */
6590     { "(bad)",          { XX } },
6591     { "(bad)",          { XX } },
6592     { "(bad)",          { XX } },
6593     { "(bad)",          { XX } },
6594     { "(bad)",          { XX } },
6595     { "(bad)",          { XX } },
6596     { "(bad)",          { XX } },
6597     { "(bad)",          { XX } },
6598     /* d8 */
6599     { "(bad)",          { XX } },
6600     { "(bad)",          { XX } },
6601     { "(bad)",          { XX } },
6602     { "(bad)",          { XX } },
6603     { "(bad)",          { XX } },
6604     { "(bad)",          { XX } },
6605     { "(bad)",          { XX } },
6606     { "(bad)",          { XX } },
6607     /* e0 */
6608     { "(bad)",          { XX } },
6609     { "(bad)",          { XX } },
6610     { "(bad)",          { XX } },
6611     { "(bad)",          { XX } },
6612     { "(bad)",          { XX } },
6613     { "(bad)",          { XX } },
6614     { "(bad)",          { XX } },
6615     { "(bad)",          { XX } },
6616     /* e8 */
6617     { "(bad)",          { XX } },
6618     { "(bad)",          { XX } },
6619     { "(bad)",          { XX } },
6620     { "(bad)",          { XX } },
6621     { "(bad)",          { XX } },
6622     { "(bad)",          { XX } },
6623     { "(bad)",          { XX } },
6624     { "(bad)",          { XX } },
6625     /* f0 */
6626     { "(bad)",          { XX } },
6627     { "(bad)",          { XX } },
6628     { "(bad)",          { XX } },
6629     { "(bad)",          { XX } },
6630     { "(bad)",          { XX } },
6631     { "(bad)",          { XX } },
6632     { "(bad)",          { XX } },
6633     { "(bad)",          { XX } },
6634     /* f8 */
6635     { "(bad)",          { XX } },
6636     { "(bad)",          { XX } },
6637     { "(bad)",          { XX } },
6638     { "(bad)",          { XX } },
6639     { "(bad)",          { XX } },
6640     { "(bad)",          { XX } },
6641     { "(bad)",          { XX } },
6642     { "(bad)",          { XX } },
6643   },
6644 };
6645
6646 static const struct dis386 xop_table[][256] = {
6647   /* XOP_08 */
6648   {
6649     /* 00 */
6650     { "(bad)",          { XX } },
6651     { "(bad)",          { XX } },
6652     { "(bad)",          { XX } },
6653     { "(bad)",          { XX } },
6654     { "(bad)",          { XX } },
6655     { "(bad)",          { XX } },
6656     { "(bad)",          { XX } },
6657     { "(bad)",          { XX } },
6658     /* 08 */
6659     { "(bad)",          { XX } },
6660     { "(bad)",          { XX } },
6661     { "(bad)",          { XX } },
6662     { "(bad)",          { XX } },
6663     { "(bad)",          { XX } },
6664     { "(bad)",          { XX } },
6665     { "(bad)",          { XX } },
6666     { "(bad)",          { XX } },
6667     /* 10 */
6668     { "(bad)",          { XX } },
6669     { "(bad)",          { XX } },
6670     { "(bad)",          { XX } },
6671     { "(bad)",          { XX } },
6672     { "(bad)",          { XX } },
6673     { "(bad)",          { XX } },
6674     { "(bad)",          { XX } },
6675     { "(bad)",          { XX } },
6676     /* 18 */
6677     { "(bad)",          { XX } },
6678     { "(bad)",          { XX } },
6679     { "(bad)",          { XX } },
6680     { "(bad)",          { XX } },
6681     { "(bad)",          { XX } },
6682     { "(bad)",          { XX } },
6683     { "(bad)",          { XX } },
6684     { "(bad)",          { XX } },
6685     /* 20 */
6686     { "(bad)",          { XX } },
6687     { "(bad)",          { XX } },
6688     { "(bad)",          { XX } },
6689     { "(bad)",          { XX } },
6690     { "(bad)",          { XX } },
6691     { "(bad)",          { XX } },
6692     { "(bad)",          { XX } },
6693     { "(bad)",          { XX } },
6694     /* 28 */
6695     { "(bad)",          { XX } },
6696     { "(bad)",          { XX } },
6697     { "(bad)",          { XX } },
6698     { "(bad)",          { XX } },
6699     { "(bad)",          { XX } },
6700     { "(bad)",          { XX } },
6701     { "(bad)",          { XX } },
6702     { "(bad)",          { XX } },
6703     /* 30 */
6704     { "(bad)",          { XX } },
6705     { "(bad)",          { XX } },
6706     { "(bad)",          { XX } },
6707     { "(bad)",          { XX } },
6708     { "(bad)",          { XX } },
6709     { "(bad)",          { XX } },
6710     { "(bad)",          { XX } },
6711     { "(bad)",          { XX } },
6712     /* 38 */
6713     { "(bad)",          { XX } },
6714     { "(bad)",          { XX } },
6715     { "(bad)",          { XX } },
6716     { "(bad)",          { XX } },
6717     { "(bad)",          { XX } },
6718     { "(bad)",          { XX } },
6719     { "(bad)",          { XX } },
6720     { "(bad)",          { XX } },
6721     /* 40 */
6722     { "(bad)",          { XX } },
6723     { "(bad)",          { XX } },
6724     { "(bad)",          { XX } },
6725     { "(bad)",          { XX } },
6726     { "(bad)",          { XX } },
6727     { "(bad)",          { XX } },
6728     { "(bad)",          { XX } },
6729     { "(bad)",          { XX } },
6730     /* 48 */
6731     { "(bad)",          { XX } },
6732     { "(bad)",          { XX } },
6733     { "(bad)",          { XX } },
6734     { "(bad)",          { XX } },
6735     { "(bad)",          { XX } },
6736     { "(bad)",          { XX } },
6737     { "(bad)",          { XX } },
6738     { "(bad)",          { XX } },
6739     /* 50 */
6740     { "(bad)",          { XX } },
6741     { "(bad)",          { XX } },
6742     { "(bad)",          { XX } },
6743     { "(bad)",          { XX } },
6744     { "(bad)",          { XX } },
6745     { "(bad)",          { XX } },
6746     { "(bad)",          { XX } },
6747     { "(bad)",          { XX } },
6748     /* 58 */
6749     { "(bad)",          { XX } },
6750     { "(bad)",          { XX } },
6751     { "(bad)",          { XX } },
6752     { "(bad)",          { XX } },
6753     { "(bad)",          { XX } },
6754     { "(bad)",          { XX } },
6755     { "(bad)",          { XX } },
6756     { "(bad)",          { XX } },
6757     /* 60 */
6758     { "(bad)",          { XX } },
6759     { "(bad)",          { XX } },
6760     { "(bad)",          { XX } },
6761     { "(bad)",          { XX } },
6762     { "(bad)",          { XX } },
6763     { "(bad)",          { XX } },
6764     { "(bad)",          { XX } },
6765     { "(bad)",          { XX } },
6766     /* 68 */
6767     { "(bad)",          { XX } },
6768     { "(bad)",          { XX } },
6769     { "(bad)",          { XX } },
6770     { "(bad)",          { XX } },
6771     { "(bad)",          { XX } },
6772     { "(bad)",          { XX } },
6773     { "(bad)",          { XX } },
6774     { "(bad)",          { XX } },
6775     /* 70 */
6776     { "(bad)",          { XX } },
6777     { "(bad)",          { XX } },
6778     { "(bad)",          { XX } },
6779     { "(bad)",          { XX } },
6780     { "(bad)",          { XX } },
6781     { "(bad)",          { XX } },
6782     { "(bad)",          { XX } },
6783     { "(bad)",          { XX } },
6784     /* 78 */
6785     { "(bad)",          { XX } },
6786     { "(bad)",          { XX } },
6787     { "(bad)",          { XX } },
6788     { "(bad)",          { XX } },
6789     { "(bad)",          { XX } },
6790     { "(bad)",          { XX } },
6791     { "(bad)",          { XX } },
6792     { "(bad)",          { XX } },
6793     /* 80 */
6794     { "(bad)",          { XX } },
6795     { "(bad)",          { XX } },
6796     { "(bad)",          { XX } },
6797     { "(bad)",          { XX } },
6798     { "(bad)",          { XX } },
6799     { "vpmacssww",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6800     { "vpmacsswd",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6801     { "vpmacssdql",     { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6802     /* 88 */
6803     { "(bad)",          { XX } },
6804     { "(bad)",          { XX } },
6805     { "(bad)",          { XX } },
6806     { "(bad)",          { XX } },
6807     { "(bad)",          { XX } },
6808     { "(bad)",          { XX } },
6809     { "vpmacssdd",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6810     { "vpmacssdqh",     { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6811     /* 90 */
6812     { "(bad)",          { XX } },
6813     { "(bad)",          { XX } },
6814     { "(bad)",          { XX } },
6815     { "(bad)",          { XX } },
6816     { "(bad)",          { XX } },
6817     { "vpmacsww",       { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6818     { "vpmacswd",       { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6819     { "vpmacsdql",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6820     /* 98 */
6821     { "(bad)",          { XX } },
6822     { "(bad)",          { XX } },
6823     { "(bad)",          { XX } },
6824     { "(bad)",          { XX } },
6825     { "(bad)",          { XX } },
6826     { "(bad)",          { XX } },
6827     { "vpmacsdd",       { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6828     { "vpmacsdqh",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6829     /* a0 */
6830     { "(bad)",          { XX } },
6831     { "(bad)",          { XX } },
6832     { "vpcmov",         { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6833     { "vpperm",         { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6834     { "(bad)",          { XX } },
6835     { "(bad)",          { XX } },
6836     { "vpmadcsswd",     { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6837     { "(bad)",          { XX } },
6838     /* a8 */
6839     { "(bad)",          { XX } },
6840     { "(bad)",          { XX } },
6841     { "(bad)",          { XX } },
6842     { "(bad)",          { XX } },
6843     { "(bad)",          { XX } },
6844     { "(bad)",          { XX } },
6845     { "(bad)",          { XX } },
6846     { "(bad)",          { XX } },
6847     /* b0 */
6848     { "(bad)",          { XX } },
6849     { "(bad)",          { XX } },
6850     { "(bad)",          { XX } },
6851     { "(bad)",          { XX } },
6852     { "(bad)",          { XX } },
6853     { "(bad)",          { XX } },
6854     { "vpmadcswd",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6855     { "(bad)",          { XX } },
6856     /* b8 */
6857     { "(bad)",          { XX } },
6858     { "(bad)",          { XX } },
6859     { "(bad)",          { XX } },
6860     { "(bad)",          { XX } },
6861     { "(bad)",          { XX } },
6862     { "(bad)",          { XX } },
6863     { "(bad)",          { XX } },
6864     { "(bad)",          { XX } },
6865     /* c0 */
6866     { "vprotb",         { XM, Vex_2src_1, Ib } },
6867     { "vprotw",         { XM, Vex_2src_1, Ib } },
6868     { "vprotd",         { XM, Vex_2src_1, Ib } },
6869     { "vprotq",         { XM, Vex_2src_1, Ib } },
6870     { "(bad)",          { XX } },
6871     { "(bad)",          { XX } },
6872     { "(bad)",          { XX } },
6873     { "(bad)",          { XX } },
6874     /* c8 */
6875     { "(bad)",          { XX } },
6876     { "(bad)",          { XX } },
6877     { "(bad)",          { XX } },
6878     { "(bad)",          { XX } },
6879     { "vpcomb",         { XM, Vex128, EXx, Ib } },
6880     { "vpcomw",         { XM, Vex128, EXx, Ib } },
6881     { "vpcomd",         { XM, Vex128, EXx, Ib } },
6882     { "vpcomq",         { XM, Vex128, EXx, Ib } },
6883     /* d0 */
6884     { "(bad)",          { XX } },
6885     { "(bad)",          { XX } },
6886     { "(bad)",          { XX } },
6887     { "(bad)",          { XX } },
6888     { "(bad)",          { XX } },
6889     { "(bad)",          { XX } },
6890     { "(bad)",          { XX } },
6891     { "(bad)",          { XX } },
6892     /* d8 */
6893     { "(bad)",          { XX } },
6894     { "(bad)",          { XX } },
6895     { "(bad)",          { XX } },
6896     { "(bad)",          { XX } },
6897     { "(bad)",          { XX } },
6898     { "(bad)",          { XX } },
6899     { "(bad)",          { XX } },
6900     { "(bad)",          { XX } },
6901     /* e0 */
6902     { "(bad)",          { XX } },
6903     { "(bad)",          { XX } },
6904     { "(bad)",          { XX } },
6905     { "(bad)",          { XX } },
6906     { "(bad)",          { XX } },
6907     { "(bad)",          { XX } },
6908     { "(bad)",          { XX } },
6909     { "(bad)",          { XX } },
6910     /* e8 */
6911     { "(bad)",          { XX } },
6912     { "(bad)",          { XX } },
6913     { "(bad)",          { XX } },
6914     { "(bad)",          { XX } },
6915     { "vpcomub",        { XM, Vex128, EXx, Ib } },
6916     { "vpcomuw",        { XM, Vex128, EXx, Ib } },
6917     { "vpcomud",        { XM, Vex128, EXx, Ib } },
6918     { "vpcomuq",        { XM, Vex128, EXx, Ib } },
6919     /* f0 */
6920     { "(bad)",          { XX } },
6921     { "(bad)",          { XX } },
6922     { "(bad)",          { XX } },
6923     { "(bad)",          { XX } },
6924     { "(bad)",          { XX } },
6925     { "(bad)",          { XX } },
6926     { "(bad)",          { XX } },
6927     { "(bad)",          { XX } },
6928     /* f8 */
6929     { "(bad)",          { XX } },
6930     { "(bad)",          { XX } },
6931     { "(bad)",          { XX } },
6932     { "(bad)",          { XX } },
6933     { "(bad)",          { XX } },
6934     { "(bad)",          { XX } },
6935     { "(bad)",          { XX } },
6936     { "(bad)",          { XX } },
6937   },
6938   /* XOP_09 */
6939   {
6940     /* 00 */
6941     { "(bad)",          { XX } },
6942     { "(bad)",          { XX } },
6943     { "(bad)",          { XX } },
6944     { "(bad)",          { XX } },
6945     { "(bad)",          { XX } },
6946     { "(bad)",          { XX } },
6947     { "(bad)",          { XX } },
6948     { "(bad)",          { XX } },
6949     /* 08 */
6950     { "(bad)",          { XX } },
6951     { "(bad)",          { XX } },
6952     { "(bad)",          { XX } },
6953     { "(bad)",          { XX } },
6954     { "(bad)",          { XX } },
6955     { "(bad)",          { XX } },
6956     { "(bad)",          { XX } },
6957     { "(bad)",          { XX } },
6958     /* 10 */
6959     { "(bad)",          { XX } },
6960     { "(bad)",          { XX } },
6961     { REG_TABLE (REG_XOP_LWPCB) },
6962     { "(bad)",          { XX } },
6963     { "(bad)",          { XX } },
6964     { "(bad)",          { XX } },
6965     { "(bad)",          { XX } },
6966     { "(bad)",          { XX } },
6967     /* 18 */
6968     { "(bad)",          { XX } },
6969     { "(bad)",          { XX } },
6970     { "(bad)",          { XX } },
6971     { "(bad)",          { XX } },
6972     { "(bad)",          { XX } },
6973     { "(bad)",          { XX } },
6974     { "(bad)",          { XX } },
6975     { "(bad)",          { XX } },
6976     /* 20 */
6977     { "(bad)",          { XX } },
6978     { "(bad)",          { XX } },
6979     { "(bad)",          { XX } },
6980     { "(bad)",          { XX } },
6981     { "(bad)",          { XX } },
6982     { "(bad)",          { XX } },
6983     { "(bad)",          { XX } },
6984     { "(bad)",          { XX } },
6985     /* 28 */
6986     { "(bad)",          { XX } },
6987     { "(bad)",          { XX } },
6988     { "(bad)",          { XX } },
6989     { "(bad)",          { XX } },
6990     { "(bad)",          { XX } },
6991     { "(bad)",          { XX } },
6992     { "(bad)",          { XX } },
6993     { "(bad)",          { XX } },
6994     /* 30 */
6995     { "(bad)",          { XX } },
6996     { "(bad)",          { XX } },
6997     { "(bad)",          { XX } },
6998     { "(bad)",          { XX } },
6999     { "(bad)",          { XX } },
7000     { "(bad)",          { XX } },
7001     { "(bad)",          { XX } },
7002     { "(bad)",          { XX } },
7003     /* 38 */
7004     { "(bad)",          { XX } },
7005     { "(bad)",          { XX } },
7006     { "(bad)",          { XX } },
7007     { "(bad)",          { XX } },
7008     { "(bad)",          { XX } },
7009     { "(bad)",          { XX } },
7010     { "(bad)",          { XX } },
7011     { "(bad)",          { XX } },
7012     /* 40 */
7013     { "(bad)",          { XX } },
7014     { "(bad)",          { XX } },
7015     { "(bad)",          { XX } },
7016     { "(bad)",          { XX } },
7017     { "(bad)",          { XX } },
7018     { "(bad)",          { XX } },
7019     { "(bad)",          { XX } },
7020     { "(bad)",          { XX } },
7021     /* 48 */
7022     { "(bad)",          { XX } },
7023     { "(bad)",          { XX } },
7024     { "(bad)",          { XX } },
7025     { "(bad)",          { XX } },
7026     { "(bad)",          { XX } },
7027     { "(bad)",          { XX } },
7028     { "(bad)",          { XX } },
7029     { "(bad)",          { XX } },
7030     /* 50 */
7031     { "(bad)",          { XX } },
7032     { "(bad)",          { XX } },
7033     { "(bad)",          { XX } },
7034     { "(bad)",          { XX } },
7035     { "(bad)",          { XX } },
7036     { "(bad)",          { XX } },
7037     { "(bad)",          { XX } },
7038     { "(bad)",          { XX } },
7039     /* 58 */
7040     { "(bad)",          { XX } },
7041     { "(bad)",          { XX } },
7042     { "(bad)",          { XX } },
7043     { "(bad)",          { XX } },
7044     { "(bad)",          { XX } },
7045     { "(bad)",          { XX } },
7046     { "(bad)",          { XX } },
7047     { "(bad)",          { XX } },
7048     /* 60 */
7049     { "(bad)",          { XX } },
7050     { "(bad)",          { XX } },
7051     { "(bad)",          { XX } },
7052     { "(bad)",          { XX } },
7053     { "(bad)",          { XX } },
7054     { "(bad)",          { XX } },
7055     { "(bad)",          { XX } },
7056     { "(bad)",          { XX } },
7057     /* 68 */
7058     { "(bad)",          { XX } },
7059     { "(bad)",          { XX } },
7060     { "(bad)",          { XX } },
7061     { "(bad)",          { XX } },
7062     { "(bad)",          { XX } },
7063     { "(bad)",          { XX } },
7064     { "(bad)",          { XX } },
7065     { "(bad)",          { XX } },
7066     /* 70 */
7067     { "(bad)",          { XX } },
7068     { "(bad)",          { XX } },
7069     { "(bad)",          { XX } },
7070     { "(bad)",          { XX } },
7071     { "(bad)",          { XX } },
7072     { "(bad)",          { XX } },
7073     { "(bad)",          { XX } },
7074     { "(bad)",          { XX } },
7075     /* 78 */
7076     { "(bad)",          { XX } },
7077     { "(bad)",          { XX } },
7078     { "(bad)",          { XX } },
7079     { "(bad)",          { XX } },
7080     { "(bad)",          { XX } },
7081     { "(bad)",          { XX } },
7082     { "(bad)",          { XX } },
7083     { "(bad)",          { XX } },
7084     /* 80 */
7085     { VEX_LEN_TABLE (VEX_LEN_XOP_09_80) },
7086     { VEX_LEN_TABLE (VEX_LEN_XOP_09_81) },
7087     { "vfrczss",        { XM, EXd } },
7088     { "vfrczsd",        { XM, EXq } },
7089     { "(bad)",          { XX } },
7090     { "(bad)",          { XX } },
7091     { "(bad)",          { XX } },
7092     { "(bad)",          { XX } },
7093     /* 88 */
7094     { "(bad)",          { XX } },
7095     { "(bad)",          { XX } },
7096     { "(bad)",          { XX } },
7097     { "(bad)",          { XX } },
7098     { "(bad)",          { XX } },
7099     { "(bad)",          { XX } },
7100     { "(bad)",          { XX } },
7101     { "(bad)",          { XX } },
7102     /* 90 */
7103     { "vprotb",         { XM, Vex_2src_1, Vex_2src_2 } },
7104     { "vprotw",         { XM, Vex_2src_1, Vex_2src_2 } },
7105     { "vprotd",         { XM, Vex_2src_1, Vex_2src_2 } },
7106     { "vprotq",         { XM, Vex_2src_1, Vex_2src_2 } },
7107     { "vpshlb",         { XM, Vex_2src_1, Vex_2src_2 } },
7108     { "vpshlw",         { XM, Vex_2src_1, Vex_2src_2 } },
7109     { "vpshld",         { XM, Vex_2src_1, Vex_2src_2 } },
7110     { "vpshlq",         { XM, Vex_2src_1, Vex_2src_2 } },
7111     /* 98 */
7112     { "vpshab",         { XM, Vex_2src_1, Vex_2src_2 } },
7113     { "vpshaw",         { XM, Vex_2src_1, Vex_2src_2 } },
7114     { "vpshad",         { XM, Vex_2src_1, Vex_2src_2 } },
7115     { "vpshaq",         { XM, Vex_2src_1, Vex_2src_2 } },
7116     { "(bad)",          { XX } },
7117     { "(bad)",          { XX } },
7118     { "(bad)",          { XX } },
7119     { "(bad)",          { XX } },
7120     /* a0 */
7121     { "(bad)",          { XX } },
7122     { "(bad)",          { XX } },
7123     { "(bad)",          { XX } },
7124     { "(bad)",          { XX } },
7125     { "(bad)",          { XX } },
7126     { "(bad)",          { XX } },
7127     { "(bad)",          { XX } },
7128     { "(bad)",          { XX } },
7129     /* a8 */
7130     { "(bad)",          { XX } },
7131     { "(bad)",          { XX } },
7132     { "(bad)",          { XX } },
7133     { "(bad)",          { XX } },
7134     { "(bad)",          { XX } },
7135     { "(bad)",          { XX } },
7136     { "(bad)",          { XX } },
7137     { "(bad)",          { XX } },
7138     /* b0 */
7139     { "(bad)",          { XX } },
7140     { "(bad)",          { XX } },
7141     { "(bad)",          { XX } },
7142     { "(bad)",          { XX } },
7143     { "(bad)",          { XX } },
7144     { "(bad)",          { XX } },
7145     { "(bad)",          { XX } },
7146     { "(bad)",          { XX } },
7147     /* b8 */
7148     { "(bad)",          { XX } },
7149     { "(bad)",          { XX } },
7150     { "(bad)",          { XX } },
7151     { "(bad)",          { XX } },
7152     { "(bad)",          { XX } },
7153     { "(bad)",          { XX } },
7154     { "(bad)",          { XX } },
7155     { "(bad)",          { XX } },
7156     /* c0 */
7157     { "(bad)",          { XX } },
7158     { "vphaddbw",       { XM, EXxmm } },
7159     { "vphaddbd",       { XM, EXxmm } },
7160     { "vphaddbq",       { XM, EXxmm } },
7161     { "(bad)",          { XX } },
7162     { "(bad)",          { XX } },
7163     { "vphaddwd",       { XM, EXxmm } },
7164     { "vphaddwq",       { XM, EXxmm } },
7165     /* c8 */
7166     { "(bad)",          { XX } },
7167     { "(bad)",          { XX } },
7168     { "(bad)",          { XX } },
7169     { "vphadddq",       { XM, EXxmm } },
7170     { "(bad)",          { XX } },
7171     { "(bad)",          { XX } },
7172     { "(bad)",          { XX } },
7173     { "(bad)",          { XX } },
7174     /* d0 */
7175     { "(bad)",          { XX } },
7176     { "vphaddubw",      { XM, EXxmm } },
7177     { "vphaddubd",      { XM, EXxmm } },
7178     { "vphaddubq",      { XM, EXxmm } },
7179     { "(bad)",          { XX } },
7180     { "(bad)",          { XX } },
7181     { "vphadduwd",      { XM, EXxmm } },
7182     { "vphadduwq",      { XM, EXxmm } },
7183     /* d8 */
7184     { "(bad)",          { XX } },
7185     { "(bad)",          { XX } },
7186     { "(bad)",          { XX } },
7187     { "vphaddudq",      { XM, EXxmm } },
7188     { "(bad)",          { XX } },
7189     { "(bad)",          { XX } },
7190     { "(bad)",          { XX } },
7191     { "(bad)",          { XX } },
7192     /* e0 */
7193     { "(bad)",          { XX } },
7194     { "vphsubbw",       { XM, EXxmm } },
7195     { "vphsubwd",       { XM, EXxmm } },
7196     { "vphsubdq",       { XM, EXxmm } },
7197     { "(bad)",          { XX } },
7198     { "(bad)",          { XX } },
7199     { "(bad)",          { XX } },
7200     { "(bad)",          { XX } },
7201     /* e8 */
7202     { "(bad)",          { XX } },
7203     { "(bad)",          { XX } },
7204     { "(bad)",          { XX } },
7205     { "(bad)",          { XX } },
7206     { "(bad)",          { XX } },
7207     { "(bad)",          { XX } },
7208     { "(bad)",          { XX } },
7209     { "(bad)",          { XX } },
7210     /* f0 */
7211     { "(bad)",          { XX } },
7212     { "(bad)",          { XX } },
7213     { "(bad)",          { XX } },
7214     { "(bad)",          { XX } },
7215     { "(bad)",          { XX } },
7216     { "(bad)",          { XX } },
7217     { "(bad)",          { XX } },
7218     { "(bad)",          { XX } },
7219     /* f8 */
7220     { "(bad)",          { XX } },
7221     { "(bad)",          { XX } },
7222     { "(bad)",          { XX } },
7223     { "(bad)",          { XX } },
7224     { "(bad)",          { XX } },
7225     { "(bad)",          { XX } },
7226     { "(bad)",          { XX } },
7227     { "(bad)",          { XX } },
7228   },
7229   /* XOP_0A */
7230   {
7231     /* 00 */
7232     { "(bad)",          { XX } },
7233     { "(bad)",          { XX } },
7234     { "(bad)",          { XX } },
7235     { "(bad)",          { XX } },
7236     { "(bad)",          { XX } },
7237     { "(bad)",          { XX } },
7238     { "(bad)",          { XX } },
7239     { "(bad)",          { XX } },
7240     /* 08 */
7241     { "(bad)",          { XX } },
7242     { "(bad)",          { XX } },
7243     { "(bad)",          { XX } },
7244     { "(bad)",          { XX } },
7245     { "(bad)",          { XX } },
7246     { "(bad)",          { XX } },
7247     { "(bad)",          { XX } },
7248     { "(bad)",          { XX } },
7249     /* 10 */
7250     { "(bad)",          { XX } },
7251     { "(bad)",          { XX } },
7252     { REG_TABLE (REG_XOP_LWP) },
7253     { "(bad)",          { XX } },
7254     { "(bad)",          { XX } },
7255     { "(bad)",          { XX } },
7256     { "(bad)",          { XX } },
7257     { "(bad)",          { XX } },
7258     /* 18 */
7259     { "(bad)",          { XX } },
7260     { "(bad)",          { XX } },
7261     { "(bad)",          { XX } },
7262     { "(bad)",          { XX } },
7263     { "(bad)",          { XX } },
7264     { "(bad)",          { XX } },
7265     { "(bad)",          { XX } },
7266     { "(bad)",          { XX } },
7267     /* 20 */
7268     { "(bad)",          { XX } },
7269     { "(bad)",          { XX } },
7270     { "(bad)",          { XX } },
7271     { "(bad)",          { XX } },
7272     { "(bad)",          { XX } },
7273     { "(bad)",          { XX } },
7274     { "(bad)",          { XX } },
7275     { "(bad)",          { XX } },
7276     /* 28 */
7277     { "(bad)",          { XX } },
7278     { "(bad)",          { XX } },
7279     { "(bad)",          { XX } },
7280     { "(bad)",          { XX } },
7281     { "(bad)",          { XX } },
7282     { "(bad)",          { XX } },
7283     { "(bad)",          { XX } },
7284     { "(bad)",          { XX } },
7285     /* 30 */
7286     { "(bad)",          { XX } },
7287     { "(bad)",          { XX } },
7288     { "(bad)",          { XX } },
7289     { "(bad)",          { XX } },
7290     { "(bad)",          { XX } },
7291     { "(bad)",          { XX } },
7292     { "(bad)",          { XX } },
7293     { "(bad)",          { XX } },
7294     /* 38 */
7295     { "(bad)",          { XX } },
7296     { "(bad)",          { XX } },
7297     { "(bad)",          { XX } },
7298     { "(bad)",          { XX } },
7299     { "(bad)",          { XX } },
7300     { "(bad)",          { XX } },
7301     { "(bad)",          { XX } },
7302     { "(bad)",          { XX } },
7303     /* 40 */
7304     { "(bad)",          { XX } },
7305     { "(bad)",          { XX } },
7306     { "(bad)",          { XX } },
7307     { "(bad)",          { XX } },
7308     { "(bad)",          { XX } },
7309     { "(bad)",          { XX } },
7310     { "(bad)",          { XX } },
7311     { "(bad)",          { XX } },
7312     /* 48 */
7313     { "(bad)",          { XX } },
7314     { "(bad)",          { XX } },
7315     { "(bad)",          { XX } },
7316     { "(bad)",          { XX } },
7317     { "(bad)",          { XX } },
7318     { "(bad)",          { XX } },
7319     { "(bad)",          { XX } },
7320     { "(bad)",          { XX } },
7321     /* 50 */
7322     { "(bad)",          { XX } },
7323     { "(bad)",          { XX } },
7324     { "(bad)",          { XX } },
7325     { "(bad)",          { XX } },
7326     { "(bad)",          { XX } },
7327     { "(bad)",          { XX } },
7328     { "(bad)",          { XX } },
7329     { "(bad)",          { XX } },
7330     /* 58 */
7331     { "(bad)",          { XX } },
7332     { "(bad)",          { XX } },
7333     { "(bad)",          { XX } },
7334     { "(bad)",          { XX } },
7335     { "(bad)",          { XX } },
7336     { "(bad)",          { XX } },
7337     { "(bad)",          { XX } },
7338     { "(bad)",          { XX } },
7339     /* 60 */
7340     { "(bad)",          { XX } },
7341     { "(bad)",          { XX } },
7342     { "(bad)",          { XX } },
7343     { "(bad)",          { XX } },
7344     { "(bad)",          { XX } },
7345     { "(bad)",          { XX } },
7346     { "(bad)",          { XX } },
7347     { "(bad)",          { XX } },
7348     /* 68 */
7349     { "(bad)",          { XX } },
7350     { "(bad)",          { XX } },
7351     { "(bad)",          { XX } },
7352     { "(bad)",          { XX } },
7353     { "(bad)",          { XX } },
7354     { "(bad)",          { XX } },
7355     { "(bad)",          { XX } },
7356     { "(bad)",          { XX } },
7357     /* 70 */
7358     { "(bad)",          { XX } },
7359     { "(bad)",          { XX } },
7360     { "(bad)",          { XX } },
7361     { "(bad)",          { XX } },
7362     { "(bad)",          { XX } },
7363     { "(bad)",          { XX } },
7364     { "(bad)",          { XX } },
7365     { "(bad)",          { XX } },
7366     /* 78 */
7367     { "(bad)",          { XX } },
7368     { "(bad)",          { XX } },
7369     { "(bad)",          { XX } },
7370     { "(bad)",          { XX } },
7371     { "(bad)",          { XX } },
7372     { "(bad)",          { XX } },
7373     { "(bad)",          { XX } },
7374     { "(bad)",          { XX } },
7375     /* 80 */
7376     { "(bad)",          { XX } },
7377     { "(bad)",          { XX } },
7378     { "(bad)",          { XX } },
7379     { "(bad)",          { XX } },
7380     { "(bad)",          { XX } },
7381     { "(bad)",          { XX } },
7382     { "(bad)",          { XX } },
7383     { "(bad)",          { XX } },
7384     /* 88 */
7385     { "(bad)",          { XX } },
7386     { "(bad)",          { XX } },
7387     { "(bad)",          { XX } },
7388     { "(bad)",          { XX } },
7389     { "(bad)",          { XX } },
7390     { "(bad)",          { XX } },
7391     { "(bad)",          { XX } },
7392     { "(bad)",          { XX } },
7393     /* 90 */
7394     { "(bad)",          { XX } },
7395     { "(bad)",          { XX } },
7396     { "(bad)",          { XX } },
7397     { "(bad)",          { XX } },
7398     { "(bad)",          { XX } },
7399     { "(bad)",          { XX } },
7400     { "(bad)",          { XX } },
7401     { "(bad)",          { XX } },
7402     /* 98 */
7403     { "(bad)",          { XX } },
7404     { "(bad)",          { XX } },
7405     { "(bad)",          { XX } },
7406     { "(bad)",          { XX } },
7407     { "(bad)",          { XX } },
7408     { "(bad)",          { XX } },
7409     { "(bad)",          { XX } },
7410     { "(bad)",          { XX } },
7411     /* a0 */
7412     { "(bad)",          { XX } },
7413     { "(bad)",          { XX } },
7414     { "(bad)",          { XX } },
7415     { "(bad)",          { XX } },
7416     { "(bad)",          { XX } },
7417     { "(bad)",          { XX } },
7418     { "(bad)",          { XX } },
7419     { "(bad)",          { XX } },
7420     /* a8 */
7421     { "(bad)",          { XX } },
7422     { "(bad)",          { XX } },
7423     { "(bad)",          { XX } },
7424     { "(bad)",          { XX } },
7425     { "(bad)",          { XX } },
7426     { "(bad)",          { XX } },
7427     { "(bad)",          { XX } },
7428     { "(bad)",          { XX } },
7429     /* b0 */
7430     { "(bad)",          { XX } },
7431     { "(bad)",          { XX } },
7432     { "(bad)",          { XX } },
7433     { "(bad)",          { XX } },
7434     { "(bad)",          { XX } },
7435     { "(bad)",          { XX } },
7436     { "(bad)",          { XX } },
7437     { "(bad)",          { XX } },
7438     /* b8 */
7439     { "(bad)",          { XX } },
7440     { "(bad)",          { XX } },
7441     { "(bad)",          { XX } },
7442     { "(bad)",          { XX } },
7443     { "(bad)",          { XX } },
7444     { "(bad)",          { XX } },
7445     { "(bad)",          { XX } },
7446     { "(bad)",          { XX } },
7447     /* c0 */
7448     { "(bad)",          { XX } },
7449     { "(bad)",          { XX } },
7450     { "(bad)",          { XX } },
7451     { "(bad)",          { XX } },
7452     { "(bad)",          { XX } },
7453     { "(bad)",          { XX } },
7454     { "(bad)",          { XX } },
7455     { "(bad)",          { XX } },
7456     /* c8 */
7457     { "(bad)",          { XX } },
7458     { "(bad)",          { XX } },
7459     { "(bad)",          { XX } },
7460     { "(bad)",          { XX } },
7461     { "(bad)",          { XX } },
7462     { "(bad)",          { XX } },
7463     { "(bad)",          { XX } },
7464     { "(bad)",          { XX } },
7465     /* d0 */
7466     { "(bad)",          { XX } },
7467     { "(bad)",          { XX } },
7468     { "(bad)",          { XX } },
7469     { "(bad)",          { XX } },
7470     { "(bad)",          { XX } },
7471     { "(bad)",          { XX } },
7472     { "(bad)",          { XX } },
7473     { "(bad)",          { XX } },
7474     /* d8 */
7475     { "(bad)",          { XX } },
7476     { "(bad)",          { XX } },
7477     { "(bad)",          { XX } },
7478     { "(bad)",          { XX } },
7479     { "(bad)",          { XX } },
7480     { "(bad)",          { XX } },
7481     { "(bad)",          { XX } },
7482     { "(bad)",          { XX } },
7483     /* e0 */
7484     { "(bad)",          { XX } },
7485     { "(bad)",          { XX } },
7486     { "(bad)",          { XX } },
7487     { "(bad)",          { XX } },
7488     { "(bad)",          { XX } },
7489     { "(bad)",          { XX } },
7490     { "(bad)",          { XX } },
7491     { "(bad)",          { XX } },
7492     /* e8 */
7493     { "(bad)",          { XX } },
7494     { "(bad)",          { XX } },
7495     { "(bad)",          { XX } },
7496     { "(bad)",          { XX } },
7497     { "(bad)",          { XX } },
7498     { "(bad)",          { XX } },
7499     { "(bad)",          { XX } },
7500     { "(bad)",          { XX } },
7501     /* f0 */
7502     { "(bad)",          { XX } },
7503     { "(bad)",          { XX } },
7504     { "(bad)",          { XX } },
7505     { "(bad)",          { XX } },
7506     { "(bad)",          { XX } },
7507     { "(bad)",          { XX } },
7508     { "(bad)",          { XX } },
7509     { "(bad)",          { XX } },
7510     /* f8 */
7511     { "(bad)",          { XX } },
7512     { "(bad)",          { XX } },
7513     { "(bad)",          { XX } },
7514     { "(bad)",          { XX } },
7515     { "(bad)",          { XX } },
7516     { "(bad)",          { XX } },
7517     { "(bad)",          { XX } },
7518     { "(bad)",          { XX } },
7519   },
7520 };
7521
7522 static const struct dis386 vex_table[][256] = {
7523   /* VEX_0F */
7524   {
7525     /* 00 */
7526     { "(bad)",          { XX } },
7527     { "(bad)",          { XX } },
7528     { "(bad)",          { XX } },
7529     { "(bad)",          { XX } },
7530     { "(bad)",          { XX } },
7531     { "(bad)",          { XX } },
7532     { "(bad)",          { XX } },
7533     { "(bad)",          { XX } },
7534     /* 08 */
7535     { "(bad)",          { XX } },
7536     { "(bad)",          { XX } },
7537     { "(bad)",          { XX } },
7538     { "(bad)",          { XX } },
7539     { "(bad)",          { XX } },
7540     { "(bad)",          { XX } },
7541     { "(bad)",          { XX } },
7542     { "(bad)",          { XX } },
7543     /* 10 */
7544     { PREFIX_TABLE (PREFIX_VEX_10) },
7545     { PREFIX_TABLE (PREFIX_VEX_11) },
7546     { PREFIX_TABLE (PREFIX_VEX_12) },
7547     { MOD_TABLE (MOD_VEX_13) },
7548     { VEX_W_TABLE (VEX_W_14) },
7549     { VEX_W_TABLE (VEX_W_15) },
7550     { PREFIX_TABLE (PREFIX_VEX_16) },
7551     { MOD_TABLE (MOD_VEX_17) },
7552     /* 18 */
7553     { "(bad)",          { XX } },
7554     { "(bad)",          { XX } },
7555     { "(bad)",          { XX } },
7556     { "(bad)",          { XX } },
7557     { "(bad)",          { XX } },
7558     { "(bad)",          { XX } },
7559     { "(bad)",          { XX } },
7560     { "(bad)",          { XX } },
7561     /* 20 */
7562     { "(bad)",          { XX } },
7563     { "(bad)",          { XX } },
7564     { "(bad)",          { XX } },
7565     { "(bad)",          { XX } },
7566     { "(bad)",          { XX } },
7567     { "(bad)",          { XX } },
7568     { "(bad)",          { XX } },
7569     { "(bad)",          { XX } },
7570     /* 28 */
7571     { VEX_W_TABLE (VEX_W_28) },
7572     { VEX_W_TABLE (VEX_W_29) },
7573     { PREFIX_TABLE (PREFIX_VEX_2A) },
7574     { MOD_TABLE (MOD_VEX_2B) },
7575     { PREFIX_TABLE (PREFIX_VEX_2C) },
7576     { PREFIX_TABLE (PREFIX_VEX_2D) },
7577     { PREFIX_TABLE (PREFIX_VEX_2E) },
7578     { PREFIX_TABLE (PREFIX_VEX_2F) },
7579     /* 30 */
7580     { "(bad)",          { XX } },
7581     { "(bad)",          { XX } },
7582     { "(bad)",          { XX } },
7583     { "(bad)",          { XX } },
7584     { "(bad)",          { XX } },
7585     { "(bad)",          { XX } },
7586     { "(bad)",          { XX } },
7587     { "(bad)",          { XX } },
7588     /* 38 */
7589     { "(bad)",          { XX } },
7590     { "(bad)",          { XX } },
7591     { "(bad)",          { XX } },
7592     { "(bad)",          { XX } },
7593     { "(bad)",          { XX } },
7594     { "(bad)",          { XX } },
7595     { "(bad)",          { XX } },
7596     { "(bad)",          { XX } },
7597     /* 40 */
7598     { "(bad)",          { XX } },
7599     { "(bad)",          { XX } },
7600     { "(bad)",          { XX } },
7601     { "(bad)",          { XX } },
7602     { "(bad)",          { XX } },
7603     { "(bad)",          { XX } },
7604     { "(bad)",          { XX } },
7605     { "(bad)",          { XX } },
7606     /* 48 */
7607     { "(bad)",          { XX } },
7608     { "(bad)",          { XX } },
7609     { "(bad)",          { XX } },
7610     { "(bad)",          { XX } },
7611     { "(bad)",          { XX } },
7612     { "(bad)",          { XX } },
7613     { "(bad)",          { XX } },
7614     { "(bad)",          { XX } },
7615     /* 50 */
7616     { MOD_TABLE (MOD_VEX_50) },
7617     { PREFIX_TABLE (PREFIX_VEX_51) },
7618     { PREFIX_TABLE (PREFIX_VEX_52) },
7619     { PREFIX_TABLE (PREFIX_VEX_53) },
7620     { "vandpX",         { XM, Vex, EXx } },
7621     { "vandnpX",        { XM, Vex, EXx } },
7622     { "vorpX",          { XM, Vex, EXx } },
7623     { "vxorpX",         { XM, Vex, EXx } },
7624     /* 58 */
7625     { PREFIX_TABLE (PREFIX_VEX_58) },
7626     { PREFIX_TABLE (PREFIX_VEX_59) },
7627     { PREFIX_TABLE (PREFIX_VEX_5A) },
7628     { PREFIX_TABLE (PREFIX_VEX_5B) },
7629     { PREFIX_TABLE (PREFIX_VEX_5C) },
7630     { PREFIX_TABLE (PREFIX_VEX_5D) },
7631     { PREFIX_TABLE (PREFIX_VEX_5E) },
7632     { PREFIX_TABLE (PREFIX_VEX_5F) },
7633     /* 60 */
7634     { PREFIX_TABLE (PREFIX_VEX_60) },
7635     { PREFIX_TABLE (PREFIX_VEX_61) },
7636     { PREFIX_TABLE (PREFIX_VEX_62) },
7637     { PREFIX_TABLE (PREFIX_VEX_63) },
7638     { PREFIX_TABLE (PREFIX_VEX_64) },
7639     { PREFIX_TABLE (PREFIX_VEX_65) },
7640     { PREFIX_TABLE (PREFIX_VEX_66) },
7641     { PREFIX_TABLE (PREFIX_VEX_67) },
7642     /* 68 */
7643     { PREFIX_TABLE (PREFIX_VEX_68) },
7644     { PREFIX_TABLE (PREFIX_VEX_69) },
7645     { PREFIX_TABLE (PREFIX_VEX_6A) },
7646     { PREFIX_TABLE (PREFIX_VEX_6B) },
7647     { PREFIX_TABLE (PREFIX_VEX_6C) },
7648     { PREFIX_TABLE (PREFIX_VEX_6D) },
7649     { PREFIX_TABLE (PREFIX_VEX_6E) },
7650     { PREFIX_TABLE (PREFIX_VEX_6F) },
7651     /* 70 */
7652     { PREFIX_TABLE (PREFIX_VEX_70) },
7653     { REG_TABLE (REG_VEX_71) },
7654     { REG_TABLE (REG_VEX_72) },
7655     { REG_TABLE (REG_VEX_73) },
7656     { PREFIX_TABLE (PREFIX_VEX_74) },
7657     { PREFIX_TABLE (PREFIX_VEX_75) },
7658     { PREFIX_TABLE (PREFIX_VEX_76) },
7659     { PREFIX_TABLE (PREFIX_VEX_77) },
7660     /* 78 */
7661     { "(bad)",          { XX } },
7662     { "(bad)",          { XX } },
7663     { "(bad)",          { XX } },
7664     { "(bad)",          { XX } },
7665     { PREFIX_TABLE (PREFIX_VEX_7C) },
7666     { PREFIX_TABLE (PREFIX_VEX_7D) },
7667     { PREFIX_TABLE (PREFIX_VEX_7E) },
7668     { PREFIX_TABLE (PREFIX_VEX_7F) },
7669     /* 80 */
7670     { "(bad)",          { XX } },
7671     { "(bad)",          { XX } },
7672     { "(bad)",          { XX } },
7673     { "(bad)",          { XX } },
7674     { "(bad)",          { XX } },
7675     { "(bad)",          { XX } },
7676     { "(bad)",          { XX } },
7677     { "(bad)",          { XX } },
7678     /* 88 */
7679     { "(bad)",          { XX } },
7680     { "(bad)",          { XX } },
7681     { "(bad)",          { XX } },
7682     { "(bad)",          { XX } },
7683     { "(bad)",          { XX } },
7684     { "(bad)",          { XX } },
7685     { "(bad)",          { XX } },
7686     { "(bad)",          { XX } },
7687     /* 90 */
7688     { "(bad)",          { XX } },
7689     { "(bad)",          { XX } },
7690     { "(bad)",          { XX } },
7691     { "(bad)",          { XX } },
7692     { "(bad)",          { XX } },
7693     { "(bad)",          { XX } },
7694     { "(bad)",          { XX } },
7695     { "(bad)",          { XX } },
7696     /* 98 */
7697     { "(bad)",          { XX } },
7698     { "(bad)",          { XX } },
7699     { "(bad)",          { XX } },
7700     { "(bad)",          { XX } },
7701     { "(bad)",          { XX } },
7702     { "(bad)",          { XX } },
7703     { "(bad)",          { XX } },
7704     { "(bad)",          { XX } },
7705     /* a0 */
7706     { "(bad)",          { XX } },
7707     { "(bad)",          { XX } },
7708     { "(bad)",          { XX } },
7709     { "(bad)",          { XX } },
7710     { "(bad)",          { XX } },
7711     { "(bad)",          { XX } },
7712     { "(bad)",          { XX } },
7713     { "(bad)",          { XX } },
7714     /* a8 */
7715     { "(bad)",          { XX } },
7716     { "(bad)",          { XX } },
7717     { "(bad)",          { XX } },
7718     { "(bad)",          { XX } },
7719     { "(bad)",          { XX } },
7720     { "(bad)",          { XX } },
7721     { REG_TABLE (REG_VEX_AE) },
7722     { "(bad)",          { XX } },
7723     /* b0 */
7724     { "(bad)",          { XX } },
7725     { "(bad)",          { XX } },
7726     { "(bad)",          { XX } },
7727     { "(bad)",          { XX } },
7728     { "(bad)",          { XX } },
7729     { "(bad)",          { XX } },
7730     { "(bad)",          { XX } },
7731     { "(bad)",          { XX } },
7732     /* b8 */
7733     { "(bad)",          { XX } },
7734     { "(bad)",          { XX } },
7735     { "(bad)",          { XX } },
7736     { "(bad)",          { XX } },
7737     { "(bad)",          { XX } },
7738     { "(bad)",          { XX } },
7739     { "(bad)",          { XX } },
7740     { "(bad)",          { XX } },
7741     /* c0 */
7742     { "(bad)",          { XX } },
7743     { "(bad)",          { XX } },
7744     { PREFIX_TABLE (PREFIX_VEX_C2) },
7745     { "(bad)",          { XX } },
7746     { PREFIX_TABLE (PREFIX_VEX_C4) },
7747     { PREFIX_TABLE (PREFIX_VEX_C5) },
7748     { "vshufpX",        { XM, Vex, EXx, Ib } },
7749     { "(bad)",          { XX } },
7750     /* c8 */
7751     { "(bad)",          { XX } },
7752     { "(bad)",          { XX } },
7753     { "(bad)",          { XX } },
7754     { "(bad)",          { XX } },
7755     { "(bad)",          { XX } },
7756     { "(bad)",          { XX } },
7757     { "(bad)",          { XX } },
7758     { "(bad)",          { XX } },
7759     /* d0 */
7760     { PREFIX_TABLE (PREFIX_VEX_D0) },
7761     { PREFIX_TABLE (PREFIX_VEX_D1) },
7762     { PREFIX_TABLE (PREFIX_VEX_D2) },
7763     { PREFIX_TABLE (PREFIX_VEX_D3) },
7764     { PREFIX_TABLE (PREFIX_VEX_D4) },
7765     { PREFIX_TABLE (PREFIX_VEX_D5) },
7766     { PREFIX_TABLE (PREFIX_VEX_D6) },
7767     { PREFIX_TABLE (PREFIX_VEX_D7) },
7768     /* d8 */
7769     { PREFIX_TABLE (PREFIX_VEX_D8) },
7770     { PREFIX_TABLE (PREFIX_VEX_D9) },
7771     { PREFIX_TABLE (PREFIX_VEX_DA) },
7772     { PREFIX_TABLE (PREFIX_VEX_DB) },
7773     { PREFIX_TABLE (PREFIX_VEX_DC) },
7774     { PREFIX_TABLE (PREFIX_VEX_DD) },
7775     { PREFIX_TABLE (PREFIX_VEX_DE) },
7776     { PREFIX_TABLE (PREFIX_VEX_DF) },
7777     /* e0 */
7778     { PREFIX_TABLE (PREFIX_VEX_E0) },
7779     { PREFIX_TABLE (PREFIX_VEX_E1) },
7780     { PREFIX_TABLE (PREFIX_VEX_E2) },
7781     { PREFIX_TABLE (PREFIX_VEX_E3) },
7782     { PREFIX_TABLE (PREFIX_VEX_E4) },
7783     { PREFIX_TABLE (PREFIX_VEX_E5) },
7784     { PREFIX_TABLE (PREFIX_VEX_E6) },
7785     { PREFIX_TABLE (PREFIX_VEX_E7) },
7786     /* e8 */
7787     { PREFIX_TABLE (PREFIX_VEX_E8) },
7788     { PREFIX_TABLE (PREFIX_VEX_E9) },
7789     { PREFIX_TABLE (PREFIX_VEX_EA) },
7790     { PREFIX_TABLE (PREFIX_VEX_EB) },
7791     { PREFIX_TABLE (PREFIX_VEX_EC) },
7792     { PREFIX_TABLE (PREFIX_VEX_ED) },
7793     { PREFIX_TABLE (PREFIX_VEX_EE) },
7794     { PREFIX_TABLE (PREFIX_VEX_EF) },
7795     /* f0 */
7796     { PREFIX_TABLE (PREFIX_VEX_F0) },
7797     { PREFIX_TABLE (PREFIX_VEX_F1) },
7798     { PREFIX_TABLE (PREFIX_VEX_F2) },
7799     { PREFIX_TABLE (PREFIX_VEX_F3) },
7800     { PREFIX_TABLE (PREFIX_VEX_F4) },
7801     { PREFIX_TABLE (PREFIX_VEX_F5) },
7802     { PREFIX_TABLE (PREFIX_VEX_F6) },
7803     { PREFIX_TABLE (PREFIX_VEX_F7) },
7804     /* f8 */
7805     { PREFIX_TABLE (PREFIX_VEX_F8) },
7806     { PREFIX_TABLE (PREFIX_VEX_F9) },
7807     { PREFIX_TABLE (PREFIX_VEX_FA) },
7808     { PREFIX_TABLE (PREFIX_VEX_FB) },
7809     { PREFIX_TABLE (PREFIX_VEX_FC) },
7810     { PREFIX_TABLE (PREFIX_VEX_FD) },
7811     { PREFIX_TABLE (PREFIX_VEX_FE) },
7812     { "(bad)",          { XX } },
7813   },
7814   /* VEX_0F38 */
7815   {
7816     /* 00 */
7817     { PREFIX_TABLE (PREFIX_VEX_3800) },
7818     { PREFIX_TABLE (PREFIX_VEX_3801) },
7819     { PREFIX_TABLE (PREFIX_VEX_3802) },
7820     { PREFIX_TABLE (PREFIX_VEX_3803) },
7821     { PREFIX_TABLE (PREFIX_VEX_3804) },
7822     { PREFIX_TABLE (PREFIX_VEX_3805) },
7823     { PREFIX_TABLE (PREFIX_VEX_3806) },
7824     { PREFIX_TABLE (PREFIX_VEX_3807) },
7825     /* 08 */
7826     { PREFIX_TABLE (PREFIX_VEX_3808) },
7827     { PREFIX_TABLE (PREFIX_VEX_3809) },
7828     { PREFIX_TABLE (PREFIX_VEX_380A) },
7829     { PREFIX_TABLE (PREFIX_VEX_380B) },
7830     { PREFIX_TABLE (PREFIX_VEX_380C) },
7831     { PREFIX_TABLE (PREFIX_VEX_380D) },
7832     { PREFIX_TABLE (PREFIX_VEX_380E) },
7833     { PREFIX_TABLE (PREFIX_VEX_380F) },
7834     /* 10 */
7835     { "(bad)",          { XX } },
7836     { "(bad)",          { XX } },
7837     { "(bad)",          { XX } },
7838     { "(bad)",          { XX } },
7839     { "(bad)",          { XX } },
7840     { "(bad)",          { XX } },
7841     { "(bad)",          { XX } },
7842     { PREFIX_TABLE (PREFIX_VEX_3817) },
7843     /* 18 */
7844     { PREFIX_TABLE (PREFIX_VEX_3818) },
7845     { PREFIX_TABLE (PREFIX_VEX_3819) },
7846     { PREFIX_TABLE (PREFIX_VEX_381A) },
7847     { "(bad)",          { XX } },
7848     { PREFIX_TABLE (PREFIX_VEX_381C) },
7849     { PREFIX_TABLE (PREFIX_VEX_381D) },
7850     { PREFIX_TABLE (PREFIX_VEX_381E) },
7851     { "(bad)",          { XX } },
7852     /* 20 */
7853     { PREFIX_TABLE (PREFIX_VEX_3820) },
7854     { PREFIX_TABLE (PREFIX_VEX_3821) },
7855     { PREFIX_TABLE (PREFIX_VEX_3822) },
7856     { PREFIX_TABLE (PREFIX_VEX_3823) },
7857     { PREFIX_TABLE (PREFIX_VEX_3824) },
7858     { PREFIX_TABLE (PREFIX_VEX_3825) },
7859     { "(bad)",          { XX } },
7860     { "(bad)",          { XX } },
7861     /* 28 */
7862     { PREFIX_TABLE (PREFIX_VEX_3828) },
7863     { PREFIX_TABLE (PREFIX_VEX_3829) },
7864     { PREFIX_TABLE (PREFIX_VEX_382A) },
7865     { PREFIX_TABLE (PREFIX_VEX_382B) },
7866     { PREFIX_TABLE (PREFIX_VEX_382C) },
7867     { PREFIX_TABLE (PREFIX_VEX_382D) },
7868     { PREFIX_TABLE (PREFIX_VEX_382E) },
7869     { PREFIX_TABLE (PREFIX_VEX_382F) },
7870     /* 30 */
7871     { PREFIX_TABLE (PREFIX_VEX_3830) },
7872     { PREFIX_TABLE (PREFIX_VEX_3831) },
7873     { PREFIX_TABLE (PREFIX_VEX_3832) },
7874     { PREFIX_TABLE (PREFIX_VEX_3833) },
7875     { PREFIX_TABLE (PREFIX_VEX_3834) },
7876     { PREFIX_TABLE (PREFIX_VEX_3835) },
7877     { "(bad)",          { XX } },
7878     { PREFIX_TABLE (PREFIX_VEX_3837) },
7879     /* 38 */
7880     { PREFIX_TABLE (PREFIX_VEX_3838) },
7881     { PREFIX_TABLE (PREFIX_VEX_3839) },
7882     { PREFIX_TABLE (PREFIX_VEX_383A) },
7883     { PREFIX_TABLE (PREFIX_VEX_383B) },
7884     { PREFIX_TABLE (PREFIX_VEX_383C) },
7885     { PREFIX_TABLE (PREFIX_VEX_383D) },
7886     { PREFIX_TABLE (PREFIX_VEX_383E) },
7887     { PREFIX_TABLE (PREFIX_VEX_383F) },
7888     /* 40 */
7889     { PREFIX_TABLE (PREFIX_VEX_3840) },
7890     { PREFIX_TABLE (PREFIX_VEX_3841) },
7891     { "(bad)",          { XX } },
7892     { "(bad)",          { XX } },
7893     { "(bad)",          { XX } },
7894     { "(bad)",          { XX } },
7895     { "(bad)",          { XX } },
7896     { "(bad)",          { XX } },
7897     /* 48 */
7898     { "(bad)",          { XX } },
7899     { "(bad)",          { XX } },
7900     { "(bad)",          { XX } },
7901     { "(bad)",          { XX } },
7902     { "(bad)",          { XX } },
7903     { "(bad)",          { XX } },
7904     { "(bad)",          { XX } },
7905     { "(bad)",          { XX } },
7906     /* 50 */
7907     { "(bad)",          { XX } },
7908     { "(bad)",          { XX } },
7909     { "(bad)",          { XX } },
7910     { "(bad)",          { XX } },
7911     { "(bad)",          { XX } },
7912     { "(bad)",          { XX } },
7913     { "(bad)",          { XX } },
7914     { "(bad)",          { XX } },
7915     /* 58 */
7916     { "(bad)",          { XX } },
7917     { "(bad)",          { XX } },
7918     { "(bad)",          { XX } },
7919     { "(bad)",          { XX } },
7920     { "(bad)",          { XX } },
7921     { "(bad)",          { XX } },
7922     { "(bad)",          { XX } },
7923     { "(bad)",          { XX } },
7924     /* 60 */
7925     { "(bad)",          { XX } },
7926     { "(bad)",          { XX } },
7927     { "(bad)",          { XX } },
7928     { "(bad)",          { XX } },
7929     { "(bad)",          { XX } },
7930     { "(bad)",          { XX } },
7931     { "(bad)",          { XX } },
7932     { "(bad)",          { XX } },
7933     /* 68 */
7934     { "(bad)",          { XX } },
7935     { "(bad)",          { XX } },
7936     { "(bad)",          { XX } },
7937     { "(bad)",          { XX } },
7938     { "(bad)",          { XX } },
7939     { "(bad)",          { XX } },
7940     { "(bad)",          { XX } },
7941     { "(bad)",          { XX } },
7942     /* 70 */
7943     { "(bad)",          { XX } },
7944     { "(bad)",          { XX } },
7945     { "(bad)",          { XX } },
7946     { "(bad)",          { XX } },
7947     { "(bad)",          { XX } },
7948     { "(bad)",          { XX } },
7949     { "(bad)",          { XX } },
7950     { "(bad)",          { XX } },
7951     /* 78 */
7952     { "(bad)",          { XX } },
7953     { "(bad)",          { XX } },
7954     { "(bad)",          { XX } },
7955     { "(bad)",          { XX } },
7956     { "(bad)",          { XX } },
7957     { "(bad)",          { XX } },
7958     { "(bad)",          { XX } },
7959     { "(bad)",          { XX } },
7960     /* 80 */
7961     { "(bad)",          { XX } },
7962     { "(bad)",          { XX } },
7963     { "(bad)",          { XX } },
7964     { "(bad)",          { XX } },
7965     { "(bad)",          { XX } },
7966     { "(bad)",          { XX } },
7967     { "(bad)",          { XX } },
7968     { "(bad)",          { XX } },
7969     /* 88 */
7970     { "(bad)",          { XX } },
7971     { "(bad)",          { XX } },
7972     { "(bad)",          { XX } },
7973     { "(bad)",          { XX } },
7974     { "(bad)",          { XX } },
7975     { "(bad)",          { XX } },
7976     { "(bad)",          { XX } },
7977     { "(bad)",          { XX } },
7978     /* 90 */
7979     { "(bad)",          { XX } },
7980     { "(bad)",          { XX } },
7981     { "(bad)",          { XX } },
7982     { "(bad)",          { XX } },
7983     { "(bad)",          { XX } },
7984     { "(bad)",          { XX } },
7985     { PREFIX_TABLE (PREFIX_VEX_3896) },
7986     { PREFIX_TABLE (PREFIX_VEX_3897) },
7987     /* 98 */
7988     { PREFIX_TABLE (PREFIX_VEX_3898) },
7989     { PREFIX_TABLE (PREFIX_VEX_3899) },
7990     { PREFIX_TABLE (PREFIX_VEX_389A) },
7991     { PREFIX_TABLE (PREFIX_VEX_389B) },
7992     { PREFIX_TABLE (PREFIX_VEX_389C) },
7993     { PREFIX_TABLE (PREFIX_VEX_389D) },
7994     { PREFIX_TABLE (PREFIX_VEX_389E) },
7995     { PREFIX_TABLE (PREFIX_VEX_389F) },
7996     /* a0 */
7997     { "(bad)",          { XX } },
7998     { "(bad)",          { XX } },
7999     { "(bad)",          { XX } },
8000     { "(bad)",          { XX } },
8001     { "(bad)",          { XX } },
8002     { "(bad)",          { XX } },
8003     { PREFIX_TABLE (PREFIX_VEX_38A6) },
8004     { PREFIX_TABLE (PREFIX_VEX_38A7) },
8005     /* a8 */
8006     { PREFIX_TABLE (PREFIX_VEX_38A8) },
8007     { PREFIX_TABLE (PREFIX_VEX_38A9) },
8008     { PREFIX_TABLE (PREFIX_VEX_38AA) },
8009     { PREFIX_TABLE (PREFIX_VEX_38AB) },
8010     { PREFIX_TABLE (PREFIX_VEX_38AC) },
8011     { PREFIX_TABLE (PREFIX_VEX_38AD) },
8012     { PREFIX_TABLE (PREFIX_VEX_38AE) },
8013     { PREFIX_TABLE (PREFIX_VEX_38AF) },
8014     /* b0 */
8015     { "(bad)",          { XX } },
8016     { "(bad)",          { XX } },
8017     { "(bad)",          { XX } },
8018     { "(bad)",          { XX } },
8019     { "(bad)",          { XX } },
8020     { "(bad)",          { XX } },
8021     { PREFIX_TABLE (PREFIX_VEX_38B6) },
8022     { PREFIX_TABLE (PREFIX_VEX_38B7) },
8023     /* b8 */
8024     { PREFIX_TABLE (PREFIX_VEX_38B8) },
8025     { PREFIX_TABLE (PREFIX_VEX_38B9) },
8026     { PREFIX_TABLE (PREFIX_VEX_38BA) },
8027     { PREFIX_TABLE (PREFIX_VEX_38BB) },
8028     { PREFIX_TABLE (PREFIX_VEX_38BC) },
8029     { PREFIX_TABLE (PREFIX_VEX_38BD) },
8030     { PREFIX_TABLE (PREFIX_VEX_38BE) },
8031     { PREFIX_TABLE (PREFIX_VEX_38BF) },
8032     /* c0 */
8033     { "(bad)",          { XX } },
8034     { "(bad)",          { XX } },
8035     { "(bad)",          { XX } },
8036     { "(bad)",          { XX } },
8037     { "(bad)",          { XX } },
8038     { "(bad)",          { XX } },
8039     { "(bad)",          { XX } },
8040     { "(bad)",          { XX } },
8041     /* c8 */
8042     { "(bad)",          { XX } },
8043     { "(bad)",          { XX } },
8044     { "(bad)",          { XX } },
8045     { "(bad)",          { XX } },
8046     { "(bad)",          { XX } },
8047     { "(bad)",          { XX } },
8048     { "(bad)",          { XX } },
8049     { "(bad)",          { XX } },
8050     /* d0 */
8051     { "(bad)",          { XX } },
8052     { "(bad)",          { XX } },
8053     { "(bad)",          { XX } },
8054     { "(bad)",          { XX } },
8055     { "(bad)",          { XX } },
8056     { "(bad)",          { XX } },
8057     { "(bad)",          { XX } },
8058     { "(bad)",          { XX } },
8059     /* d8 */
8060     { "(bad)",          { XX } },
8061     { "(bad)",          { XX } },
8062     { "(bad)",          { XX } },
8063     { PREFIX_TABLE (PREFIX_VEX_38DB) },
8064     { PREFIX_TABLE (PREFIX_VEX_38DC) },
8065     { PREFIX_TABLE (PREFIX_VEX_38DD) },
8066     { PREFIX_TABLE (PREFIX_VEX_38DE) },
8067     { PREFIX_TABLE (PREFIX_VEX_38DF) },
8068     /* e0 */
8069     { "(bad)",          { XX } },
8070     { "(bad)",          { XX } },
8071     { "(bad)",          { XX } },
8072     { "(bad)",          { XX } },
8073     { "(bad)",          { XX } },
8074     { "(bad)",          { XX } },
8075     { "(bad)",          { XX } },
8076     { "(bad)",          { XX } },
8077     /* e8 */
8078     { "(bad)",          { XX } },
8079     { "(bad)",          { XX } },
8080     { "(bad)",          { XX } },
8081     { "(bad)",          { XX } },
8082     { "(bad)",          { XX } },
8083     { "(bad)",          { XX } },
8084     { "(bad)",          { XX } },
8085     { "(bad)",          { XX } },
8086     /* f0 */
8087     { "(bad)",          { XX } },
8088     { "(bad)",          { XX } },
8089     { "(bad)",          { XX } },
8090     { "(bad)",          { XX } },
8091     { "(bad)",          { XX } },
8092     { "(bad)",          { XX } },
8093     { "(bad)",          { XX } },
8094     { "(bad)",          { XX } },
8095     /* f8 */
8096     { "(bad)",          { XX } },
8097     { "(bad)",          { XX } },
8098     { "(bad)",          { XX } },
8099     { "(bad)",          { XX } },
8100     { "(bad)",          { XX } },
8101     { "(bad)",          { XX } },
8102     { "(bad)",          { XX } },
8103     { "(bad)",          { XX } },
8104   },
8105   /* VEX_0F3A */
8106   {
8107     /* 00 */
8108     { "(bad)",          { XX } },
8109     { "(bad)",          { XX } },
8110     { "(bad)",          { XX } },
8111     { "(bad)",          { XX } },
8112     { PREFIX_TABLE (PREFIX_VEX_3A04) },
8113     { PREFIX_TABLE (PREFIX_VEX_3A05) },
8114     { PREFIX_TABLE (PREFIX_VEX_3A06) },
8115     { "(bad)",          { XX } },
8116     /* 08 */
8117     { PREFIX_TABLE (PREFIX_VEX_3A08) },
8118     { PREFIX_TABLE (PREFIX_VEX_3A09) },
8119     { PREFIX_TABLE (PREFIX_VEX_3A0A) },
8120     { PREFIX_TABLE (PREFIX_VEX_3A0B) },
8121     { PREFIX_TABLE (PREFIX_VEX_3A0C) },
8122     { PREFIX_TABLE (PREFIX_VEX_3A0D) },
8123     { PREFIX_TABLE (PREFIX_VEX_3A0E) },
8124     { PREFIX_TABLE (PREFIX_VEX_3A0F) },
8125     /* 10 */
8126     { "(bad)",          { XX } },
8127     { "(bad)",          { XX } },
8128     { "(bad)",          { XX } },
8129     { "(bad)",          { XX } },
8130     { PREFIX_TABLE (PREFIX_VEX_3A14) },
8131     { PREFIX_TABLE (PREFIX_VEX_3A15) },
8132     { PREFIX_TABLE (PREFIX_VEX_3A16) },
8133     { PREFIX_TABLE (PREFIX_VEX_3A17) },
8134     /* 18 */
8135     { PREFIX_TABLE (PREFIX_VEX_3A18) },
8136     { PREFIX_TABLE (PREFIX_VEX_3A19) },
8137     { "(bad)",          { XX } },
8138     { "(bad)",          { XX } },
8139     { "(bad)",          { XX } },
8140     { "(bad)",          { XX } },
8141     { "(bad)",          { XX } },
8142     { "(bad)",          { XX } },
8143     /* 20 */
8144     { PREFIX_TABLE (PREFIX_VEX_3A20) },
8145     { PREFIX_TABLE (PREFIX_VEX_3A21) },
8146     { PREFIX_TABLE (PREFIX_VEX_3A22) },
8147     { "(bad)",          { XX } },
8148     { "(bad)",          { XX } },
8149     { "(bad)",          { XX } },
8150     { "(bad)",          { XX } },
8151     { "(bad)",          { XX } },
8152     /* 28 */
8153     { "(bad)",          { XX } },
8154     { "(bad)",          { XX } },
8155     { "(bad)",          { XX } },
8156     { "(bad)",          { XX } },
8157     { "(bad)",          { XX } },
8158     { "(bad)",          { XX } },
8159     { "(bad)",          { XX } },
8160     { "(bad)",          { XX } },
8161     /* 30 */
8162     { "(bad)",          { XX } },
8163     { "(bad)",          { XX } },
8164     { "(bad)",          { XX } },
8165     { "(bad)",          { XX } },
8166     { "(bad)",          { XX } },
8167     { "(bad)",          { XX } },
8168     { "(bad)",          { XX } },
8169     { "(bad)",          { XX } },
8170     /* 38 */
8171     { "(bad)",          { XX } },
8172     { "(bad)",          { XX } },
8173     { "(bad)",          { XX } },
8174     { "(bad)",          { XX } },
8175     { "(bad)",          { XX } },
8176     { "(bad)",          { XX } },
8177     { "(bad)",          { XX } },
8178     { "(bad)",          { XX } },
8179     /* 40 */
8180     { PREFIX_TABLE (PREFIX_VEX_3A40) },
8181     { PREFIX_TABLE (PREFIX_VEX_3A41) },
8182     { PREFIX_TABLE (PREFIX_VEX_3A42) },
8183     { "(bad)",          { XX } },
8184     { PREFIX_TABLE (PREFIX_VEX_3A44) },
8185     { "(bad)",          { XX } },
8186     { "(bad)",          { XX } },
8187     { "(bad)",          { XX } },
8188     /* 48 */
8189     { "(bad)",          { XX } },
8190     { "(bad)",          { XX } },
8191     { PREFIX_TABLE (PREFIX_VEX_3A4A) },
8192     { PREFIX_TABLE (PREFIX_VEX_3A4B) },
8193     { PREFIX_TABLE (PREFIX_VEX_3A4C) },
8194     { "(bad)",          { XX } },
8195     { "(bad)",          { XX } },
8196     { "(bad)",          { XX } },
8197     /* 50 */
8198     { "(bad)",          { XX } },
8199     { "(bad)",          { XX } },
8200     { "(bad)",          { XX } },
8201     { "(bad)",          { XX } },
8202     { "(bad)",          { XX } },
8203     { "(bad)",          { XX } },
8204     { "(bad)",          { XX } },
8205     { "(bad)",          { XX } },
8206     /* 58 */
8207     { "(bad)",          { XX } },
8208     { "(bad)",          { XX } },
8209     { "(bad)",          { XX } },
8210     { "(bad)",          { XX } },
8211     { PREFIX_TABLE (PREFIX_VEX_3A5C) },
8212     { PREFIX_TABLE (PREFIX_VEX_3A5D) },
8213     { PREFIX_TABLE (PREFIX_VEX_3A5E) },
8214     { PREFIX_TABLE (PREFIX_VEX_3A5F) },
8215     /* 60 */
8216     { PREFIX_TABLE (PREFIX_VEX_3A60) },
8217     { PREFIX_TABLE (PREFIX_VEX_3A61) },
8218     { PREFIX_TABLE (PREFIX_VEX_3A62) },
8219     { PREFIX_TABLE (PREFIX_VEX_3A63) },
8220     { "(bad)",          { XX } },
8221     { "(bad)",          { XX } },
8222     { "(bad)",          { XX } },
8223     { "(bad)",          { XX } },
8224     /* 68 */
8225     { PREFIX_TABLE (PREFIX_VEX_3A68) },
8226     { PREFIX_TABLE (PREFIX_VEX_3A69) },
8227     { PREFIX_TABLE (PREFIX_VEX_3A6A) },
8228     { PREFIX_TABLE (PREFIX_VEX_3A6B) },
8229     { PREFIX_TABLE (PREFIX_VEX_3A6C) },
8230     { PREFIX_TABLE (PREFIX_VEX_3A6D) },
8231     { PREFIX_TABLE (PREFIX_VEX_3A6E) },
8232     { PREFIX_TABLE (PREFIX_VEX_3A6F) },
8233     /* 70 */
8234     { "(bad)",          { XX } },
8235     { "(bad)",          { XX } },
8236     { "(bad)",          { XX } },
8237     { "(bad)",          { XX } },
8238     { "(bad)",          { XX } },
8239     { "(bad)",          { XX } },
8240     { "(bad)",          { XX } },
8241     { "(bad)",          { XX } },
8242     /* 78 */
8243     { PREFIX_TABLE (PREFIX_VEX_3A78) },
8244     { PREFIX_TABLE (PREFIX_VEX_3A79) },
8245     { PREFIX_TABLE (PREFIX_VEX_3A7A) },
8246     { PREFIX_TABLE (PREFIX_VEX_3A7B) },
8247     { PREFIX_TABLE (PREFIX_VEX_3A7C) },
8248     { PREFIX_TABLE (PREFIX_VEX_3A7D) },
8249     { PREFIX_TABLE (PREFIX_VEX_3A7E) },
8250     { PREFIX_TABLE (PREFIX_VEX_3A7F) },
8251     /* 80 */
8252     { "(bad)",          { XX } },
8253     { "(bad)",          { XX } },
8254     { "(bad)",          { XX } },
8255     { "(bad)",          { XX } },
8256     { "(bad)",          { XX } },
8257     { "(bad)",          { XX } },
8258     { "(bad)",          { XX } },
8259     { "(bad)",          { XX } },
8260     /* 88 */
8261     { "(bad)",          { XX } },
8262     { "(bad)",          { XX } },
8263     { "(bad)",          { XX } },
8264     { "(bad)",          { XX } },
8265     { "(bad)",          { XX } },
8266     { "(bad)",          { XX } },
8267     { "(bad)",          { XX } },
8268     { "(bad)",          { XX } },
8269     /* 90 */
8270     { "(bad)",          { XX } },
8271     { "(bad)",          { XX } },
8272     { "(bad)",          { XX } },
8273     { "(bad)",          { XX } },
8274     { "(bad)",          { XX } },
8275     { "(bad)",          { XX } },
8276     { "(bad)",          { XX } },
8277     { "(bad)",          { XX } },
8278     /* 98 */
8279     { "(bad)",          { XX } },
8280     { "(bad)",          { XX } },
8281     { "(bad)",          { XX } },
8282     { "(bad)",          { XX } },
8283     { "(bad)",          { XX } },
8284     { "(bad)",          { XX } },
8285     { "(bad)",          { XX } },
8286     { "(bad)",          { XX } },
8287     /* a0 */
8288     { "(bad)",          { XX } },
8289     { "(bad)",          { XX } },
8290     { "(bad)",          { XX } },
8291     { "(bad)",          { XX } },
8292     { "(bad)",          { XX } },
8293     { "(bad)",          { XX } },
8294     { "(bad)",          { XX } },
8295     { "(bad)",          { XX } },
8296     /* a8 */
8297     { "(bad)",          { XX } },
8298     { "(bad)",          { XX } },
8299     { "(bad)",          { XX } },
8300     { "(bad)",          { XX } },
8301     { "(bad)",          { XX } },
8302     { "(bad)",          { XX } },
8303     { "(bad)",          { XX } },
8304     { "(bad)",          { XX } },
8305     /* b0 */
8306     { "(bad)",          { XX } },
8307     { "(bad)",          { XX } },
8308     { "(bad)",          { XX } },
8309     { "(bad)",          { XX } },
8310     { "(bad)",          { XX } },
8311     { "(bad)",          { XX } },
8312     { "(bad)",          { XX } },
8313     { "(bad)",          { XX } },
8314     /* b8 */
8315     { "(bad)",          { XX } },
8316     { "(bad)",          { XX } },
8317     { "(bad)",          { XX } },
8318     { "(bad)",          { XX } },
8319     { "(bad)",          { XX } },
8320     { "(bad)",          { XX } },
8321     { "(bad)",          { XX } },
8322     { "(bad)",          { XX } },
8323     /* c0 */
8324     { "(bad)",          { XX } },
8325     { "(bad)",          { XX } },
8326     { "(bad)",          { XX } },
8327     { "(bad)",          { XX } },
8328     { "(bad)",          { XX } },
8329     { "(bad)",          { XX } },
8330     { "(bad)",          { XX } },
8331     { "(bad)",          { XX } },
8332     /* c8 */
8333     { "(bad)",          { XX } },
8334     { "(bad)",          { XX } },
8335     { "(bad)",          { XX } },
8336     { "(bad)",          { XX } },
8337     { "(bad)",          { XX } },
8338     { "(bad)",          { XX } },
8339     { "(bad)",          { XX } },
8340     { "(bad)",          { XX } },
8341     /* d0 */
8342     { "(bad)",          { XX } },
8343     { "(bad)",          { XX } },
8344     { "(bad)",          { XX } },
8345     { "(bad)",          { XX } },
8346     { "(bad)",          { XX } },
8347     { "(bad)",          { XX } },
8348     { "(bad)",          { XX } },
8349     { "(bad)",          { XX } },
8350     /* d8 */
8351     { "(bad)",          { XX } },
8352     { "(bad)",          { XX } },
8353     { "(bad)",          { XX } },
8354     { "(bad)",          { XX } },
8355     { "(bad)",          { XX } },
8356     { "(bad)",          { XX } },
8357     { "(bad)",          { XX } },
8358     { PREFIX_TABLE (PREFIX_VEX_3ADF) },
8359     /* e0 */
8360     { "(bad)",          { XX } },
8361     { "(bad)",          { XX } },
8362     { "(bad)",          { XX } },
8363     { "(bad)",          { XX } },
8364     { "(bad)",          { XX } },
8365     { "(bad)",          { XX } },
8366     { "(bad)",          { XX } },
8367     { "(bad)",          { XX } },
8368     /* e8 */
8369     { "(bad)",          { XX } },
8370     { "(bad)",          { XX } },
8371     { "(bad)",          { XX } },
8372     { "(bad)",          { XX } },
8373     { "(bad)",          { XX } },
8374     { "(bad)",          { XX } },
8375     { "(bad)",          { XX } },
8376     { "(bad)",          { XX } },
8377     /* f0 */
8378     { "(bad)",          { XX } },
8379     { "(bad)",          { XX } },
8380     { "(bad)",          { XX } },
8381     { "(bad)",          { XX } },
8382     { "(bad)",          { XX } },
8383     { "(bad)",          { XX } },
8384     { "(bad)",          { XX } },
8385     { "(bad)",          { XX } },
8386     /* f8 */
8387     { "(bad)",          { XX } },
8388     { "(bad)",          { XX } },
8389     { "(bad)",          { XX } },
8390     { "(bad)",          { XX } },
8391     { "(bad)",          { XX } },
8392     { "(bad)",          { XX } },
8393     { "(bad)",          { XX } },
8394     { "(bad)",          { XX } },
8395   },
8396 };
8397
8398 static const struct dis386 vex_len_table[][2] = {
8399   /* VEX_LEN_10_P_1 */
8400   {
8401     { VEX_W_TABLE (VEX_W_10_P_1) },
8402     { "(bad)",          { XX } },
8403   },
8404
8405   /* VEX_LEN_10_P_3 */
8406   {
8407     { VEX_W_TABLE (VEX_W_10_P_3) },
8408     { "(bad)",          { XX } },
8409   },
8410
8411   /* VEX_LEN_11_P_1 */
8412   {
8413     { VEX_W_TABLE (VEX_W_11_P_1) },
8414     { "(bad)",          { XX } },
8415   },
8416
8417   /* VEX_LEN_11_P_3 */
8418   {
8419     { VEX_W_TABLE (VEX_W_11_P_3) },
8420     { "(bad)",          { XX } },
8421   },
8422
8423   /* VEX_LEN_12_P_0_M_0 */
8424   {
8425     { VEX_W_TABLE (VEX_W_12_P_0_M_0) },
8426     { "(bad)",          { XX } },
8427   },
8428
8429   /* VEX_LEN_12_P_0_M_1 */
8430   {
8431     { VEX_W_TABLE (VEX_W_12_P_0_M_1) },
8432     { "(bad)",          { XX } },
8433   },
8434
8435   /* VEX_LEN_12_P_2 */
8436   {
8437     { VEX_W_TABLE (VEX_W_12_P_2) },
8438     { "(bad)",          { XX } },
8439   },
8440
8441   /* VEX_LEN_13_M_0 */
8442   {
8443     { VEX_W_TABLE (VEX_W_13_M_0) },
8444     { "(bad)",          { XX } },
8445   },
8446
8447   /* VEX_LEN_16_P_0_M_0 */
8448   {
8449     { VEX_W_TABLE (VEX_W_16_P_0_M_0) },
8450     { "(bad)",          { XX } },
8451   },
8452
8453   /* VEX_LEN_16_P_0_M_1 */
8454   {
8455     { VEX_W_TABLE (VEX_W_16_P_0_M_1) },
8456     { "(bad)",          { XX } },
8457   },
8458
8459   /* VEX_LEN_16_P_2 */
8460   {
8461     { VEX_W_TABLE (VEX_W_16_P_2) },
8462     { "(bad)",          { XX } },
8463   },
8464
8465   /* VEX_LEN_17_M_0 */
8466   {
8467     { VEX_W_TABLE (VEX_W_17_M_0) },
8468     { "(bad)",          { XX } },
8469   },
8470
8471   /* VEX_LEN_2A_P_1 */
8472   {
8473     { "vcvtsi2ss%LQ",   { XM, Vex128, Ev } },
8474     { "(bad)",          { XX } },
8475   },
8476
8477   /* VEX_LEN_2A_P_3 */
8478   {
8479     { "vcvtsi2sd%LQ",   { XM, Vex128, Ev } },
8480     { "(bad)",          { XX } },
8481   },
8482
8483   /* VEX_LEN_2C_P_1 */
8484   {
8485     { "vcvttss2siY",    { Gv, EXd } },
8486     { "(bad)",          { XX } },
8487   },
8488
8489   /* VEX_LEN_2C_P_3 */
8490   {
8491     { "vcvttsd2siY",    { Gv, EXq } },
8492     { "(bad)",          { XX } },
8493   },
8494
8495   /* VEX_LEN_2D_P_1 */
8496   {
8497     { "vcvtss2siY",     { Gv, EXd } },
8498     { "(bad)",          { XX } },
8499   },
8500
8501   /* VEX_LEN_2D_P_3 */
8502   {
8503     { "vcvtsd2siY",     { Gv, EXq } },
8504     { "(bad)",          { XX } },
8505   },
8506
8507   /* VEX_LEN_2E_P_0 */
8508   {
8509     { VEX_W_TABLE (VEX_W_2E_P_0) },
8510     { "(bad)",          { XX } },
8511   },
8512
8513   /* VEX_LEN_2E_P_2 */
8514   {
8515     { VEX_W_TABLE (VEX_W_2E_P_2) },
8516     { "(bad)",          { XX } },
8517   },
8518
8519   /* VEX_LEN_2F_P_0 */
8520   {
8521     { VEX_W_TABLE (VEX_W_2F_P_0) },
8522     { "(bad)",          { XX } },
8523   },
8524
8525   /* VEX_LEN_2F_P_2 */
8526   {
8527     { VEX_W_TABLE (VEX_W_2F_P_2) },
8528     { "(bad)",          { XX } },
8529   },
8530
8531   /* VEX_LEN_51_P_1 */
8532   {
8533     { VEX_W_TABLE (VEX_W_51_P_1) },
8534     { "(bad)",          { XX } },
8535   },
8536
8537   /* VEX_LEN_51_P_3 */
8538   {
8539     { VEX_W_TABLE (VEX_W_51_P_3) },
8540     { "(bad)",          { XX } },
8541   },
8542
8543   /* VEX_LEN_52_P_1 */
8544   {
8545     { VEX_W_TABLE (VEX_W_52_P_1) },
8546     { "(bad)",          { XX } },
8547   },
8548
8549   /* VEX_LEN_53_P_1 */
8550   {
8551     { VEX_W_TABLE (VEX_W_53_P_1) },
8552     { "(bad)",          { XX } },
8553   },
8554
8555   /* VEX_LEN_58_P_1 */
8556   {
8557     { VEX_W_TABLE (VEX_W_58_P_1) },
8558     { "(bad)",          { XX } },
8559   },
8560
8561   /* VEX_LEN_58_P_3 */
8562   {
8563     { VEX_W_TABLE (VEX_W_58_P_3) },
8564     { "(bad)",          { XX } },
8565   },
8566
8567   /* VEX_LEN_59_P_1 */
8568   {
8569     { VEX_W_TABLE (VEX_W_59_P_1) },
8570     { "(bad)",          { XX } },
8571   },
8572
8573   /* VEX_LEN_59_P_3 */
8574   {
8575     { VEX_W_TABLE (VEX_W_59_P_3) },
8576     { "(bad)",          { XX } },
8577   },
8578
8579   /* VEX_LEN_5A_P_1 */
8580   {
8581     { VEX_W_TABLE (VEX_W_5A_P_1) },
8582     { "(bad)",          { XX } },
8583   },
8584
8585   /* VEX_LEN_5A_P_3 */
8586   {
8587     { VEX_W_TABLE (VEX_W_5A_P_3) },
8588     { "(bad)",          { XX } },
8589   },
8590
8591   /* VEX_LEN_5C_P_1 */
8592   {
8593     { VEX_W_TABLE (VEX_W_5C_P_1) },
8594     { "(bad)",          { XX } },
8595   },
8596
8597   /* VEX_LEN_5C_P_3 */
8598   {
8599     { VEX_W_TABLE (VEX_W_5C_P_3) },
8600     { "(bad)",          { XX } },
8601   },
8602
8603   /* VEX_LEN_5D_P_1 */
8604   {
8605     { VEX_W_TABLE (VEX_W_5D_P_1) },
8606     { "(bad)",          { XX } },
8607   },
8608
8609   /* VEX_LEN_5D_P_3 */
8610   {
8611     { VEX_W_TABLE (VEX_W_5D_P_3) },
8612     { "(bad)",          { XX } },
8613   },
8614
8615   /* VEX_LEN_5E_P_1 */
8616   {
8617     { VEX_W_TABLE (VEX_W_5E_P_1) },
8618     { "(bad)",          { XX } },
8619   },
8620
8621   /* VEX_LEN_5E_P_3 */
8622   {
8623     { VEX_W_TABLE (VEX_W_5E_P_3) },
8624     { "(bad)",          { XX } },
8625   },
8626
8627   /* VEX_LEN_5F_P_1 */
8628   {
8629     { VEX_W_TABLE (VEX_W_5F_P_1) },
8630     { "(bad)",          { XX } },
8631   },
8632
8633   /* VEX_LEN_5F_P_3 */
8634   {
8635     { VEX_W_TABLE (VEX_W_5F_P_3) },
8636     { "(bad)",          { XX } },
8637   },
8638
8639   /* VEX_LEN_60_P_2 */
8640   {
8641     { VEX_W_TABLE (VEX_W_60_P_2) },
8642     { "(bad)",          { XX } },
8643   },
8644
8645   /* VEX_LEN_61_P_2 */
8646   {
8647     { VEX_W_TABLE (VEX_W_61_P_2) },
8648     { "(bad)",          { XX } },
8649   },
8650
8651   /* VEX_LEN_62_P_2 */
8652   {
8653     { VEX_W_TABLE (VEX_W_62_P_2) },
8654     { "(bad)",          { XX } },
8655   },
8656
8657   /* VEX_LEN_63_P_2 */
8658   {
8659     { VEX_W_TABLE (VEX_W_63_P_2) },
8660     { "(bad)",          { XX } },
8661   },
8662
8663   /* VEX_LEN_64_P_2 */
8664   {
8665     { VEX_W_TABLE (VEX_W_64_P_2) },
8666     { "(bad)",          { XX } },
8667   },
8668
8669   /* VEX_LEN_65_P_2 */
8670   {
8671     { VEX_W_TABLE (VEX_W_65_P_2) },
8672     { "(bad)",          { XX } },
8673   },
8674
8675   /* VEX_LEN_66_P_2 */
8676   {
8677     { VEX_W_TABLE (VEX_W_66_P_2) },
8678     { "(bad)",          { XX } },
8679   },
8680
8681   /* VEX_LEN_67_P_2 */
8682   {
8683     { VEX_W_TABLE (VEX_W_67_P_2) },
8684     { "(bad)",          { XX } },
8685   },
8686
8687   /* VEX_LEN_68_P_2 */
8688   {
8689     { VEX_W_TABLE (VEX_W_68_P_2) },
8690     { "(bad)",          { XX } },
8691   },
8692
8693   /* VEX_LEN_69_P_2 */
8694   {
8695     { VEX_W_TABLE (VEX_W_69_P_2) },
8696     { "(bad)",          { XX } },
8697   },
8698
8699   /* VEX_LEN_6A_P_2 */
8700   {
8701     { VEX_W_TABLE (VEX_W_6A_P_2) },
8702     { "(bad)",          { XX } },
8703   },
8704
8705   /* VEX_LEN_6B_P_2 */
8706   {
8707     { VEX_W_TABLE (VEX_W_6B_P_2) },
8708     { "(bad)",          { XX } },
8709   },
8710
8711   /* VEX_LEN_6C_P_2 */
8712   {
8713     { VEX_W_TABLE (VEX_W_6C_P_2) },
8714     { "(bad)",          { XX } },
8715   },
8716
8717   /* VEX_LEN_6D_P_2 */
8718   {
8719     { VEX_W_TABLE (VEX_W_6D_P_2) },
8720     { "(bad)",          { XX } },
8721   },
8722
8723   /* VEX_LEN_6E_P_2 */
8724   {
8725     { "vmovK",          { XM, Edq } },
8726     { "(bad)",          { XX } },
8727   },
8728
8729   /* VEX_LEN_70_P_1 */
8730   {
8731     { VEX_W_TABLE (VEX_W_70_P_1) },
8732     { "(bad)",          { XX } },
8733   },
8734
8735   /* VEX_LEN_70_P_2 */
8736   {
8737     { VEX_W_TABLE (VEX_W_70_P_2) },
8738     { "(bad)",          { XX } },
8739   },
8740
8741   /* VEX_LEN_70_P_3 */
8742   {
8743     { VEX_W_TABLE (VEX_W_70_P_3) },
8744     { "(bad)",          { XX } },
8745   },
8746
8747   /* VEX_LEN_71_R_2_P_2 */
8748   {
8749     { VEX_W_TABLE (VEX_W_71_R_2_P_2) },
8750     { "(bad)",          { XX } },
8751   },
8752
8753   /* VEX_LEN_71_R_4_P_2 */
8754   {
8755     { VEX_W_TABLE (VEX_W_71_R_4_P_2) },
8756     { "(bad)",          { XX } },
8757   },
8758
8759   /* VEX_LEN_71_R_6_P_2 */
8760   {
8761     { VEX_W_TABLE (VEX_W_71_R_6_P_2) },
8762     { "(bad)",          { XX } },
8763   },
8764
8765   /* VEX_LEN_72_R_2_P_2 */
8766   {
8767     { VEX_W_TABLE (VEX_W_72_R_2_P_2) },
8768     { "(bad)",          { XX } },
8769   },
8770
8771   /* VEX_LEN_72_R_4_P_2 */
8772   {
8773     { VEX_W_TABLE (VEX_W_72_R_4_P_2) },
8774     { "(bad)",          { XX } },
8775   },
8776
8777   /* VEX_LEN_72_R_6_P_2 */
8778   {
8779     { VEX_W_TABLE (VEX_W_72_R_6_P_2) },
8780     { "(bad)",          { XX } },
8781   },
8782
8783   /* VEX_LEN_73_R_2_P_2 */
8784   {
8785     { VEX_W_TABLE (VEX_W_73_R_2_P_2) },
8786     { "(bad)",          { XX } },
8787   },
8788
8789   /* VEX_LEN_73_R_3_P_2 */
8790   {
8791     { VEX_W_TABLE (VEX_W_73_R_3_P_2) },
8792     { "(bad)",          { XX } },
8793   },
8794
8795   /* VEX_LEN_73_R_6_P_2 */
8796   {
8797     { VEX_W_TABLE (VEX_W_73_R_6_P_2) },
8798     { "(bad)",          { XX } },
8799   },
8800
8801   /* VEX_LEN_73_R_7_P_2 */
8802   {
8803     { VEX_W_TABLE (VEX_W_73_R_7_P_2) },
8804     { "(bad)",          { XX } },
8805   },
8806
8807   /* VEX_LEN_74_P_2 */
8808   {
8809     { VEX_W_TABLE (VEX_W_74_P_2) },
8810     { "(bad)",          { XX } },
8811   },
8812
8813   /* VEX_LEN_75_P_2 */
8814   {
8815     { VEX_W_TABLE (VEX_W_75_P_2) },
8816     { "(bad)",          { XX } },
8817   },
8818
8819   /* VEX_LEN_76_P_2 */
8820   {
8821     { VEX_W_TABLE (VEX_W_76_P_2) },
8822     { "(bad)",          { XX } },
8823   },
8824
8825   /* VEX_LEN_7E_P_1 */
8826   {
8827     { VEX_W_TABLE (VEX_W_7E_P_1) },
8828     { "(bad)",          { XX } },
8829   },
8830
8831   /* VEX_LEN_7E_P_2 */
8832   {
8833     { "vmovK",          { Edq, XM } },
8834     { "(bad)",          { XX } },
8835   },
8836
8837   /* VEX_LEN_AE_R_2_M_0 */
8838   {
8839     { VEX_W_TABLE (VEX_W_AE_R_2_M_0) },
8840     { "(bad)",          { XX } },
8841   },
8842
8843   /* VEX_LEN_AE_R_3_M_0 */
8844   {
8845     { VEX_W_TABLE (VEX_W_AE_R_3_M_0) },
8846     { "(bad)",          { XX } },
8847   },
8848
8849   /* VEX_LEN_C2_P_1 */
8850   {
8851     { VEX_W_TABLE (VEX_W_C2_P_1) },
8852     { "(bad)",          { XX } },
8853   },
8854
8855   /* VEX_LEN_C2_P_3 */
8856   {
8857     { VEX_W_TABLE (VEX_W_C2_P_3) },
8858     { "(bad)",          { XX } },
8859   },
8860
8861   /* VEX_LEN_C4_P_2 */
8862   {
8863     { VEX_W_TABLE (VEX_W_C4_P_2) },
8864     { "(bad)",          { XX } },
8865   },
8866
8867   /* VEX_LEN_C5_P_2 */
8868   {
8869     { VEX_W_TABLE (VEX_W_C5_P_2) },
8870     { "(bad)",          { XX } },
8871   },
8872
8873   /* VEX_LEN_D1_P_2 */
8874   {
8875     { VEX_W_TABLE (VEX_W_D1_P_2) },
8876     { "(bad)",          { XX } },
8877   },
8878
8879   /* VEX_LEN_D2_P_2 */
8880   {
8881     { VEX_W_TABLE (VEX_W_D2_P_2) },
8882     { "(bad)",          { XX } },
8883   },
8884
8885   /* VEX_LEN_D3_P_2 */
8886   {
8887     { VEX_W_TABLE (VEX_W_D3_P_2) },
8888     { "(bad)",          { XX } },
8889   },
8890
8891   /* VEX_LEN_D4_P_2 */
8892   {
8893     { VEX_W_TABLE (VEX_W_D4_P_2) },
8894     { "(bad)",          { XX } },
8895   },
8896
8897   /* VEX_LEN_D5_P_2 */
8898   {
8899     { VEX_W_TABLE (VEX_W_D5_P_2) },
8900     { "(bad)",          { XX } },
8901   },
8902
8903   /* VEX_LEN_D6_P_2 */
8904   {
8905     { VEX_W_TABLE (VEX_W_D6_P_2) },
8906     { "(bad)",          { XX } },
8907   },
8908
8909   /* VEX_LEN_D7_P_2_M_1 */
8910   {
8911     { VEX_W_TABLE (VEX_W_D7_P_2_M_1) },
8912     { "(bad)",          { XX } },
8913   },
8914
8915   /* VEX_LEN_D8_P_2 */
8916   {
8917     { VEX_W_TABLE (VEX_W_D8_P_2) },
8918     { "(bad)",          { XX } },
8919   },
8920
8921   /* VEX_LEN_D9_P_2 */
8922   {
8923     { VEX_W_TABLE (VEX_W_D9_P_2) },
8924     { "(bad)",          { XX } },
8925   },
8926
8927   /* VEX_LEN_DA_P_2 */
8928   {
8929     { VEX_W_TABLE (VEX_W_DA_P_2) },
8930     { "(bad)",          { XX } },
8931   },
8932
8933   /* VEX_LEN_DB_P_2 */
8934   {
8935     { VEX_W_TABLE (VEX_W_DB_P_2) },
8936     { "(bad)",          { XX } },
8937   },
8938
8939   /* VEX_LEN_DC_P_2 */
8940   {
8941     { VEX_W_TABLE (VEX_W_DC_P_2) },
8942     { "(bad)",          { XX } },
8943   },
8944
8945   /* VEX_LEN_DD_P_2 */
8946   {
8947     { VEX_W_TABLE (VEX_W_DD_P_2) },
8948     { "(bad)",          { XX } },
8949   },
8950
8951   /* VEX_LEN_DE_P_2 */
8952   {
8953     { VEX_W_TABLE (VEX_W_DE_P_2) },
8954     { "(bad)",          { XX } },
8955   },
8956
8957   /* VEX_LEN_DF_P_2 */
8958   {
8959     { VEX_W_TABLE (VEX_W_DF_P_2) },
8960     { "(bad)",          { XX } },
8961   },
8962
8963   /* VEX_LEN_E0_P_2 */
8964   {
8965     { VEX_W_TABLE (VEX_W_E0_P_2) },
8966     { "(bad)",          { XX } },
8967   },
8968
8969   /* VEX_LEN_E1_P_2 */
8970   {
8971     { VEX_W_TABLE (VEX_W_E1_P_2) },
8972     { "(bad)",          { XX } },
8973   },
8974
8975   /* VEX_LEN_E2_P_2 */
8976   {
8977     { VEX_W_TABLE (VEX_W_E2_P_2) },
8978     { "(bad)",          { XX } },
8979   },
8980
8981   /* VEX_LEN_E3_P_2 */
8982   {
8983     { VEX_W_TABLE (VEX_W_E3_P_2) },
8984     { "(bad)",          { XX } },
8985   },
8986
8987   /* VEX_LEN_E4_P_2 */
8988   {
8989     { VEX_W_TABLE (VEX_W_E4_P_2) },
8990     { "(bad)",          { XX } },
8991   },
8992
8993   /* VEX_LEN_E5_P_2 */
8994   {
8995     { VEX_W_TABLE (VEX_W_E5_P_2) },
8996     { "(bad)",          { XX } },
8997   },
8998
8999   /* VEX_LEN_E8_P_2 */
9000   {
9001     { VEX_W_TABLE (VEX_W_E8_P_2) },
9002     { "(bad)",          { XX } },
9003   },
9004
9005   /* VEX_LEN_E9_P_2 */
9006   {
9007     { VEX_W_TABLE (VEX_W_E9_P_2) },
9008     { "(bad)",          { XX } },
9009   },
9010
9011   /* VEX_LEN_EA_P_2 */
9012   {
9013     { VEX_W_TABLE (VEX_W_EA_P_2) },
9014     { "(bad)",          { XX } },
9015   },
9016
9017   /* VEX_LEN_EB_P_2 */
9018   {
9019     { VEX_W_TABLE (VEX_W_EB_P_2) },
9020     { "(bad)",          { XX } },
9021   },
9022
9023   /* VEX_LEN_EC_P_2 */
9024   {
9025     { VEX_W_TABLE (VEX_W_EC_P_2) },
9026     { "(bad)",          { XX } },
9027   },
9028
9029   /* VEX_LEN_ED_P_2 */
9030   {
9031     { VEX_W_TABLE (VEX_W_ED_P_2) },
9032     { "(bad)",          { XX } },
9033   },
9034
9035   /* VEX_LEN_EE_P_2 */
9036   {
9037     { VEX_W_TABLE (VEX_W_EE_P_2) },
9038     { "(bad)",          { XX } },
9039   },
9040
9041   /* VEX_LEN_EF_P_2 */
9042   {
9043     { VEX_W_TABLE (VEX_W_EF_P_2) },
9044     { "(bad)",          { XX } },
9045   },
9046
9047   /* VEX_LEN_F1_P_2 */
9048   {
9049     { VEX_W_TABLE (VEX_W_F1_P_2) },
9050     { "(bad)",          { XX } },
9051   },
9052
9053   /* VEX_LEN_F2_P_2 */
9054   {
9055     { VEX_W_TABLE (VEX_W_F2_P_2) },
9056     { "(bad)",          { XX } },
9057   },
9058
9059   /* VEX_LEN_F3_P_2 */
9060   {
9061     { VEX_W_TABLE (VEX_W_F3_P_2) },
9062     { "(bad)",          { XX } },
9063   },
9064
9065   /* VEX_LEN_F4_P_2 */
9066   {
9067     { VEX_W_TABLE (VEX_W_F4_P_2) },
9068     { "(bad)",          { XX } },
9069   },
9070
9071   /* VEX_LEN_F5_P_2 */
9072   {
9073     { VEX_W_TABLE (VEX_W_F5_P_2) },
9074     { "(bad)",          { XX } },
9075   },
9076
9077   /* VEX_LEN_F6_P_2 */
9078   {
9079     { VEX_W_TABLE (VEX_W_F6_P_2) },
9080     { "(bad)",          { XX } },
9081   },
9082
9083   /* VEX_LEN_F7_P_2 */
9084   {
9085     { VEX_W_TABLE (VEX_W_F7_P_2) },
9086     { "(bad)",          { XX } },
9087   },
9088
9089   /* VEX_LEN_F8_P_2 */
9090   {
9091     { VEX_W_TABLE (VEX_W_F8_P_2) },
9092     { "(bad)",          { XX } },
9093   },
9094
9095   /* VEX_LEN_F9_P_2 */
9096   {
9097     { VEX_W_TABLE (VEX_W_F9_P_2) },
9098     { "(bad)",          { XX } },
9099   },
9100
9101   /* VEX_LEN_FA_P_2 */
9102   {
9103     { VEX_W_TABLE (VEX_W_FA_P_2) },
9104     { "(bad)",          { XX } },
9105   },
9106
9107   /* VEX_LEN_FB_P_2 */
9108   {
9109     { VEX_W_TABLE (VEX_W_FB_P_2) },
9110     { "(bad)",          { XX } },
9111   },
9112
9113   /* VEX_LEN_FC_P_2 */
9114   {
9115     { VEX_W_TABLE (VEX_W_FC_P_2) },
9116     { "(bad)",          { XX } },
9117   },
9118
9119   /* VEX_LEN_FD_P_2 */
9120   {
9121     { VEX_W_TABLE (VEX_W_FD_P_2) },
9122     { "(bad)",          { XX } },
9123   },
9124
9125   /* VEX_LEN_FE_P_2 */
9126   {
9127     { VEX_W_TABLE (VEX_W_FE_P_2) },
9128     { "(bad)",          { XX } },
9129   },
9130
9131   /* VEX_LEN_3800_P_2 */
9132   {
9133     { VEX_W_TABLE (VEX_W_3800_P_2) },
9134     { "(bad)",          { XX } },
9135   },
9136
9137   /* VEX_LEN_3801_P_2 */
9138   {
9139     { VEX_W_TABLE (VEX_W_3801_P_2) },
9140     { "(bad)",          { XX } },
9141   },
9142
9143   /* VEX_LEN_3802_P_2 */
9144   {
9145     { VEX_W_TABLE (VEX_W_3802_P_2) },
9146     { "(bad)",          { XX } },
9147   },
9148
9149   /* VEX_LEN_3803_P_2 */
9150   {
9151     { VEX_W_TABLE (VEX_W_3803_P_2) },
9152     { "(bad)",          { XX } },
9153   },
9154
9155   /* VEX_LEN_3804_P_2 */
9156   {
9157     { VEX_W_TABLE (VEX_W_3804_P_2) },
9158     { "(bad)",          { XX } },
9159   },
9160
9161   /* VEX_LEN_3805_P_2 */
9162   {
9163     { VEX_W_TABLE (VEX_W_3805_P_2) },
9164     { "(bad)",          { XX } },
9165   },
9166
9167   /* VEX_LEN_3806_P_2 */
9168   {
9169     { VEX_W_TABLE (VEX_W_3806_P_2) },
9170     { "(bad)",          { XX } },
9171   },
9172
9173   /* VEX_LEN_3807_P_2 */
9174   {
9175     { VEX_W_TABLE (VEX_W_3807_P_2) },
9176     { "(bad)",          { XX } },
9177   },
9178
9179   /* VEX_LEN_3808_P_2 */
9180   {
9181     { VEX_W_TABLE (VEX_W_3808_P_2) },
9182     { "(bad)",          { XX } },
9183   },
9184
9185   /* VEX_LEN_3809_P_2 */
9186   {
9187     { VEX_W_TABLE (VEX_W_3809_P_2) },
9188     { "(bad)",          { XX } },
9189   },
9190
9191   /* VEX_LEN_380A_P_2 */
9192   {
9193     { VEX_W_TABLE (VEX_W_380A_P_2) },
9194     { "(bad)",          { XX } },
9195   },
9196
9197   /* VEX_LEN_380B_P_2 */
9198   {
9199     { VEX_W_TABLE (VEX_W_380B_P_2) },
9200     { "(bad)",          { XX } },
9201   },
9202
9203   /* VEX_LEN_3819_P_2_M_0 */
9204   {
9205     { "(bad)",          { XX } },
9206     { VEX_W_TABLE (VEX_W_3819_P_2_M_0) },
9207   },
9208
9209   /* VEX_LEN_381A_P_2_M_0 */
9210   {
9211     { "(bad)",          { XX } },
9212     { VEX_W_TABLE (VEX_W_381A_P_2_M_0) },
9213   },
9214
9215   /* VEX_LEN_381C_P_2 */
9216   {
9217     { VEX_W_TABLE (VEX_W_381C_P_2) },
9218     { "(bad)",          { XX } },
9219   },
9220
9221   /* VEX_LEN_381D_P_2 */
9222   {
9223     { VEX_W_TABLE (VEX_W_381D_P_2) },
9224     { "(bad)",          { XX } },
9225   },
9226
9227   /* VEX_LEN_381E_P_2 */
9228   {
9229     { VEX_W_TABLE (VEX_W_381E_P_2) },
9230     { "(bad)",          { XX } },
9231   },
9232
9233   /* VEX_LEN_3820_P_2 */
9234   {
9235     { VEX_W_TABLE (VEX_W_3820_P_2) },
9236     { "(bad)",          { XX } },
9237   },
9238
9239   /* VEX_LEN_3821_P_2 */
9240   {
9241     { VEX_W_TABLE (VEX_W_3821_P_2) },
9242     { "(bad)",          { XX } },
9243   },
9244
9245   /* VEX_LEN_3822_P_2 */
9246   {
9247     { VEX_W_TABLE (VEX_W_3822_P_2) },
9248     { "(bad)",          { XX } },
9249   },
9250
9251   /* VEX_LEN_3823_P_2 */
9252   {
9253     { VEX_W_TABLE (VEX_W_3823_P_2) },
9254     { "(bad)",          { XX } },
9255   },
9256
9257   /* VEX_LEN_3824_P_2 */
9258   {
9259     { VEX_W_TABLE (VEX_W_3824_P_2) },
9260     { "(bad)",          { XX } },
9261   },
9262
9263   /* VEX_LEN_3825_P_2 */
9264   {
9265     { VEX_W_TABLE (VEX_W_3825_P_2) },
9266     { "(bad)",          { XX } },
9267   },
9268
9269   /* VEX_LEN_3828_P_2 */
9270   {
9271     { VEX_W_TABLE (VEX_W_3828_P_2) },
9272     { "(bad)",          { XX } },
9273   },
9274
9275   /* VEX_LEN_3829_P_2 */
9276   {
9277     { VEX_W_TABLE (VEX_W_3829_P_2) },
9278     { "(bad)",          { XX } },
9279   },
9280
9281   /* VEX_LEN_382A_P_2_M_0 */
9282   {
9283     { VEX_W_TABLE (VEX_W_382A_P_2_M_0) },
9284     { "(bad)",          { XX } },
9285   },
9286
9287   /* VEX_LEN_382B_P_2 */
9288   {
9289     { VEX_W_TABLE (VEX_W_382B_P_2) },
9290     { "(bad)",          { XX } },
9291   },
9292
9293   /* VEX_LEN_3830_P_2 */
9294   {
9295     { VEX_W_TABLE (VEX_W_3830_P_2) },
9296     { "(bad)",          { XX } },
9297   },
9298
9299   /* VEX_LEN_3831_P_2 */
9300   {
9301     { VEX_W_TABLE (VEX_W_3831_P_2) },
9302     { "(bad)",          { XX } },
9303   },
9304
9305   /* VEX_LEN_3832_P_2 */
9306   {
9307     { VEX_W_TABLE (VEX_W_3832_P_2) },
9308     { "(bad)",          { XX } },
9309   },
9310
9311   /* VEX_LEN_3833_P_2 */
9312   {
9313     { VEX_W_TABLE (VEX_W_3833_P_2) },
9314     { "(bad)",          { XX } },
9315   },
9316
9317   /* VEX_LEN_3834_P_2 */
9318   {
9319     { VEX_W_TABLE (VEX_W_3834_P_2) },
9320     { "(bad)",          { XX } },
9321   },
9322
9323   /* VEX_LEN_3835_P_2 */
9324   {
9325     { VEX_W_TABLE (VEX_W_3835_P_2) },
9326     { "(bad)",          { XX } },
9327   },
9328
9329   /* VEX_LEN_3837_P_2 */
9330   {
9331     { VEX_W_TABLE (VEX_W_3837_P_2) },
9332     { "(bad)",          { XX } },
9333   },
9334
9335   /* VEX_LEN_3838_P_2 */
9336   {
9337     { VEX_W_TABLE (VEX_W_3838_P_2) },
9338     { "(bad)",          { XX } },
9339   },
9340
9341   /* VEX_LEN_3839_P_2 */
9342   {
9343     { VEX_W_TABLE (VEX_W_3839_P_2) },
9344     { "(bad)",          { XX } },
9345   },
9346
9347   /* VEX_LEN_383A_P_2 */
9348   {
9349     { VEX_W_TABLE (VEX_W_383A_P_2) },
9350     { "(bad)",          { XX } },
9351   },
9352
9353   /* VEX_LEN_383B_P_2 */
9354   {
9355     { VEX_W_TABLE (VEX_W_383B_P_2) },
9356     { "(bad)",          { XX } },
9357   },
9358
9359   /* VEX_LEN_383C_P_2 */
9360   {
9361     { VEX_W_TABLE (VEX_W_383C_P_2) },
9362     { "(bad)",          { XX } },
9363   },
9364
9365   /* VEX_LEN_383D_P_2 */
9366   {
9367     { VEX_W_TABLE (VEX_W_383D_P_2) },
9368     { "(bad)",          { XX } },
9369   },
9370
9371   /* VEX_LEN_383E_P_2 */
9372   {
9373     { VEX_W_TABLE (VEX_W_383E_P_2) },
9374     { "(bad)",          { XX } },
9375   },
9376
9377   /* VEX_LEN_383F_P_2 */
9378   {
9379     { VEX_W_TABLE (VEX_W_383F_P_2) },
9380     { "(bad)",          { XX } },
9381   },
9382
9383   /* VEX_LEN_3840_P_2 */
9384   {
9385     { VEX_W_TABLE (VEX_W_3840_P_2) },
9386     { "(bad)",          { XX } },
9387   },
9388
9389   /* VEX_LEN_3841_P_2 */
9390   {
9391     { VEX_W_TABLE (VEX_W_3841_P_2) },
9392     { "(bad)",          { XX } },
9393   },
9394
9395   /* VEX_LEN_38DB_P_2 */
9396   {
9397     { VEX_W_TABLE (VEX_W_38DB_P_2) },
9398     { "(bad)",          { XX } },
9399   },
9400
9401   /* VEX_LEN_38DC_P_2 */
9402   {
9403     { VEX_W_TABLE (VEX_W_38DC_P_2) },
9404     { "(bad)",          { XX } },
9405   },
9406
9407   /* VEX_LEN_38DD_P_2 */
9408   {
9409     { VEX_W_TABLE (VEX_W_38DD_P_2) },
9410     { "(bad)",          { XX } },
9411   },
9412
9413   /* VEX_LEN_38DE_P_2 */
9414   {
9415     { VEX_W_TABLE (VEX_W_38DE_P_2) },
9416     { "(bad)",          { XX } },
9417   },
9418
9419   /* VEX_LEN_38DF_P_2 */
9420   {
9421     { VEX_W_TABLE (VEX_W_38DF_P_2) },
9422     { "(bad)",          { XX } },
9423   },
9424
9425   /* VEX_LEN_3A06_P_2 */
9426   {
9427     { "(bad)",          { XX } },
9428     { VEX_W_TABLE (VEX_W_3A06_P_2) },
9429   },
9430
9431   /* VEX_LEN_3A0A_P_2 */
9432   {
9433     { VEX_W_TABLE (VEX_W_3A0A_P_2) },
9434     { "(bad)",          { XX } },
9435   },
9436
9437   /* VEX_LEN_3A0B_P_2 */
9438   {
9439     { VEX_W_TABLE (VEX_W_3A0B_P_2) },
9440     { "(bad)",          { XX } },
9441   },
9442
9443   /* VEX_LEN_3A0E_P_2 */
9444   {
9445     { VEX_W_TABLE (VEX_W_3A0E_P_2) },
9446     { "(bad)",          { XX } },
9447   },
9448
9449   /* VEX_LEN_3A0F_P_2 */
9450   {
9451     { VEX_W_TABLE (VEX_W_3A0F_P_2) },
9452     { "(bad)",          { XX } },
9453   },
9454
9455   /* VEX_LEN_3A14_P_2 */
9456   {
9457     { VEX_W_TABLE (VEX_W_3A14_P_2) },
9458     { "(bad)",          { XX } },
9459   },
9460
9461   /* VEX_LEN_3A15_P_2 */
9462   {
9463     { VEX_W_TABLE (VEX_W_3A15_P_2) },
9464     { "(bad)",          { XX } },
9465   },
9466
9467   /* VEX_LEN_3A16_P_2  */
9468   {
9469     { "vpextrK",        { Edq, XM, Ib } },
9470     { "(bad)",          { XX } },
9471   },
9472
9473   /* VEX_LEN_3A17_P_2 */
9474   {
9475     { "vextractps",     { Edqd, XM, Ib } },
9476     { "(bad)",          { XX } },
9477   },
9478
9479   /* VEX_LEN_3A18_P_2 */
9480   {
9481     { "(bad)",          { XX } },
9482     { VEX_W_TABLE (VEX_W_3A18_P_2) },
9483   },
9484
9485   /* VEX_LEN_3A19_P_2 */
9486   {
9487     { "(bad)",          { XX } },
9488     { VEX_W_TABLE (VEX_W_3A19_P_2) },
9489   },
9490
9491   /* VEX_LEN_3A20_P_2 */
9492   {
9493     { VEX_W_TABLE (VEX_W_3A20_P_2) },
9494     { "(bad)",          { XX } },
9495   },
9496
9497   /* VEX_LEN_3A21_P_2 */
9498   {
9499     { VEX_W_TABLE (VEX_W_3A21_P_2) },
9500     { "(bad)",          { XX } },
9501   },
9502
9503   /* VEX_LEN_3A22_P_2 */
9504   {
9505     { "vpinsrK",        { XM, Vex128, Edq, Ib } },
9506     { "(bad)",          { XX } },
9507   },
9508
9509   /* VEX_LEN_3A41_P_2 */
9510   {
9511     { VEX_W_TABLE (VEX_W_3A41_P_2) },
9512     { "(bad)",          { XX } },
9513   },
9514
9515   /* VEX_LEN_3A42_P_2 */
9516   {
9517     { VEX_W_TABLE (VEX_W_3A42_P_2) },
9518     { "(bad)",          { XX } },
9519   },
9520
9521   /* VEX_LEN_3A44_P_2 */
9522   {
9523     { VEX_W_TABLE (VEX_W_3A44_P_2) },
9524     { "(bad)",          { XX } },
9525   },
9526
9527   /* VEX_LEN_3A4C_P_2 */
9528   {
9529     { VEX_W_TABLE (VEX_W_3A4C_P_2) },
9530     { "(bad)",          { XX } },
9531   },
9532
9533   /* VEX_LEN_3A60_P_2 */
9534   {
9535     { VEX_W_TABLE (VEX_W_3A60_P_2) },
9536     { "(bad)",          { XX } },
9537   },
9538
9539   /* VEX_LEN_3A61_P_2 */
9540   {
9541     { VEX_W_TABLE (VEX_W_3A61_P_2) },
9542     { "(bad)",          { XX } },
9543   },
9544
9545   /* VEX_LEN_3A62_P_2 */
9546   {
9547     { VEX_W_TABLE (VEX_W_3A62_P_2) },
9548     { "(bad)",          { XX } },
9549   },
9550
9551   /* VEX_LEN_3A63_P_2 */
9552   {
9553     { VEX_W_TABLE (VEX_W_3A63_P_2) },
9554     { "(bad)",          { XX } },
9555   },
9556
9557   /* VEX_LEN_3A6A_P_2 */
9558   {
9559     { "vfmaddss",       { XMVexW, Vex128, EXdVexW, EXdVexW, VexI4 } },
9560     { "(bad)",          { XX } },
9561   },
9562
9563   /* VEX_LEN_3A6B_P_2 */
9564   {
9565     { "vfmaddsd",       { XMVexW, Vex128, EXqVexW, EXqVexW, VexI4 } },
9566     { "(bad)",          { XX } },
9567   },
9568
9569   /* VEX_LEN_3A6E_P_2 */
9570   {
9571     { "vfmsubss",       { XMVexW, Vex128, EXdVexW, EXdVexW, VexI4 } },
9572     { "(bad)",          { XX } },
9573   },
9574
9575   /* VEX_LEN_3A6F_P_2 */
9576   {
9577     { "vfmsubsd",       { XMVexW, Vex128, EXqVexW, EXqVexW, VexI4 } },
9578     { "(bad)",          { XX } },
9579   },
9580
9581   /* VEX_LEN_3A7A_P_2 */
9582   {
9583     { "vfnmaddss",      { XMVexW, Vex128, EXdVexW, EXdVexW, VexI4 } },
9584     { "(bad)",          { XX } },
9585   },
9586
9587   /* VEX_LEN_3A7B_P_2 */
9588   {
9589     { "vfnmaddsd",      { XMVexW, Vex128, EXqVexW, EXqVexW, VexI4 } },
9590     { "(bad)",          { XX } },
9591   },
9592
9593   /* VEX_LEN_3A7E_P_2 */
9594   {
9595     { "vfnmsubss",      { XMVexW, Vex128, EXdVexW, EXdVexW, VexI4 } },
9596     { "(bad)",          { XX } },
9597   },
9598
9599   /* VEX_LEN_3A7F_P_2 */
9600   {
9601     { "vfnmsubsd",      { XMVexW, Vex128, EXqVexW, EXqVexW, VexI4 } },
9602     { "(bad)",          { XX } },
9603   },
9604
9605   /* VEX_LEN_3ADF_P_2 */
9606   {
9607     { VEX_W_TABLE (VEX_W_3ADF_P_2) },
9608     { "(bad)",          { XX } },
9609   },
9610
9611   /* VEX_LEN_XOP_09_80 */
9612   {
9613     { "vfrczps",        { XM, EXxmm } },
9614     { "vfrczps",        { XM, EXymmq } },
9615   },
9616
9617   /* VEX_LEN_XOP_09_81 */
9618   {
9619     { "vfrczpd",        { XM, EXxmm } },
9620     { "vfrczpd",        { XM, EXymmq } },
9621   },
9622 };
9623
9624 static const struct dis386 vex_w_table[][2] = {
9625   {
9626     /* VEX_W_10_P_0 */
9627     { "vmovups",        { XM, EXx } },
9628     { "(bad)",          { XX } },
9629   },
9630   {
9631     /* VEX_W_10_P_1 */
9632     { "vmovss",         { XMVex, Vex128, EXd } },
9633     { "(bad)",          { XX } },
9634   },
9635   {
9636     /* VEX_W_10_P_2 */
9637     { "vmovupd",        { XM, EXx } },
9638     { "(bad)",          { XX } },
9639   },
9640   {
9641     /* VEX_W_10_P_3 */
9642     { "vmovsd",         { XMVex, Vex128, EXq } },
9643     { "(bad)",          { XX } },
9644   },
9645   {
9646     /* VEX_W_11_P_0 */
9647     { "vmovups",        { EXxS, XM } },
9648     { "(bad)",          { XX } },
9649   },
9650   {
9651     /* VEX_W_11_P_1 */
9652     { "vmovss",         { EXdVexS, Vex128, XM } },
9653     { "(bad)",          { XX } },
9654   },
9655   {
9656     /* VEX_W_11_P_2 */
9657     { "vmovupd",        { EXxS, XM } },
9658     { "(bad)",          { XX } },
9659   },
9660   {
9661     /* VEX_W_11_P_3 */
9662     { "vmovsd",         { EXqVexS, Vex128, XM } },
9663     { "(bad)",          { XX } },
9664   },
9665   {
9666     /* VEX_W_12_P_0_M_0 */
9667     { "vmovlps",        { XM, Vex128, EXq } },
9668     { "(bad)",          { XX } },
9669   },
9670   {
9671     /* VEX_W_12_P_0_M_1 */
9672     { "vmovhlps",       { XM, Vex128, EXq } },
9673     { "(bad)",          { XX } },
9674   },
9675   {
9676     /* VEX_W_12_P_1 */
9677     { "vmovsldup",      { XM, EXx } },
9678     { "(bad)",          { XX } },
9679   },
9680   {
9681     /* VEX_W_12_P_2 */
9682     { "vmovlpd",        { XM, Vex128, EXq } },
9683     { "(bad)",          { XX } },
9684   },
9685   {
9686     /* VEX_W_12_P_3 */
9687     { "vmovddup",       { XM, EXymmq } },
9688     { "(bad)",          { XX } },
9689   },
9690   {
9691     /* VEX_W_13_M_0 */
9692     { "vmovlpX",        { EXq, XM } },
9693     { "(bad)",          { XX } },
9694   },
9695   {
9696     /* VEX_W_14 */
9697     { "vunpcklpX",      { XM, Vex, EXx } },
9698     { "(bad)",          { XX } },
9699   },
9700   {
9701     /* VEX_W_15 */
9702     { "vunpckhpX",      { XM, Vex, EXx } },
9703     { "(bad)",          { XX } },
9704   },
9705   {
9706     /* VEX_W_16_P_0_M_0 */
9707     { "vmovhps",        { XM, Vex128, EXq } },
9708     { "(bad)",          { XX } },
9709   },
9710   {
9711     /* VEX_W_16_P_0_M_1 */
9712     { "vmovlhps",       { XM, Vex128, EXq } },
9713     { "(bad)",          { XX } },
9714   },
9715   {
9716     /* VEX_W_16_P_1 */
9717     { "vmovshdup",      { XM, EXx } },
9718     { "(bad)",          { XX } },
9719   },
9720   {
9721     /* VEX_W_16_P_2 */
9722     { "vmovhpd",        { XM, Vex128, EXq } },
9723     { "(bad)",          { XX } },
9724   },
9725   {
9726     /* VEX_W_17_M_0 */
9727     { "vmovhpX",        { EXq, XM } },
9728     { "(bad)",          { XX } },
9729   },
9730   {
9731     /* VEX_W_28 */
9732     { "vmovapX",        { XM, EXx } },
9733     { "(bad)",          { XX } },
9734   },
9735   {
9736     /* VEX_W_29 */
9737     { "vmovapX",        { EXxS, XM } },
9738     { "(bad)",          { XX } },
9739   },
9740   {
9741     /* VEX_W_2B_M_0 */
9742     { "vmovntpX",       { Mx, XM } },
9743     { "(bad)",          { XX } },
9744   },
9745   {
9746     /* VEX_W_2E_P_0 */
9747     { "vucomiss",       { XM, EXd } }, 
9748     { "(bad)",          { XX } },
9749   },
9750   {
9751     /* VEX_W_2E_P_2 */
9752     { "vucomisd",       { XM, EXq } }, 
9753     { "(bad)",          { XX } },
9754   },
9755   {
9756     /* VEX_W_2F_P_0 */
9757     { "vcomiss",        { XM, EXd } },
9758     { "(bad)",          { XX } },
9759   },
9760   {
9761     /* VEX_W_2F_P_2 */
9762     { "vcomisd",        { XM, EXq } },
9763     { "(bad)",          { XX } },
9764   },
9765   {
9766     /* VEX_W_50_M_0 */
9767     { "vmovmskpX",      { Gdq, XS } },
9768     { "(bad)",          { XX } },
9769   },
9770   {
9771     /* VEX_W_51_P_0 */
9772     { "vsqrtps",        { XM, EXx } },
9773     { "(bad)",          { XX } },
9774   },
9775   {
9776     /* VEX_W_51_P_1 */
9777     { "vsqrtss",        { XM, Vex128, EXd } },
9778     { "(bad)",          { XX } },
9779   },
9780   {
9781     /* VEX_W_51_P_2  */
9782     { "vsqrtpd",        { XM, EXx } },
9783     { "(bad)",          { XX } },
9784   },
9785   {
9786     /* VEX_W_51_P_3 */
9787     { "vsqrtsd",        { XM, Vex128, EXq } },
9788     { "(bad)",          { XX } },
9789   },
9790   {
9791     /* VEX_W_52_P_0 */
9792     { "vrsqrtps",       { XM, EXx } },
9793     { "(bad)",          { XX } },
9794   },
9795   {
9796     /* VEX_W_52_P_1 */
9797     { "vrsqrtss",       { XM, Vex128, EXd } },
9798     { "(bad)",          { XX } },
9799   },
9800   {
9801     /* VEX_W_53_P_0  */
9802     { "vrcpps",         { XM, EXx } },
9803     { "(bad)",          { XX } },
9804   },
9805   {
9806     /* VEX_W_53_P_1  */
9807     { "vrcpss",         { XM, Vex128, EXd } },
9808     { "(bad)",          { XX } },
9809   },
9810   {
9811     /* VEX_W_58_P_0  */
9812     { "vaddps",         { XM, Vex, EXx } },
9813     { "(bad)",          { XX } },
9814   },
9815   {
9816     /* VEX_W_58_P_1  */
9817     { "vaddss",         { XM, Vex128, EXd } },
9818     { "(bad)",          { XX } },
9819   },
9820   {
9821     /* VEX_W_58_P_2  */
9822     { "vaddpd",         { XM, Vex, EXx } },
9823     { "(bad)",          { XX } },
9824   },
9825   {
9826     /* VEX_W_58_P_3  */
9827     { "vaddsd",         { XM, Vex128, EXq } },
9828     { "(bad)",          { XX } },
9829   },
9830   {
9831     /* VEX_W_59_P_0  */
9832     { "vmulps",         { XM, Vex, EXx } },
9833     { "(bad)",          { XX } },
9834   },
9835   {
9836     /* VEX_W_59_P_1  */
9837     { "vmulss",         { XM, Vex128, EXd } },
9838     { "(bad)",          { XX } },
9839   },
9840   {
9841     /* VEX_W_59_P_2  */
9842     { "vmulpd",         { XM, Vex, EXx } },
9843     { "(bad)",          { XX } },
9844   },
9845   {
9846     /* VEX_W_59_P_3  */
9847     { "vmulsd",         { XM, Vex128, EXq } },
9848     { "(bad)",          { XX } },
9849   },
9850   {
9851     /* VEX_W_5A_P_0  */
9852     { "vcvtps2pd",      { XM, EXxmmq } },
9853     { "(bad)",          { XX } },
9854   },
9855   {
9856     /* VEX_W_5A_P_1  */
9857     { "vcvtss2sd",      { XM, Vex128, EXd } },
9858     { "(bad)",          { XX } },
9859   },
9860   {
9861     /* VEX_W_5A_P_3  */
9862     { "vcvtsd2ss",      { XM, Vex128, EXq } },
9863     { "(bad)",          { XX } },
9864   },
9865   {
9866     /* VEX_W_5B_P_0  */
9867     { "vcvtdq2ps",      { XM, EXx } },
9868     { "(bad)",          { XX } },
9869   },
9870   {
9871     /* VEX_W_5B_P_1  */
9872     { "vcvttps2dq",     { XM, EXx } },
9873     { "(bad)",          { XX } },
9874   },
9875   {
9876     /* VEX_W_5B_P_2  */
9877     { "vcvtps2dq",      { XM, EXx } },
9878     { "(bad)",          { XX } },
9879   },
9880   {
9881     /* VEX_W_5C_P_0  */
9882     { "vsubps",         { XM, Vex, EXx } },
9883     { "(bad)",          { XX } },
9884   },
9885   {
9886     /* VEX_W_5C_P_1  */
9887     { "vsubss",         { XM, Vex128, EXd } },
9888     { "(bad)",          { XX } },
9889   },
9890   {
9891     /* VEX_W_5C_P_2  */
9892     { "vsubpd",         { XM, Vex, EXx } },
9893     { "(bad)",          { XX } },
9894   },
9895   {
9896     /* VEX_W_5C_P_3  */
9897     { "vsubsd",         { XM, Vex128, EXq } },
9898     { "(bad)",          { XX } },
9899   },
9900   {
9901     /* VEX_W_5D_P_0  */
9902     { "vminps",         { XM, Vex, EXx } },
9903     { "(bad)",          { XX } },
9904   },
9905   {
9906     /* VEX_W_5D_P_1  */
9907     { "vminss",         { XM, Vex128, EXd } },
9908     { "(bad)",          { XX } },
9909   },
9910   {
9911     /* VEX_W_5D_P_2  */
9912     { "vminpd",         { XM, Vex, EXx } },
9913     { "(bad)",          { XX } },
9914   },
9915   {
9916     /* VEX_W_5D_P_3  */
9917     { "vminsd",         { XM, Vex128, EXq } },
9918     { "(bad)",          { XX } },
9919   },
9920   {
9921     /* VEX_W_5E_P_0  */
9922     { "vdivps",         { XM, Vex, EXx } },
9923     { "(bad)",          { XX } },
9924   },
9925   {
9926     /* VEX_W_5E_P_1  */
9927     { "vdivss",         { XM, Vex128, EXd } },
9928     { "(bad)",          { XX } },
9929   },
9930   {
9931     /* VEX_W_5E_P_2  */
9932     { "vdivpd",         { XM, Vex, EXx } },
9933     { "(bad)",          { XX } },
9934   },
9935   {
9936     /* VEX_W_5E_P_3  */
9937     { "vdivsd",         { XM, Vex128, EXq } },
9938     { "(bad)",          { XX } },
9939   },
9940   {
9941     /* VEX_W_5F_P_0  */
9942     { "vmaxps",         { XM, Vex, EXx } },
9943     { "(bad)",          { XX } },
9944   },
9945   {
9946     /* VEX_W_5F_P_1  */
9947     { "vmaxss",         { XM, Vex128, EXd } },
9948     { "(bad)",          { XX } },
9949   },
9950   {
9951     /* VEX_W_5F_P_2  */
9952     { "vmaxpd",         { XM, Vex, EXx } },
9953     { "(bad)",          { XX } },
9954   },
9955   {
9956     /* VEX_W_5F_P_3  */
9957     { "vmaxsd",         { XM, Vex128, EXq } },
9958     { "(bad)",          { XX } },
9959   },
9960   {
9961     /* VEX_W_60_P_2  */
9962     { "vpunpcklbw",     { XM, Vex128, EXx } },
9963     { "(bad)",          { XX } },
9964   },
9965   {
9966     /* VEX_W_61_P_2  */
9967     { "vpunpcklwd",     { XM, Vex128, EXx } },
9968     { "(bad)",          { XX } },
9969   },
9970   {
9971     /* VEX_W_62_P_2  */
9972     { "vpunpckldq",     { XM, Vex128, EXx } },
9973     { "(bad)",          { XX } },
9974   },
9975   {
9976     /* VEX_W_63_P_2  */
9977     { "vpacksswb",      { XM, Vex128, EXx } },
9978     { "(bad)",          { XX } },
9979   },
9980   {
9981     /* VEX_W_64_P_2  */
9982     { "vpcmpgtb",       { XM, Vex128, EXx } },
9983     { "(bad)",          { XX } },
9984   },
9985   {
9986     /* VEX_W_65_P_2  */
9987     { "vpcmpgtw",       { XM, Vex128, EXx } },
9988     { "(bad)",          { XX } },
9989   },
9990   {
9991     /* VEX_W_66_P_2  */
9992     { "vpcmpgtd",       { XM, Vex128, EXx } },
9993     { "(bad)",          { XX } },
9994   },
9995   {
9996     /* VEX_W_67_P_2  */
9997     { "vpackuswb",      { XM, Vex128, EXx } },
9998     { "(bad)",          { XX } },
9999   },
10000   {
10001     /* VEX_W_68_P_2  */
10002     { "vpunpckhbw",     { XM, Vex128, EXx } },
10003     { "(bad)",          { XX } },
10004   },
10005   {
10006     /* VEX_W_69_P_2  */
10007     { "vpunpckhwd",     { XM, Vex128, EXx } },
10008     { "(bad)",          { XX } },
10009   },
10010   {
10011     /* VEX_W_6A_P_2  */
10012     { "vpunpckhdq",     { XM, Vex128, EXx } },
10013     { "(bad)",          { XX } },
10014   },
10015   {
10016     /* VEX_W_6B_P_2  */
10017     { "vpackssdw",      { XM, Vex128, EXx } },
10018     { "(bad)",          { XX } },
10019   },
10020   {
10021     /* VEX_W_6C_P_2  */
10022     { "vpunpcklqdq",    { XM, Vex128, EXx } },
10023     { "(bad)",          { XX } },
10024   },
10025   {
10026     /* VEX_W_6D_P_2  */
10027     { "vpunpckhqdq",    { XM, Vex128, EXx } },
10028     { "(bad)",          { XX } },
10029   },
10030   {
10031     /* VEX_W_6F_P_1  */
10032     { "vmovdqu", { XM, EXx } },
10033     { "(bad)",          { XX } },
10034   },
10035   {
10036     /* VEX_W_6F_P_2  */
10037     { "vmovdqa", { XM, EXx } },
10038     { "(bad)",          { XX } },
10039   },
10040   {
10041     /* VEX_W_70_P_1 */
10042     { "vpshufhw",       { XM, EXx, Ib } },
10043     { "(bad)",          { XX } },
10044   },
10045   {
10046     /* VEX_W_70_P_2 */
10047     { "vpshufd",        { XM, EXx, Ib } },
10048     { "(bad)",          { XX } },
10049   },
10050   {
10051     /* VEX_W_70_P_3 */
10052     { "vpshuflw",       { XM, EXx, Ib } },
10053     { "(bad)",          { XX } },
10054   },
10055   {
10056     /* VEX_W_71_R_2_P_2  */
10057     { "vpsrlw",         { Vex128, XS, Ib } },
10058     { "(bad)",          { XX } },
10059   },
10060   {
10061     /* VEX_W_71_R_4_P_2  */
10062     { "vpsraw",         { Vex128, XS, Ib } },
10063     { "(bad)",          { XX } },
10064   },
10065   {
10066     /* VEX_W_71_R_6_P_2  */
10067     { "vpsllw",         { Vex128, XS, Ib } },
10068     { "(bad)",          { XX } },
10069   },
10070   {
10071     /* VEX_W_72_R_2_P_2  */
10072     { "vpsrld",         { Vex128, XS, Ib } },
10073     { "(bad)",          { XX } },
10074   },
10075   {
10076     /* VEX_W_72_R_4_P_2  */
10077     { "vpsrad",         { Vex128, XS, Ib } },
10078     { "(bad)",          { XX } },
10079   },
10080   {
10081     /* VEX_W_72_R_6_P_2  */
10082     { "vpslld",         { Vex128, XS, Ib } },
10083     { "(bad)",          { XX } },
10084   },
10085   {
10086     /* VEX_W_73_R_2_P_2  */
10087     { "vpsrlq",         { Vex128, XS, Ib } },
10088     { "(bad)",          { XX } },
10089   },
10090   {
10091     /* VEX_W_73_R_3_P_2  */
10092     { "vpsrldq",        { Vex128, XS, Ib } },
10093     { "(bad)",          { XX } },
10094   },
10095   {
10096     /* VEX_W_73_R_6_P_2  */
10097     { "vpsllq",         { Vex128, XS, Ib } },
10098     { "(bad)",          { XX } },
10099   },
10100   {
10101     /* VEX_W_73_R_7_P_2  */
10102     { "vpslldq",        { Vex128, XS, Ib } },
10103     { "(bad)",          { XX } },
10104   },
10105   {
10106     /* VEX_W_74_P_2 */
10107     { "vpcmpeqb",       { XM, Vex128, EXx } },
10108     { "(bad)",          { XX } },
10109   },
10110   {
10111     /* VEX_W_75_P_2 */
10112     { "vpcmpeqw",       { XM, Vex128, EXx } },
10113     { "(bad)",          { XX } },
10114   },
10115   {
10116     /* VEX_W_76_P_2 */
10117     { "vpcmpeqd",       { XM, Vex128, EXx } },
10118     { "(bad)",          { XX } },
10119   },
10120   {
10121     /* VEX_W_77_P_0 */
10122     { "",               { VZERO } },
10123     { "(bad)",          { XX } },
10124   },
10125   {
10126     /* VEX_W_7C_P_2 */
10127     { "vhaddpd",        { XM, Vex, EXx } },
10128     { "(bad)",          { XX } },
10129   },
10130   {
10131     /* VEX_W_7C_P_3 */
10132     { "vhaddps",        { XM, Vex, EXx } },
10133     { "(bad)",          { XX } },
10134   },
10135   {
10136     /* VEX_W_7D_P_2 */
10137     { "vhsubpd",        { XM, Vex, EXx } },
10138     { "(bad)",          { XX } },
10139   },
10140   {
10141     /* VEX_W_7D_P_3 */
10142     { "vhsubps",        { XM, Vex, EXx } },
10143     { "(bad)",          { XX } },
10144   },
10145   {
10146     /* VEX_W_7E_P_1 */
10147     { "vmovq",          { XM, EXq } },
10148     { "(bad)",          { XX } },
10149   },
10150   {
10151     /* VEX_W_7F_P_1 */
10152     { "vmovdqu",        { EXxS, XM } },
10153     { "(bad)",          { XX } },
10154   },
10155   {
10156     /* VEX_W_7F_P_2 */
10157     { "vmovdqa",        { EXxS, XM } },
10158     { "(bad)",          { XX } },
10159   },
10160   {
10161     /* VEX_W_AE_R_2_M_0 */
10162     { "vldmxcsr",       { Md } },
10163     { "(bad)",          { XX } },
10164   },
10165   {
10166     /* VEX_W_AE_R_3_M_0 */
10167     { "vstmxcsr",       { Md } },
10168     { "(bad)",          { XX } },
10169   },
10170   {
10171     /* VEX_W_C2_P_0 */
10172     { "vcmpps",         { XM, Vex, EXx, VCMP } },
10173     { "(bad)",          { XX } },
10174   },
10175   {
10176     /* VEX_W_C2_P_1 */
10177     { "vcmpss",         { XM, Vex128, EXd, VCMP } },
10178     { "(bad)",          { XX } },
10179   },
10180   {
10181     /* VEX_W_C2_P_2 */
10182     { "vcmppd",         { XM, Vex, EXx, VCMP } },
10183     { "(bad)",          { XX } },
10184   },
10185   {
10186     /* VEX_W_C2_P_3 */
10187     { "vcmpsd",         { XM, Vex128, EXq, VCMP } },
10188     { "(bad)",          { XX } },
10189   },
10190   {
10191     /* VEX_W_C4_P_2 */
10192     { "vpinsrw",        { XM, Vex128, Edqw, Ib } },
10193     { "(bad)",          { XX } },
10194   },
10195   {
10196     /* VEX_W_C5_P_2 */
10197     { "vpextrw",        { Gdq, XS, Ib } },
10198     { "(bad)",          { XX } },
10199   },
10200   {
10201     /* VEX_W_D0_P_2 */
10202     { "vaddsubpd",      { XM, Vex, EXx } },
10203     { "(bad)",          { XX } },
10204   },
10205   {
10206     /* VEX_W_D0_P_3 */
10207     { "vaddsubps",      { XM, Vex, EXx } },
10208     { "(bad)",          { XX } },
10209   },
10210   {
10211     /* VEX_W_D1_P_2 */
10212     { "vpsrlw",         { XM, Vex128, EXx } },
10213     { "(bad)",          { XX } },
10214   },
10215   {
10216     /* VEX_W_D2_P_2 */
10217     { "vpsrld",         { XM, Vex128, EXx } },
10218     { "(bad)",          { XX } },
10219   },
10220   {
10221     /* VEX_W_D3_P_2 */
10222     { "vpsrlq",         { XM, Vex128, EXx } },
10223     { "(bad)",          { XX } },
10224   },
10225   {
10226     /* VEX_W_D4_P_2 */
10227     { "vpaddq",         { XM, Vex128, EXx } },
10228     { "(bad)",          { XX } },
10229   },
10230   {
10231     /* VEX_W_D5_P_2 */
10232     { "vpmullw",        { XM, Vex128, EXx } },
10233     { "(bad)",          { XX } },
10234   },
10235   {
10236     /* VEX_W_D6_P_2 */
10237     { "vmovq",          { EXqS, XM } },
10238     { "(bad)",          { XX } },
10239   },
10240   {
10241     /* VEX_W_D7_P_2_M_1 */
10242     { "vpmovmskb",      { Gdq, XS } },
10243     { "(bad)",          { XX } },
10244   },
10245   {
10246     /* VEX_W_D8_P_2 */
10247     { "vpsubusb",       { XM, Vex128, EXx } },
10248     { "(bad)",          { XX } },
10249   },
10250   {
10251     /* VEX_W_D9_P_2 */
10252     { "vpsubusw",       { XM, Vex128, EXx } },
10253     { "(bad)",          { XX } },
10254   },
10255   {
10256     /* VEX_W_DA_P_2 */
10257     { "vpminub",        { XM, Vex128, EXx } },
10258     { "(bad)",          { XX } },
10259   },
10260   {
10261     /* VEX_W_DB_P_2 */
10262     { "vpand",          { XM, Vex128, EXx } },
10263     { "(bad)",          { XX } },
10264   },
10265   {
10266     /* VEX_W_DC_P_2 */
10267     { "vpaddusb",       { XM, Vex128, EXx } },
10268     { "(bad)",          { XX } },
10269   },
10270   {
10271     /* VEX_W_DD_P_2 */
10272     { "vpaddusw",       { XM, Vex128, EXx } },
10273     { "(bad)",          { XX } },
10274   },
10275   {
10276     /* VEX_W_DE_P_2 */
10277     { "vpmaxub",        { XM, Vex128, EXx } },
10278     { "(bad)",          { XX } },
10279   },
10280   {
10281     /* VEX_W_DF_P_2 */
10282     { "vpandn",         { XM, Vex128, EXx } },
10283     { "(bad)",          { XX } },
10284   },
10285   {
10286     /* VEX_W_E0_P_2  */
10287     { "vpavgb",         { XM, Vex128, EXx } },
10288     { "(bad)",          { XX } },
10289   },
10290   {
10291     /* VEX_W_E1_P_2  */
10292     { "vpsraw",         { XM, Vex128, EXx } },
10293     { "(bad)",          { XX } },
10294   },
10295   {
10296     /* VEX_W_E2_P_2  */
10297     { "vpsrad",         { XM, Vex128, EXx } },
10298     { "(bad)",          { XX } },
10299   },
10300   {
10301     /* VEX_W_E3_P_2  */
10302     { "vpavgw",         { XM, Vex128, EXx } },
10303     { "(bad)",          { XX } },
10304   },
10305   {
10306     /* VEX_W_E4_P_2  */
10307     { "vpmulhuw",       { XM, Vex128, EXx } },
10308     { "(bad)",          { XX } },
10309   },
10310   {
10311     /* VEX_W_E5_P_2  */
10312     { "vpmulhw",        { XM, Vex128, EXx } },
10313     { "(bad)",          { XX } },
10314   },
10315   {
10316     /* VEX_W_E6_P_1  */
10317     { "vcvtdq2pd", { XM, EXxmmq } },
10318     { "(bad)",          { XX } },
10319   },
10320   {
10321     /* VEX_W_E6_P_2  */
10322     { "vcvttpd2dq%XY", { XMM, EXx } },
10323     { "(bad)",          { XX } },
10324   },
10325   {
10326     /* VEX_W_E6_P_3  */
10327     { "vcvtpd2dq%XY", { XMM, EXx } },
10328     { "(bad)",          { XX } },
10329   },
10330   {
10331     /* VEX_W_E7_P_2_M_0 */
10332     { "vmovntdq",       { Mx, XM } },
10333     { "(bad)",          { XX } },
10334   },
10335   {
10336     /* VEX_W_E8_P_2  */
10337     { "vpsubsb",        { XM, Vex128, EXx } },
10338     { "(bad)",          { XX } },
10339   },
10340   {
10341     /* VEX_W_E9_P_2  */
10342     { "vpsubsw",        { XM, Vex128, EXx } },
10343     { "(bad)",          { XX } },
10344   },
10345   {
10346     /* VEX_W_EA_P_2  */
10347     { "vpminsw",        { XM, Vex128, EXx } },
10348     { "(bad)",          { XX } },
10349   },
10350   {
10351     /* VEX_W_EB_P_2  */
10352     { "vpor",           { XM, Vex128, EXx } },
10353     { "(bad)",          { XX } },
10354   },
10355   {
10356     /* VEX_W_EC_P_2  */
10357     { "vpaddsb",        { XM, Vex128, EXx } },
10358     { "(bad)",          { XX } },
10359   },
10360   {
10361     /* VEX_W_ED_P_2  */
10362     { "vpaddsw",        { XM, Vex128, EXx } },
10363     { "(bad)",          { XX } },
10364   },
10365   {
10366     /* VEX_W_EE_P_2  */
10367     { "vpmaxsw",        { XM, Vex128, EXx } },
10368     { "(bad)",          { XX } },
10369   },
10370   {
10371     /* VEX_W_EF_P_2  */
10372     { "vpxor",          { XM, Vex128, EXx } },
10373     { "(bad)",          { XX } },
10374   },
10375   {
10376     /* VEX_W_F0_P_3_M_0 */
10377     { "vlddqu",         { XM, M } },
10378     { "(bad)",          { XX } },
10379   },
10380   {
10381     /* VEX_W_F1_P_2 */
10382     { "vpsllw",         { XM, Vex128, EXx } },
10383     { "(bad)",          { XX } },
10384   },
10385   {
10386     /* VEX_W_F2_P_2 */
10387     { "vpslld",         { XM, Vex128, EXx } },
10388     { "(bad)",          { XX } },
10389   },
10390   {
10391     /* VEX_W_F3_P_2 */
10392     { "vpsllq",         { XM, Vex128, EXx } },
10393     { "(bad)",          { XX } },
10394   },
10395   {
10396     /* VEX_W_F4_P_2 */
10397     { "vpmuludq",       { XM, Vex128, EXx } },
10398     { "(bad)",          { XX } },
10399   },
10400   {
10401     /* VEX_W_F5_P_2 */
10402     { "vpmaddwd",       { XM, Vex128, EXx } },
10403     { "(bad)",          { XX } },
10404   },
10405   {
10406     /* VEX_W_F6_P_2 */
10407     { "vpsadbw",        { XM, Vex128, EXx } },
10408     { "(bad)",          { XX } },
10409   },
10410   {
10411     /* VEX_W_F7_P_2 */
10412     { "vmaskmovdqu",    { XM, XS } },
10413     { "(bad)",          { XX } },
10414   },
10415   {
10416     /* VEX_W_F8_P_2 */
10417     { "vpsubb",         { XM, Vex128, EXx } },
10418     { "(bad)",          { XX } },
10419   },
10420   {
10421     /* VEX_W_F9_P_2 */
10422     { "vpsubw",         { XM, Vex128, EXx } },
10423     { "(bad)",          { XX } },
10424   },
10425   {
10426     /* VEX_W_FA_P_2 */
10427     { "vpsubd",         { XM, Vex128, EXx } },
10428     { "(bad)",          { XX } },
10429   },
10430   {
10431     /* VEX_W_FB_P_2 */
10432     { "vpsubq",         { XM, Vex128, EXx } },
10433     { "(bad)",          { XX } },
10434   },
10435   {
10436     /* VEX_W_FC_P_2 */
10437     { "vpaddb",         { XM, Vex128, EXx } },
10438     { "(bad)",          { XX } },
10439   },
10440   {
10441     /* VEX_W_FD_P_2 */
10442     { "vpaddw",         { XM, Vex128, EXx } },
10443     { "(bad)",          { XX } },
10444   },
10445   {
10446     /* VEX_W_FE_P_2 */
10447     { "vpaddd",         { XM, Vex128, EXx } },
10448     { "(bad)",          { XX } },
10449   },
10450   {
10451     /* VEX_W_3800_P_2  */
10452     { "vpshufb",        { XM, Vex128, EXx } },
10453     { "(bad)",          { XX } },
10454   },
10455   {
10456     /* VEX_W_3801_P_2  */
10457     { "vphaddw",        { XM, Vex128, EXx } },
10458     { "(bad)",          { XX } },
10459   },
10460   {
10461     /* VEX_W_3802_P_2  */
10462     { "vphaddd",        { XM, Vex128, EXx } },
10463     { "(bad)",          { XX } },
10464   },
10465   {
10466     /* VEX_W_3803_P_2  */
10467     { "vphaddsw",       { XM, Vex128, EXx } },
10468     { "(bad)",          { XX } },
10469   },
10470   {
10471     /* VEX_W_3804_P_2  */
10472     { "vpmaddubsw",     { XM, Vex128, EXx } },
10473     { "(bad)",          { XX } },
10474   },
10475   {
10476     /* VEX_W_3805_P_2  */
10477     { "vphsubw",        { XM, Vex128, EXx } },
10478     { "(bad)",          { XX } },
10479   },
10480   {
10481     /* VEX_W_3806_P_2  */
10482     { "vphsubd",        { XM, Vex128, EXx } },
10483     { "(bad)",          { XX } },
10484   },
10485   {
10486     /* VEX_W_3807_P_2  */
10487     { "vphsubsw",       { XM, Vex128, EXx } },
10488     { "(bad)",          { XX } },
10489   },
10490   {
10491     /* VEX_W_3808_P_2  */
10492     { "vpsignb",        { XM, Vex128, EXx } },
10493     { "(bad)",          { XX } },
10494   },
10495   {
10496     /* VEX_W_3809_P_2  */
10497     { "vpsignw",        { XM, Vex128, EXx } },
10498     { "(bad)",          { XX } },
10499   },
10500   {
10501     /* VEX_W_380A_P_2  */
10502     { "vpsignd",        { XM, Vex128, EXx } },
10503     { "(bad)",          { XX } },
10504   },
10505   {
10506     /* VEX_W_380B_P_2  */
10507     { "vpmulhrsw",      { XM, Vex128, EXx } },
10508     { "(bad)",          { XX } },
10509   },
10510   {
10511     /* VEX_W_380C_P_2  */
10512     { "vpermilps",      { XM, Vex, EXx } },
10513     { "(bad)",          { XX } },
10514   },
10515   {
10516     /* VEX_W_380D_P_2  */
10517     { "vpermilpd",      { XM, Vex, EXx } },
10518     { "(bad)",          { XX } },
10519   },
10520   {
10521     /* VEX_W_380E_P_2  */
10522     { "vtestps",        { XM, EXx } },
10523     { "(bad)",          { XX } },
10524   },
10525   {
10526     /* VEX_W_380F_P_2  */
10527     { "vtestpd",        { XM, EXx } },
10528     { "(bad)",          { XX } },
10529   },
10530   {
10531     /* VEX_W_3817_P_2 */
10532     { "vptest",         { XM, EXx } },
10533     { "(bad)",          { XX } },
10534   },
10535   {
10536     /* VEX_W_3819_P_2_M_0 */
10537     { "vbroadcastsd",   { XM, Mq } },
10538     { "(bad)",          { XX } },
10539   },
10540   {
10541     /* VEX_W_381A_P_2_M_0 */
10542     { "vbroadcastf128", { XM, Mxmm } },
10543     { "(bad)",          { XX } },
10544   },
10545   {
10546     /* VEX_W_381C_P_2 */
10547     { "vpabsb",         { XM, EXx } },
10548     { "(bad)",          { XX } },
10549   },
10550   {
10551     /* VEX_W_381D_P_2 */
10552     { "vpabsw",         { XM, EXx } },
10553     { "(bad)",          { XX } },
10554   },
10555   {
10556     /* VEX_W_381E_P_2 */
10557     { "vpabsd",         { XM, EXx } },
10558     { "(bad)",          { XX } },
10559   },
10560   {
10561     /* VEX_W_3820_P_2 */
10562     { "vpmovsxbw",      { XM, EXq } },
10563     { "(bad)",          { XX } },
10564   },
10565   {
10566     /* VEX_W_3821_P_2 */
10567     { "vpmovsxbd",      { XM, EXd } },
10568     { "(bad)",          { XX } },
10569   },
10570   {
10571     /* VEX_W_3822_P_2 */
10572     { "vpmovsxbq",      { XM, EXw } },
10573     { "(bad)",          { XX } },
10574   },
10575   {
10576     /* VEX_W_3823_P_2 */
10577     { "vpmovsxwd",      { XM, EXq } },
10578     { "(bad)",          { XX } },
10579   },
10580   {
10581     /* VEX_W_3824_P_2 */
10582     { "vpmovsxwq",      { XM, EXd } },
10583     { "(bad)",          { XX } },
10584   },
10585   {
10586     /* VEX_W_3825_P_2 */
10587     { "vpmovsxdq",      { XM, EXq } },
10588     { "(bad)",          { XX } },
10589   },
10590   {
10591     /* VEX_W_3828_P_2 */
10592     { "vpmuldq",        { XM, Vex128, EXx } },
10593     { "(bad)",          { XX } },
10594   },
10595   {
10596     /* VEX_W_3829_P_2 */
10597     { "vpcmpeqq",       { XM, Vex128, EXx } },
10598     { "(bad)",          { XX } },
10599   },
10600   {
10601     /* VEX_W_382A_P_2_M_0 */
10602     { "vmovntdqa",      { XM, Mx } },
10603     { "(bad)",          { XX } },
10604   },
10605   {
10606     /* VEX_W_382B_P_2 */
10607     { "vpackusdw",      { XM, Vex128, EXx } },
10608     { "(bad)",          { XX } },
10609   },
10610   {
10611     /* VEX_W_3830_P_2 */
10612     { "vpmovzxbw",      { XM, EXq } },
10613     { "(bad)",          { XX } },
10614   },
10615   {
10616     /* VEX_W_3831_P_2 */
10617     { "vpmovzxbd",      { XM, EXd } },
10618     { "(bad)",          { XX } },
10619   },
10620   {
10621     /* VEX_W_3832_P_2 */
10622     { "vpmovzxbq",      { XM, EXw } },
10623     { "(bad)",          { XX } },
10624   },
10625   {
10626     /* VEX_W_3833_P_2 */
10627     { "vpmovzxwd",      { XM, EXq } },
10628     { "(bad)",          { XX } },
10629   },
10630   {
10631     /* VEX_W_3834_P_2 */
10632     { "vpmovzxwq",      { XM, EXd } },
10633     { "(bad)",          { XX } },
10634   },
10635   {
10636     /* VEX_W_3835_P_2 */
10637     { "vpmovzxdq",      { XM, EXq } },
10638     { "(bad)",          { XX } },
10639   },
10640   {
10641     /* VEX_W_3837_P_2 */
10642     { "vpcmpgtq",       { XM, Vex128, EXx } },
10643     { "(bad)",          { XX } },
10644   },
10645   {
10646     /* VEX_W_3838_P_2 */
10647     { "vpminsb",        { XM, Vex128, EXx } },
10648     { "(bad)",          { XX } },
10649   },
10650   {
10651     /* VEX_W_3839_P_2 */
10652     { "vpminsd",        { XM, Vex128, EXx } },
10653     { "(bad)",          { XX } },
10654   },
10655   {
10656     /* VEX_W_383A_P_2 */
10657     { "vpminuw",        { XM, Vex128, EXx } },
10658     { "(bad)",          { XX } },
10659   },
10660   {
10661     /* VEX_W_383B_P_2 */
10662     { "vpminud",        { XM, Vex128, EXx } },
10663     { "(bad)",          { XX } },
10664   },
10665   {
10666     /* VEX_W_383C_P_2 */
10667     { "vpmaxsb",        { XM, Vex128, EXx } },
10668     { "(bad)",          { XX } },
10669   },
10670   {
10671     /* VEX_W_383D_P_2 */
10672     { "vpmaxsd",        { XM, Vex128, EXx } },
10673     { "(bad)",          { XX } },
10674   },
10675   {
10676     /* VEX_W_383E_P_2 */
10677     { "vpmaxuw",        { XM, Vex128, EXx } },
10678     { "(bad)",          { XX } },
10679   },
10680   {
10681     /* VEX_W_383F_P_2 */
10682     { "vpmaxud",        { XM, Vex128, EXx } },
10683     { "(bad)",          { XX } },
10684   },
10685   {
10686     /* VEX_W_3840_P_2 */
10687     { "vpmulld",        { XM, Vex128, EXx } },
10688     { "(bad)",          { XX } },
10689   },
10690   {
10691     /* VEX_W_3841_P_2 */
10692     { "vphminposuw",    { XM, EXx } },
10693     { "(bad)",          { XX } },
10694   },
10695   {
10696     /* VEX_W_38DB_P_2 */
10697     { "vaesimc",        { XM, EXx } },
10698     { "(bad)",          { XX } },
10699   },
10700   {
10701     /* VEX_W_38DC_P_2 */
10702     { "vaesenc",        { XM, Vex128, EXx } },
10703     { "(bad)",          { XX } },
10704   },
10705   {
10706     /* VEX_W_38DD_P_2 */
10707     { "vaesenclast",    { XM, Vex128, EXx } },
10708     { "(bad)",          { XX } },
10709   },
10710   {
10711     /* VEX_W_38DE_P_2 */
10712     { "vaesdec",        { XM, Vex128, EXx } },
10713     { "(bad)",          { XX } },
10714   },
10715   {
10716     /* VEX_W_38DF_P_2 */
10717     { "vaesdeclast",    { XM, Vex128, EXx } },
10718     { "(bad)",          { XX } },
10719   },
10720   {
10721     /* VEX_W_3A04_P_2 */
10722     { "vpermilps",      { XM, EXx, Ib } },
10723     { "(bad)",          { XX } },
10724   },
10725   {
10726     /* VEX_W_3A05_P_2 */
10727     { "vpermilpd",      { XM, EXx, Ib } },
10728     { "(bad)",          { XX } },
10729   },
10730   {
10731     /* VEX_W_3A06_P_2 */
10732     { "vperm2f128",     { XM, Vex256, EXx, Ib } },
10733     { "(bad)",          { XX } },
10734   },
10735   {
10736     /* VEX_W_3A08_P_2 */
10737     { "vroundps",       { XM, EXx, Ib } },
10738     { "(bad)",          { XX } },
10739   },
10740   {
10741     /* VEX_W_3A09_P_2 */
10742     { "vroundpd",       { XM, EXx, Ib } },
10743     { "(bad)",          { XX } },
10744   },
10745   {
10746     /* VEX_W_3A0A_P_2 */
10747     { "vroundss",       { XM, Vex128, EXd, Ib } },
10748     { "(bad)",          { XX } },
10749   },
10750   {
10751     /* VEX_W_3A0B_P_2 */
10752     { "vroundsd",       { XM, Vex128, EXq, Ib } },
10753     { "(bad)",          { XX } },
10754   },
10755   {
10756     /* VEX_W_3A0C_P_2 */
10757     { "vblendps",       { XM, Vex, EXx, Ib } },
10758     { "(bad)",          { XX } },
10759   },
10760   {
10761     /* VEX_W_3A0D_P_2 */
10762     { "vblendpd",       { XM, Vex, EXx, Ib } },
10763     { "(bad)",          { XX } },
10764   },
10765   {
10766     /* VEX_W_3A0E_P_2 */
10767     { "vpblendw",       { XM, Vex128, EXx, Ib } },
10768     { "(bad)",          { XX } },
10769   },
10770   {
10771     /* VEX_W_3A0F_P_2 */
10772     { "vpalignr",       { XM, Vex128, EXx, Ib } },
10773     { "(bad)",          { XX } },
10774   },
10775   {
10776     /* VEX_W_3A14_P_2 */
10777     { "vpextrb",        { Edqb, XM, Ib } },
10778     { "(bad)",          { XX } },
10779   },
10780   {
10781     /* VEX_W_3A15_P_2 */
10782     { "vpextrw",        { Edqw, XM, Ib } },
10783     { "(bad)",          { XX } },
10784   },
10785   {
10786     /* VEX_W_3A18_P_2 */
10787     { "vinsertf128",    { XM, Vex256, EXxmm, Ib } },
10788     { "(bad)",          { XX } },
10789   },
10790   {
10791     /* VEX_W_3A19_P_2 */
10792     { "vextractf128",   { EXxmm, XM, Ib } },
10793     { "(bad)",          { XX } },
10794   },
10795   {
10796     /* VEX_W_3A20_P_2 */
10797     { "vpinsrb",        { XM, Vex128, Edqb, Ib } },
10798     { "(bad)",          { XX } },
10799   },
10800   {
10801     /* VEX_W_3A21_P_2 */
10802     { "vinsertps",      { XM, Vex128, EXd, Ib } },
10803     { "(bad)",          { XX } },
10804   },
10805   {
10806     /* VEX_W_3A40_P_2 */
10807     { "vdpps",          { XM, Vex, EXx, Ib } },
10808     { "(bad)",          { XX } },
10809   },
10810   {
10811     /* VEX_W_3A41_P_2 */
10812     { "vdppd",          { XM, Vex128, EXx, Ib } },
10813     { "(bad)",          { XX } },
10814   },
10815   {
10816     /* VEX_W_3A42_P_2 */
10817     { "vmpsadbw",       { XM, Vex128, EXx, Ib } },
10818     { "(bad)",          { XX } },
10819   },
10820   {
10821     /* VEX_W_3A44_P_2 */
10822     { "vpclmulqdq",     { XM, Vex128, EXx, PCLMUL } },
10823     { "(bad)",          { XX } },
10824   },
10825   {
10826     /* VEX_W_3A4A_P_2 */
10827     { "vblendvps",      { XM, Vex, EXx, XMVexI4 } },
10828     { "(bad)",          { XX } },
10829   },
10830   {
10831     /* VEX_W_3A4B_P_2 */
10832     { "vblendvpd",      { XM, Vex, EXx, XMVexI4 } },
10833     { "(bad)",          { XX } },
10834   },
10835   {
10836     /* VEX_W_3A4C_P_2 */
10837     { "vpblendvb",      { XM, Vex128, EXx, XMVexI4 } },
10838     { "(bad)",          { XX } },
10839   },
10840   {
10841     /* VEX_W_3A60_P_2 */
10842     { "vpcmpestrm",     { XM, EXx, Ib } },
10843     { "(bad)",          { XX } },
10844   },
10845   {
10846     /* VEX_W_3A61_P_2 */
10847     { "vpcmpestri",     { XM, EXx, Ib } },
10848     { "(bad)",          { XX } },
10849   },
10850   {
10851     /* VEX_W_3A62_P_2 */
10852     { "vpcmpistrm",     { XM, EXx, Ib } },
10853     { "(bad)",          { XX } },
10854   },
10855   {
10856     /* VEX_W_3A63_P_2 */
10857     { "vpcmpistri",     { XM, EXx, Ib } },
10858     { "(bad)",          { XX } },
10859   },
10860   {
10861     /* VEX_W_3ADF_P_2 */
10862     { "vaeskeygenassist", { XM, EXx, Ib } },
10863     { "(bad)",          { XX } },
10864   },
10865 };
10866
10867 static const struct dis386 mod_table[][2] = {
10868   {
10869     /* MOD_8D */
10870     { "leaS",           { Gv, M } },
10871     { "(bad)",          { XX } },
10872   },
10873   {
10874     /* MOD_0F01_REG_0 */
10875     { X86_64_TABLE (X86_64_0F01_REG_0) },
10876     { RM_TABLE (RM_0F01_REG_0) },
10877   },
10878   {
10879     /* MOD_0F01_REG_1 */
10880     { X86_64_TABLE (X86_64_0F01_REG_1) },
10881     { RM_TABLE (RM_0F01_REG_1) },
10882   },
10883   {
10884     /* MOD_0F01_REG_2 */
10885     { X86_64_TABLE (X86_64_0F01_REG_2) },
10886     { RM_TABLE (RM_0F01_REG_2) },
10887   },
10888   {
10889     /* MOD_0F01_REG_3 */
10890     { X86_64_TABLE (X86_64_0F01_REG_3) },
10891     { RM_TABLE (RM_0F01_REG_3) },
10892   },
10893   {
10894     /* MOD_0F01_REG_7 */
10895     { "invlpg",         { Mb } },
10896     { RM_TABLE (RM_0F01_REG_7) },
10897   },
10898   {
10899     /* MOD_0F12_PREFIX_0 */
10900     { "movlps",         { XM, EXq } },
10901     { "movhlps",        { XM, EXq } },
10902   },
10903   {
10904     /* MOD_0F13 */
10905     { "movlpX",         { EXq, XM } },
10906     { "(bad)",          { XX } },
10907   },
10908   {
10909     /* MOD_0F16_PREFIX_0 */
10910     { "movhps",         { XM, EXq } },
10911     { "movlhps",        { XM, EXq } },
10912   },
10913   {
10914     /* MOD_0F17 */
10915     { "movhpX",         { EXq, XM } },
10916     { "(bad)",          { XX } },
10917   },
10918   {
10919     /* MOD_0F18_REG_0 */
10920     { "prefetchnta",    { Mb } },
10921     { "(bad)",          { XX } },
10922   },
10923   {
10924     /* MOD_0F18_REG_1 */
10925     { "prefetcht0",     { Mb } },
10926     { "(bad)",          { XX } },
10927   },
10928   {
10929     /* MOD_0F18_REG_2 */
10930     { "prefetcht1",     { Mb } },
10931     { "(bad)",          { XX } },
10932   },
10933   {
10934     /* MOD_0F18_REG_3 */
10935     { "prefetcht2",     { Mb } },
10936     { "(bad)",          { XX } },
10937   },
10938   {
10939     /* MOD_0F20 */
10940     { "(bad)",          { XX } },
10941     { "movZ",           { Rm, Cm } },
10942   },
10943   {
10944     /* MOD_0F21 */
10945     { "(bad)",          { XX } },
10946     { "movZ",           { Rm, Dm } },
10947   },
10948   {
10949     /* MOD_0F22 */
10950     { "(bad)",          { XX } },
10951     { "movZ",           { Cm, Rm } },
10952   },
10953   {
10954     /* MOD_0F23 */
10955     { "(bad)",          { XX } },
10956     { "movZ",           { Dm, Rm } },
10957   },
10958   {
10959     /* MOD_0F24 */
10960     { "(bad)",          { XX } },    
10961     { "movL",           { Rd, Td } },
10962   },
10963   {
10964     /* MOD_0F26 */
10965     { "(bad)",          { XX } },
10966     { "movL",           { Td, Rd } },
10967   },
10968   {
10969     /* MOD_0F2B_PREFIX_0 */
10970     {"movntps",         { Mx, XM } },
10971     { "(bad)",          { XX } },
10972   },
10973   {
10974     /* MOD_0F2B_PREFIX_1 */
10975     {"movntss",         { Md, XM } },
10976     { "(bad)",          { XX } },
10977   },
10978   {
10979     /* MOD_0F2B_PREFIX_2 */
10980     {"movntpd",         { Mx, XM } },
10981     { "(bad)",          { XX } },
10982   },
10983   {
10984     /* MOD_0F2B_PREFIX_3 */
10985     {"movntsd",         { Mq, XM } },
10986     { "(bad)",          { XX } },
10987   },
10988   {
10989     /* MOD_0F51 */
10990     { "(bad)",          { XX } },
10991     { "movmskpX",       { Gdq, XS } },
10992   },
10993   {
10994     /* MOD_0F71_REG_2 */
10995     { "(bad)",          { XX } },
10996     { "psrlw",          { MS, Ib } },
10997   },
10998   {
10999     /* MOD_0F71_REG_4 */
11000     { "(bad)",          { XX } },
11001     { "psraw",          { MS, Ib } },
11002   },
11003   {
11004     /* MOD_0F71_REG_6 */
11005     { "(bad)",          { XX } },
11006     { "psllw",          { MS, Ib } },
11007   },
11008   {
11009     /* MOD_0F72_REG_2 */
11010     { "(bad)",          { XX } },
11011     { "psrld",          { MS, Ib } },
11012   },
11013   {
11014     /* MOD_0F72_REG_4 */
11015     { "(bad)",          { XX } },
11016     { "psrad",          { MS, Ib } },
11017   },
11018   {
11019     /* MOD_0F72_REG_6 */
11020     { "(bad)",          { XX } },
11021     { "pslld",          { MS, Ib } },
11022   },
11023   {
11024     /* MOD_0F73_REG_2 */
11025     { "(bad)",          { XX } },
11026     { "psrlq",          { MS, Ib } },
11027   },
11028   {
11029     /* MOD_0F73_REG_3 */
11030     { "(bad)",          { XX } },
11031     { PREFIX_TABLE (PREFIX_0F73_REG_3) },
11032   },
11033   {
11034     /* MOD_0F73_REG_6 */
11035     { "(bad)",          { XX } },
11036     { "psllq",          { MS, Ib } },
11037   },
11038   {
11039     /* MOD_0F73_REG_7 */
11040     { "(bad)",          { XX } },
11041     { PREFIX_TABLE (PREFIX_0F73_REG_7) },
11042   },
11043   {
11044     /* MOD_0FAE_REG_0 */
11045     { "fxsave",         { FXSAVE } },
11046     { "(bad)",          { XX } },
11047   },
11048   {
11049     /* MOD_0FAE_REG_1 */
11050     { "fxrstor",        { FXSAVE } },
11051     { "(bad)",          { XX } },
11052   },
11053   {
11054     /* MOD_0FAE_REG_2 */
11055     { "ldmxcsr",        { Md } },
11056     { "(bad)",          { XX } },
11057   },
11058   {
11059     /* MOD_0FAE_REG_3 */
11060     { "stmxcsr",        { Md } },
11061     { "(bad)",          { XX } },
11062   },
11063   {
11064     /* MOD_0FAE_REG_4 */
11065     { "xsave",          { M } },
11066     { "(bad)",          { XX } },
11067   },
11068   {
11069     /* MOD_0FAE_REG_5 */
11070     { "xrstor",         { M } },
11071     { RM_TABLE (RM_0FAE_REG_5) },
11072   },
11073   {
11074     /* MOD_0FAE_REG_6 */
11075     { "xsaveopt",       { M } },
11076     { RM_TABLE (RM_0FAE_REG_6) },
11077   },
11078   {
11079     /* MOD_0FAE_REG_7 */
11080     { "clflush",        { Mb } },
11081     { RM_TABLE (RM_0FAE_REG_7) },
11082   },
11083   {
11084     /* MOD_0FB2 */
11085     { "lssS",           { Gv, Mp } },
11086     { "(bad)",          { XX } },
11087   },
11088   {
11089     /* MOD_0FB4 */
11090     { "lfsS",           { Gv, Mp } },
11091     { "(bad)",          { XX } },
11092   },
11093   {
11094     /* MOD_0FB5 */
11095     { "lgsS",           { Gv, Mp } },
11096     { "(bad)",          { XX } },
11097   },
11098   {
11099     /* MOD_0FC7_REG_6 */
11100     { PREFIX_TABLE (PREFIX_0FC7_REG_6) },
11101     { "(bad)",          { XX } },
11102   },
11103   {
11104     /* MOD_0FC7_REG_7 */
11105     { "vmptrst",        { Mq } },
11106     { "(bad)",          { XX } },
11107   },
11108   {
11109     /* MOD_0FD7 */
11110     { "(bad)",          { XX } },
11111     { "pmovmskb",       { Gdq, MS } },
11112   },
11113   {
11114     /* MOD_0FE7_PREFIX_2 */
11115     { "movntdq",        { Mx, XM } },
11116     { "(bad)",          { XX } },
11117   },
11118   {
11119     /* MOD_0FF0_PREFIX_3 */
11120     { "lddqu",          { XM, M } },
11121     { "(bad)",          { XX } },
11122   },
11123   {
11124     /* MOD_0F382A_PREFIX_2 */
11125     { "movntdqa",       { XM, Mx } },
11126     { "(bad)",          { XX } },
11127   },
11128   {
11129     /* MOD_62_32BIT */
11130     { "bound{S|}",      { Gv, Ma } },
11131     { "(bad)",          { XX } },
11132   },
11133   {
11134     /* MOD_C4_32BIT */
11135     { "lesS",           { Gv, Mp } },
11136     { VEX_C4_TABLE (VEX_0F) },
11137   },
11138   {
11139     /* MOD_C5_32BIT */
11140     { "ldsS",           { Gv, Mp } },
11141     { VEX_C5_TABLE (VEX_0F) },
11142   },
11143   {
11144     /* MOD_VEX_12_PREFIX_0 */
11145     { VEX_LEN_TABLE (VEX_LEN_12_P_0_M_0) },
11146     { VEX_LEN_TABLE (VEX_LEN_12_P_0_M_1) },
11147   },
11148   {
11149     /* MOD_VEX_13 */
11150     { VEX_LEN_TABLE (VEX_LEN_13_M_0) },
11151     { "(bad)",          { XX } },
11152   },
11153   {
11154     /* MOD_VEX_16_PREFIX_0 */
11155     { VEX_LEN_TABLE (VEX_LEN_16_P_0_M_0) },
11156     { VEX_LEN_TABLE (VEX_LEN_16_P_0_M_1) },
11157   },
11158   {
11159     /* MOD_VEX_17 */
11160     { VEX_LEN_TABLE (VEX_LEN_17_M_0) },
11161     { "(bad)",          { XX } },
11162   },
11163   {
11164     /* MOD_VEX_2B */
11165     { VEX_W_TABLE (VEX_W_2B_M_0) },
11166     { "(bad)",          { XX } },
11167   },
11168   {
11169     /* MOD_VEX_50 */
11170     { "(bad)",          { XX } },
11171     { VEX_W_TABLE (VEX_W_50_M_0) },
11172   },
11173   {
11174     /* MOD_VEX_71_REG_2 */
11175     { "(bad)",          { XX } },
11176     { PREFIX_TABLE (PREFIX_VEX_71_REG_2) },
11177   },
11178   {
11179     /* MOD_VEX_71_REG_4 */
11180     { "(bad)",          { XX } },
11181     { PREFIX_TABLE (PREFIX_VEX_71_REG_4) },
11182   },
11183   {
11184     /* MOD_VEX_71_REG_6 */
11185     { "(bad)",          { XX } },
11186     { PREFIX_TABLE (PREFIX_VEX_71_REG_6) },
11187   },
11188   {
11189     /* MOD_VEX_72_REG_2 */
11190     { "(bad)",          { XX } },
11191     { PREFIX_TABLE (PREFIX_VEX_72_REG_2) },
11192   },
11193   {
11194     /* MOD_VEX_72_REG_4 */
11195     { "(bad)",          { XX } },
11196     { PREFIX_TABLE (PREFIX_VEX_72_REG_4) },
11197   },
11198   {
11199     /* MOD_VEX_72_REG_6 */
11200     { "(bad)",          { XX } },
11201     { PREFIX_TABLE (PREFIX_VEX_72_REG_6) },
11202   },
11203   {
11204     /* MOD_VEX_73_REG_2 */
11205     { "(bad)",          { XX } },
11206     { PREFIX_TABLE (PREFIX_VEX_73_REG_2) },
11207   },
11208   {
11209     /* MOD_VEX_73_REG_3 */
11210     { "(bad)",          { XX } },
11211     { PREFIX_TABLE (PREFIX_VEX_73_REG_3) },
11212   },
11213   {
11214     /* MOD_VEX_73_REG_6 */
11215     { "(bad)",          { XX } },
11216     { PREFIX_TABLE (PREFIX_VEX_73_REG_6) },
11217   },
11218   {
11219     /* MOD_VEX_73_REG_7 */
11220     { "(bad)",          { XX } },
11221     { PREFIX_TABLE (PREFIX_VEX_73_REG_7) },
11222   },
11223   {
11224     /* MOD_VEX_AE_REG_2 */
11225     { VEX_LEN_TABLE (VEX_LEN_AE_R_2_M_0) },
11226     { "(bad)",          { XX } },
11227   },
11228   {
11229     /* MOD_VEX_AE_REG_3 */
11230     { VEX_LEN_TABLE (VEX_LEN_AE_R_3_M_0) },
11231     { "(bad)",          { XX } },
11232   },
11233   {
11234     /* MOD_VEX_D7_PREFIX_2 */
11235     { "(bad)",          { XX } },
11236     { VEX_LEN_TABLE (VEX_LEN_D7_P_2_M_1) },
11237   },
11238   {
11239     /* MOD_VEX_E7_PREFIX_2 */
11240     { VEX_W_TABLE (VEX_W_E7_P_2_M_0) },
11241     { "(bad)",          { XX } },
11242   },
11243   {
11244     /* MOD_VEX_F0_PREFIX_3 */
11245     { VEX_W_TABLE (VEX_W_F0_P_3_M_0) },
11246     { "(bad)",          { XX } },
11247   },
11248   {
11249     /* MOD_VEX_3818_PREFIX_2 */
11250     { "vbroadcastss",   { XM, Md } },
11251     { "(bad)",          { XX } },
11252   },
11253   {
11254     /* MOD_VEX_3819_PREFIX_2 */
11255     { VEX_LEN_TABLE (VEX_LEN_3819_P_2_M_0) },
11256     { "(bad)",          { XX } },
11257   },
11258   {
11259     /* MOD_VEX_381A_PREFIX_2 */
11260     { VEX_LEN_TABLE (VEX_LEN_381A_P_2_M_0) },
11261     { "(bad)",          { XX } },
11262   },
11263   {
11264     /* MOD_VEX_382A_PREFIX_2 */
11265     { VEX_LEN_TABLE (VEX_LEN_382A_P_2_M_0) },
11266     { "(bad)",          { XX } },
11267   },
11268   {
11269     /* MOD_VEX_382C_PREFIX_2 */
11270     { "vmaskmovps",     { XM, Vex, Mx } },
11271     { "(bad)",          { XX } },
11272   },
11273   {
11274     /* MOD_VEX_382D_PREFIX_2 */
11275     { "vmaskmovpd",     { XM, Vex, Mx } },
11276     { "(bad)",          { XX } },
11277   },
11278   {
11279     /* MOD_VEX_382E_PREFIX_2 */
11280     { "vmaskmovps",     { Mx, Vex, XM } },
11281     { "(bad)",          { XX } },
11282   },
11283   {
11284     /* MOD_VEX_382F_PREFIX_2 */
11285     { "vmaskmovpd",     { Mx, Vex, XM } },
11286     { "(bad)",          { XX } },
11287   },
11288 };
11289
11290 static const struct dis386 rm_table[][8] = {
11291   {
11292     /* RM_0F01_REG_0 */
11293     { "(bad)",          { XX } },
11294     { "vmcall",         { Skip_MODRM } },
11295     { "vmlaunch",       { Skip_MODRM } },
11296     { "vmresume",       { Skip_MODRM } },
11297     { "vmxoff",         { Skip_MODRM } },
11298     { "(bad)",          { XX } },
11299     { "(bad)",          { XX } },
11300     { "(bad)",          { XX } },
11301   },
11302   {
11303     /* RM_0F01_REG_1 */
11304     { "monitor",        { { OP_Monitor, 0 } } },
11305     { "mwait",          { { OP_Mwait, 0 } } },
11306     { "(bad)",          { XX } },
11307     { "(bad)",          { XX } },
11308     { "(bad)",          { XX } },
11309     { "(bad)",          { XX } },
11310     { "(bad)",          { XX } },
11311     { "(bad)",          { XX } },
11312   },
11313   {
11314     /* RM_0F01_REG_2 */
11315     { "xgetbv",         { Skip_MODRM } },
11316     { "xsetbv",         { Skip_MODRM } },
11317     { "(bad)",          { XX } },
11318     { "(bad)",          { XX } },
11319     { "(bad)",          { XX } },
11320     { "(bad)",          { XX } },
11321     { "(bad)",          { XX } },
11322     { "(bad)",          { XX } },
11323   },
11324   {
11325     /* RM_0F01_REG_3 */
11326     { "vmrun",          { Skip_MODRM } },
11327     { "vmmcall",        { Skip_MODRM } },
11328     { "vmload",         { Skip_MODRM } },
11329     { "vmsave",         { Skip_MODRM } },
11330     { "stgi",           { Skip_MODRM } },
11331     { "clgi",           { Skip_MODRM } },
11332     { "skinit",         { Skip_MODRM } },
11333     { "invlpga",        { Skip_MODRM } },
11334   },
11335   {
11336     /* RM_0F01_REG_7 */
11337     { "swapgs",         { Skip_MODRM } },
11338     { "rdtscp",         { Skip_MODRM } },
11339     { "(bad)",          { XX } },
11340     { "(bad)",          { XX } },
11341     { "(bad)",          { XX } },
11342     { "(bad)",          { XX } },
11343     { "(bad)",          { XX } },
11344     { "(bad)",          { XX } },
11345   },
11346   {
11347     /* RM_0FAE_REG_5 */
11348     { "lfence",         { Skip_MODRM } },
11349     { "(bad)",          { XX } },
11350     { "(bad)",          { XX } },
11351     { "(bad)",          { XX } },
11352     { "(bad)",          { XX } },
11353     { "(bad)",          { XX } },
11354     { "(bad)",          { XX } },
11355     { "(bad)",          { XX } },
11356   },
11357   {
11358     /* RM_0FAE_REG_6 */
11359     { "mfence",         { Skip_MODRM } },
11360     { "(bad)",          { XX } },
11361     { "(bad)",          { XX } },
11362     { "(bad)",          { XX } },
11363     { "(bad)",          { XX } },
11364     { "(bad)",          { XX } },
11365     { "(bad)",          { XX } },
11366     { "(bad)",          { XX } },
11367   },
11368   {
11369     /* RM_0FAE_REG_7 */
11370     { "sfence",         { Skip_MODRM } },
11371     { "(bad)",          { XX } },
11372     { "(bad)",          { XX } },
11373     { "(bad)",          { XX } },
11374     { "(bad)",          { XX } },
11375     { "(bad)",          { XX } },
11376     { "(bad)",          { XX } },
11377     { "(bad)",          { XX } },
11378   },
11379 };
11380
11381 #define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
11382
11383 /* We use the high bit to indicate different name for the same
11384    prefix.  */
11385 #define ADDR16_PREFIX   (0x67 | 0x100)
11386 #define ADDR32_PREFIX   (0x67 | 0x200)
11387 #define DATA16_PREFIX   (0x66 | 0x100)
11388 #define DATA32_PREFIX   (0x66 | 0x200)
11389 #define REP_PREFIX      (0xf3 | 0x100)
11390
11391 static int
11392 ckprefix (void)
11393 {
11394   int newrex, i, length;
11395   rex = 0;
11396   rex_original = 0;
11397   rex_ignored = 0;
11398   prefixes = 0;
11399   used_prefixes = 0;
11400   rex_used = 0;
11401   last_lock_prefix = -1;
11402   last_repz_prefix = -1;
11403   last_repnz_prefix = -1;
11404   last_data_prefix = -1;
11405   last_addr_prefix = -1;
11406   last_rex_prefix = -1;
11407   last_seg_prefix = -1;
11408   for (i = 0; i < (int) ARRAY_SIZE (all_prefixes); i++)
11409     all_prefixes[i] = 0;
11410   i = 0;
11411   length = 0;
11412   /* The maximum instruction length is 15bytes.  */
11413   while (length < MAX_CODE_LENGTH - 1)
11414     {
11415       FETCH_DATA (the_info, codep + 1);
11416       newrex = 0;
11417       switch (*codep)
11418         {
11419         /* REX prefixes family.  */
11420         case 0x40:
11421         case 0x41:
11422         case 0x42:
11423         case 0x43:
11424         case 0x44:
11425         case 0x45:
11426         case 0x46:
11427         case 0x47:
11428         case 0x48:
11429         case 0x49:
11430         case 0x4a:
11431         case 0x4b:
11432         case 0x4c:
11433         case 0x4d:
11434         case 0x4e:
11435         case 0x4f:
11436           if (address_mode == mode_64bit)
11437             newrex = *codep;
11438           else
11439             return 1;
11440           last_rex_prefix = i;
11441           break;
11442         case 0xf3:
11443           prefixes |= PREFIX_REPZ;
11444           last_repz_prefix = i;
11445           break;
11446         case 0xf2:
11447           prefixes |= PREFIX_REPNZ;
11448           last_repnz_prefix = i;
11449           break;
11450         case 0xf0:
11451           prefixes |= PREFIX_LOCK;
11452           last_lock_prefix = i;
11453           break;
11454         case 0x2e:
11455           prefixes |= PREFIX_CS;
11456           last_seg_prefix = i;
11457           break;
11458         case 0x36:
11459           prefixes |= PREFIX_SS;
11460           last_seg_prefix = i;
11461           break;
11462         case 0x3e:
11463           prefixes |= PREFIX_DS;
11464           last_seg_prefix = i;
11465           break;
11466         case 0x26:
11467           prefixes |= PREFIX_ES;
11468           last_seg_prefix = i;
11469           break;
11470         case 0x64:
11471           prefixes |= PREFIX_FS;
11472           last_seg_prefix = i;
11473           break;
11474         case 0x65:
11475           prefixes |= PREFIX_GS;
11476           last_seg_prefix = i;
11477           break;
11478         case 0x66:
11479           prefixes |= PREFIX_DATA;
11480           last_data_prefix = i;
11481           break;
11482         case 0x67:
11483           prefixes |= PREFIX_ADDR;
11484           last_addr_prefix = i;
11485           break;
11486         case FWAIT_OPCODE:
11487           /* fwait is really an instruction.  If there are prefixes
11488              before the fwait, they belong to the fwait, *not* to the
11489              following instruction.  */
11490           if (prefixes || rex)
11491             {
11492               prefixes |= PREFIX_FWAIT;
11493               codep++;
11494               return 1;
11495             }
11496           prefixes = PREFIX_FWAIT;
11497           break;
11498         default:
11499           return 1;
11500         }
11501       /* Rex is ignored when followed by another prefix.  */
11502       if (rex)
11503         {
11504           rex_used = rex;
11505           return 1;
11506         }
11507       if (*codep != FWAIT_OPCODE)
11508         all_prefixes[i++] = *codep;
11509       rex = newrex;
11510       rex_original = rex;
11511       codep++;
11512       length++;
11513     }
11514   return 0;
11515 }
11516
11517 static int
11518 seg_prefix (int pref)
11519 {
11520   switch (pref)
11521     {
11522     case 0x2e:
11523       return PREFIX_CS;
11524     case 0x36:
11525       return PREFIX_SS;
11526     case 0x3e:
11527       return PREFIX_DS;
11528     case 0x26:
11529       return PREFIX_ES;
11530     case 0x64:
11531       return PREFIX_FS;
11532     case 0x65:
11533       return PREFIX_GS;
11534     default:
11535       return 0;
11536     }
11537 }
11538
11539 /* Return the name of the prefix byte PREF, or NULL if PREF is not a
11540    prefix byte.  */
11541
11542 static const char *
11543 prefix_name (int pref, int sizeflag)
11544 {
11545   static const char *rexes [16] =
11546     {
11547       "rex",            /* 0x40 */
11548       "rex.B",          /* 0x41 */
11549       "rex.X",          /* 0x42 */
11550       "rex.XB",         /* 0x43 */
11551       "rex.R",          /* 0x44 */
11552       "rex.RB",         /* 0x45 */
11553       "rex.RX",         /* 0x46 */
11554       "rex.RXB",        /* 0x47 */
11555       "rex.W",          /* 0x48 */
11556       "rex.WB",         /* 0x49 */
11557       "rex.WX",         /* 0x4a */
11558       "rex.WXB",        /* 0x4b */
11559       "rex.WR",         /* 0x4c */
11560       "rex.WRB",        /* 0x4d */
11561       "rex.WRX",        /* 0x4e */
11562       "rex.WRXB",       /* 0x4f */
11563     };
11564
11565   switch (pref)
11566     {
11567     /* REX prefixes family.  */
11568     case 0x40:
11569     case 0x41:
11570     case 0x42:
11571     case 0x43:
11572     case 0x44:
11573     case 0x45:
11574     case 0x46:
11575     case 0x47:
11576     case 0x48:
11577     case 0x49:
11578     case 0x4a:
11579     case 0x4b:
11580     case 0x4c:
11581     case 0x4d:
11582     case 0x4e:
11583     case 0x4f:
11584       return rexes [pref - 0x40];
11585     case 0xf3:
11586       return "repz";
11587     case 0xf2:
11588       return "repnz";
11589     case 0xf0:
11590       return "lock";
11591     case 0x2e:
11592       return "cs";
11593     case 0x36:
11594       return "ss";
11595     case 0x3e:
11596       return "ds";
11597     case 0x26:
11598       return "es";
11599     case 0x64:
11600       return "fs";
11601     case 0x65:
11602       return "gs";
11603     case 0x66:
11604       return (sizeflag & DFLAG) ? "data16" : "data32";
11605     case 0x67:
11606       if (address_mode == mode_64bit)
11607         return (sizeflag & AFLAG) ? "addr32" : "addr64";
11608       else
11609         return (sizeflag & AFLAG) ? "addr16" : "addr32";
11610     case FWAIT_OPCODE:
11611       return "fwait";
11612     case ADDR16_PREFIX:
11613       return "addr16";
11614     case ADDR32_PREFIX:
11615       return "addr32";
11616     case DATA16_PREFIX:
11617       return "data16";
11618     case DATA32_PREFIX:
11619       return "data32";
11620     case REP_PREFIX:
11621       return "rep";
11622     default:
11623       return NULL;
11624     }
11625 }
11626
11627 static char op_out[MAX_OPERANDS][100];
11628 static int op_ad, op_index[MAX_OPERANDS];
11629 static int two_source_ops;
11630 static bfd_vma op_address[MAX_OPERANDS];
11631 static bfd_vma op_riprel[MAX_OPERANDS];
11632 static bfd_vma start_pc;
11633
11634 /*
11635  *   On the 386's of 1988, the maximum length of an instruction is 15 bytes.
11636  *   (see topic "Redundant prefixes" in the "Differences from 8086"
11637  *   section of the "Virtual 8086 Mode" chapter.)
11638  * 'pc' should be the address of this instruction, it will
11639  *   be used to print the target address if this is a relative jump or call
11640  * The function returns the length of this instruction in bytes.
11641  */
11642
11643 static char intel_syntax;
11644 static char intel_mnemonic = !SYSV386_COMPAT;
11645 static char open_char;
11646 static char close_char;
11647 static char separator_char;
11648 static char scale_char;
11649
11650 /* Here for backwards compatibility.  When gdb stops using
11651    print_insn_i386_att and print_insn_i386_intel these functions can
11652    disappear, and print_insn_i386 be merged into print_insn.  */
11653 int
11654 print_insn_i386_att (bfd_vma pc, disassemble_info *info)
11655 {
11656   intel_syntax = 0;
11657
11658   return print_insn (pc, info);
11659 }
11660
11661 int
11662 print_insn_i386_intel (bfd_vma pc, disassemble_info *info)
11663 {
11664   intel_syntax = 1;
11665
11666   return print_insn (pc, info);
11667 }
11668
11669 int
11670 print_insn_i386 (bfd_vma pc, disassemble_info *info)
11671 {
11672   intel_syntax = -1;
11673
11674   return print_insn (pc, info);
11675 }
11676
11677 void
11678 print_i386_disassembler_options (FILE *stream)
11679 {
11680   fprintf (stream, _("\n\
11681 The following i386/x86-64 specific disassembler options are supported for use\n\
11682 with the -M switch (multiple options should be separated by commas):\n"));
11683
11684   fprintf (stream, _("  x86-64      Disassemble in 64bit mode\n"));
11685   fprintf (stream, _("  i386        Disassemble in 32bit mode\n"));
11686   fprintf (stream, _("  i8086       Disassemble in 16bit mode\n"));
11687   fprintf (stream, _("  att         Display instruction in AT&T syntax\n"));
11688   fprintf (stream, _("  intel       Display instruction in Intel syntax\n"));
11689   fprintf (stream, _("  att-mnemonic\n"
11690                      "              Display instruction in AT&T mnemonic\n"));
11691   fprintf (stream, _("  intel-mnemonic\n"
11692                      "              Display instruction in Intel mnemonic\n"));
11693   fprintf (stream, _("  addr64      Assume 64bit address size\n"));
11694   fprintf (stream, _("  addr32      Assume 32bit address size\n"));
11695   fprintf (stream, _("  addr16      Assume 16bit address size\n"));
11696   fprintf (stream, _("  data32      Assume 32bit data size\n"));
11697   fprintf (stream, _("  data16      Assume 16bit data size\n"));
11698   fprintf (stream, _("  suffix      Always display instruction suffix in AT&T syntax\n"));
11699 }
11700
11701 /* Get a pointer to struct dis386 with a valid name.  */
11702
11703 static const struct dis386 *
11704 get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
11705 {
11706   int vindex, vex_table_index;
11707
11708   if (dp->name != NULL)
11709     return dp;
11710
11711   switch (dp->op[0].bytemode)
11712     {
11713     case USE_REG_TABLE:
11714       dp = &reg_table[dp->op[1].bytemode][modrm.reg];
11715       break;
11716
11717     case USE_MOD_TABLE:
11718       vindex = modrm.mod == 0x3 ? 1 : 0;
11719       dp = &mod_table[dp->op[1].bytemode][vindex];
11720       break;
11721
11722     case USE_RM_TABLE:
11723       dp = &rm_table[dp->op[1].bytemode][modrm.rm];
11724       break;
11725
11726     case USE_PREFIX_TABLE:
11727       if (need_vex)
11728         {
11729           /* The prefix in VEX is implicit.  */
11730           switch (vex.prefix)
11731             {
11732             case 0:
11733               vindex = 0;
11734               break;
11735             case REPE_PREFIX_OPCODE:
11736               vindex = 1;
11737               break;
11738             case DATA_PREFIX_OPCODE:
11739               vindex = 2;
11740               break;
11741             case REPNE_PREFIX_OPCODE:
11742               vindex = 3;
11743               break;
11744             default:
11745               abort ();
11746               break;
11747             }
11748         }
11749       else 
11750         {
11751           vindex = 0;
11752           used_prefixes |= (prefixes & PREFIX_REPZ);
11753           if (prefixes & PREFIX_REPZ)
11754             {
11755               vindex = 1;
11756               all_prefixes[last_repz_prefix] = 0;
11757             }
11758           else
11759             {
11760               /* We should check PREFIX_REPNZ and PREFIX_REPZ before
11761                  PREFIX_DATA.  */
11762               used_prefixes |= (prefixes & PREFIX_REPNZ);
11763               if (prefixes & PREFIX_REPNZ)
11764                 {
11765                   vindex = 3;
11766                   all_prefixes[last_repnz_prefix] = 0;
11767                 }
11768               else
11769                 {
11770                   used_prefixes |= (prefixes & PREFIX_DATA);
11771                   if (prefixes & PREFIX_DATA)
11772                     {
11773                       vindex = 2;
11774                       all_prefixes[last_data_prefix] = 0;
11775                     }
11776                 }
11777             }
11778         }
11779       dp = &prefix_table[dp->op[1].bytemode][vindex];
11780       break;
11781
11782     case USE_X86_64_TABLE:
11783       vindex = address_mode == mode_64bit ? 1 : 0;
11784       dp = &x86_64_table[dp->op[1].bytemode][vindex];
11785       break;
11786
11787     case USE_3BYTE_TABLE:
11788       FETCH_DATA (info, codep + 2);
11789       vindex = *codep++;
11790       dp = &three_byte_table[dp->op[1].bytemode][vindex];
11791       modrm.mod = (*codep >> 6) & 3;
11792       modrm.reg = (*codep >> 3) & 7;
11793       modrm.rm = *codep & 7;
11794       break;
11795
11796     case USE_VEX_LEN_TABLE:
11797       if (!need_vex)
11798         abort ();
11799
11800       switch (vex.length)
11801         {
11802         case 128:
11803           vindex = 0;
11804           break;
11805         case 256:
11806           vindex = 1;
11807           break;
11808         default:
11809           abort ();
11810           break;
11811         }
11812
11813       dp = &vex_len_table[dp->op[1].bytemode][vindex];
11814       break;
11815
11816     case USE_XOP_8F_TABLE:
11817       FETCH_DATA (info, codep + 3);
11818       /* All bits in the REX prefix are ignored.  */
11819       rex_ignored = rex;
11820       rex = ~(*codep >> 5) & 0x7;
11821
11822       /* VEX_TABLE_INDEX is the mmmmm part of the XOP byte 1 "RCB.mmmmm".  */
11823       switch ((*codep & 0x1f))
11824         {
11825         default:
11826           BadOp ();
11827         case 0x8:
11828           vex_table_index = XOP_08;
11829           break;
11830         case 0x9:
11831           vex_table_index = XOP_09;
11832           break;
11833         case 0xa:
11834           vex_table_index = XOP_0A;
11835           break;
11836         }
11837       codep++;
11838       vex.w = *codep & 0x80;
11839       if (vex.w && address_mode == mode_64bit)
11840         rex |= REX_W;
11841
11842       vex.register_specifier = (~(*codep >> 3)) & 0xf;
11843       if (address_mode != mode_64bit
11844           && vex.register_specifier > 0x7)
11845         BadOp ();
11846
11847       vex.length = (*codep & 0x4) ? 256 : 128;
11848       switch ((*codep & 0x3))
11849         {
11850         case 0:
11851           vex.prefix = 0;
11852           break;
11853         case 1:
11854           vex.prefix = DATA_PREFIX_OPCODE;
11855           break;
11856         case 2:
11857           vex.prefix = REPE_PREFIX_OPCODE;
11858           break;
11859         case 3:
11860           vex.prefix = REPNE_PREFIX_OPCODE;
11861           break;
11862         }
11863       need_vex = 1;
11864       need_vex_reg = 1;
11865       codep++;
11866       vindex = *codep++;
11867       dp = &xop_table[vex_table_index][vindex];
11868
11869       FETCH_DATA (info, codep + 1);
11870       modrm.mod = (*codep >> 6) & 3;
11871       modrm.reg = (*codep >> 3) & 7;
11872       modrm.rm = *codep & 7;
11873       break;
11874
11875     case USE_VEX_C4_TABLE:
11876       FETCH_DATA (info, codep + 3);
11877       /* All bits in the REX prefix are ignored.  */
11878       rex_ignored = rex;
11879       rex = ~(*codep >> 5) & 0x7;
11880       switch ((*codep & 0x1f))
11881         {
11882         default:
11883           BadOp ();
11884         case 0x1:
11885           vex_table_index = VEX_0F;
11886           break;
11887         case 0x2:
11888           vex_table_index = VEX_0F38;
11889           break;
11890         case 0x3:
11891           vex_table_index = VEX_0F3A;
11892           break;
11893         }
11894       codep++;
11895       vex.w = *codep & 0x80;
11896       if (vex.w && address_mode == mode_64bit)
11897         rex |= REX_W;
11898
11899       vex.register_specifier = (~(*codep >> 3)) & 0xf;
11900       if (address_mode != mode_64bit
11901           && vex.register_specifier > 0x7)
11902         BadOp ();
11903
11904       vex.length = (*codep & 0x4) ? 256 : 128;
11905       switch ((*codep & 0x3))
11906         {
11907         case 0:
11908           vex.prefix = 0;
11909           break;
11910         case 1:
11911           vex.prefix = DATA_PREFIX_OPCODE;
11912           break;
11913         case 2:
11914           vex.prefix = REPE_PREFIX_OPCODE;
11915           break;
11916         case 3:
11917           vex.prefix = REPNE_PREFIX_OPCODE;
11918           break;
11919         }
11920       need_vex = 1;
11921       need_vex_reg = 1;
11922       codep++;
11923       vindex = *codep++;
11924       dp = &vex_table[vex_table_index][vindex];
11925       /* There is no MODRM byte for VEX [82|77].  */
11926       if (vindex != 0x77 && vindex != 0x82)
11927         {
11928           FETCH_DATA (info, codep + 1);
11929           modrm.mod = (*codep >> 6) & 3;
11930           modrm.reg = (*codep >> 3) & 7;
11931           modrm.rm = *codep & 7;
11932         }
11933       break;
11934
11935     case USE_VEX_C5_TABLE:
11936       FETCH_DATA (info, codep + 2);
11937       /* All bits in the REX prefix are ignored.  */
11938       rex_ignored = rex;
11939       rex = (*codep & 0x80) ? 0 : REX_R;
11940
11941       vex.register_specifier = (~(*codep >> 3)) & 0xf;
11942       if (address_mode != mode_64bit
11943           && vex.register_specifier > 0x7)
11944         BadOp ();
11945
11946       vex.w = 0;
11947
11948       vex.length = (*codep & 0x4) ? 256 : 128;
11949       switch ((*codep & 0x3))
11950         {
11951         case 0:
11952           vex.prefix = 0;
11953           break;
11954         case 1:
11955           vex.prefix = DATA_PREFIX_OPCODE;
11956           break;
11957         case 2:
11958           vex.prefix = REPE_PREFIX_OPCODE;
11959           break;
11960         case 3:
11961           vex.prefix = REPNE_PREFIX_OPCODE;
11962           break;
11963         }
11964       need_vex = 1;
11965       need_vex_reg = 1;
11966       codep++;
11967       vindex = *codep++;
11968       dp = &vex_table[dp->op[1].bytemode][vindex];
11969       /* There is no MODRM byte for VEX [82|77].  */
11970       if (vindex != 0x77 && vindex != 0x82)
11971         {
11972           FETCH_DATA (info, codep + 1);
11973           modrm.mod = (*codep >> 6) & 3;
11974           modrm.reg = (*codep >> 3) & 7;
11975           modrm.rm = *codep & 7;
11976         }
11977       break;
11978
11979     case USE_VEX_W_TABLE:
11980       if (!need_vex)
11981         abort ();
11982
11983       dp = &vex_w_table[dp->op[1].bytemode][vex.w ? 1 : 0];
11984       break;
11985
11986     default:
11987       abort ();
11988     }
11989
11990   if (dp->name != NULL)
11991     return dp;
11992   else
11993     return get_valid_dis386 (dp, info);
11994 }
11995
11996 static int
11997 print_insn (bfd_vma pc, disassemble_info *info)
11998 {
11999   const struct dis386 *dp;
12000   int i;
12001   char *op_txt[MAX_OPERANDS];
12002   int needcomma;
12003   int sizeflag;
12004   const char *p;
12005   struct dis_private priv;
12006   unsigned char op;
12007   int prefix_length;
12008   int default_prefixes;
12009
12010   if (info->mach == bfd_mach_x86_64_intel_syntax
12011       || info->mach == bfd_mach_x86_64
12012       || info->mach == bfd_mach_l1om
12013       || info->mach == bfd_mach_l1om_intel_syntax)
12014     address_mode = mode_64bit;
12015   else
12016     address_mode = mode_32bit;
12017
12018   if (intel_syntax == (char) -1)
12019     intel_syntax = (info->mach == bfd_mach_i386_i386_intel_syntax
12020                     || info->mach == bfd_mach_x86_64_intel_syntax
12021                     || info->mach == bfd_mach_l1om_intel_syntax);
12022
12023   if (info->mach == bfd_mach_i386_i386
12024       || info->mach == bfd_mach_x86_64
12025       || info->mach == bfd_mach_l1om
12026       || info->mach == bfd_mach_i386_i386_intel_syntax
12027       || info->mach == bfd_mach_x86_64_intel_syntax
12028       || info->mach == bfd_mach_l1om_intel_syntax)
12029     priv.orig_sizeflag = AFLAG | DFLAG;
12030   else if (info->mach == bfd_mach_i386_i8086)
12031     priv.orig_sizeflag = 0;
12032   else
12033     abort ();
12034
12035   for (p = info->disassembler_options; p != NULL; )
12036     {
12037       if (CONST_STRNEQ (p, "x86-64"))
12038         {
12039           address_mode = mode_64bit;
12040           priv.orig_sizeflag = AFLAG | DFLAG;
12041         }
12042       else if (CONST_STRNEQ (p, "i386"))
12043         {
12044           address_mode = mode_32bit;
12045           priv.orig_sizeflag = AFLAG | DFLAG;
12046         }
12047       else if (CONST_STRNEQ (p, "i8086"))
12048         {
12049           address_mode = mode_16bit;
12050           priv.orig_sizeflag = 0;
12051         }
12052       else if (CONST_STRNEQ (p, "intel"))
12053         {
12054           intel_syntax = 1;
12055           if (CONST_STRNEQ (p + 5, "-mnemonic"))
12056             intel_mnemonic = 1;
12057         }
12058       else if (CONST_STRNEQ (p, "att"))
12059         {
12060           intel_syntax = 0;
12061           if (CONST_STRNEQ (p + 3, "-mnemonic"))
12062             intel_mnemonic = 0;
12063         }
12064       else if (CONST_STRNEQ (p, "addr"))
12065         {
12066           if (address_mode == mode_64bit)
12067             {
12068               if (p[4] == '3' && p[5] == '2')
12069                 priv.orig_sizeflag &= ~AFLAG;
12070               else if (p[4] == '6' && p[5] == '4')
12071                 priv.orig_sizeflag |= AFLAG;
12072             }
12073           else
12074             {
12075               if (p[4] == '1' && p[5] == '6')
12076                 priv.orig_sizeflag &= ~AFLAG;
12077               else if (p[4] == '3' && p[5] == '2')
12078                 priv.orig_sizeflag |= AFLAG;
12079             }
12080         }
12081       else if (CONST_STRNEQ (p, "data"))
12082         {
12083           if (p[4] == '1' && p[5] == '6')
12084             priv.orig_sizeflag &= ~DFLAG;
12085           else if (p[4] == '3' && p[5] == '2')
12086             priv.orig_sizeflag |= DFLAG;
12087         }
12088       else if (CONST_STRNEQ (p, "suffix"))
12089         priv.orig_sizeflag |= SUFFIX_ALWAYS;
12090
12091       p = strchr (p, ',');
12092       if (p != NULL)
12093         p++;
12094     }
12095
12096   if (intel_syntax)
12097     {
12098       names64 = intel_names64;
12099       names32 = intel_names32;
12100       names16 = intel_names16;
12101       names8 = intel_names8;
12102       names8rex = intel_names8rex;
12103       names_seg = intel_names_seg;
12104       index64 = intel_index64;
12105       index32 = intel_index32;
12106       index16 = intel_index16;
12107       open_char = '[';
12108       close_char = ']';
12109       separator_char = '+';
12110       scale_char = '*';
12111     }
12112   else
12113     {
12114       names64 = att_names64;
12115       names32 = att_names32;
12116       names16 = att_names16;
12117       names8 = att_names8;
12118       names8rex = att_names8rex;
12119       names_seg = att_names_seg;
12120       index64 = att_index64;
12121       index32 = att_index32;
12122       index16 = att_index16;
12123       open_char = '(';
12124       close_char =  ')';
12125       separator_char = ',';
12126       scale_char = ',';
12127     }
12128
12129   /* The output looks better if we put 7 bytes on a line, since that
12130      puts most long word instructions on a single line.  Use 8 bytes
12131      for Intel L1OM.  */
12132   if (info->mach == bfd_mach_l1om
12133       || info->mach == bfd_mach_l1om_intel_syntax)
12134     info->bytes_per_line = 8;
12135   else
12136     info->bytes_per_line = 7;
12137
12138   info->private_data = &priv;
12139   priv.max_fetched = priv.the_buffer;
12140   priv.insn_start = pc;
12141
12142   obuf[0] = 0;
12143   for (i = 0; i < MAX_OPERANDS; ++i)
12144     {
12145       op_out[i][0] = 0;
12146       op_index[i] = -1;
12147     }
12148
12149   the_info = info;
12150   start_pc = pc;
12151   start_codep = priv.the_buffer;
12152   codep = priv.the_buffer;
12153
12154   if (setjmp (priv.bailout) != 0)
12155     {
12156       const char *name;
12157
12158       /* Getting here means we tried for data but didn't get it.  That
12159          means we have an incomplete instruction of some sort.  Just
12160          print the first byte as a prefix or a .byte pseudo-op.  */
12161       if (codep > priv.the_buffer)
12162         {
12163           name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
12164           if (name != NULL)
12165             (*info->fprintf_func) (info->stream, "%s", name);
12166           else
12167             {
12168               /* Just print the first byte as a .byte instruction.  */
12169               (*info->fprintf_func) (info->stream, ".byte 0x%x",
12170                                      (unsigned int) priv.the_buffer[0]);
12171             }
12172
12173           return 1;
12174         }
12175
12176       return -1;
12177     }
12178
12179   obufp = obuf;
12180   sizeflag = priv.orig_sizeflag;
12181
12182   if (!ckprefix () || rex_used)
12183     {
12184       /* Too many prefixes or unused REX prefixes.  */
12185       for (i = 0;
12186            all_prefixes[i] && i < (int) ARRAY_SIZE (all_prefixes);
12187            i++)
12188         (*info->fprintf_func) (info->stream, "%s",
12189                                prefix_name (all_prefixes[i], sizeflag));
12190       return 1;
12191     }
12192
12193   insn_codep = codep;
12194
12195   FETCH_DATA (info, codep + 1);
12196   two_source_ops = (*codep == 0x62) || (*codep == 0xc8);
12197
12198   if (((prefixes & PREFIX_FWAIT)
12199        && ((*codep < 0xd8) || (*codep > 0xdf))))
12200     {
12201       (*info->fprintf_func) (info->stream, "fwait");
12202       return 1;
12203     }
12204
12205   op = 0;
12206
12207   if (*codep == 0x0f)
12208     {
12209       unsigned char threebyte;
12210       FETCH_DATA (info, codep + 2);
12211       threebyte = *++codep;
12212       dp = &dis386_twobyte[threebyte];
12213       need_modrm = twobyte_has_modrm[*codep];
12214       codep++;
12215     }
12216   else
12217     {
12218       dp = &dis386[*codep];
12219       need_modrm = onebyte_has_modrm[*codep];
12220       codep++;
12221     }
12222
12223   if ((prefixes & PREFIX_REPZ))
12224     used_prefixes |= PREFIX_REPZ;
12225   if ((prefixes & PREFIX_REPNZ))
12226     used_prefixes |= PREFIX_REPNZ;
12227   if ((prefixes & PREFIX_LOCK))
12228     used_prefixes |= PREFIX_LOCK;
12229
12230   default_prefixes = 0;
12231   if (prefixes & PREFIX_ADDR)
12232     {
12233       sizeflag ^= AFLAG;
12234       if (dp->op[2].bytemode != loop_jcxz_mode || intel_syntax)
12235         {
12236           if ((sizeflag & AFLAG) || address_mode == mode_64bit)
12237             all_prefixes[last_addr_prefix] = ADDR32_PREFIX;
12238           else
12239             all_prefixes[last_addr_prefix] = ADDR16_PREFIX;
12240           default_prefixes |= PREFIX_ADDR;
12241         }
12242     }
12243
12244   if ((prefixes & PREFIX_DATA))
12245     {
12246       sizeflag ^= DFLAG;
12247       if (dp->op[2].bytemode == cond_jump_mode
12248           && dp->op[0].bytemode == v_mode
12249           && !intel_syntax)
12250         {
12251           if (sizeflag & DFLAG)
12252             all_prefixes[last_data_prefix] = DATA32_PREFIX;
12253           else
12254             all_prefixes[last_data_prefix] = DATA16_PREFIX;
12255           default_prefixes |= PREFIX_DATA;
12256         }
12257       else if (rex & REX_W)
12258         {
12259           /* REX_W will override PREFIX_DATA.  */
12260           default_prefixes |= PREFIX_DATA;
12261         }
12262     }
12263
12264   if (need_modrm)
12265     {
12266       FETCH_DATA (info, codep + 1);
12267       modrm.mod = (*codep >> 6) & 3;
12268       modrm.reg = (*codep >> 3) & 7;
12269       modrm.rm = *codep & 7;
12270     }
12271
12272    need_vex = 0;
12273    need_vex_reg = 0;
12274    vex_w_done = 0;
12275
12276   if (dp->name == NULL && dp->op[0].bytemode == FLOATCODE)
12277     {
12278       dofloat (sizeflag);
12279     }
12280   else
12281     {
12282       dp = get_valid_dis386 (dp, info);
12283       if (dp != NULL && putop (dp->name, sizeflag) == 0)
12284         {
12285           for (i = 0; i < MAX_OPERANDS; ++i)
12286             {
12287               obufp = op_out[i];
12288               op_ad = MAX_OPERANDS - 1 - i;
12289               if (dp->op[i].rtn)
12290                 (*dp->op[i].rtn) (dp->op[i].bytemode, sizeflag);
12291             }
12292         }
12293     }
12294
12295   /* See if any prefixes were not used.  If so, print the first one
12296      separately.  If we don't do this, we'll wind up printing an
12297      instruction stream which does not precisely correspond to the
12298      bytes we are disassembling.  */
12299   if ((prefixes & ~(used_prefixes | default_prefixes)) != 0)
12300     {
12301       for (i = 0; i < (int) ARRAY_SIZE (all_prefixes); i++)
12302         if (all_prefixes[i])
12303           {
12304             const char *name;
12305             name = prefix_name (all_prefixes[i], priv.orig_sizeflag);
12306             if (name == NULL)
12307               name = INTERNAL_DISASSEMBLER_ERROR;
12308             (*info->fprintf_func) (info->stream, "%s", name);
12309             return 1;
12310           }
12311     }
12312
12313   /* Check if the REX prefix used.  */
12314   if (rex_ignored == 0 && (rex ^ rex_used) == 0)
12315     all_prefixes[last_rex_prefix] = 0;
12316
12317   /* Check if the SEG prefix used.  */
12318   if ((prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS | PREFIX_ES
12319                    | PREFIX_FS | PREFIX_GS)) != 0
12320       && (used_prefixes
12321           & seg_prefix (all_prefixes[last_seg_prefix])) != 0)
12322     all_prefixes[last_seg_prefix] = 0;
12323
12324   /* Check if the ADDR prefix used.  */
12325   if ((prefixes & PREFIX_ADDR) != 0
12326       && (used_prefixes & PREFIX_ADDR) != 0)
12327     all_prefixes[last_addr_prefix] = 0;
12328
12329   /* Check if the DATA prefix used.  */
12330   if ((prefixes & PREFIX_DATA) != 0
12331       && (used_prefixes & PREFIX_DATA) != 0)
12332     all_prefixes[last_data_prefix] = 0;
12333
12334   prefix_length = 0;
12335   for (i = 0; i < (int) ARRAY_SIZE (all_prefixes); i++)
12336     if (all_prefixes[i])
12337       {
12338         const char *name;
12339         name = prefix_name (all_prefixes[i], sizeflag);
12340         if (name == NULL)
12341           abort ();
12342         prefix_length += strlen (name) + 1;
12343         (*info->fprintf_func) (info->stream, "%s ", name);
12344       }
12345
12346   /* Check maximum code length.  */
12347   if ((codep - start_codep) > MAX_CODE_LENGTH)
12348     {
12349       (*info->fprintf_func) (info->stream, "(bad)");
12350       return MAX_CODE_LENGTH;
12351     }
12352
12353   obufp = mnemonicendp;
12354   for (i = strlen (obuf) + prefix_length; i < 6; i++)
12355     oappend (" ");
12356   oappend (" ");
12357   (*info->fprintf_func) (info->stream, "%s", obuf);
12358
12359   /* The enter and bound instructions are printed with operands in the same
12360      order as the intel book; everything else is printed in reverse order.  */
12361   if (intel_syntax || two_source_ops)
12362     {
12363       bfd_vma riprel;
12364
12365       for (i = 0; i < MAX_OPERANDS; ++i)
12366         op_txt[i] = op_out[i];
12367
12368       for (i = 0; i < (MAX_OPERANDS >> 1); ++i)
12369         {
12370           op_ad = op_index[i];
12371           op_index[i] = op_index[MAX_OPERANDS - 1 - i];
12372           op_index[MAX_OPERANDS - 1 - i] = op_ad;
12373           riprel = op_riprel[i];
12374           op_riprel[i] = op_riprel [MAX_OPERANDS - 1 - i];
12375           op_riprel[MAX_OPERANDS - 1 - i] = riprel;
12376         }
12377     }
12378   else
12379     {
12380       for (i = 0; i < MAX_OPERANDS; ++i)
12381         op_txt[MAX_OPERANDS - 1 - i] = op_out[i];
12382     }
12383
12384   needcomma = 0;
12385   for (i = 0; i < MAX_OPERANDS; ++i)
12386     if (*op_txt[i])
12387       {
12388         if (needcomma)
12389           (*info->fprintf_func) (info->stream, ",");
12390         if (op_index[i] != -1 && !op_riprel[i])
12391           (*info->print_address_func) ((bfd_vma) op_address[op_index[i]], info);
12392         else
12393           (*info->fprintf_func) (info->stream, "%s", op_txt[i]);
12394         needcomma = 1;
12395       }
12396
12397   for (i = 0; i < MAX_OPERANDS; i++)
12398     if (op_index[i] != -1 && op_riprel[i])
12399       {
12400         (*info->fprintf_func) (info->stream, "        # ");
12401         (*info->print_address_func) ((bfd_vma) (start_pc + codep - start_codep
12402                                                 + op_address[op_index[i]]), info);
12403         break;
12404       }
12405   return codep - priv.the_buffer;
12406 }
12407
12408 static const char *float_mem[] = {
12409   /* d8 */
12410   "fadd{s|}",
12411   "fmul{s|}",
12412   "fcom{s|}",
12413   "fcomp{s|}",
12414   "fsub{s|}",
12415   "fsubr{s|}",
12416   "fdiv{s|}",
12417   "fdivr{s|}",
12418   /* d9 */
12419   "fld{s|}",
12420   "(bad)",
12421   "fst{s|}",
12422   "fstp{s|}",
12423   "fldenvIC",
12424   "fldcw",
12425   "fNstenvIC",
12426   "fNstcw",
12427   /* da */
12428   "fiadd{l|}",
12429   "fimul{l|}",
12430   "ficom{l|}",
12431   "ficomp{l|}",
12432   "fisub{l|}",
12433   "fisubr{l|}",
12434   "fidiv{l|}",
12435   "fidivr{l|}",
12436   /* db */
12437   "fild{l|}",
12438   "fisttp{l|}",
12439   "fist{l|}",
12440   "fistp{l|}",
12441   "(bad)",
12442   "fld{t||t|}",
12443   "(bad)",
12444   "fstp{t||t|}",
12445   /* dc */
12446   "fadd{l|}",
12447   "fmul{l|}",
12448   "fcom{l|}",
12449   "fcomp{l|}",
12450   "fsub{l|}",
12451   "fsubr{l|}",
12452   "fdiv{l|}",
12453   "fdivr{l|}",
12454   /* dd */
12455   "fld{l|}",
12456   "fisttp{ll|}",
12457   "fst{l||}",
12458   "fstp{l|}",
12459   "frstorIC",
12460   "(bad)",
12461   "fNsaveIC",
12462   "fNstsw",
12463   /* de */
12464   "fiadd",
12465   "fimul",
12466   "ficom",
12467   "ficomp",
12468   "fisub",
12469   "fisubr",
12470   "fidiv",
12471   "fidivr",
12472   /* df */
12473   "fild",
12474   "fisttp",
12475   "fist",
12476   "fistp",
12477   "fbld",
12478   "fild{ll|}",
12479   "fbstp",
12480   "fistp{ll|}",
12481 };
12482
12483 static const unsigned char float_mem_mode[] = {
12484   /* d8 */
12485   d_mode,
12486   d_mode,
12487   d_mode,
12488   d_mode,
12489   d_mode,
12490   d_mode,
12491   d_mode,
12492   d_mode,
12493   /* d9 */
12494   d_mode,
12495   0,
12496   d_mode,
12497   d_mode,
12498   0,
12499   w_mode,
12500   0,
12501   w_mode,
12502   /* da */
12503   d_mode,
12504   d_mode,
12505   d_mode,
12506   d_mode,
12507   d_mode,
12508   d_mode,
12509   d_mode,
12510   d_mode,
12511   /* db */
12512   d_mode,
12513   d_mode,
12514   d_mode,
12515   d_mode,
12516   0,
12517   t_mode,
12518   0,
12519   t_mode,
12520   /* dc */
12521   q_mode,
12522   q_mode,
12523   q_mode,
12524   q_mode,
12525   q_mode,
12526   q_mode,
12527   q_mode,
12528   q_mode,
12529   /* dd */
12530   q_mode,
12531   q_mode,
12532   q_mode,
12533   q_mode,
12534   0,
12535   0,
12536   0,
12537   w_mode,
12538   /* de */
12539   w_mode,
12540   w_mode,
12541   w_mode,
12542   w_mode,
12543   w_mode,
12544   w_mode,
12545   w_mode,
12546   w_mode,
12547   /* df */
12548   w_mode,
12549   w_mode,
12550   w_mode,
12551   w_mode,
12552   t_mode,
12553   q_mode,
12554   t_mode,
12555   q_mode
12556 };
12557
12558 #define ST { OP_ST, 0 }
12559 #define STi { OP_STi, 0 }
12560
12561 #define FGRPd9_2 NULL, { { NULL, 0 } }
12562 #define FGRPd9_4 NULL, { { NULL, 1 } }
12563 #define FGRPd9_5 NULL, { { NULL, 2 } }
12564 #define FGRPd9_6 NULL, { { NULL, 3 } }
12565 #define FGRPd9_7 NULL, { { NULL, 4 } }
12566 #define FGRPda_5 NULL, { { NULL, 5 } }
12567 #define FGRPdb_4 NULL, { { NULL, 6 } }
12568 #define FGRPde_3 NULL, { { NULL, 7 } }
12569 #define FGRPdf_4 NULL, { { NULL, 8 } }
12570
12571 static const struct dis386 float_reg[][8] = {
12572   /* d8 */
12573   {
12574     { "fadd",   { ST, STi } },
12575     { "fmul",   { ST, STi } },
12576     { "fcom",   { STi } },
12577     { "fcomp",  { STi } },
12578     { "fsub",   { ST, STi } },
12579     { "fsubr",  { ST, STi } },
12580     { "fdiv",   { ST, STi } },
12581     { "fdivr",  { ST, STi } },
12582   },
12583   /* d9 */
12584   {
12585     { "fld",    { STi } },
12586     { "fxch",   { STi } },
12587     { FGRPd9_2 },
12588     { "(bad)",  { XX } },
12589     { FGRPd9_4 },
12590     { FGRPd9_5 },
12591     { FGRPd9_6 },
12592     { FGRPd9_7 },
12593   },
12594   /* da */
12595   {
12596     { "fcmovb", { ST, STi } },
12597     { "fcmove", { ST, STi } },
12598     { "fcmovbe",{ ST, STi } },
12599     { "fcmovu", { ST, STi } },
12600     { "(bad)",  { XX } },
12601     { FGRPda_5 },
12602     { "(bad)",  { XX } },
12603     { "(bad)",  { XX } },
12604   },
12605   /* db */
12606   {
12607     { "fcmovnb",{ ST, STi } },
12608     { "fcmovne",{ ST, STi } },
12609     { "fcmovnbe",{ ST, STi } },
12610     { "fcmovnu",{ ST, STi } },
12611     { FGRPdb_4 },
12612     { "fucomi", { ST, STi } },
12613     { "fcomi",  { ST, STi } },
12614     { "(bad)",  { XX } },
12615   },
12616   /* dc */
12617   {
12618     { "fadd",   { STi, ST } },
12619     { "fmul",   { STi, ST } },
12620     { "(bad)",  { XX } },
12621     { "(bad)",  { XX } },
12622     { "fsub!M", { STi, ST } },
12623     { "fsubM",  { STi, ST } },
12624     { "fdiv!M", { STi, ST } },
12625     { "fdivM",  { STi, ST } },
12626   },
12627   /* dd */
12628   {
12629     { "ffree",  { STi } },
12630     { "(bad)",  { XX } },
12631     { "fst",    { STi } },
12632     { "fstp",   { STi } },
12633     { "fucom",  { STi } },
12634     { "fucomp", { STi } },
12635     { "(bad)",  { XX } },
12636     { "(bad)",  { XX } },
12637   },
12638   /* de */
12639   {
12640     { "faddp",  { STi, ST } },
12641     { "fmulp",  { STi, ST } },
12642     { "(bad)",  { XX } },
12643     { FGRPde_3 },
12644     { "fsub!Mp", { STi, ST } },
12645     { "fsubMp", { STi, ST } },
12646     { "fdiv!Mp", { STi, ST } },
12647     { "fdivMp", { STi, ST } },
12648   },
12649   /* df */
12650   {
12651     { "ffreep", { STi } },
12652     { "(bad)",  { XX } },
12653     { "(bad)",  { XX } },
12654     { "(bad)",  { XX } },
12655     { FGRPdf_4 },
12656     { "fucomip", { ST, STi } },
12657     { "fcomip", { ST, STi } },
12658     { "(bad)",  { XX } },
12659   },
12660 };
12661
12662 static char *fgrps[][8] = {
12663   /* d9_2  0 */
12664   {
12665     "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
12666   },
12667
12668   /* d9_4  1 */
12669   {
12670     "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)",
12671   },
12672
12673   /* d9_5  2 */
12674   {
12675     "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)",
12676   },
12677
12678   /* d9_6  3 */
12679   {
12680     "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp",
12681   },
12682
12683   /* d9_7  4 */
12684   {
12685     "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos",
12686   },
12687
12688   /* da_5  5 */
12689   {
12690     "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
12691   },
12692
12693   /* db_4  6 */
12694   {
12695     "fNeni(8087 only)","fNdisi(8087 only)","fNclex","fNinit",
12696     "fNsetpm(287 only)","frstpm(287 only)","(bad)","(bad)",
12697   },
12698
12699   /* de_3  7 */
12700   {
12701     "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
12702   },
12703
12704   /* df_4  8 */
12705   {
12706     "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
12707   },
12708 };
12709
12710 static void
12711 swap_operand (void)
12712 {
12713   mnemonicendp[0] = '.';
12714   mnemonicendp[1] = 's';
12715   mnemonicendp += 2;
12716 }
12717
12718 static void
12719 OP_Skip_MODRM (int bytemode ATTRIBUTE_UNUSED,
12720                int sizeflag ATTRIBUTE_UNUSED)
12721 {
12722   /* Skip mod/rm byte.  */
12723   MODRM_CHECK;
12724   codep++;
12725 }
12726
12727 static void
12728 dofloat (int sizeflag)
12729 {
12730   const struct dis386 *dp;
12731   unsigned char floatop;
12732
12733   floatop = codep[-1];
12734
12735   if (modrm.mod != 3)
12736     {
12737       int fp_indx = (floatop - 0xd8) * 8 + modrm.reg;
12738
12739       putop (float_mem[fp_indx], sizeflag);
12740       obufp = op_out[0];
12741       op_ad = 2;
12742       OP_E (float_mem_mode[fp_indx], sizeflag);
12743       return;
12744     }
12745   /* Skip mod/rm byte.  */
12746   MODRM_CHECK;
12747   codep++;
12748
12749   dp = &float_reg[floatop - 0xd8][modrm.reg];
12750   if (dp->name == NULL)
12751     {
12752       putop (fgrps[dp->op[0].bytemode][modrm.rm], sizeflag);
12753
12754       /* Instruction fnstsw is only one with strange arg.  */
12755       if (floatop == 0xdf && codep[-1] == 0xe0)
12756         strcpy (op_out[0], names16[0]);
12757     }
12758   else
12759     {
12760       putop (dp->name, sizeflag);
12761
12762       obufp = op_out[0];
12763       op_ad = 2;
12764       if (dp->op[0].rtn)
12765         (*dp->op[0].rtn) (dp->op[0].bytemode, sizeflag);
12766
12767       obufp = op_out[1];
12768       op_ad = 1;
12769       if (dp->op[1].rtn)
12770         (*dp->op[1].rtn) (dp->op[1].bytemode, sizeflag);
12771     }
12772 }
12773
12774 static void
12775 OP_ST (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
12776 {
12777   oappend ("%st" + intel_syntax);
12778 }
12779
12780 static void
12781 OP_STi (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
12782 {
12783   sprintf (scratchbuf, "%%st(%d)", modrm.rm);
12784   oappend (scratchbuf + intel_syntax);
12785 }
12786
12787 /* Capital letters in template are macros.  */
12788 static int
12789 putop (const char *in_template, int sizeflag)
12790 {
12791   const char *p;
12792   int alt = 0;
12793   int cond = 1;
12794   unsigned int l = 0, len = 1;
12795   char last[4];
12796
12797 #define SAVE_LAST(c)                    \
12798   if (l < len && l < sizeof (last))     \
12799     last[l++] = c;                      \
12800   else                                  \
12801     abort ();
12802
12803   for (p = in_template; *p; p++)
12804     {
12805       switch (*p)
12806         {
12807         default:
12808           *obufp++ = *p;
12809           break;
12810         case '%':
12811           len++;
12812           break;
12813         case '!':
12814           cond = 0;
12815           break;
12816         case '{':
12817           alt = 0;
12818           if (intel_syntax)
12819             {
12820               while (*++p != '|')
12821                 if (*p == '}' || *p == '\0')
12822                   abort ();
12823             }
12824           /* Fall through.  */
12825         case 'I':
12826           alt = 1;
12827           continue;
12828         case '|':
12829           while (*++p != '}')
12830             {
12831               if (*p == '\0')
12832                 abort ();
12833             }
12834           break;
12835         case '}':
12836           break;
12837         case 'A':
12838           if (intel_syntax)
12839             break;
12840           if (modrm.mod != 3 || (sizeflag & SUFFIX_ALWAYS))
12841             *obufp++ = 'b';
12842           break;
12843         case 'B':
12844           if (l == 0 && len == 1)
12845             {
12846 case_B:
12847               if (intel_syntax)
12848                 break;
12849               if (sizeflag & SUFFIX_ALWAYS)
12850                 *obufp++ = 'b';
12851             }
12852           else
12853             {
12854               if (l != 1
12855                   || len != 2
12856                   || last[0] != 'L')
12857                 {
12858                   SAVE_LAST (*p);
12859                   break;
12860                 }
12861
12862               if (address_mode == mode_64bit
12863                   && !(prefixes & PREFIX_ADDR))
12864                 {
12865                   *obufp++ = 'a';
12866                   *obufp++ = 'b';
12867                   *obufp++ = 's';
12868                 }
12869
12870               goto case_B;
12871             }
12872           break;
12873         case 'C':
12874           if (intel_syntax && !alt)
12875             break;
12876           if ((prefixes & PREFIX_DATA) || (sizeflag & SUFFIX_ALWAYS))
12877             {
12878               if (sizeflag & DFLAG)
12879                 *obufp++ = intel_syntax ? 'd' : 'l';
12880               else
12881                 *obufp++ = intel_syntax ? 'w' : 's';
12882               used_prefixes |= (prefixes & PREFIX_DATA);
12883             }
12884           break;
12885         case 'D':
12886           if (intel_syntax || !(sizeflag & SUFFIX_ALWAYS))
12887             break;
12888           USED_REX (REX_W);
12889           if (modrm.mod == 3)
12890             {
12891               if (rex & REX_W)
12892                 *obufp++ = 'q';
12893               else
12894                 {
12895                   if (sizeflag & DFLAG)
12896                     *obufp++ = intel_syntax ? 'd' : 'l';
12897                   else
12898                     *obufp++ = 'w';
12899                   used_prefixes |= (prefixes & PREFIX_DATA);
12900                 }
12901             }
12902           else
12903             *obufp++ = 'w';
12904           break;
12905         case 'E':               /* For jcxz/jecxz */
12906           if (address_mode == mode_64bit)
12907             {
12908               if (sizeflag & AFLAG)
12909                 *obufp++ = 'r';
12910               else
12911                 *obufp++ = 'e';
12912             }
12913           else
12914             if (sizeflag & AFLAG)
12915               *obufp++ = 'e';
12916           used_prefixes |= (prefixes & PREFIX_ADDR);
12917           break;
12918         case 'F':
12919           if (intel_syntax)
12920             break;
12921           if ((prefixes & PREFIX_ADDR) || (sizeflag & SUFFIX_ALWAYS))
12922             {
12923               if (sizeflag & AFLAG)
12924                 *obufp++ = address_mode == mode_64bit ? 'q' : 'l';
12925               else
12926                 *obufp++ = address_mode == mode_64bit ? 'l' : 'w';
12927               used_prefixes |= (prefixes & PREFIX_ADDR);
12928             }
12929           break;
12930         case 'G':
12931           if (intel_syntax || (obufp[-1] != 's' && !(sizeflag & SUFFIX_ALWAYS)))
12932             break;
12933           if ((rex & REX_W) || (sizeflag & DFLAG))
12934             *obufp++ = 'l';
12935           else
12936             *obufp++ = 'w';
12937           if (!(rex & REX_W))
12938             used_prefixes |= (prefixes & PREFIX_DATA);
12939           break;
12940         case 'H':
12941           if (intel_syntax)
12942             break;
12943           if ((prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_CS
12944               || (prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_DS)
12945             {
12946               used_prefixes |= prefixes & (PREFIX_CS | PREFIX_DS);
12947               *obufp++ = ',';
12948               *obufp++ = 'p';
12949               if (prefixes & PREFIX_DS)
12950                 *obufp++ = 't';
12951               else
12952                 *obufp++ = 'n';
12953             }
12954           break;
12955         case 'J':
12956           if (intel_syntax)
12957             break;
12958           *obufp++ = 'l';
12959           break;
12960         case 'K':
12961           USED_REX (REX_W);
12962           if (rex & REX_W)
12963             *obufp++ = 'q';
12964           else
12965             *obufp++ = 'd';
12966           break;
12967         case 'Z':
12968           if (intel_syntax)
12969             break;
12970           if (address_mode == mode_64bit && (sizeflag & SUFFIX_ALWAYS))
12971             {
12972               *obufp++ = 'q';
12973               break;
12974             }
12975           /* Fall through.  */
12976           goto case_L;
12977         case 'L':
12978           if (l != 0 || len != 1)
12979             {
12980               SAVE_LAST (*p);
12981               break;
12982             }
12983 case_L:
12984           if (intel_syntax)
12985             break;
12986           if (sizeflag & SUFFIX_ALWAYS)
12987             *obufp++ = 'l';
12988           break;
12989         case 'M':
12990           if (intel_mnemonic != cond)
12991             *obufp++ = 'r';
12992           break;
12993         case 'N':
12994           if ((prefixes & PREFIX_FWAIT) == 0)
12995             *obufp++ = 'n';
12996           else
12997             used_prefixes |= PREFIX_FWAIT;
12998           break;
12999         case 'O':
13000           USED_REX (REX_W);
13001           if (rex & REX_W)
13002             *obufp++ = 'o';
13003           else if (intel_syntax && (sizeflag & DFLAG))
13004             *obufp++ = 'q';
13005           else
13006             *obufp++ = 'd';
13007           if (!(rex & REX_W))
13008             used_prefixes |= (prefixes & PREFIX_DATA);
13009           break;
13010         case 'T':
13011           if (intel_syntax)
13012             break;
13013           if (address_mode == mode_64bit && (sizeflag & DFLAG))
13014             {
13015               *obufp++ = 'q';
13016               break;
13017             }
13018           /* Fall through.  */
13019         case 'P':
13020           if (intel_syntax)
13021             break;
13022           if ((prefixes & PREFIX_DATA)
13023               || (rex & REX_W)
13024               || (sizeflag & SUFFIX_ALWAYS))
13025             {
13026               USED_REX (REX_W);
13027               if (rex & REX_W)
13028                 *obufp++ = 'q';
13029               else
13030                 {
13031                    if (sizeflag & DFLAG)
13032                       *obufp++ = 'l';
13033                    else
13034                      *obufp++ = 'w';
13035                    used_prefixes |= (prefixes & PREFIX_DATA);
13036                 }
13037             }
13038           break;
13039         case 'U':
13040           if (intel_syntax)
13041             break;
13042           if (address_mode == mode_64bit && (sizeflag & DFLAG))
13043             {
13044               if (modrm.mod != 3 || (sizeflag & SUFFIX_ALWAYS))
13045                 *obufp++ = 'q';
13046               break;
13047             }
13048           /* Fall through.  */
13049           goto case_Q;
13050         case 'Q':
13051           if (l == 0 && len == 1)
13052             {
13053 case_Q:
13054               if (intel_syntax && !alt)
13055                 break;
13056               USED_REX (REX_W);
13057               if (modrm.mod != 3 || (sizeflag & SUFFIX_ALWAYS))
13058                 {
13059                   if (rex & REX_W)
13060                     *obufp++ = 'q';
13061                   else
13062                     {
13063                       if (sizeflag & DFLAG)
13064                         *obufp++ = intel_syntax ? 'd' : 'l';
13065                       else
13066                         *obufp++ = 'w';
13067                       used_prefixes |= (prefixes & PREFIX_DATA);
13068                     }
13069                 }
13070             }
13071           else
13072             {
13073               if (l != 1 || len != 2 || last[0] != 'L')
13074                 {
13075                   SAVE_LAST (*p);
13076                   break;
13077                 }
13078               if (intel_syntax
13079                   || (modrm.mod == 3 && !(sizeflag & SUFFIX_ALWAYS)))
13080                 break;
13081               if ((rex & REX_W))
13082                 {
13083                   USED_REX (REX_W);
13084                   *obufp++ = 'q';
13085                 }
13086               else
13087                 *obufp++ = 'l';
13088             }
13089           break;
13090         case 'R':
13091           USED_REX (REX_W);
13092           if (rex & REX_W)
13093             *obufp++ = 'q';
13094           else if (sizeflag & DFLAG)
13095             {
13096               if (intel_syntax)
13097                   *obufp++ = 'd';
13098               else
13099                   *obufp++ = 'l';
13100             }
13101           else
13102             *obufp++ = 'w';
13103           if (intel_syntax && !p[1]
13104               && ((rex & REX_W) || (sizeflag & DFLAG)))
13105             *obufp++ = 'e';
13106           if (!(rex & REX_W))
13107             used_prefixes |= (prefixes & PREFIX_DATA);
13108           break;
13109         case 'V':
13110           if (l == 0 && len == 1)
13111             {
13112               if (intel_syntax)
13113                 break;
13114               if (address_mode == mode_64bit && (sizeflag & DFLAG))
13115                 {
13116                   if (sizeflag & SUFFIX_ALWAYS)
13117                     *obufp++ = 'q';
13118                   break;
13119                 }
13120             }
13121           else
13122             {
13123               if (l != 1
13124                   || len != 2
13125                   || last[0] != 'L')
13126                 {
13127                   SAVE_LAST (*p);
13128                   break;
13129                 }
13130
13131               if (rex & REX_W)
13132                 {
13133                   *obufp++ = 'a';
13134                   *obufp++ = 'b';
13135                   *obufp++ = 's';
13136                 }
13137             }
13138           /* Fall through.  */
13139           goto case_S;
13140         case 'S':
13141           if (l == 0 && len == 1)
13142             {
13143 case_S:
13144               if (intel_syntax)
13145                 break;
13146               if (sizeflag & SUFFIX_ALWAYS)
13147                 {
13148                   if (rex & REX_W)
13149                     *obufp++ = 'q';
13150                   else
13151                     {
13152                       if (sizeflag & DFLAG)
13153                         *obufp++ = 'l';
13154                       else
13155                         *obufp++ = 'w';
13156                       used_prefixes |= (prefixes & PREFIX_DATA);
13157                     }
13158                 }
13159             }
13160           else
13161             {
13162               if (l != 1
13163                   || len != 2
13164                   || last[0] != 'L')
13165                 {
13166                   SAVE_LAST (*p);
13167                   break;
13168                 }
13169
13170               if (address_mode == mode_64bit
13171                   && !(prefixes & PREFIX_ADDR))
13172                 {
13173                   *obufp++ = 'a';
13174                   *obufp++ = 'b';
13175                   *obufp++ = 's';
13176                 }
13177
13178               goto case_S;
13179             }
13180           break;
13181         case 'X':
13182           if (l != 0 || len != 1)
13183             {
13184               SAVE_LAST (*p);
13185               break;
13186             }
13187           if (need_vex && vex.prefix)
13188             {
13189               if (vex.prefix == DATA_PREFIX_OPCODE)
13190                 *obufp++ = 'd';
13191               else
13192                 *obufp++ = 's';
13193             }
13194           else
13195             {
13196               if (prefixes & PREFIX_DATA)
13197                 *obufp++ = 'd';
13198               else
13199                 *obufp++ = 's';
13200               used_prefixes |= (prefixes & PREFIX_DATA);
13201             }
13202           break;
13203         case 'Y':
13204           if (l == 0 && len == 1)
13205             {
13206               if (intel_syntax || !(sizeflag & SUFFIX_ALWAYS))
13207                 break;
13208               if (rex & REX_W)
13209                 {
13210                   USED_REX (REX_W);
13211                   *obufp++ = 'q';
13212                 }
13213               break;
13214             }
13215           else
13216             {
13217               if (l != 1 || len != 2 || last[0] != 'X')
13218                 {
13219                   SAVE_LAST (*p);
13220                   break;
13221                 }
13222               if (!need_vex)
13223                 abort ();
13224               if (intel_syntax
13225                   || (modrm.mod == 3 && !(sizeflag & SUFFIX_ALWAYS)))
13226                 break;
13227               switch (vex.length)
13228                 {
13229                 case 128:
13230                   *obufp++ = 'x';
13231                   break;
13232                 case 256:
13233                   *obufp++ = 'y';
13234                   break;
13235                 default:
13236                   abort ();
13237                 }
13238             }
13239           break;
13240         case 'W':
13241           if (l == 0 && len == 1)
13242             {
13243               /* operand size flag for cwtl, cbtw */
13244               USED_REX (REX_W);
13245               if (rex & REX_W)
13246                 {
13247                   if (intel_syntax)
13248                     *obufp++ = 'd';
13249                   else
13250                     *obufp++ = 'l';
13251                 }
13252               else if (sizeflag & DFLAG)
13253                 *obufp++ = 'w';
13254               else
13255                 *obufp++ = 'b';
13256               if (!(rex & REX_W))
13257                 used_prefixes |= (prefixes & PREFIX_DATA);
13258             }
13259           else
13260             {
13261               if (l != 1 || len != 2 || last[0] != 'X')
13262                 {
13263                   SAVE_LAST (*p);
13264                   break;
13265                 }
13266               if (!need_vex)
13267                 abort ();
13268               *obufp++ = vex.w ? 'd': 's';
13269             }
13270           break;
13271         }
13272       alt = 0;
13273     }
13274   *obufp = 0;
13275   mnemonicendp = obufp;
13276   return 0;
13277 }
13278
13279 static void
13280 oappend (const char *s)
13281 {
13282   obufp = stpcpy (obufp, s);
13283 }
13284
13285 static void
13286 append_seg (void)
13287 {
13288   if (prefixes & PREFIX_CS)
13289     {
13290       used_prefixes |= PREFIX_CS;
13291       oappend ("%cs:" + intel_syntax);
13292     }
13293   if (prefixes & PREFIX_DS)
13294     {
13295       used_prefixes |= PREFIX_DS;
13296       oappend ("%ds:" + intel_syntax);
13297     }
13298   if (prefixes & PREFIX_SS)
13299     {
13300       used_prefixes |= PREFIX_SS;
13301       oappend ("%ss:" + intel_syntax);
13302     }
13303   if (prefixes & PREFIX_ES)
13304     {
13305       used_prefixes |= PREFIX_ES;
13306       oappend ("%es:" + intel_syntax);
13307     }
13308   if (prefixes & PREFIX_FS)
13309     {
13310       used_prefixes |= PREFIX_FS;
13311       oappend ("%fs:" + intel_syntax);
13312     }
13313   if (prefixes & PREFIX_GS)
13314     {
13315       used_prefixes |= PREFIX_GS;
13316       oappend ("%gs:" + intel_syntax);
13317     }
13318 }
13319
13320 static void
13321 OP_indirE (int bytemode, int sizeflag)
13322 {
13323   if (!intel_syntax)
13324     oappend ("*");
13325   OP_E (bytemode, sizeflag);
13326 }
13327
13328 static void
13329 print_operand_value (char *buf, int hex, bfd_vma disp)
13330 {
13331   if (address_mode == mode_64bit)
13332     {
13333       if (hex)
13334         {
13335           char tmp[30];
13336           int i;
13337           buf[0] = '0';
13338           buf[1] = 'x';
13339           sprintf_vma (tmp, disp);
13340           for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++);
13341           strcpy (buf + 2, tmp + i);
13342         }
13343       else
13344         {
13345           bfd_signed_vma v = disp;
13346           char tmp[30];
13347           int i;
13348           if (v < 0)
13349             {
13350               *(buf++) = '-';
13351               v = -disp;
13352               /* Check for possible overflow on 0x8000000000000000.  */
13353               if (v < 0)
13354                 {
13355                   strcpy (buf, "9223372036854775808");
13356                   return;
13357                 }
13358             }
13359           if (!v)
13360             {
13361               strcpy (buf, "0");
13362               return;
13363             }
13364
13365           i = 0;
13366           tmp[29] = 0;
13367           while (v)
13368             {
13369               tmp[28 - i] = (v % 10) + '0';
13370               v /= 10;
13371               i++;
13372             }
13373           strcpy (buf, tmp + 29 - i);
13374         }
13375     }
13376   else
13377     {
13378       if (hex)
13379         sprintf (buf, "0x%x", (unsigned int) disp);
13380       else
13381         sprintf (buf, "%d", (int) disp);
13382     }
13383 }
13384
13385 /* Put DISP in BUF as signed hex number.  */
13386
13387 static void
13388 print_displacement (char *buf, bfd_vma disp)
13389 {
13390   bfd_signed_vma val = disp;
13391   char tmp[30];
13392   int i, j = 0;
13393
13394   if (val < 0)
13395     {
13396       buf[j++] = '-';
13397       val = -disp;
13398
13399       /* Check for possible overflow.  */
13400       if (val < 0)
13401         {
13402           switch (address_mode)
13403             {
13404             case mode_64bit:
13405               strcpy (buf + j, "0x8000000000000000");
13406               break;
13407             case mode_32bit:
13408               strcpy (buf + j, "0x80000000");
13409               break;
13410             case mode_16bit:
13411               strcpy (buf + j, "0x8000");
13412               break;
13413             }
13414           return;
13415         }
13416     }
13417
13418   buf[j++] = '0';
13419   buf[j++] = 'x';
13420
13421   sprintf_vma (tmp, (bfd_vma) val);
13422   for (i = 0; tmp[i] == '0'; i++)
13423     continue;
13424   if (tmp[i] == '\0')
13425     i--;
13426   strcpy (buf + j, tmp + i);
13427 }
13428
13429 static void
13430 intel_operand_size (int bytemode, int sizeflag)
13431 {
13432   switch (bytemode)
13433     {
13434     case b_mode:
13435     case b_swap_mode:
13436     case dqb_mode:
13437       oappend ("BYTE PTR ");
13438       break;
13439     case w_mode:
13440     case dqw_mode:
13441       oappend ("WORD PTR ");
13442       break;
13443     case stack_v_mode:
13444       if (address_mode == mode_64bit && (sizeflag & DFLAG))
13445         {
13446           oappend ("QWORD PTR ");
13447           break;
13448         }
13449       /* FALLTHRU */
13450     case v_mode:
13451     case v_swap_mode:
13452     case dq_mode:
13453       USED_REX (REX_W);
13454       if (rex & REX_W)
13455         oappend ("QWORD PTR ");
13456       else
13457         {
13458           if ((sizeflag & DFLAG) || bytemode == dq_mode)
13459             oappend ("DWORD PTR ");
13460           else
13461             oappend ("WORD PTR ");
13462           used_prefixes |= (prefixes & PREFIX_DATA);
13463         }
13464       break;
13465     case z_mode:
13466       if ((rex & REX_W) || (sizeflag & DFLAG))
13467         *obufp++ = 'D';
13468       oappend ("WORD PTR ");
13469       if (!(rex & REX_W))
13470         used_prefixes |= (prefixes & PREFIX_DATA);
13471       break;
13472     case a_mode:
13473       if (sizeflag & DFLAG)
13474         oappend ("QWORD PTR ");
13475       else
13476         oappend ("DWORD PTR ");
13477       used_prefixes |= (prefixes & PREFIX_DATA);
13478       break;
13479     case d_mode:
13480     case d_swap_mode:
13481     case dqd_mode:
13482       oappend ("DWORD PTR ");
13483       break;
13484     case q_mode:
13485     case q_swap_mode:
13486       oappend ("QWORD PTR ");
13487       break;
13488     case m_mode:
13489       if (address_mode == mode_64bit)
13490         oappend ("QWORD PTR ");
13491       else
13492         oappend ("DWORD PTR ");
13493       break;
13494     case f_mode:
13495       if (sizeflag & DFLAG)
13496         oappend ("FWORD PTR ");
13497       else
13498         oappend ("DWORD PTR ");
13499       used_prefixes |= (prefixes & PREFIX_DATA);
13500       break;
13501     case t_mode:
13502       oappend ("TBYTE PTR ");
13503       break;
13504     case x_mode:
13505     case x_swap_mode:
13506       if (need_vex)
13507         {
13508           switch (vex.length)
13509             {
13510             case 128:
13511               oappend ("XMMWORD PTR ");
13512               break;
13513             case 256:
13514               oappend ("YMMWORD PTR ");
13515               break;
13516             default:
13517               abort ();
13518             }
13519         }
13520       else
13521         oappend ("XMMWORD PTR ");
13522       break;
13523     case xmm_mode:
13524       oappend ("XMMWORD PTR ");
13525       break;
13526     case xmmq_mode:
13527       if (!need_vex)
13528         abort ();
13529
13530       switch (vex.length)
13531         {
13532         case 128:
13533           oappend ("QWORD PTR ");
13534           break;
13535         case 256:
13536           oappend ("XMMWORD PTR ");
13537           break;
13538         default:
13539           abort ();
13540         }
13541       break;
13542     case ymmq_mode:
13543       if (!need_vex)
13544         abort ();
13545
13546       switch (vex.length)
13547         {
13548         case 128:
13549           oappend ("QWORD PTR ");
13550           break;
13551         case 256:
13552           oappend ("YMMWORD PTR ");
13553           break;
13554         default:
13555           abort ();
13556         }
13557       break;
13558     case o_mode:
13559       oappend ("OWORD PTR ");
13560       break;
13561     case vex_w_dq_mode:
13562       if (!need_vex)
13563         abort ();
13564
13565       if (vex.w)
13566         oappend ("QWORD PTR ");
13567       else
13568         oappend ("DWORD PTR ");
13569       break;
13570     default:
13571       break;
13572     }
13573 }
13574
13575 static void
13576 OP_E_register (int bytemode, int sizeflag)
13577 {
13578   int reg = modrm.rm;
13579   const char **names;
13580
13581   USED_REX (REX_B);
13582   if ((rex & REX_B))
13583     reg += 8;
13584
13585   if ((sizeflag & SUFFIX_ALWAYS)
13586       && (bytemode == b_swap_mode || bytemode == v_swap_mode))
13587     swap_operand ();
13588
13589   switch (bytemode)
13590     {
13591     case b_mode:
13592     case b_swap_mode:
13593       USED_REX (0);
13594       if (rex)
13595         names = names8rex;
13596       else
13597         names = names8;
13598       break;
13599     case w_mode:
13600       names = names16;
13601       break;
13602     case d_mode:
13603       names = names32;
13604       break;
13605     case q_mode:
13606       names = names64;
13607       break;
13608     case m_mode:
13609       names = address_mode == mode_64bit ? names64 : names32;
13610       break;
13611     case stack_v_mode:
13612       if (address_mode == mode_64bit && (sizeflag & DFLAG))
13613         {
13614           names = names64;
13615           break;
13616         }
13617       bytemode = v_mode;
13618       /* FALLTHRU */
13619     case v_mode:
13620     case v_swap_mode:
13621     case dq_mode:
13622     case dqb_mode:
13623     case dqd_mode:
13624     case dqw_mode:
13625       USED_REX (REX_W);
13626       if (rex & REX_W)
13627         names = names64;
13628       else
13629         {
13630           if ((sizeflag & DFLAG) 
13631               || (bytemode != v_mode
13632                   && bytemode != v_swap_mode))
13633             names = names32;
13634           else
13635             names = names16;
13636           used_prefixes |= (prefixes & PREFIX_DATA);
13637         }
13638       break;
13639     case 0:
13640       return;
13641     default:
13642       oappend (INTERNAL_DISASSEMBLER_ERROR);
13643       return;
13644     }
13645   oappend (names[reg]);
13646 }
13647
13648 static void
13649 OP_E_memory (int bytemode, int sizeflag)
13650 {
13651   bfd_vma disp = 0;
13652   int add = (rex & REX_B) ? 8 : 0;
13653   int riprel = 0;
13654
13655   USED_REX (REX_B);
13656   if (intel_syntax)
13657     intel_operand_size (bytemode, sizeflag);
13658   append_seg ();
13659
13660   if ((sizeflag & AFLAG) || address_mode == mode_64bit)
13661     {
13662       /* 32/64 bit address mode */
13663       int havedisp;
13664       int havesib;
13665       int havebase;
13666       int haveindex;
13667       int needindex;
13668       int base, rbase;
13669       int vindex = 0;
13670       int scale = 0;
13671
13672       havesib = 0;
13673       havebase = 1;
13674       haveindex = 0;
13675       base = modrm.rm;
13676
13677       if (base == 4)
13678         {
13679           havesib = 1;
13680           FETCH_DATA (the_info, codep + 1);
13681           vindex = (*codep >> 3) & 7;
13682           scale = (*codep >> 6) & 3;
13683           base = *codep & 7;
13684           USED_REX (REX_X);
13685           if (rex & REX_X)
13686             vindex += 8;
13687           haveindex = vindex != 4;
13688           codep++;
13689         }
13690       rbase = base + add;
13691
13692       switch (modrm.mod)
13693         {
13694         case 0:
13695           if (base == 5)
13696             {
13697               havebase = 0;
13698               if (address_mode == mode_64bit && !havesib)
13699                 riprel = 1;
13700               disp = get32s ();
13701             }
13702           break;
13703         case 1:
13704           FETCH_DATA (the_info, codep + 1);
13705           disp = *codep++;
13706           if ((disp & 0x80) != 0)
13707             disp -= 0x100;
13708           break;
13709         case 2:
13710           disp = get32s ();
13711           break;
13712         }
13713
13714       /* In 32bit mode, we need index register to tell [offset] from
13715          [eiz*1 + offset].  */
13716       needindex = (havesib
13717                    && !havebase
13718                    && !haveindex
13719                    && address_mode == mode_32bit);
13720       havedisp = (havebase
13721                   || needindex
13722                   || (havesib && (haveindex || scale != 0)));
13723
13724       if (!intel_syntax)
13725         if (modrm.mod != 0 || base == 5)
13726           {
13727             if (havedisp || riprel)
13728               print_displacement (scratchbuf, disp);
13729             else
13730               print_operand_value (scratchbuf, 1, disp);
13731             oappend (scratchbuf);
13732             if (riprel)
13733               {
13734                 set_op (disp, 1);
13735                 oappend (sizeflag & AFLAG ? "(%rip)" : "(%eip)");
13736               }
13737           }
13738
13739       if (havebase || haveindex || riprel)
13740         used_prefixes |= PREFIX_ADDR;
13741
13742       if (havedisp || (intel_syntax && riprel))
13743         {
13744           *obufp++ = open_char;
13745           if (intel_syntax && riprel)
13746             {
13747               set_op (disp, 1);
13748               oappend (sizeflag & AFLAG ? "rip" : "eip");
13749             }
13750           *obufp = '\0';
13751           if (havebase)
13752             oappend (address_mode == mode_64bit && (sizeflag & AFLAG)
13753                      ? names64[rbase] : names32[rbase]);
13754           if (havesib)
13755             {
13756               /* ESP/RSP won't allow index.  If base isn't ESP/RSP,
13757                  print index to tell base + index from base.  */
13758               if (scale != 0
13759                   || needindex
13760                   || haveindex
13761                   || (havebase && base != ESP_REG_NUM))
13762                 {
13763                   if (!intel_syntax || havebase)
13764                     {
13765                       *obufp++ = separator_char;
13766                       *obufp = '\0';
13767                     }
13768                   if (haveindex)
13769                     oappend (address_mode == mode_64bit 
13770                              && (sizeflag & AFLAG)
13771                              ? names64[vindex] : names32[vindex]);
13772                   else
13773                     oappend (address_mode == mode_64bit 
13774                              && (sizeflag & AFLAG)
13775                              ? index64 : index32);
13776
13777                   *obufp++ = scale_char;
13778                   *obufp = '\0';
13779                   sprintf (scratchbuf, "%d", 1 << scale);
13780                   oappend (scratchbuf);
13781                 }
13782             }
13783           if (intel_syntax
13784               && (disp || modrm.mod != 0 || base == 5))
13785             {
13786               if (!havedisp || (bfd_signed_vma) disp >= 0)
13787                 {
13788                   *obufp++ = '+';
13789                   *obufp = '\0';
13790                 }
13791               else if (modrm.mod != 1 && disp != -disp)
13792                 {
13793                   *obufp++ = '-';
13794                   *obufp = '\0';
13795                   disp = - (bfd_signed_vma) disp;
13796                 }
13797
13798               if (havedisp)
13799                 print_displacement (scratchbuf, disp);
13800               else
13801                 print_operand_value (scratchbuf, 1, disp);
13802               oappend (scratchbuf);
13803             }
13804
13805           *obufp++ = close_char;
13806           *obufp = '\0';
13807         }
13808       else if (intel_syntax)
13809         {
13810           if (modrm.mod != 0 || base == 5)
13811             {
13812               if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
13813                               | PREFIX_ES | PREFIX_FS | PREFIX_GS))
13814                 ;
13815               else
13816                 {
13817                   oappend (names_seg[ds_reg - es_reg]);
13818                   oappend (":");
13819                 }
13820               print_operand_value (scratchbuf, 1, disp);
13821               oappend (scratchbuf);
13822             }
13823         }
13824     }
13825   else
13826     {
13827       /* 16 bit address mode */
13828       used_prefixes |= prefixes & PREFIX_ADDR;
13829       switch (modrm.mod)
13830         {
13831         case 0:
13832           if (modrm.rm == 6)
13833             {
13834               disp = get16 ();
13835               if ((disp & 0x8000) != 0)
13836                 disp -= 0x10000;
13837             }
13838           break;
13839         case 1:
13840           FETCH_DATA (the_info, codep + 1);
13841           disp = *codep++;
13842           if ((disp & 0x80) != 0)
13843             disp -= 0x100;
13844           break;
13845         case 2:
13846           disp = get16 ();
13847           if ((disp & 0x8000) != 0)
13848             disp -= 0x10000;
13849           break;
13850         }
13851
13852       if (!intel_syntax)
13853         if (modrm.mod != 0 || modrm.rm == 6)
13854           {
13855             print_displacement (scratchbuf, disp);
13856             oappend (scratchbuf);
13857           }
13858
13859       if (modrm.mod != 0 || modrm.rm != 6)
13860         {
13861           *obufp++ = open_char;
13862           *obufp = '\0';
13863           oappend (index16[modrm.rm]);
13864           if (intel_syntax
13865               && (disp || modrm.mod != 0 || modrm.rm == 6))
13866             {
13867               if ((bfd_signed_vma) disp >= 0)
13868                 {
13869                   *obufp++ = '+';
13870                   *obufp = '\0';
13871                 }
13872               else if (modrm.mod != 1)
13873                 {
13874                   *obufp++ = '-';
13875                   *obufp = '\0';
13876                   disp = - (bfd_signed_vma) disp;
13877                 }
13878
13879               print_displacement (scratchbuf, disp);
13880               oappend (scratchbuf);
13881             }
13882
13883           *obufp++ = close_char;
13884           *obufp = '\0';
13885         }
13886       else if (intel_syntax)
13887         {
13888           if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
13889                           | PREFIX_ES | PREFIX_FS | PREFIX_GS))
13890             ;
13891           else
13892             {
13893               oappend (names_seg[ds_reg - es_reg]);
13894               oappend (":");
13895             }
13896           print_operand_value (scratchbuf, 1, disp & 0xffff);
13897           oappend (scratchbuf);
13898         }
13899     }
13900 }
13901
13902 static void
13903 OP_E (int bytemode, int sizeflag)
13904 {
13905   /* Skip mod/rm byte.  */
13906   MODRM_CHECK;
13907   codep++;
13908
13909   if (modrm.mod == 3)
13910     OP_E_register (bytemode, sizeflag);
13911   else
13912     OP_E_memory (bytemode, sizeflag);
13913 }
13914
13915 static void
13916 OP_G (int bytemode, int sizeflag)
13917 {
13918   int add = 0;
13919   USED_REX (REX_R);
13920   if (rex & REX_R)
13921     add += 8;
13922   switch (bytemode)
13923     {
13924     case b_mode:
13925       USED_REX (0);
13926       if (rex)
13927         oappend (names8rex[modrm.reg + add]);
13928       else
13929         oappend (names8[modrm.reg + add]);
13930       break;
13931     case w_mode:
13932       oappend (names16[modrm.reg + add]);
13933       break;
13934     case d_mode:
13935       oappend (names32[modrm.reg + add]);
13936       break;
13937     case q_mode:
13938       oappend (names64[modrm.reg + add]);
13939       break;
13940     case v_mode:
13941     case dq_mode:
13942     case dqb_mode:
13943     case dqd_mode:
13944     case dqw_mode:
13945       USED_REX (REX_W);
13946       if (rex & REX_W)
13947         oappend (names64[modrm.reg + add]);
13948       else
13949         {
13950           if ((sizeflag & DFLAG) || bytemode != v_mode)
13951             oappend (names32[modrm.reg + add]);
13952           else
13953             oappend (names16[modrm.reg + add]);
13954           used_prefixes |= (prefixes & PREFIX_DATA);
13955         }
13956       break;
13957     case m_mode:
13958       if (address_mode == mode_64bit)
13959         oappend (names64[modrm.reg + add]);
13960       else
13961         oappend (names32[modrm.reg + add]);
13962       break;
13963     default:
13964       oappend (INTERNAL_DISASSEMBLER_ERROR);
13965       break;
13966     }
13967 }
13968
13969 static bfd_vma
13970 get64 (void)
13971 {
13972   bfd_vma x;
13973 #ifdef BFD64
13974   unsigned int a;
13975   unsigned int b;
13976
13977   FETCH_DATA (the_info, codep + 8);
13978   a = *codep++ & 0xff;
13979   a |= (*codep++ & 0xff) << 8;
13980   a |= (*codep++ & 0xff) << 16;
13981   a |= (*codep++ & 0xff) << 24;
13982   b = *codep++ & 0xff;
13983   b |= (*codep++ & 0xff) << 8;
13984   b |= (*codep++ & 0xff) << 16;
13985   b |= (*codep++ & 0xff) << 24;
13986   x = a + ((bfd_vma) b << 32);
13987 #else
13988   abort ();
13989   x = 0;
13990 #endif
13991   return x;
13992 }
13993
13994 static bfd_signed_vma
13995 get32 (void)
13996 {
13997   bfd_signed_vma x = 0;
13998
13999   FETCH_DATA (the_info, codep + 4);
14000   x = *codep++ & (bfd_signed_vma) 0xff;
14001   x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
14002   x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
14003   x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
14004   return x;
14005 }
14006
14007 static bfd_signed_vma
14008 get32s (void)
14009 {
14010   bfd_signed_vma x = 0;
14011
14012   FETCH_DATA (the_info, codep + 4);
14013   x = *codep++ & (bfd_signed_vma) 0xff;
14014   x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
14015   x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
14016   x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
14017
14018   x = (x ^ ((bfd_signed_vma) 1 << 31)) - ((bfd_signed_vma) 1 << 31);
14019
14020   return x;
14021 }
14022
14023 static int
14024 get16 (void)
14025 {
14026   int x = 0;
14027
14028   FETCH_DATA (the_info, codep + 2);
14029   x = *codep++ & 0xff;
14030   x |= (*codep++ & 0xff) << 8;
14031   return x;
14032 }
14033
14034 static void
14035 set_op (bfd_vma op, int riprel)
14036 {
14037   op_index[op_ad] = op_ad;
14038   if (address_mode == mode_64bit)
14039     {
14040       op_address[op_ad] = op;
14041       op_riprel[op_ad] = riprel;
14042     }
14043   else
14044     {
14045       /* Mask to get a 32-bit address.  */
14046       op_address[op_ad] = op & 0xffffffff;
14047       op_riprel[op_ad] = riprel & 0xffffffff;
14048     }
14049 }
14050
14051 static void
14052 OP_REG (int code, int sizeflag)
14053 {
14054   const char *s;
14055   int add;
14056   USED_REX (REX_B);
14057   if (rex & REX_B)
14058     add = 8;
14059   else
14060     add = 0;
14061
14062   switch (code)
14063     {
14064     case ax_reg: case cx_reg: case dx_reg: case bx_reg:
14065     case sp_reg: case bp_reg: case si_reg: case di_reg:
14066       s = names16[code - ax_reg + add];
14067       break;
14068     case es_reg: case ss_reg: case cs_reg:
14069     case ds_reg: case fs_reg: case gs_reg:
14070       s = names_seg[code - es_reg + add];
14071       break;
14072     case al_reg: case ah_reg: case cl_reg: case ch_reg:
14073     case dl_reg: case dh_reg: case bl_reg: case bh_reg:
14074       USED_REX (0);
14075       if (rex)
14076         s = names8rex[code - al_reg + add];
14077       else
14078         s = names8[code - al_reg];
14079       break;
14080     case rAX_reg: case rCX_reg: case rDX_reg: case rBX_reg:
14081     case rSP_reg: case rBP_reg: case rSI_reg: case rDI_reg:
14082       if (address_mode == mode_64bit && (sizeflag & DFLAG))
14083         {
14084           s = names64[code - rAX_reg + add];
14085           break;
14086         }
14087       code += eAX_reg - rAX_reg;
14088       /* Fall through.  */
14089     case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
14090     case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
14091       USED_REX (REX_W);
14092       if (rex & REX_W)
14093         s = names64[code - eAX_reg + add];
14094       else
14095         {
14096           if (sizeflag & DFLAG)
14097             s = names32[code - eAX_reg + add];
14098           else
14099             s = names16[code - eAX_reg + add];
14100           used_prefixes |= (prefixes & PREFIX_DATA);
14101         }
14102       break;
14103     default:
14104       s = INTERNAL_DISASSEMBLER_ERROR;
14105       break;
14106     }
14107   oappend (s);
14108 }
14109
14110 static void
14111 OP_IMREG (int code, int sizeflag)
14112 {
14113   const char *s;
14114
14115   switch (code)
14116     {
14117     case indir_dx_reg:
14118       if (intel_syntax)
14119         s = "dx";
14120       else
14121         s = "(%dx)";
14122       break;
14123     case ax_reg: case cx_reg: case dx_reg: case bx_reg:
14124     case sp_reg: case bp_reg: case si_reg: case di_reg:
14125       s = names16[code - ax_reg];
14126       break;
14127     case es_reg: case ss_reg: case cs_reg:
14128     case ds_reg: case fs_reg: case gs_reg:
14129       s = names_seg[code - es_reg];
14130       break;
14131     case al_reg: case ah_reg: case cl_reg: case ch_reg:
14132     case dl_reg: case dh_reg: case bl_reg: case bh_reg:
14133       USED_REX (0);
14134       if (rex)
14135         s = names8rex[code - al_reg];
14136       else
14137         s = names8[code - al_reg];
14138       break;
14139     case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
14140     case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
14141       USED_REX (REX_W);
14142       if (rex & REX_W)
14143         s = names64[code - eAX_reg];
14144       else
14145         {
14146           if (sizeflag & DFLAG)
14147             s = names32[code - eAX_reg];
14148           else
14149             s = names16[code - eAX_reg];
14150           used_prefixes |= (prefixes & PREFIX_DATA);
14151         }
14152       break;
14153     case z_mode_ax_reg:
14154       if ((rex & REX_W) || (sizeflag & DFLAG))
14155         s = *names32;
14156       else
14157         s = *names16;
14158       if (!(rex & REX_W))
14159         used_prefixes |= (prefixes & PREFIX_DATA);
14160       break;
14161     default:
14162       s = INTERNAL_DISASSEMBLER_ERROR;
14163       break;
14164     }
14165   oappend (s);
14166 }
14167
14168 static void
14169 OP_I (int bytemode, int sizeflag)
14170 {
14171   bfd_signed_vma op;
14172   bfd_signed_vma mask = -1;
14173
14174   switch (bytemode)
14175     {
14176     case b_mode:
14177       FETCH_DATA (the_info, codep + 1);
14178       op = *codep++;
14179       mask = 0xff;
14180       break;
14181     case q_mode:
14182       if (address_mode == mode_64bit)
14183         {
14184           op = get32s ();
14185           break;
14186         }
14187       /* Fall through.  */
14188     case v_mode:
14189       USED_REX (REX_W);
14190       if (rex & REX_W)
14191         op = get32s ();
14192       else
14193         {
14194           if (sizeflag & DFLAG)
14195             {
14196               op = get32 ();
14197               mask = 0xffffffff;
14198             }
14199           else
14200             {
14201               op = get16 ();
14202               mask = 0xfffff;
14203             }
14204           used_prefixes |= (prefixes & PREFIX_DATA);
14205         }
14206       break;
14207     case w_mode:
14208       mask = 0xfffff;
14209       op = get16 ();
14210       break;
14211     case const_1_mode:
14212       if (intel_syntax)
14213         oappend ("1");
14214       return;
14215     default:
14216       oappend (INTERNAL_DISASSEMBLER_ERROR);
14217       return;
14218     }
14219
14220   op &= mask;
14221   scratchbuf[0] = '$';
14222   print_operand_value (scratchbuf + 1, 1, op);
14223   oappend (scratchbuf + intel_syntax);
14224   scratchbuf[0] = '\0';
14225 }
14226
14227 static void
14228 OP_I64 (int bytemode, int sizeflag)
14229 {
14230   bfd_signed_vma op;
14231   bfd_signed_vma mask = -1;
14232
14233   if (address_mode != mode_64bit)
14234     {
14235       OP_I (bytemode, sizeflag);
14236       return;
14237     }
14238
14239   switch (bytemode)
14240     {
14241     case b_mode:
14242       FETCH_DATA (the_info, codep + 1);
14243       op = *codep++;
14244       mask = 0xff;
14245       break;
14246     case v_mode:
14247       USED_REX (REX_W);
14248       if (rex & REX_W)
14249         op = get64 ();
14250       else
14251         {
14252           if (sizeflag & DFLAG)
14253             {
14254               op = get32 ();
14255               mask = 0xffffffff;
14256             }
14257           else
14258             {
14259               op = get16 ();
14260               mask = 0xfffff;
14261             }
14262           used_prefixes |= (prefixes & PREFIX_DATA);
14263         }
14264       break;
14265     case w_mode:
14266       mask = 0xfffff;
14267       op = get16 ();
14268       break;
14269     default:
14270       oappend (INTERNAL_DISASSEMBLER_ERROR);
14271       return;
14272     }
14273
14274   op &= mask;
14275   scratchbuf[0] = '$';
14276   print_operand_value (scratchbuf + 1, 1, op);
14277   oappend (scratchbuf + intel_syntax);
14278   scratchbuf[0] = '\0';
14279 }
14280
14281 static void
14282 OP_sI (int bytemode, int sizeflag)
14283 {
14284   bfd_signed_vma op;
14285   bfd_signed_vma mask = -1;
14286
14287   switch (bytemode)
14288     {
14289     case b_mode:
14290       FETCH_DATA (the_info, codep + 1);
14291       op = *codep++;
14292       if ((op & 0x80) != 0)
14293         op -= 0x100;
14294       mask = 0xffffffff;
14295       break;
14296     case v_mode:
14297       USED_REX (REX_W);
14298       if (rex & REX_W)
14299         op = get32s ();
14300       else
14301         {
14302           if (sizeflag & DFLAG)
14303             {
14304               op = get32s ();
14305               mask = 0xffffffff;
14306             }
14307           else
14308             {
14309               mask = 0xffffffff;
14310               op = get16 ();
14311               if ((op & 0x8000) != 0)
14312                 op -= 0x10000;
14313             }
14314           used_prefixes |= (prefixes & PREFIX_DATA);
14315         }
14316       break;
14317     case w_mode:
14318       op = get16 ();
14319       mask = 0xffffffff;
14320       if ((op & 0x8000) != 0)
14321         op -= 0x10000;
14322       break;
14323     default:
14324       oappend (INTERNAL_DISASSEMBLER_ERROR);
14325       return;
14326     }
14327
14328   scratchbuf[0] = '$';
14329   print_operand_value (scratchbuf + 1, 1, op);
14330   oappend (scratchbuf + intel_syntax);
14331 }
14332
14333 static void
14334 OP_J (int bytemode, int sizeflag)
14335 {
14336   bfd_vma disp;
14337   bfd_vma mask = -1;
14338   bfd_vma segment = 0;
14339
14340   switch (bytemode)
14341     {
14342     case b_mode:
14343       FETCH_DATA (the_info, codep + 1);
14344       disp = *codep++;
14345       if ((disp & 0x80) != 0)
14346         disp -= 0x100;
14347       break;
14348     case v_mode:
14349       USED_REX (REX_W);
14350       if ((sizeflag & DFLAG) || (rex & REX_W))
14351         disp = get32s ();
14352       else
14353         {
14354           disp = get16 ();
14355           if ((disp & 0x8000) != 0)
14356             disp -= 0x10000;
14357           /* In 16bit mode, address is wrapped around at 64k within
14358              the same segment.  Otherwise, a data16 prefix on a jump
14359              instruction means that the pc is masked to 16 bits after
14360              the displacement is added!  */
14361           mask = 0xffff;
14362           if ((prefixes & PREFIX_DATA) == 0)
14363             segment = ((start_pc + codep - start_codep)
14364                        & ~((bfd_vma) 0xffff));
14365         }
14366       if (!(rex & REX_W))
14367         used_prefixes |= (prefixes & PREFIX_DATA);
14368       break;
14369     default:
14370       oappend (INTERNAL_DISASSEMBLER_ERROR);
14371       return;
14372     }
14373   disp = ((start_pc + codep - start_codep + disp) & mask) | segment;
14374   set_op (disp, 0);
14375   print_operand_value (scratchbuf, 1, disp);
14376   oappend (scratchbuf);
14377 }
14378
14379 static void
14380 OP_SEG (int bytemode, int sizeflag)
14381 {
14382   if (bytemode == w_mode)
14383     oappend (names_seg[modrm.reg]);
14384   else
14385     OP_E (modrm.mod == 3 ? bytemode : w_mode, sizeflag);
14386 }
14387
14388 static void
14389 OP_DIR (int dummy ATTRIBUTE_UNUSED, int sizeflag)
14390 {
14391   int seg, offset;
14392
14393   if (sizeflag & DFLAG)
14394     {
14395       offset = get32 ();
14396       seg = get16 ();
14397     }
14398   else
14399     {
14400       offset = get16 ();
14401       seg = get16 ();
14402     }
14403   used_prefixes |= (prefixes & PREFIX_DATA);
14404   if (intel_syntax)
14405     sprintf (scratchbuf, "0x%x:0x%x", seg, offset);
14406   else
14407     sprintf (scratchbuf, "$0x%x,$0x%x", seg, offset);
14408   oappend (scratchbuf);
14409 }
14410
14411 static void
14412 OP_OFF (int bytemode, int sizeflag)
14413 {
14414   bfd_vma off;
14415
14416   if (intel_syntax && (sizeflag & SUFFIX_ALWAYS))
14417     intel_operand_size (bytemode, sizeflag);
14418   append_seg ();
14419
14420   if ((sizeflag & AFLAG) || address_mode == mode_64bit)
14421     off = get32 ();
14422   else
14423     off = get16 ();
14424
14425   if (intel_syntax)
14426     {
14427       if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
14428                         | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
14429         {
14430           oappend (names_seg[ds_reg - es_reg]);
14431           oappend (":");
14432         }
14433     }
14434   print_operand_value (scratchbuf, 1, off);
14435   oappend (scratchbuf);
14436 }
14437
14438 static void
14439 OP_OFF64 (int bytemode, int sizeflag)
14440 {
14441   bfd_vma off;
14442
14443   if (address_mode != mode_64bit
14444       || (prefixes & PREFIX_ADDR))
14445     {
14446       OP_OFF (bytemode, sizeflag);
14447       return;
14448     }
14449
14450   if (intel_syntax && (sizeflag & SUFFIX_ALWAYS))
14451     intel_operand_size (bytemode, sizeflag);
14452   append_seg ();
14453
14454   off = get64 ();
14455
14456   if (intel_syntax)
14457     {
14458       if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
14459                         | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
14460         {
14461           oappend (names_seg[ds_reg - es_reg]);
14462           oappend (":");
14463         }
14464     }
14465   print_operand_value (scratchbuf, 1, off);
14466   oappend (scratchbuf);
14467 }
14468
14469 static void
14470 ptr_reg (int code, int sizeflag)
14471 {
14472   const char *s;
14473
14474   *obufp++ = open_char;
14475   used_prefixes |= (prefixes & PREFIX_ADDR);
14476   if (address_mode == mode_64bit)
14477     {
14478       if (!(sizeflag & AFLAG))
14479         s = names32[code - eAX_reg];
14480       else
14481         s = names64[code - eAX_reg];
14482     }
14483   else if (sizeflag & AFLAG)
14484     s = names32[code - eAX_reg];
14485   else
14486     s = names16[code - eAX_reg];
14487   oappend (s);
14488   *obufp++ = close_char;
14489   *obufp = 0;
14490 }
14491
14492 static void
14493 OP_ESreg (int code, int sizeflag)
14494 {
14495   if (intel_syntax)
14496     {
14497       switch (codep[-1])
14498         {
14499         case 0x6d:      /* insw/insl */
14500           intel_operand_size (z_mode, sizeflag);
14501           break;
14502         case 0xa5:      /* movsw/movsl/movsq */
14503         case 0xa7:      /* cmpsw/cmpsl/cmpsq */
14504         case 0xab:      /* stosw/stosl */
14505         case 0xaf:      /* scasw/scasl */
14506           intel_operand_size (v_mode, sizeflag);
14507           break;
14508         default:
14509           intel_operand_size (b_mode, sizeflag);
14510         }
14511     }
14512   oappend ("%es:" + intel_syntax);
14513   ptr_reg (code, sizeflag);
14514 }
14515
14516 static void
14517 OP_DSreg (int code, int sizeflag)
14518 {
14519   if (intel_syntax)
14520     {
14521       switch (codep[-1])
14522         {
14523         case 0x6f:      /* outsw/outsl */
14524           intel_operand_size (z_mode, sizeflag);
14525           break;
14526         case 0xa5:      /* movsw/movsl/movsq */
14527         case 0xa7:      /* cmpsw/cmpsl/cmpsq */
14528         case 0xad:      /* lodsw/lodsl/lodsq */
14529           intel_operand_size (v_mode, sizeflag);
14530           break;
14531         default:
14532           intel_operand_size (b_mode, sizeflag);
14533         }
14534     }
14535   if ((prefixes
14536        & (PREFIX_CS
14537           | PREFIX_DS
14538           | PREFIX_SS
14539           | PREFIX_ES
14540           | PREFIX_FS
14541           | PREFIX_GS)) == 0)
14542     prefixes |= PREFIX_DS;
14543   append_seg ();
14544   ptr_reg (code, sizeflag);
14545 }
14546
14547 static void
14548 OP_C (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14549 {
14550   int add;
14551   if (rex & REX_R)
14552     {
14553       USED_REX (REX_R);
14554       add = 8;
14555     }
14556   else if (address_mode != mode_64bit && (prefixes & PREFIX_LOCK))
14557     {
14558       all_prefixes[last_lock_prefix] = 0;
14559       used_prefixes |= PREFIX_LOCK;
14560       add = 8;
14561     }
14562   else
14563     add = 0;
14564   sprintf (scratchbuf, "%%cr%d", modrm.reg + add);
14565   oappend (scratchbuf + intel_syntax);
14566 }
14567
14568 static void
14569 OP_D (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14570 {
14571   int add;
14572   USED_REX (REX_R);
14573   if (rex & REX_R)
14574     add = 8;
14575   else
14576     add = 0;
14577   if (intel_syntax)
14578     sprintf (scratchbuf, "db%d", modrm.reg + add);
14579   else
14580     sprintf (scratchbuf, "%%db%d", modrm.reg + add);
14581   oappend (scratchbuf);
14582 }
14583
14584 static void
14585 OP_T (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14586 {
14587   sprintf (scratchbuf, "%%tr%d", modrm.reg);
14588   oappend (scratchbuf + intel_syntax);
14589 }
14590
14591 static void
14592 OP_R (int bytemode, int sizeflag)
14593 {
14594   if (modrm.mod == 3)
14595     OP_E (bytemode, sizeflag);
14596   else
14597     BadOp ();
14598 }
14599
14600 static void
14601 OP_MMX (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14602 {
14603   used_prefixes |= (prefixes & PREFIX_DATA);
14604   if (prefixes & PREFIX_DATA)
14605     {
14606       int add;
14607       USED_REX (REX_R);
14608       if (rex & REX_R)
14609         add = 8;
14610       else
14611         add = 0;
14612       sprintf (scratchbuf, "%%xmm%d", modrm.reg + add);
14613     }
14614   else
14615     sprintf (scratchbuf, "%%mm%d", modrm.reg);
14616   oappend (scratchbuf + intel_syntax);
14617 }
14618
14619 static void
14620 OP_XMM (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
14621 {
14622   int add;
14623   USED_REX (REX_R);
14624   if (rex & REX_R)
14625     add = 8;
14626   else
14627     add = 0;
14628   if (need_vex && bytemode != xmm_mode)
14629     {
14630       switch (vex.length)
14631         {
14632         case 128:
14633           sprintf (scratchbuf, "%%xmm%d", modrm.reg + add);
14634           break;
14635         case 256:
14636           sprintf (scratchbuf, "%%ymm%d", modrm.reg + add);
14637           break;
14638         default:
14639           abort ();
14640         }
14641     }
14642   else
14643     sprintf (scratchbuf, "%%xmm%d", modrm.reg + add);
14644   oappend (scratchbuf + intel_syntax);
14645 }
14646
14647 static void
14648 OP_EM (int bytemode, int sizeflag)
14649 {
14650   if (modrm.mod != 3)
14651     {
14652       if (intel_syntax
14653           && (bytemode == v_mode || bytemode == v_swap_mode))
14654         {
14655           bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode;
14656           used_prefixes |= (prefixes & PREFIX_DATA);
14657         }
14658       OP_E (bytemode, sizeflag);
14659       return;
14660     }
14661
14662   if ((sizeflag & SUFFIX_ALWAYS) && bytemode == v_swap_mode)
14663     swap_operand ();
14664
14665   /* Skip mod/rm byte.  */
14666   MODRM_CHECK;
14667   codep++;
14668   used_prefixes |= (prefixes & PREFIX_DATA);
14669   if (prefixes & PREFIX_DATA)
14670     {
14671       int add;
14672
14673       USED_REX (REX_B);
14674       if (rex & REX_B)
14675         add = 8;
14676       else
14677         add = 0;
14678       sprintf (scratchbuf, "%%xmm%d", modrm.rm + add);
14679     }
14680   else
14681     sprintf (scratchbuf, "%%mm%d", modrm.rm);
14682   oappend (scratchbuf + intel_syntax);
14683 }
14684
14685 /* cvt* are the only instructions in sse2 which have
14686    both SSE and MMX operands and also have 0x66 prefix
14687    in their opcode. 0x66 was originally used to differentiate
14688    between SSE and MMX instruction(operands). So we have to handle the
14689    cvt* separately using OP_EMC and OP_MXC */
14690 static void
14691 OP_EMC (int bytemode, int sizeflag)
14692 {
14693   if (modrm.mod != 3)
14694     {
14695       if (intel_syntax && bytemode == v_mode)
14696         {
14697           bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode;
14698           used_prefixes |= (prefixes & PREFIX_DATA);
14699         }
14700       OP_E (bytemode, sizeflag);
14701       return;
14702     }
14703
14704   /* Skip mod/rm byte.  */
14705   MODRM_CHECK;
14706   codep++;
14707   used_prefixes |= (prefixes & PREFIX_DATA);
14708   sprintf (scratchbuf, "%%mm%d", modrm.rm);
14709   oappend (scratchbuf + intel_syntax);
14710 }
14711
14712 static void
14713 OP_MXC (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14714 {
14715   used_prefixes |= (prefixes & PREFIX_DATA);
14716   sprintf (scratchbuf, "%%mm%d", modrm.reg);
14717   oappend (scratchbuf + intel_syntax);
14718 }
14719
14720 static void
14721 OP_EX (int bytemode, int sizeflag)
14722 {
14723   int add;
14724
14725   /* Skip mod/rm byte.  */
14726   MODRM_CHECK;
14727   codep++;
14728
14729   if (modrm.mod != 3)
14730     {
14731       OP_E_memory (bytemode, sizeflag);
14732       return;
14733     }
14734
14735   USED_REX (REX_B);
14736   if (rex & REX_B)
14737     add = 8;
14738   else
14739     add = 0;
14740
14741   if ((sizeflag & SUFFIX_ALWAYS)
14742       && (bytemode == x_swap_mode
14743           || bytemode == d_swap_mode
14744           || bytemode == q_swap_mode))
14745     swap_operand ();
14746
14747   if (need_vex
14748       && bytemode != xmm_mode
14749       && bytemode != xmmq_mode)
14750     {
14751       switch (vex.length)
14752         {
14753         case 128:
14754           sprintf (scratchbuf, "%%xmm%d", modrm.rm + add);
14755           break;
14756         case 256:
14757           sprintf (scratchbuf, "%%ymm%d", modrm.rm + add);
14758           break;
14759         default:
14760           abort ();
14761         }
14762     }
14763   else
14764     sprintf (scratchbuf, "%%xmm%d", modrm.rm + add);
14765   oappend (scratchbuf + intel_syntax);
14766 }
14767
14768 static void
14769 OP_MS (int bytemode, int sizeflag)
14770 {
14771   if (modrm.mod == 3)
14772     OP_EM (bytemode, sizeflag);
14773   else
14774     BadOp ();
14775 }
14776
14777 static void
14778 OP_XS (int bytemode, int sizeflag)
14779 {
14780   if (modrm.mod == 3)
14781     OP_EX (bytemode, sizeflag);
14782   else
14783     BadOp ();
14784 }
14785
14786 static void
14787 OP_M (int bytemode, int sizeflag)
14788 {
14789   if (modrm.mod == 3)
14790     /* bad bound,lea,lds,les,lfs,lgs,lss,cmpxchg8b,vmptrst modrm */
14791     BadOp ();
14792   else
14793     OP_E (bytemode, sizeflag);
14794 }
14795
14796 static void
14797 OP_0f07 (int bytemode, int sizeflag)
14798 {
14799   if (modrm.mod != 3 || modrm.rm != 0)
14800     BadOp ();
14801   else
14802     OP_E (bytemode, sizeflag);
14803 }
14804
14805 /* NOP is an alias of "xchg %ax,%ax" in 16bit mode, "xchg %eax,%eax" in
14806    32bit mode and "xchg %rax,%rax" in 64bit mode.  */
14807
14808 static void
14809 NOP_Fixup1 (int bytemode, int sizeflag)
14810 {
14811   if ((prefixes & PREFIX_DATA) != 0
14812       || (rex != 0
14813           && rex != 0x48
14814           && address_mode == mode_64bit))
14815     OP_REG (bytemode, sizeflag);
14816   else
14817     strcpy (obuf, "nop");
14818 }
14819
14820 static void
14821 NOP_Fixup2 (int bytemode, int sizeflag)
14822 {
14823   if ((prefixes & PREFIX_DATA) != 0
14824       || (rex != 0
14825           && rex != 0x48
14826           && address_mode == mode_64bit))
14827     OP_IMREG (bytemode, sizeflag);
14828 }
14829
14830 static const char *const Suffix3DNow[] = {
14831 /* 00 */        NULL,           NULL,           NULL,           NULL,
14832 /* 04 */        NULL,           NULL,           NULL,           NULL,
14833 /* 08 */        NULL,           NULL,           NULL,           NULL,
14834 /* 0C */        "pi2fw",        "pi2fd",        NULL,           NULL,
14835 /* 10 */        NULL,           NULL,           NULL,           NULL,
14836 /* 14 */        NULL,           NULL,           NULL,           NULL,
14837 /* 18 */        NULL,           NULL,           NULL,           NULL,
14838 /* 1C */        "pf2iw",        "pf2id",        NULL,           NULL,
14839 /* 20 */        NULL,           NULL,           NULL,           NULL,
14840 /* 24 */        NULL,           NULL,           NULL,           NULL,
14841 /* 28 */        NULL,           NULL,           NULL,           NULL,
14842 /* 2C */        NULL,           NULL,           NULL,           NULL,
14843 /* 30 */        NULL,           NULL,           NULL,           NULL,
14844 /* 34 */        NULL,           NULL,           NULL,           NULL,
14845 /* 38 */        NULL,           NULL,           NULL,           NULL,
14846 /* 3C */        NULL,           NULL,           NULL,           NULL,
14847 /* 40 */        NULL,           NULL,           NULL,           NULL,
14848 /* 44 */        NULL,           NULL,           NULL,           NULL,
14849 /* 48 */        NULL,           NULL,           NULL,           NULL,
14850 /* 4C */        NULL,           NULL,           NULL,           NULL,
14851 /* 50 */        NULL,           NULL,           NULL,           NULL,
14852 /* 54 */        NULL,           NULL,           NULL,           NULL,
14853 /* 58 */        NULL,           NULL,           NULL,           NULL,
14854 /* 5C */        NULL,           NULL,           NULL,           NULL,
14855 /* 60 */        NULL,           NULL,           NULL,           NULL,
14856 /* 64 */        NULL,           NULL,           NULL,           NULL,
14857 /* 68 */        NULL,           NULL,           NULL,           NULL,
14858 /* 6C */        NULL,           NULL,           NULL,           NULL,
14859 /* 70 */        NULL,           NULL,           NULL,           NULL,
14860 /* 74 */        NULL,           NULL,           NULL,           NULL,
14861 /* 78 */        NULL,           NULL,           NULL,           NULL,
14862 /* 7C */        NULL,           NULL,           NULL,           NULL,
14863 /* 80 */        NULL,           NULL,           NULL,           NULL,
14864 /* 84 */        NULL,           NULL,           NULL,           NULL,
14865 /* 88 */        NULL,           NULL,           "pfnacc",       NULL,
14866 /* 8C */        NULL,           NULL,           "pfpnacc",      NULL,
14867 /* 90 */        "pfcmpge",      NULL,           NULL,           NULL,
14868 /* 94 */        "pfmin",        NULL,           "pfrcp",        "pfrsqrt",
14869 /* 98 */        NULL,           NULL,           "pfsub",        NULL,
14870 /* 9C */        NULL,           NULL,           "pfadd",        NULL,
14871 /* A0 */        "pfcmpgt",      NULL,           NULL,           NULL,
14872 /* A4 */        "pfmax",        NULL,           "pfrcpit1",     "pfrsqit1",
14873 /* A8 */        NULL,           NULL,           "pfsubr",       NULL,
14874 /* AC */        NULL,           NULL,           "pfacc",        NULL,
14875 /* B0 */        "pfcmpeq",      NULL,           NULL,           NULL,
14876 /* B4 */        "pfmul",        NULL,           "pfrcpit2",     "pmulhrw",
14877 /* B8 */        NULL,           NULL,           NULL,           "pswapd",
14878 /* BC */        NULL,           NULL,           NULL,           "pavgusb",
14879 /* C0 */        NULL,           NULL,           NULL,           NULL,
14880 /* C4 */        NULL,           NULL,           NULL,           NULL,
14881 /* C8 */        NULL,           NULL,           NULL,           NULL,
14882 /* CC */        NULL,           NULL,           NULL,           NULL,
14883 /* D0 */        NULL,           NULL,           NULL,           NULL,
14884 /* D4 */        NULL,           NULL,           NULL,           NULL,
14885 /* D8 */        NULL,           NULL,           NULL,           NULL,
14886 /* DC */        NULL,           NULL,           NULL,           NULL,
14887 /* E0 */        NULL,           NULL,           NULL,           NULL,
14888 /* E4 */        NULL,           NULL,           NULL,           NULL,
14889 /* E8 */        NULL,           NULL,           NULL,           NULL,
14890 /* EC */        NULL,           NULL,           NULL,           NULL,
14891 /* F0 */        NULL,           NULL,           NULL,           NULL,
14892 /* F4 */        NULL,           NULL,           NULL,           NULL,
14893 /* F8 */        NULL,           NULL,           NULL,           NULL,
14894 /* FC */        NULL,           NULL,           NULL,           NULL,
14895 };
14896
14897 static void
14898 OP_3DNowSuffix (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14899 {
14900   const char *mnemonic;
14901
14902   FETCH_DATA (the_info, codep + 1);
14903   /* AMD 3DNow! instructions are specified by an opcode suffix in the
14904      place where an 8-bit immediate would normally go.  ie. the last
14905      byte of the instruction.  */
14906   obufp = mnemonicendp;
14907   mnemonic = Suffix3DNow[*codep++ & 0xff];
14908   if (mnemonic)
14909     oappend (mnemonic);
14910   else
14911     {
14912       /* Since a variable sized modrm/sib chunk is between the start
14913          of the opcode (0x0f0f) and the opcode suffix, we need to do
14914          all the modrm processing first, and don't know until now that
14915          we have a bad opcode.  This necessitates some cleaning up.  */
14916       op_out[0][0] = '\0';
14917       op_out[1][0] = '\0';
14918       BadOp ();
14919     }
14920   mnemonicendp = obufp;
14921 }
14922
14923 static struct op simd_cmp_op[] =
14924 {
14925   { STRING_COMMA_LEN ("eq") },
14926   { STRING_COMMA_LEN ("lt") },
14927   { STRING_COMMA_LEN ("le") },
14928   { STRING_COMMA_LEN ("unord") },
14929   { STRING_COMMA_LEN ("neq") },
14930   { STRING_COMMA_LEN ("nlt") },
14931   { STRING_COMMA_LEN ("nle") },
14932   { STRING_COMMA_LEN ("ord") }
14933 };
14934
14935 static void
14936 CMP_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14937 {
14938   unsigned int cmp_type;
14939
14940   FETCH_DATA (the_info, codep + 1);
14941   cmp_type = *codep++ & 0xff;
14942   if (cmp_type < ARRAY_SIZE (simd_cmp_op))
14943     {
14944       char suffix [3];
14945       char *p = mnemonicendp - 2;
14946       suffix[0] = p[0];
14947       suffix[1] = p[1];
14948       suffix[2] = '\0';
14949       sprintf (p, "%s%s", simd_cmp_op[cmp_type].name, suffix);
14950       mnemonicendp += simd_cmp_op[cmp_type].len;
14951     }
14952   else
14953     {
14954       /* We have a reserved extension byte.  Output it directly.  */
14955       scratchbuf[0] = '$';
14956       print_operand_value (scratchbuf + 1, 1, cmp_type);
14957       oappend (scratchbuf + intel_syntax);
14958       scratchbuf[0] = '\0';
14959     }
14960 }
14961
14962 static void
14963 OP_Mwait (int bytemode ATTRIBUTE_UNUSED,
14964           int sizeflag ATTRIBUTE_UNUSED)
14965 {
14966   /* mwait %eax,%ecx  */
14967   if (!intel_syntax)
14968     {
14969       const char **names = (address_mode == mode_64bit
14970                             ? names64 : names32);
14971       strcpy (op_out[0], names[0]);
14972       strcpy (op_out[1], names[1]);
14973       two_source_ops = 1;
14974     }
14975   /* Skip mod/rm byte.  */
14976   MODRM_CHECK;
14977   codep++;
14978 }
14979
14980 static void
14981 OP_Monitor (int bytemode ATTRIBUTE_UNUSED,
14982             int sizeflag ATTRIBUTE_UNUSED)
14983 {
14984   /* monitor %eax,%ecx,%edx"  */
14985   if (!intel_syntax)
14986     {
14987       const char **op1_names;
14988       const char **names = (address_mode == mode_64bit
14989                             ? names64 : names32);
14990
14991       if (!(prefixes & PREFIX_ADDR))
14992         op1_names = (address_mode == mode_16bit
14993                      ? names16 : names);
14994       else
14995         {
14996           /* Remove "addr16/addr32".  */
14997           all_prefixes[last_addr_prefix] = 0;
14998           op1_names = (address_mode != mode_32bit
14999                        ? names32 : names16);
15000           used_prefixes |= PREFIX_ADDR;
15001         }
15002       strcpy (op_out[0], op1_names[0]);
15003       strcpy (op_out[1], names[1]);
15004       strcpy (op_out[2], names[2]);
15005       two_source_ops = 1;
15006     }
15007   /* Skip mod/rm byte.  */
15008   MODRM_CHECK;
15009   codep++;
15010 }
15011
15012 static void
15013 BadOp (void)
15014 {
15015   /* Throw away prefixes and 1st. opcode byte.  */
15016   codep = insn_codep + 1;
15017   oappend ("(bad)");
15018 }
15019
15020 static void
15021 REP_Fixup (int bytemode, int sizeflag)
15022 {
15023   /* The 0xf3 prefix should be displayed as "rep" for ins, outs, movs,
15024      lods and stos.  */
15025   if (prefixes & PREFIX_REPZ)
15026     all_prefixes[last_repz_prefix] = REP_PREFIX;
15027
15028   switch (bytemode)
15029     {
15030     case al_reg:
15031     case eAX_reg:
15032     case indir_dx_reg:
15033       OP_IMREG (bytemode, sizeflag);
15034       break;
15035     case eDI_reg:
15036       OP_ESreg (bytemode, sizeflag);
15037       break;
15038     case eSI_reg:
15039       OP_DSreg (bytemode, sizeflag);
15040       break;
15041     default:
15042       abort ();
15043       break;
15044     }
15045 }
15046
15047 static void
15048 CMPXCHG8B_Fixup (int bytemode, int sizeflag)
15049 {
15050   USED_REX (REX_W);
15051   if (rex & REX_W)
15052     {
15053       /* Change cmpxchg8b to cmpxchg16b.  */
15054       char *p = mnemonicendp - 2;
15055       mnemonicendp = stpcpy (p, "16b");
15056       bytemode = o_mode;
15057     }
15058   OP_M (bytemode, sizeflag);
15059 }
15060
15061 static void
15062 XMM_Fixup (int reg, int sizeflag ATTRIBUTE_UNUSED)
15063 {
15064   if (need_vex)
15065     {
15066       switch (vex.length)
15067         {
15068         case 128:
15069           sprintf (scratchbuf, "%%xmm%d", reg);
15070           break;
15071         case 256:
15072           sprintf (scratchbuf, "%%ymm%d", reg);
15073           break;
15074         default:
15075           abort ();
15076         }
15077     }
15078   else
15079     sprintf (scratchbuf, "%%xmm%d", reg);
15080   oappend (scratchbuf + intel_syntax);
15081 }
15082
15083 static void
15084 CRC32_Fixup (int bytemode, int sizeflag)
15085 {
15086   /* Add proper suffix to "crc32".  */
15087   char *p = mnemonicendp;
15088
15089   switch (bytemode)
15090     {
15091     case b_mode:
15092       if (intel_syntax)
15093         goto skip;
15094
15095       *p++ = 'b';
15096       break;
15097     case v_mode:
15098       if (intel_syntax)
15099         goto skip;
15100
15101       USED_REX (REX_W);
15102       if (rex & REX_W)
15103         *p++ = 'q';
15104       else 
15105         {
15106           if (sizeflag & DFLAG)
15107             *p++ = 'l';
15108           else
15109             *p++ = 'w';
15110           used_prefixes |= (prefixes & PREFIX_DATA);
15111         }
15112       break;
15113     default:
15114       oappend (INTERNAL_DISASSEMBLER_ERROR);
15115       break;
15116     }
15117   mnemonicendp = p;
15118   *p = '\0';
15119
15120 skip:
15121   if (modrm.mod == 3)
15122     {
15123       int add;
15124
15125       /* Skip mod/rm byte.  */
15126       MODRM_CHECK;
15127       codep++;
15128
15129       USED_REX (REX_B);
15130       add = (rex & REX_B) ? 8 : 0;
15131       if (bytemode == b_mode)
15132         {
15133           USED_REX (0);
15134           if (rex)
15135             oappend (names8rex[modrm.rm + add]);
15136           else
15137             oappend (names8[modrm.rm + add]);
15138         }
15139       else
15140         {
15141           USED_REX (REX_W);
15142           if (rex & REX_W)
15143             oappend (names64[modrm.rm + add]);
15144           else if ((prefixes & PREFIX_DATA))
15145             oappend (names16[modrm.rm + add]);
15146           else
15147             oappend (names32[modrm.rm + add]);
15148         }
15149     }
15150   else
15151     OP_E (bytemode, sizeflag);
15152 }
15153
15154 static void
15155 FXSAVE_Fixup (int bytemode, int sizeflag)
15156 {
15157   /* Add proper suffix to "fxsave" and "fxrstor".  */
15158   USED_REX (REX_W);
15159   if (rex & REX_W)
15160     {
15161       char *p = mnemonicendp;
15162       *p++ = '6';
15163       *p++ = '4';
15164       *p = '\0';
15165       mnemonicendp = p;
15166     }
15167   OP_M (bytemode, sizeflag);
15168 }
15169
15170 /* Display the destination register operand for instructions with
15171    VEX. */
15172
15173 static void
15174 OP_VEX (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
15175 {
15176   if (!need_vex)
15177     abort ();
15178
15179   if (!need_vex_reg)
15180     return;
15181
15182   switch (vex.length)
15183     {
15184     case 128:
15185       switch (bytemode)
15186         {
15187         case vex_mode:
15188         case vex128_mode:
15189           break;
15190         default:
15191           abort ();
15192           return;
15193         }
15194
15195       sprintf (scratchbuf, "%%xmm%d", vex.register_specifier);
15196       break;
15197     case 256:
15198       switch (bytemode)
15199         {
15200         case vex_mode:
15201         case vex256_mode:
15202           break;
15203         default:
15204           abort ();
15205           return;
15206         }
15207
15208       sprintf (scratchbuf, "%%ymm%d", vex.register_specifier);
15209       break;
15210     default:
15211       abort ();
15212       break;
15213     }
15214   oappend (scratchbuf + intel_syntax);
15215 }
15216
15217 /* Get the VEX immediate byte without moving codep.  */
15218
15219 static unsigned char
15220 get_vex_imm8 (int sizeflag, int opnum)
15221 {
15222   int bytes_before_imm = 0;
15223
15224   if (modrm.mod != 3)
15225     {
15226       /* There are SIB/displacement bytes.  */
15227       if ((sizeflag & AFLAG) || address_mode == mode_64bit)
15228         {
15229           /* 32/64 bit address mode */
15230           int base = modrm.rm;
15231
15232           /* Check SIB byte.  */
15233           if (base == 4)
15234             {
15235               FETCH_DATA (the_info, codep + 1);
15236               base = *codep & 7;
15237               /* When decoding the third source, don't increase
15238                  bytes_before_imm as this has already been incremented
15239                  by one in OP_E_memory while decoding the second
15240                  source operand.  */
15241               if (opnum == 0)
15242                 bytes_before_imm++;
15243             }
15244
15245           /* Don't increase bytes_before_imm when decoding the third source,
15246              it has already been incremented by OP_E_memory while decoding
15247              the second source operand.  */
15248           if (opnum == 0)
15249             {
15250               switch (modrm.mod)
15251                 {
15252                   case 0:
15253                     /* When modrm.rm == 5 or modrm.rm == 4 and base in
15254                        SIB == 5, there is a 4 byte displacement.  */
15255                     if (base != 5)
15256                       /* No displacement. */
15257                       break;
15258                   case 2:
15259                     /* 4 byte displacement.  */
15260                     bytes_before_imm += 4;
15261                     break;
15262                   case 1:
15263                     /* 1 byte displacement.  */
15264                     bytes_before_imm++;
15265                     break;
15266                 }
15267             }
15268         }
15269       else
15270         {
15271           /* 16 bit address mode */
15272           /* Don't increase bytes_before_imm when decoding the third source,
15273              it has already been incremented by OP_E_memory while decoding
15274              the second source operand.  */
15275           if (opnum == 0)
15276             {
15277               switch (modrm.mod)
15278                 {
15279                 case 0:
15280                   /* When modrm.rm == 6, there is a 2 byte displacement.  */
15281                   if (modrm.rm != 6)
15282                     /* No displacement. */
15283                     break;
15284                 case 2:
15285                   /* 2 byte displacement.  */
15286                   bytes_before_imm += 2;
15287                   break;
15288                 case 1:
15289                   /* 1 byte displacement: when decoding the third source,
15290                      don't increase bytes_before_imm as this has already
15291                      been incremented by one in OP_E_memory while decoding
15292                      the second source operand.  */
15293                   if (opnum == 0)
15294                     bytes_before_imm++;
15295
15296                   break;
15297                 }
15298             }
15299         }
15300     }
15301
15302   FETCH_DATA (the_info, codep + bytes_before_imm + 1);
15303   return codep [bytes_before_imm];
15304 }
15305
15306 static void
15307 OP_EX_VexReg (int bytemode, int sizeflag, int reg)
15308 {
15309   if (reg == -1 && modrm.mod != 3)
15310     {
15311       OP_E_memory (bytemode, sizeflag);
15312       return;
15313     }
15314   else
15315     {
15316       if (reg == -1)
15317         {
15318           reg = modrm.rm;
15319           USED_REX (REX_B);
15320           if (rex & REX_B)
15321             reg += 8;
15322         }
15323       else if (reg > 7 && address_mode != mode_64bit)
15324         BadOp ();
15325     }
15326
15327   switch (vex.length)
15328     {
15329     case 128:
15330       sprintf (scratchbuf, "%%xmm%d", reg);
15331       break;
15332     case 256:
15333       sprintf (scratchbuf, "%%ymm%d", reg);
15334       break;
15335     default:
15336       abort ();
15337     }
15338   oappend (scratchbuf + intel_syntax);
15339 }
15340
15341 static void
15342 OP_Vex_2src (int bytemode, int sizeflag)
15343 {
15344   if (modrm.mod == 3)
15345     {
15346       USED_REX (REX_B);
15347       sprintf (scratchbuf, "%%xmm%d", rex & REX_B ? modrm.rm + 8 : modrm.rm);
15348       oappend (scratchbuf + intel_syntax);
15349     }
15350   else
15351     {
15352       if (intel_syntax
15353           && (bytemode == v_mode || bytemode == v_swap_mode))
15354         {
15355           bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode;
15356           used_prefixes |= (prefixes & PREFIX_DATA);
15357         }
15358       OP_E (bytemode, sizeflag);
15359     }
15360 }
15361
15362 static void
15363 OP_Vex_2src_1 (int bytemode, int sizeflag)
15364 {
15365   if (modrm.mod == 3)
15366     {
15367       /* Skip mod/rm byte.   */
15368       MODRM_CHECK;
15369       codep++;
15370     }
15371
15372   if (vex.w)
15373     {
15374       sprintf (scratchbuf, "%%xmm%d", vex.register_specifier);
15375       oappend (scratchbuf + intel_syntax);
15376     }
15377   else
15378     OP_Vex_2src (bytemode, sizeflag);
15379 }
15380
15381 static void
15382 OP_Vex_2src_2 (int bytemode, int sizeflag)
15383 {
15384   if (vex.w)
15385     OP_Vex_2src (bytemode, sizeflag);
15386   else
15387     {
15388       sprintf (scratchbuf, "%%xmm%d", vex.register_specifier);
15389       oappend (scratchbuf + intel_syntax);
15390     }
15391 }
15392
15393 static void
15394 OP_EX_VexW (int bytemode, int sizeflag)
15395 {
15396   int reg = -1;
15397
15398   if (!vex_w_done)
15399     {
15400       vex_w_done = 1;
15401
15402       /* Skip mod/rm byte.  */
15403       MODRM_CHECK;
15404       codep++;
15405
15406       if (vex.w)
15407         reg = get_vex_imm8 (sizeflag, 0) >> 4;
15408     }
15409   else
15410     {
15411       if (!vex.w)
15412         reg = get_vex_imm8 (sizeflag, 1) >> 4;
15413     }
15414
15415   OP_EX_VexReg (bytemode, sizeflag, reg);
15416 }
15417
15418 static void
15419 VEXI4_Fixup (int bytemode ATTRIBUTE_UNUSED,
15420              int sizeflag ATTRIBUTE_UNUSED)
15421 {
15422   /* Skip the immediate byte and check for invalid bits.  */
15423   FETCH_DATA (the_info, codep + 1);
15424   if (*codep++ & 0xf)
15425     BadOp ();
15426 }
15427
15428 static void
15429 OP_REG_VexI4 (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
15430 {
15431   int reg;
15432   FETCH_DATA (the_info, codep + 1);
15433   reg = *codep++;
15434
15435   if (bytemode != x_mode)
15436     abort ();
15437
15438   if (reg & 0xf)
15439       BadOp ();
15440
15441   reg >>= 4;
15442   if (reg > 7 && address_mode != mode_64bit)
15443     BadOp ();
15444
15445   switch (vex.length)
15446     {
15447     case 128:
15448       sprintf (scratchbuf, "%%xmm%d", reg);
15449       break;
15450     case 256:
15451       sprintf (scratchbuf, "%%ymm%d", reg);
15452       break;
15453     default:
15454       abort ();
15455     }
15456   oappend (scratchbuf + intel_syntax);
15457 }
15458
15459 static void
15460 OP_XMM_VexW (int bytemode, int sizeflag)
15461 {
15462   /* Turn off the REX.W bit since it is used for swapping operands
15463      now.  */
15464   rex &= ~REX_W;
15465   OP_XMM (bytemode, sizeflag);
15466 }
15467
15468 static void
15469 OP_EX_Vex (int bytemode, int sizeflag)
15470 {
15471   if (modrm.mod != 3)
15472     {
15473       if (vex.register_specifier != 0)
15474         BadOp ();
15475       need_vex_reg = 0;
15476     }
15477   OP_EX (bytemode, sizeflag);
15478 }
15479
15480 static void
15481 OP_XMM_Vex (int bytemode, int sizeflag)
15482 {
15483   if (modrm.mod != 3)
15484     {
15485       if (vex.register_specifier != 0)
15486         BadOp ();
15487       need_vex_reg = 0;
15488     }
15489   OP_XMM (bytemode, sizeflag);
15490 }
15491
15492 static void
15493 VZERO_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
15494 {
15495   switch (vex.length)
15496     {
15497     case 128:
15498       mnemonicendp = stpcpy (obuf, "vzeroupper");
15499       break;
15500     case 256:
15501       mnemonicendp = stpcpy (obuf, "vzeroall");
15502       break;
15503     default:
15504       abort ();
15505     }
15506 }
15507
15508 static struct op vex_cmp_op[] =
15509 {
15510   { STRING_COMMA_LEN ("eq") },
15511   { STRING_COMMA_LEN ("lt") },
15512   { STRING_COMMA_LEN ("le") },
15513   { STRING_COMMA_LEN ("unord") },
15514   { STRING_COMMA_LEN ("neq") },
15515   { STRING_COMMA_LEN ("nlt") },
15516   { STRING_COMMA_LEN ("nle") },
15517   { STRING_COMMA_LEN ("ord") },
15518   { STRING_COMMA_LEN ("eq_uq") },
15519   { STRING_COMMA_LEN ("nge") },
15520   { STRING_COMMA_LEN ("ngt") },
15521   { STRING_COMMA_LEN ("false") },
15522   { STRING_COMMA_LEN ("neq_oq") },
15523   { STRING_COMMA_LEN ("ge") },
15524   { STRING_COMMA_LEN ("gt") },
15525   { STRING_COMMA_LEN ("true") },
15526   { STRING_COMMA_LEN ("eq_os") },
15527   { STRING_COMMA_LEN ("lt_oq") },
15528   { STRING_COMMA_LEN ("le_oq") },
15529   { STRING_COMMA_LEN ("unord_s") },
15530   { STRING_COMMA_LEN ("neq_us") },
15531   { STRING_COMMA_LEN ("nlt_uq") },
15532   { STRING_COMMA_LEN ("nle_uq") },
15533   { STRING_COMMA_LEN ("ord_s") },
15534   { STRING_COMMA_LEN ("eq_us") },
15535   { STRING_COMMA_LEN ("nge_uq") },
15536   { STRING_COMMA_LEN ("ngt_uq") },
15537   { STRING_COMMA_LEN ("false_os") },
15538   { STRING_COMMA_LEN ("neq_os") },
15539   { STRING_COMMA_LEN ("ge_oq") },
15540   { STRING_COMMA_LEN ("gt_oq") },
15541   { STRING_COMMA_LEN ("true_us") },
15542 };
15543
15544 static void
15545 VCMP_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
15546 {
15547   unsigned int cmp_type;
15548
15549   FETCH_DATA (the_info, codep + 1);
15550   cmp_type = *codep++ & 0xff;
15551   if (cmp_type < ARRAY_SIZE (vex_cmp_op))
15552     {
15553       char suffix [3];
15554       char *p = mnemonicendp - 2;
15555       suffix[0] = p[0];
15556       suffix[1] = p[1];
15557       suffix[2] = '\0';
15558       sprintf (p, "%s%s", vex_cmp_op[cmp_type].name, suffix);
15559       mnemonicendp += vex_cmp_op[cmp_type].len;
15560     }
15561   else
15562     {
15563       /* We have a reserved extension byte.  Output it directly.  */
15564       scratchbuf[0] = '$';
15565       print_operand_value (scratchbuf + 1, 1, cmp_type);
15566       oappend (scratchbuf + intel_syntax);
15567       scratchbuf[0] = '\0';
15568     }
15569 }
15570
15571 static const struct op pclmul_op[] =
15572 {
15573   { STRING_COMMA_LEN ("lql") },
15574   { STRING_COMMA_LEN ("hql") },
15575   { STRING_COMMA_LEN ("lqh") },
15576   { STRING_COMMA_LEN ("hqh") }
15577 };
15578
15579 static void
15580 PCLMUL_Fixup (int bytemode ATTRIBUTE_UNUSED,
15581               int sizeflag ATTRIBUTE_UNUSED)
15582 {
15583   unsigned int pclmul_type;
15584
15585   FETCH_DATA (the_info, codep + 1);
15586   pclmul_type = *codep++ & 0xff;
15587   switch (pclmul_type)
15588     {
15589     case 0x10:
15590       pclmul_type = 2;
15591       break;
15592     case 0x11:
15593       pclmul_type = 3;
15594       break;
15595     default:
15596       break;
15597     } 
15598   if (pclmul_type < ARRAY_SIZE (pclmul_op))
15599     {
15600       char suffix [4];
15601       char *p = mnemonicendp - 3;
15602       suffix[0] = p[0];
15603       suffix[1] = p[1];
15604       suffix[2] = p[2];
15605       suffix[3] = '\0';
15606       sprintf (p, "%s%s", pclmul_op[pclmul_type].name, suffix);
15607       mnemonicendp += pclmul_op[pclmul_type].len;
15608     }
15609   else
15610     {
15611       /* We have a reserved extension byte.  Output it directly.  */
15612       scratchbuf[0] = '$';
15613       print_operand_value (scratchbuf + 1, 1, pclmul_type);
15614       oappend (scratchbuf + intel_syntax);
15615       scratchbuf[0] = '\0';
15616     }
15617 }
15618
15619 static void
15620 MOVBE_Fixup (int bytemode, int sizeflag)
15621 {
15622   /* Add proper suffix to "movbe".  */
15623   char *p = mnemonicendp;
15624
15625   switch (bytemode)
15626     {
15627     case v_mode:
15628       if (intel_syntax)
15629         goto skip;
15630
15631       USED_REX (REX_W);
15632       if (sizeflag & SUFFIX_ALWAYS)
15633         {
15634           if (rex & REX_W)
15635             *p++ = 'q';
15636           else
15637             {
15638               if (sizeflag & DFLAG)
15639                 *p++ = 'l';
15640               else
15641                 *p++ = 'w';
15642               used_prefixes |= (prefixes & PREFIX_DATA);
15643             }
15644         }
15645       break;
15646     default:
15647       oappend (INTERNAL_DISASSEMBLER_ERROR);
15648       break;
15649     }
15650   mnemonicendp = p;
15651   *p = '\0';
15652
15653 skip:
15654   OP_M (bytemode, sizeflag);
15655 }
15656
15657 static void
15658 OP_LWPCB_E (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
15659 {
15660   int reg;
15661   const char **names;
15662
15663   /* Skip mod/rm byte.  */
15664   MODRM_CHECK;
15665   codep++;
15666
15667   if (vex.w)
15668     names = names64;
15669   else if (vex.length == 256)
15670     names = names32;
15671   else
15672     names = names16;
15673
15674   reg = modrm.rm;
15675   USED_REX (REX_B);
15676   if (rex & REX_B)
15677     reg += 8;
15678
15679   oappend (names[reg]);
15680 }
15681
15682 static void
15683 OP_LWP_E (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
15684 {
15685   const char **names;
15686
15687   if (vex.w)
15688     names = names64;
15689   else if (vex.length == 256)
15690     names = names32;
15691   else
15692     names = names16;
15693
15694   oappend (names[vex.register_specifier]);
15695 }
15696
15697 static void
15698 OP_LWP_I (int bytemode ATTRIBUTE_UNUSED, int sizeflag)
15699 {
15700   if (vex.w || vex.length == 256)
15701     OP_I (q_mode, sizeflag);
15702   else
15703     OP_I (w_mode, sizeflag);
15704 }
15705