Add VEX_W_382X_P_2_M_0.
[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_382C_P_2_M_0,
1504   VEX_W_382D_P_2_M_0,
1505   VEX_W_382E_P_2_M_0,
1506   VEX_W_382F_P_2_M_0,
1507   VEX_W_3830_P_2,
1508   VEX_W_3831_P_2,
1509   VEX_W_3832_P_2,
1510   VEX_W_3833_P_2,
1511   VEX_W_3834_P_2,
1512   VEX_W_3835_P_2,
1513   VEX_W_3837_P_2,
1514   VEX_W_3838_P_2,
1515   VEX_W_3839_P_2,
1516   VEX_W_383A_P_2,
1517   VEX_W_383B_P_2,
1518   VEX_W_383C_P_2,
1519   VEX_W_383D_P_2,
1520   VEX_W_383E_P_2,
1521   VEX_W_383F_P_2,
1522   VEX_W_3840_P_2,
1523   VEX_W_3841_P_2,
1524   VEX_W_38DB_P_2,
1525   VEX_W_38DC_P_2,
1526   VEX_W_38DD_P_2,
1527   VEX_W_38DE_P_2,
1528   VEX_W_38DF_P_2,
1529   VEX_W_3A04_P_2,
1530   VEX_W_3A05_P_2,
1531   VEX_W_3A06_P_2,
1532   VEX_W_3A08_P_2,
1533   VEX_W_3A09_P_2,
1534   VEX_W_3A0A_P_2,
1535   VEX_W_3A0B_P_2,
1536   VEX_W_3A0C_P_2,
1537   VEX_W_3A0D_P_2,
1538   VEX_W_3A0E_P_2,
1539   VEX_W_3A0F_P_2,
1540   VEX_W_3A14_P_2,
1541   VEX_W_3A15_P_2,
1542   VEX_W_3A18_P_2,
1543   VEX_W_3A19_P_2,
1544   VEX_W_3A20_P_2,
1545   VEX_W_3A21_P_2,
1546   VEX_W_3A40_P_2,
1547   VEX_W_3A41_P_2,
1548   VEX_W_3A42_P_2,
1549   VEX_W_3A44_P_2,
1550   VEX_W_3A4A_P_2,
1551   VEX_W_3A4B_P_2,
1552   VEX_W_3A4C_P_2,
1553   VEX_W_3A60_P_2,
1554   VEX_W_3A61_P_2,
1555   VEX_W_3A62_P_2,
1556   VEX_W_3A63_P_2,
1557   VEX_W_3ADF_P_2
1558 };
1559
1560 typedef void (*op_rtn) (int bytemode, int sizeflag);
1561
1562 struct dis386 {
1563   const char *name;
1564   struct
1565     {
1566       op_rtn rtn;
1567       int bytemode;
1568     } op[MAX_OPERANDS];
1569 };
1570
1571 /* Upper case letters in the instruction names here are macros.
1572    'A' => print 'b' if no register operands or suffix_always is true
1573    'B' => print 'b' if suffix_always is true
1574    'C' => print 's' or 'l' ('w' or 'd' in Intel mode) depending on operand
1575           size prefix
1576    'D' => print 'w' if no register operands or 'w', 'l' or 'q', if
1577           suffix_always is true
1578    'E' => print 'e' if 32-bit form of jcxz
1579    'F' => print 'w' or 'l' depending on address size prefix (loop insns)
1580    'G' => print 'w' or 'l' depending on operand size prefix (i/o insns)
1581    'H' => print ",pt" or ",pn" branch hint
1582    'I' => honor following macro letter even in Intel mode (implemented only
1583           for some of the macro letters)
1584    'J' => print 'l'
1585    'K' => print 'd' or 'q' if rex prefix is present.
1586    'L' => print 'l' if suffix_always is true
1587    'M' => print 'r' if intel_mnemonic is false.
1588    'N' => print 'n' if instruction has no wait "prefix"
1589    'O' => print 'd' or 'o' (or 'q' in Intel mode)
1590    'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix,
1591           or suffix_always is true.  print 'q' if rex prefix is present.
1592    'Q' => print 'w', 'l' or 'q' for memory operand or suffix_always
1593           is true
1594    'R' => print 'w', 'l' or 'q' ('d' for 'l' and 'e' in Intel mode)
1595    'S' => print 'w', 'l' or 'q' if suffix_always is true
1596    'T' => print 'q' in 64bit mode and behave as 'P' otherwise
1597    'U' => print 'q' in 64bit mode and behave as 'Q' otherwise
1598    'V' => print 'q' in 64bit mode and behave as 'S' otherwise
1599    'W' => print 'b', 'w' or 'l' ('d' in Intel mode)
1600    'X' => print 's', 'd' depending on data16 prefix (for XMM)
1601    'Y' => 'q' if instruction has an REX 64bit overwrite prefix and
1602           suffix_always is true.
1603    'Z' => print 'q' in 64bit mode and behave as 'L' otherwise
1604    '!' => change condition from true to false or from false to true.
1605    '%' => add 1 upper case letter to the macro.
1606
1607    2 upper case letter macros:
1608    "XY" => print 'x' or 'y' if no register operands or suffix_always
1609            is true.
1610    "XW" => print 's', 'd' depending on the VEX.W bit (for FMA)
1611    "LQ" => print 'l' ('d' in Intel mode) or 'q' for memory operand
1612            or suffix_always is true
1613    "LB" => print "abs" in 64bit mode and behave as 'B' otherwise
1614    "LS" => print "abs" in 64bit mode and behave as 'S' otherwise
1615    "LV" => print "abs" for 64bit operand and behave as 'S' otherwise
1616
1617    Many of the above letters print nothing in Intel mode.  See "putop"
1618    for the details.
1619
1620    Braces '{' and '}', and vertical bars '|', indicate alternative
1621    mnemonic strings for AT&T and Intel.  */
1622
1623 static const struct dis386 dis386[] = {
1624   /* 00 */
1625   { "addB",             { Eb, Gb } },
1626   { "addS",             { Ev, Gv } },
1627   { "addB",             { Gb, EbS } },
1628   { "addS",             { Gv, EvS } },
1629   { "addB",             { AL, Ib } },
1630   { "addS",             { eAX, Iv } },
1631   { X86_64_TABLE (X86_64_06) },
1632   { X86_64_TABLE (X86_64_07) },
1633   /* 08 */
1634   { "orB",              { Eb, Gb } },
1635   { "orS",              { Ev, Gv } },
1636   { "orB",              { Gb, EbS } },
1637   { "orS",              { Gv, EvS } },
1638   { "orB",              { AL, Ib } },
1639   { "orS",              { eAX, Iv } },
1640   { X86_64_TABLE (X86_64_0D) },
1641   { "(bad)",            { XX } },       /* 0x0f extended opcode escape */
1642   /* 10 */
1643   { "adcB",             { Eb, Gb } },
1644   { "adcS",             { Ev, Gv } },
1645   { "adcB",             { Gb, EbS } },
1646   { "adcS",             { Gv, EvS } },
1647   { "adcB",             { AL, Ib } },
1648   { "adcS",             { eAX, Iv } },
1649   { X86_64_TABLE (X86_64_16) },
1650   { X86_64_TABLE (X86_64_17) },
1651   /* 18 */
1652   { "sbbB",             { Eb, Gb } },
1653   { "sbbS",             { Ev, Gv } },
1654   { "sbbB",             { Gb, EbS } },
1655   { "sbbS",             { Gv, EvS } },
1656   { "sbbB",             { AL, Ib } },
1657   { "sbbS",             { eAX, Iv } },
1658   { X86_64_TABLE (X86_64_1E) },
1659   { X86_64_TABLE (X86_64_1F) },
1660   /* 20 */
1661   { "andB",             { Eb, Gb } },
1662   { "andS",             { Ev, Gv } },
1663   { "andB",             { Gb, EbS } },
1664   { "andS",             { Gv, EvS } },
1665   { "andB",             { AL, Ib } },
1666   { "andS",             { eAX, Iv } },
1667   { "(bad)",            { XX } },       /* SEG ES prefix */
1668   { X86_64_TABLE (X86_64_27) },
1669   /* 28 */
1670   { "subB",             { Eb, Gb } },
1671   { "subS",             { Ev, Gv } },
1672   { "subB",             { Gb, EbS } },
1673   { "subS",             { Gv, EvS } },
1674   { "subB",             { AL, Ib } },
1675   { "subS",             { eAX, Iv } },
1676   { "(bad)",            { XX } },       /* SEG CS prefix */
1677   { X86_64_TABLE (X86_64_2F) },
1678   /* 30 */
1679   { "xorB",             { Eb, Gb } },
1680   { "xorS",             { Ev, Gv } },
1681   { "xorB",             { Gb, EbS } },
1682   { "xorS",             { Gv, EvS } },
1683   { "xorB",             { AL, Ib } },
1684   { "xorS",             { eAX, Iv } },
1685   { "(bad)",            { XX } },       /* SEG SS prefix */
1686   { X86_64_TABLE (X86_64_37) },
1687   /* 38 */
1688   { "cmpB",             { Eb, Gb } },
1689   { "cmpS",             { Ev, Gv } },
1690   { "cmpB",             { Gb, EbS } },
1691   { "cmpS",             { Gv, EvS } },
1692   { "cmpB",             { AL, Ib } },
1693   { "cmpS",             { eAX, Iv } },
1694   { "(bad)",            { XX } },       /* SEG DS prefix */
1695   { X86_64_TABLE (X86_64_3F) },
1696   /* 40 */
1697   { "inc{S|}",          { RMeAX } },
1698   { "inc{S|}",          { RMeCX } },
1699   { "inc{S|}",          { RMeDX } },
1700   { "inc{S|}",          { RMeBX } },
1701   { "inc{S|}",          { RMeSP } },
1702   { "inc{S|}",          { RMeBP } },
1703   { "inc{S|}",          { RMeSI } },
1704   { "inc{S|}",          { RMeDI } },
1705   /* 48 */
1706   { "dec{S|}",          { RMeAX } },
1707   { "dec{S|}",          { RMeCX } },
1708   { "dec{S|}",          { RMeDX } },
1709   { "dec{S|}",          { RMeBX } },
1710   { "dec{S|}",          { RMeSP } },
1711   { "dec{S|}",          { RMeBP } },
1712   { "dec{S|}",          { RMeSI } },
1713   { "dec{S|}",          { RMeDI } },
1714   /* 50 */
1715   { "pushV",            { RMrAX } },
1716   { "pushV",            { RMrCX } },
1717   { "pushV",            { RMrDX } },
1718   { "pushV",            { RMrBX } },
1719   { "pushV",            { RMrSP } },
1720   { "pushV",            { RMrBP } },
1721   { "pushV",            { RMrSI } },
1722   { "pushV",            { RMrDI } },
1723   /* 58 */
1724   { "popV",             { RMrAX } },
1725   { "popV",             { RMrCX } },
1726   { "popV",             { RMrDX } },
1727   { "popV",             { RMrBX } },
1728   { "popV",             { RMrSP } },
1729   { "popV",             { RMrBP } },
1730   { "popV",             { RMrSI } },
1731   { "popV",             { RMrDI } },
1732   /* 60 */
1733   { X86_64_TABLE (X86_64_60) },
1734   { X86_64_TABLE (X86_64_61) },
1735   { X86_64_TABLE (X86_64_62) },
1736   { X86_64_TABLE (X86_64_63) },
1737   { "(bad)",            { XX } },       /* seg fs */
1738   { "(bad)",            { XX } },       /* seg gs */
1739   { "(bad)",            { XX } },       /* op size prefix */
1740   { "(bad)",            { XX } },       /* adr size prefix */
1741   /* 68 */
1742   { "pushT",            { Iq } },
1743   { "imulS",            { Gv, Ev, Iv } },
1744   { "pushT",            { sIb } },
1745   { "imulS",            { Gv, Ev, sIb } },
1746   { "ins{b|}",          { Ybr, indirDX } },
1747   { X86_64_TABLE (X86_64_6D) },
1748   { "outs{b|}",         { indirDXr, Xb } },
1749   { X86_64_TABLE (X86_64_6F) },
1750   /* 70 */
1751   { "joH",              { Jb, XX, cond_jump_flag } },
1752   { "jnoH",             { Jb, XX, cond_jump_flag } },
1753   { "jbH",              { Jb, XX, cond_jump_flag } },
1754   { "jaeH",             { Jb, XX, cond_jump_flag } },
1755   { "jeH",              { Jb, XX, cond_jump_flag } },
1756   { "jneH",             { Jb, XX, cond_jump_flag } },
1757   { "jbeH",             { Jb, XX, cond_jump_flag } },
1758   { "jaH",              { Jb, XX, cond_jump_flag } },
1759   /* 78 */
1760   { "jsH",              { Jb, XX, cond_jump_flag } },
1761   { "jnsH",             { Jb, XX, cond_jump_flag } },
1762   { "jpH",              { Jb, XX, cond_jump_flag } },
1763   { "jnpH",             { Jb, XX, cond_jump_flag } },
1764   { "jlH",              { Jb, XX, cond_jump_flag } },
1765   { "jgeH",             { Jb, XX, cond_jump_flag } },
1766   { "jleH",             { Jb, XX, cond_jump_flag } },
1767   { "jgH",              { Jb, XX, cond_jump_flag } },
1768   /* 80 */
1769   { REG_TABLE (REG_80) },
1770   { REG_TABLE (REG_81) },
1771   { "(bad)",            { XX } },
1772   { REG_TABLE (REG_82) },
1773   { "testB",            { Eb, Gb } },
1774   { "testS",            { Ev, Gv } },
1775   { "xchgB",            { Eb, Gb } },
1776   { "xchgS",            { Ev, Gv } },
1777   /* 88 */
1778   { "movB",             { Eb, Gb } },
1779   { "movS",             { Ev, Gv } },
1780   { "movB",             { Gb, EbS } },
1781   { "movS",             { Gv, EvS } },
1782   { "movD",             { Sv, Sw } },
1783   { MOD_TABLE (MOD_8D) },
1784   { "movD",             { Sw, Sv } },
1785   { REG_TABLE (REG_8F) },
1786   /* 90 */
1787   { PREFIX_TABLE (PREFIX_90) },
1788   { "xchgS",            { RMeCX, eAX } },
1789   { "xchgS",            { RMeDX, eAX } },
1790   { "xchgS",            { RMeBX, eAX } },
1791   { "xchgS",            { RMeSP, eAX } },
1792   { "xchgS",            { RMeBP, eAX } },
1793   { "xchgS",            { RMeSI, eAX } },
1794   { "xchgS",            { RMeDI, eAX } },
1795   /* 98 */
1796   { "cW{t|}R",          { XX } },
1797   { "cR{t|}O",          { XX } },
1798   { X86_64_TABLE (X86_64_9A) },
1799   { "(bad)",            { XX } },       /* fwait */
1800   { "pushfT",           { XX } },
1801   { "popfT",            { XX } },
1802   { "sahf",             { XX } },
1803   { "lahf",             { XX } },
1804   /* a0 */
1805   { "mov%LB",           { AL, Ob } },
1806   { "mov%LS",           { eAX, Ov } },
1807   { "mov%LB",           { Ob, AL } },
1808   { "mov%LS",           { Ov, eAX } },
1809   { "movs{b|}",         { Ybr, Xb } },
1810   { "movs{R|}",         { Yvr, Xv } },
1811   { "cmps{b|}",         { Xb, Yb } },
1812   { "cmps{R|}",         { Xv, Yv } },
1813   /* a8 */
1814   { "testB",            { AL, Ib } },
1815   { "testS",            { eAX, Iv } },
1816   { "stosB",            { Ybr, AL } },
1817   { "stosS",            { Yvr, eAX } },
1818   { "lodsB",            { ALr, Xb } },
1819   { "lodsS",            { eAXr, Xv } },
1820   { "scasB",            { AL, Yb } },
1821   { "scasS",            { eAX, Yv } },
1822   /* b0 */
1823   { "movB",             { RMAL, Ib } },
1824   { "movB",             { RMCL, Ib } },
1825   { "movB",             { RMDL, Ib } },
1826   { "movB",             { RMBL, Ib } },
1827   { "movB",             { RMAH, Ib } },
1828   { "movB",             { RMCH, Ib } },
1829   { "movB",             { RMDH, Ib } },
1830   { "movB",             { RMBH, Ib } },
1831   /* b8 */
1832   { "mov%LV",           { RMeAX, Iv64 } },
1833   { "mov%LV",           { RMeCX, Iv64 } },
1834   { "mov%LV",           { RMeDX, Iv64 } },
1835   { "mov%LV",           { RMeBX, Iv64 } },
1836   { "mov%LV",           { RMeSP, Iv64 } },
1837   { "mov%LV",           { RMeBP, Iv64 } },
1838   { "mov%LV",           { RMeSI, Iv64 } },
1839   { "mov%LV",           { RMeDI, Iv64 } },
1840   /* c0 */
1841   { REG_TABLE (REG_C0) },
1842   { REG_TABLE (REG_C1) },
1843   { "retT",             { Iw } },
1844   { "retT",             { XX } },
1845   { X86_64_TABLE (X86_64_C4) },
1846   { X86_64_TABLE (X86_64_C5) },
1847   { REG_TABLE (REG_C6) },
1848   { REG_TABLE (REG_C7) },
1849   /* c8 */
1850   { "enterT",           { Iw, Ib } },
1851   { "leaveT",           { XX } },
1852   { "Jret{|f}P",        { Iw } },
1853   { "Jret{|f}P",        { XX } },
1854   { "int3",             { XX } },
1855   { "int",              { Ib } },
1856   { X86_64_TABLE (X86_64_CE) },
1857   { "iretP",            { XX } },
1858   /* d0 */
1859   { REG_TABLE (REG_D0) },
1860   { REG_TABLE (REG_D1) },
1861   { REG_TABLE (REG_D2) },
1862   { REG_TABLE (REG_D3) },
1863   { X86_64_TABLE (X86_64_D4) },
1864   { X86_64_TABLE (X86_64_D5) },
1865   { "(bad)",            { XX } },
1866   { "xlat",             { DSBX } },
1867   /* d8 */
1868   { FLOAT },
1869   { FLOAT },
1870   { FLOAT },
1871   { FLOAT },
1872   { FLOAT },
1873   { FLOAT },
1874   { FLOAT },
1875   { FLOAT },
1876   /* e0 */
1877   { "loopneFH",         { Jb, XX, loop_jcxz_flag } },
1878   { "loopeFH",          { Jb, XX, loop_jcxz_flag } },
1879   { "loopFH",           { Jb, XX, loop_jcxz_flag } },
1880   { "jEcxzH",           { Jb, XX, loop_jcxz_flag } },
1881   { "inB",              { AL, Ib } },
1882   { "inG",              { zAX, Ib } },
1883   { "outB",             { Ib, AL } },
1884   { "outG",             { Ib, zAX } },
1885   /* e8 */
1886   { "callT",            { Jv } },
1887   { "jmpT",             { Jv } },
1888   { X86_64_TABLE (X86_64_EA) },
1889   { "jmp",              { Jb } },
1890   { "inB",              { AL, indirDX } },
1891   { "inG",              { zAX, indirDX } },
1892   { "outB",             { indirDX, AL } },
1893   { "outG",             { indirDX, zAX } },
1894   /* f0 */
1895   { "(bad)",            { XX } },       /* lock prefix */
1896   { "icebp",            { XX } },
1897   { "(bad)",            { XX } },       /* repne */
1898   { "(bad)",            { XX } },       /* repz */
1899   { "hlt",              { XX } },
1900   { "cmc",              { XX } },
1901   { REG_TABLE (REG_F6) },
1902   { REG_TABLE (REG_F7) },
1903   /* f8 */
1904   { "clc",              { XX } },
1905   { "stc",              { XX } },
1906   { "cli",              { XX } },
1907   { "sti",              { XX } },
1908   { "cld",              { XX } },
1909   { "std",              { XX } },
1910   { REG_TABLE (REG_FE) },
1911   { REG_TABLE (REG_FF) },
1912 };
1913
1914 static const struct dis386 dis386_twobyte[] = {
1915   /* 00 */
1916   { REG_TABLE (REG_0F00 ) },
1917   { REG_TABLE (REG_0F01 ) },
1918   { "larS",             { Gv, Ew } },
1919   { "lslS",             { Gv, Ew } },
1920   { "(bad)",            { XX } },
1921   { "syscall",          { XX } },
1922   { "clts",             { XX } },
1923   { "sysretP",          { XX } },
1924   /* 08 */
1925   { "invd",             { XX } },
1926   { "wbinvd",           { XX } },
1927   { "(bad)",            { XX } },
1928   { "ud2a",             { XX } },
1929   { "(bad)",            { XX } },
1930   { REG_TABLE (REG_0F0D) },
1931   { "femms",            { XX } },
1932   { "",                 { MX, EM, OPSUF } }, /* See OP_3DNowSuffix.  */
1933   /* 10 */
1934   { PREFIX_TABLE (PREFIX_0F10) },
1935   { PREFIX_TABLE (PREFIX_0F11) },
1936   { PREFIX_TABLE (PREFIX_0F12) },
1937   { MOD_TABLE (MOD_0F13) },
1938   { "unpcklpX",         { XM, EXx } },
1939   { "unpckhpX",         { XM, EXx } },
1940   { PREFIX_TABLE (PREFIX_0F16) },
1941   { MOD_TABLE (MOD_0F17) },
1942   /* 18 */
1943   { REG_TABLE (REG_0F18) },
1944   { "nopQ",             { Ev } },
1945   { "nopQ",             { Ev } },
1946   { "nopQ",             { Ev } },
1947   { "nopQ",             { Ev } },
1948   { "nopQ",             { Ev } },
1949   { "nopQ",             { Ev } },
1950   { "nopQ",             { Ev } },
1951   /* 20 */
1952   { MOD_TABLE (MOD_0F20) },
1953   { MOD_TABLE (MOD_0F21) },
1954   { MOD_TABLE (MOD_0F22) },
1955   { MOD_TABLE (MOD_0F23) },
1956   { MOD_TABLE (MOD_0F24) },
1957   { "(bad)",            { XX } },
1958   { MOD_TABLE (MOD_0F26) },
1959   { "(bad)",            { XX } },
1960   /* 28 */
1961   { "movapX",           { XM, EXx } },
1962   { "movapX",           { EXxS, XM } },
1963   { PREFIX_TABLE (PREFIX_0F2A) },
1964   { PREFIX_TABLE (PREFIX_0F2B) },
1965   { PREFIX_TABLE (PREFIX_0F2C) },
1966   { PREFIX_TABLE (PREFIX_0F2D) },
1967   { PREFIX_TABLE (PREFIX_0F2E) },
1968   { PREFIX_TABLE (PREFIX_0F2F) },
1969   /* 30 */
1970   { "wrmsr",            { XX } },
1971   { "rdtsc",            { XX } },
1972   { "rdmsr",            { XX } },
1973   { "rdpmc",            { XX } },
1974   { "sysenter",         { XX } },
1975   { "sysexit",          { XX } },
1976   { "(bad)",            { XX } },
1977   { "getsec",           { XX } },
1978   /* 38 */
1979   { THREE_BYTE_TABLE (THREE_BYTE_0F38) },
1980   { "(bad)",            { XX } },
1981   { THREE_BYTE_TABLE (THREE_BYTE_0F3A) },
1982   { "(bad)",            { XX } },
1983   { "(bad)",            { XX } },
1984   { "(bad)",            { XX } },
1985   { "(bad)",            { XX } },
1986   { "(bad)",            { XX } },
1987   /* 40 */
1988   { "cmovoS",           { Gv, Ev } },
1989   { "cmovnoS",          { Gv, Ev } },
1990   { "cmovbS",           { Gv, Ev } },
1991   { "cmovaeS",          { Gv, Ev } },
1992   { "cmoveS",           { Gv, Ev } },
1993   { "cmovneS",          { Gv, Ev } },
1994   { "cmovbeS",          { Gv, Ev } },
1995   { "cmovaS",           { Gv, Ev } },
1996   /* 48 */
1997   { "cmovsS",           { Gv, Ev } },
1998   { "cmovnsS",          { Gv, Ev } },
1999   { "cmovpS",           { Gv, Ev } },
2000   { "cmovnpS",          { Gv, Ev } },
2001   { "cmovlS",           { Gv, Ev } },
2002   { "cmovgeS",          { Gv, Ev } },
2003   { "cmovleS",          { Gv, Ev } },
2004   { "cmovgS",           { Gv, Ev } },
2005   /* 50 */
2006   { MOD_TABLE (MOD_0F51) },
2007   { PREFIX_TABLE (PREFIX_0F51) },
2008   { PREFIX_TABLE (PREFIX_0F52) },
2009   { PREFIX_TABLE (PREFIX_0F53) },
2010   { "andpX",            { XM, EXx } },
2011   { "andnpX",           { XM, EXx } },
2012   { "orpX",             { XM, EXx } },
2013   { "xorpX",            { XM, EXx } },
2014   /* 58 */
2015   { PREFIX_TABLE (PREFIX_0F58) },
2016   { PREFIX_TABLE (PREFIX_0F59) },
2017   { PREFIX_TABLE (PREFIX_0F5A) },
2018   { PREFIX_TABLE (PREFIX_0F5B) },
2019   { PREFIX_TABLE (PREFIX_0F5C) },
2020   { PREFIX_TABLE (PREFIX_0F5D) },
2021   { PREFIX_TABLE (PREFIX_0F5E) },
2022   { PREFIX_TABLE (PREFIX_0F5F) },
2023   /* 60 */
2024   { PREFIX_TABLE (PREFIX_0F60) },
2025   { PREFIX_TABLE (PREFIX_0F61) },
2026   { PREFIX_TABLE (PREFIX_0F62) },
2027   { "packsswb",         { MX, EM } },
2028   { "pcmpgtb",          { MX, EM } },
2029   { "pcmpgtw",          { MX, EM } },
2030   { "pcmpgtd",          { MX, EM } },
2031   { "packuswb",         { MX, EM } },
2032   /* 68 */
2033   { "punpckhbw",        { MX, EM } },
2034   { "punpckhwd",        { MX, EM } },
2035   { "punpckhdq",        { MX, EM } },
2036   { "packssdw",         { MX, EM } },
2037   { PREFIX_TABLE (PREFIX_0F6C) },
2038   { PREFIX_TABLE (PREFIX_0F6D) },
2039   { "movK",             { MX, Edq } },
2040   { PREFIX_TABLE (PREFIX_0F6F) },
2041   /* 70 */
2042   { PREFIX_TABLE (PREFIX_0F70) },
2043   { REG_TABLE (REG_0F71) },
2044   { REG_TABLE (REG_0F72) },
2045   { REG_TABLE (REG_0F73) },
2046   { "pcmpeqb",          { MX, EM } },
2047   { "pcmpeqw",          { MX, EM } },
2048   { "pcmpeqd",          { MX, EM } },
2049   { "emms",             { XX } },
2050   /* 78 */
2051   { PREFIX_TABLE (PREFIX_0F78) },
2052   { PREFIX_TABLE (PREFIX_0F79) },
2053   { THREE_BYTE_TABLE (THREE_BYTE_0F7A) },
2054   { "(bad)",            { XX } },
2055   { PREFIX_TABLE (PREFIX_0F7C) },
2056   { PREFIX_TABLE (PREFIX_0F7D) },
2057   { PREFIX_TABLE (PREFIX_0F7E) },
2058   { PREFIX_TABLE (PREFIX_0F7F) },
2059   /* 80 */
2060   { "joH",              { Jv, XX, cond_jump_flag } },
2061   { "jnoH",             { Jv, XX, cond_jump_flag } },
2062   { "jbH",              { Jv, XX, cond_jump_flag } },
2063   { "jaeH",             { Jv, XX, cond_jump_flag } },
2064   { "jeH",              { Jv, XX, cond_jump_flag } },
2065   { "jneH",             { Jv, XX, cond_jump_flag } },
2066   { "jbeH",             { Jv, XX, cond_jump_flag } },
2067   { "jaH",              { Jv, XX, cond_jump_flag } },
2068   /* 88 */
2069   { "jsH",              { Jv, XX, cond_jump_flag } },
2070   { "jnsH",             { Jv, XX, cond_jump_flag } },
2071   { "jpH",              { Jv, XX, cond_jump_flag } },
2072   { "jnpH",             { Jv, XX, cond_jump_flag } },
2073   { "jlH",              { Jv, XX, cond_jump_flag } },
2074   { "jgeH",             { Jv, XX, cond_jump_flag } },
2075   { "jleH",             { Jv, XX, cond_jump_flag } },
2076   { "jgH",              { Jv, XX, cond_jump_flag } },
2077   /* 90 */
2078   { "seto",             { Eb } },
2079   { "setno",            { Eb } },
2080   { "setb",             { Eb } },
2081   { "setae",            { Eb } },
2082   { "sete",             { Eb } },
2083   { "setne",            { Eb } },
2084   { "setbe",            { Eb } },
2085   { "seta",             { Eb } },
2086   /* 98 */
2087   { "sets",             { Eb } },
2088   { "setns",            { Eb } },
2089   { "setp",             { Eb } },
2090   { "setnp",            { Eb } },
2091   { "setl",             { Eb } },
2092   { "setge",            { Eb } },
2093   { "setle",            { Eb } },
2094   { "setg",             { Eb } },
2095   /* a0 */
2096   { "pushT",            { fs } },
2097   { "popT",             { fs } },
2098   { "cpuid",            { XX } },
2099   { "btS",              { Ev, Gv } },
2100   { "shldS",            { Ev, Gv, Ib } },
2101   { "shldS",            { Ev, Gv, CL } },
2102   { REG_TABLE (REG_0FA6) },
2103   { REG_TABLE (REG_0FA7) },
2104   /* a8 */
2105   { "pushT",            { gs } },
2106   { "popT",             { gs } },
2107   { "rsm",              { XX } },
2108   { "btsS",             { Ev, Gv } },
2109   { "shrdS",            { Ev, Gv, Ib } },
2110   { "shrdS",            { Ev, Gv, CL } },
2111   { REG_TABLE (REG_0FAE) },
2112   { "imulS",            { Gv, Ev } },
2113   /* b0 */
2114   { "cmpxchgB",         { Eb, Gb } },
2115   { "cmpxchgS",         { Ev, Gv } },
2116   { MOD_TABLE (MOD_0FB2) },
2117   { "btrS",             { Ev, Gv } },
2118   { MOD_TABLE (MOD_0FB4) },
2119   { MOD_TABLE (MOD_0FB5) },
2120   { "movz{bR|x}",       { Gv, Eb } },
2121   { "movz{wR|x}",       { Gv, Ew } }, /* yes, there really is movzww ! */
2122   /* b8 */
2123   { PREFIX_TABLE (PREFIX_0FB8) },
2124   { "ud2b",             { XX } },
2125   { REG_TABLE (REG_0FBA) },
2126   { "btcS",             { Ev, Gv } },
2127   { "bsfS",             { Gv, Ev } },
2128   { PREFIX_TABLE (PREFIX_0FBD) },
2129   { "movs{bR|x}",       { Gv, Eb } },
2130   { "movs{wR|x}",       { Gv, Ew } }, /* yes, there really is movsww ! */
2131   /* c0 */
2132   { "xaddB",            { Eb, Gb } },
2133   { "xaddS",            { Ev, Gv } },
2134   { PREFIX_TABLE (PREFIX_0FC2) },
2135   { PREFIX_TABLE (PREFIX_0FC3) },
2136   { "pinsrw",           { MX, Edqw, Ib } },
2137   { "pextrw",           { Gdq, MS, Ib } },
2138   { "shufpX",           { XM, EXx, Ib } },
2139   { REG_TABLE (REG_0FC7) },
2140   /* c8 */
2141   { "bswap",            { RMeAX } },
2142   { "bswap",            { RMeCX } },
2143   { "bswap",            { RMeDX } },
2144   { "bswap",            { RMeBX } },
2145   { "bswap",            { RMeSP } },
2146   { "bswap",            { RMeBP } },
2147   { "bswap",            { RMeSI } },
2148   { "bswap",            { RMeDI } },
2149   /* d0 */
2150   { PREFIX_TABLE (PREFIX_0FD0) },
2151   { "psrlw",            { MX, EM } },
2152   { "psrld",            { MX, EM } },
2153   { "psrlq",            { MX, EM } },
2154   { "paddq",            { MX, EM } },
2155   { "pmullw",           { MX, EM } },
2156   { PREFIX_TABLE (PREFIX_0FD6) },
2157   { MOD_TABLE (MOD_0FD7) },
2158   /* d8 */
2159   { "psubusb",          { MX, EM } },
2160   { "psubusw",          { MX, EM } },
2161   { "pminub",           { MX, EM } },
2162   { "pand",             { MX, EM } },
2163   { "paddusb",          { MX, EM } },
2164   { "paddusw",          { MX, EM } },
2165   { "pmaxub",           { MX, EM } },
2166   { "pandn",            { MX, EM } },
2167   /* e0 */
2168   { "pavgb",            { MX, EM } },
2169   { "psraw",            { MX, EM } },
2170   { "psrad",            { MX, EM } },
2171   { "pavgw",            { MX, EM } },
2172   { "pmulhuw",          { MX, EM } },
2173   { "pmulhw",           { MX, EM } },
2174   { PREFIX_TABLE (PREFIX_0FE6) },
2175   { PREFIX_TABLE (PREFIX_0FE7) },
2176   /* e8 */
2177   { "psubsb",           { MX, EM } },
2178   { "psubsw",           { MX, EM } },
2179   { "pminsw",           { MX, EM } },
2180   { "por",              { MX, EM } },
2181   { "paddsb",           { MX, EM } },
2182   { "paddsw",           { MX, EM } },
2183   { "pmaxsw",           { MX, EM } },
2184   { "pxor",             { MX, EM } },
2185   /* f0 */
2186   { PREFIX_TABLE (PREFIX_0FF0) },
2187   { "psllw",            { MX, EM } },
2188   { "pslld",            { MX, EM } },
2189   { "psllq",            { MX, EM } },
2190   { "pmuludq",          { MX, EM } },
2191   { "pmaddwd",          { MX, EM } },
2192   { "psadbw",           { MX, EM } },
2193   { PREFIX_TABLE (PREFIX_0FF7) },
2194   /* f8 */
2195   { "psubb",            { MX, EM } },
2196   { "psubw",            { MX, EM } },
2197   { "psubd",            { MX, EM } },
2198   { "psubq",            { MX, EM } },
2199   { "paddb",            { MX, EM } },
2200   { "paddw",            { MX, EM } },
2201   { "paddd",            { MX, EM } },
2202   { "(bad)",            { XX } },
2203 };
2204
2205 static const unsigned char onebyte_has_modrm[256] = {
2206   /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
2207   /*       -------------------------------        */
2208   /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
2209   /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
2210   /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
2211   /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
2212   /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
2213   /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
2214   /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
2215   /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
2216   /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
2217   /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
2218   /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
2219   /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
2220   /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
2221   /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
2222   /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
2223   /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1  /* f0 */
2224   /*       -------------------------------        */
2225   /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
2226 };
2227
2228 static const unsigned char twobyte_has_modrm[256] = {
2229   /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
2230   /*       -------------------------------        */
2231   /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
2232   /* 10 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 1f */
2233   /* 20 */ 1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1, /* 2f */
2234   /* 30 */ 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, /* 3f */
2235   /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
2236   /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */
2237   /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */
2238   /* 70 */ 1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1, /* 7f */
2239   /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
2240   /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
2241   /* a0 */ 0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1, /* af */
2242   /* b0 */ 1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1, /* bf */
2243   /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
2244   /* d0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
2245   /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
2246   /* f0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0  /* ff */
2247   /*       -------------------------------        */
2248   /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
2249 };
2250
2251 static char obuf[100];
2252 static char *obufp;
2253 static char *mnemonicendp;
2254 static char scratchbuf[100];
2255 static unsigned char *start_codep;
2256 static unsigned char *insn_codep;
2257 static unsigned char *codep;
2258 static int last_lock_prefix;
2259 static int last_repz_prefix;
2260 static int last_repnz_prefix;
2261 static int last_data_prefix;
2262 static int last_addr_prefix;
2263 static int last_rex_prefix;
2264 static int last_seg_prefix;
2265 #define MAX_CODE_LENGTH 15
2266 /* We can up to 14 prefixes since the maximum instruction length is
2267    15bytes.  */
2268 static int all_prefixes[MAX_CODE_LENGTH - 1];
2269 static disassemble_info *the_info;
2270 static struct
2271   {
2272     int mod;
2273     int reg;
2274     int rm;
2275   }
2276 modrm;
2277 static unsigned char need_modrm;
2278 static struct
2279   {
2280     int register_specifier;
2281     int length;
2282     int prefix;
2283     int w;
2284   }
2285 vex;
2286 static unsigned char need_vex;
2287 static unsigned char need_vex_reg;
2288 static unsigned char vex_w_done;
2289
2290 struct op
2291   {
2292     const char *name;
2293     unsigned int len;
2294   };
2295
2296 /* If we are accessing mod/rm/reg without need_modrm set, then the
2297    values are stale.  Hitting this abort likely indicates that you
2298    need to update onebyte_has_modrm or twobyte_has_modrm.  */
2299 #define MODRM_CHECK  if (!need_modrm) abort ()
2300
2301 static const char **names64;
2302 static const char **names32;
2303 static const char **names16;
2304 static const char **names8;
2305 static const char **names8rex;
2306 static const char **names_seg;
2307 static const char *index64;
2308 static const char *index32;
2309 static const char **index16;
2310
2311 static const char *intel_names64[] = {
2312   "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
2313   "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
2314 };
2315 static const char *intel_names32[] = {
2316   "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
2317   "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
2318 };
2319 static const char *intel_names16[] = {
2320   "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
2321   "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
2322 };
2323 static const char *intel_names8[] = {
2324   "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
2325 };
2326 static const char *intel_names8rex[] = {
2327   "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil",
2328   "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"
2329 };
2330 static const char *intel_names_seg[] = {
2331   "es", "cs", "ss", "ds", "fs", "gs", "?", "?",
2332 };
2333 static const char *intel_index64 = "riz";
2334 static const char *intel_index32 = "eiz";
2335 static const char *intel_index16[] = {
2336   "bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx"
2337 };
2338
2339 static const char *att_names64[] = {
2340   "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
2341   "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
2342 };
2343 static const char *att_names32[] = {
2344   "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
2345   "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
2346 };
2347 static const char *att_names16[] = {
2348   "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
2349   "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
2350 };
2351 static const char *att_names8[] = {
2352   "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh",
2353 };
2354 static const char *att_names8rex[] = {
2355   "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
2356   "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
2357 };
2358 static const char *att_names_seg[] = {
2359   "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "%?", "%?",
2360 };
2361 static const char *att_index64 = "%riz";
2362 static const char *att_index32 = "%eiz";
2363 static const char *att_index16[] = {
2364   "%bx,%si", "%bx,%di", "%bp,%si", "%bp,%di", "%si", "%di", "%bp", "%bx"
2365 };
2366
2367 static const struct dis386 reg_table[][8] = {
2368   /* REG_80 */
2369   {
2370     { "addA",   { Eb, Ib } },
2371     { "orA",    { Eb, Ib } },
2372     { "adcA",   { Eb, Ib } },
2373     { "sbbA",   { Eb, Ib } },
2374     { "andA",   { Eb, Ib } },
2375     { "subA",   { Eb, Ib } },
2376     { "xorA",   { Eb, Ib } },
2377     { "cmpA",   { Eb, Ib } },
2378   },
2379   /* REG_81 */
2380   {
2381     { "addQ",   { Ev, Iv } },
2382     { "orQ",    { Ev, Iv } },
2383     { "adcQ",   { Ev, Iv } },
2384     { "sbbQ",   { Ev, Iv } },
2385     { "andQ",   { Ev, Iv } },
2386     { "subQ",   { Ev, Iv } },
2387     { "xorQ",   { Ev, Iv } },
2388     { "cmpQ",   { Ev, Iv } },
2389   },
2390   /* REG_82 */
2391   {
2392     { "addQ",   { Ev, sIb } },
2393     { "orQ",    { Ev, sIb } },
2394     { "adcQ",   { Ev, sIb } },
2395     { "sbbQ",   { Ev, sIb } },
2396     { "andQ",   { Ev, sIb } },
2397     { "subQ",   { Ev, sIb } },
2398     { "xorQ",   { Ev, sIb } },
2399     { "cmpQ",   { Ev, sIb } },
2400   },
2401   /* REG_8F */
2402   {
2403     { "popU",   { stackEv } },
2404     { XOP_8F_TABLE (XOP_09) },
2405     { "(bad)",  { XX } },
2406     { "(bad)",  { XX } },
2407     { "(bad)",  { XX } },
2408     { XOP_8F_TABLE (XOP_09) },
2409     { "(bad)",  { XX } },
2410     { "(bad)",  { XX } },
2411   },
2412   /* REG_C0 */
2413   {
2414     { "rolA",   { Eb, Ib } },
2415     { "rorA",   { Eb, Ib } },
2416     { "rclA",   { Eb, Ib } },
2417     { "rcrA",   { Eb, Ib } },
2418     { "shlA",   { Eb, Ib } },
2419     { "shrA",   { Eb, Ib } },
2420     { "(bad)",  { XX } },
2421     { "sarA",   { Eb, Ib } },
2422   },
2423   /* REG_C1 */
2424   {
2425     { "rolQ",   { Ev, Ib } },
2426     { "rorQ",   { Ev, Ib } },
2427     { "rclQ",   { Ev, Ib } },
2428     { "rcrQ",   { Ev, Ib } },
2429     { "shlQ",   { Ev, Ib } },
2430     { "shrQ",   { Ev, Ib } },
2431     { "(bad)",  { XX } },
2432     { "sarQ",   { Ev, Ib } },
2433   },
2434   /* REG_C6 */
2435   {
2436     { "movA",   { Eb, Ib } },
2437     { "(bad)",  { XX } },
2438     { "(bad)",  { XX } },
2439     { "(bad)",  { XX } },
2440     { "(bad)",  { XX } },
2441     { "(bad)",  { XX } },
2442     { "(bad)",  { XX } },
2443     { "(bad)",  { XX } },
2444   },
2445   /* REG_C7 */
2446   {
2447     { "movQ",   { Ev, Iv } },
2448     { "(bad)",  { XX } },
2449     { "(bad)",  { XX } },
2450     { "(bad)",  { XX } },
2451     { "(bad)",  { XX } },
2452     { "(bad)",  { XX } },
2453     { "(bad)",  { XX } },
2454     { "(bad)",  { XX } },
2455   },
2456   /* REG_D0 */
2457   {
2458     { "rolA",   { Eb, I1 } },
2459     { "rorA",   { Eb, I1 } },
2460     { "rclA",   { Eb, I1 } },
2461     { "rcrA",   { Eb, I1 } },
2462     { "shlA",   { Eb, I1 } },
2463     { "shrA",   { Eb, I1 } },
2464     { "(bad)",  { XX } },
2465     { "sarA",   { Eb, I1 } },
2466   },
2467   /* REG_D1 */
2468   {
2469     { "rolQ",   { Ev, I1 } },
2470     { "rorQ",   { Ev, I1 } },
2471     { "rclQ",   { Ev, I1 } },
2472     { "rcrQ",   { Ev, I1 } },
2473     { "shlQ",   { Ev, I1 } },
2474     { "shrQ",   { Ev, I1 } },
2475     { "(bad)",  { XX } },
2476     { "sarQ",   { Ev, I1 } },
2477   },
2478   /* REG_D2 */
2479   {
2480     { "rolA",   { Eb, CL } },
2481     { "rorA",   { Eb, CL } },
2482     { "rclA",   { Eb, CL } },
2483     { "rcrA",   { Eb, CL } },
2484     { "shlA",   { Eb, CL } },
2485     { "shrA",   { Eb, CL } },
2486     { "(bad)",  { XX } },
2487     { "sarA",   { Eb, CL } },
2488   },
2489   /* REG_D3 */
2490   {
2491     { "rolQ",   { Ev, CL } },
2492     { "rorQ",   { Ev, CL } },
2493     { "rclQ",   { Ev, CL } },
2494     { "rcrQ",   { Ev, CL } },
2495     { "shlQ",   { Ev, CL } },
2496     { "shrQ",   { Ev, CL } },
2497     { "(bad)",  { XX } },
2498     { "sarQ",   { Ev, CL } },
2499   },
2500   /* REG_F6 */
2501   {
2502     { "testA",  { Eb, Ib } },
2503     { "(bad)",  { XX } },
2504     { "notA",   { Eb } },
2505     { "negA",   { Eb } },
2506     { "mulA",   { Eb } },       /* Don't print the implicit %al register,  */
2507     { "imulA",  { Eb } },       /* to distinguish these opcodes from other */
2508     { "divA",   { Eb } },       /* mul/imul opcodes.  Do the same for div  */
2509     { "idivA",  { Eb } },       /* and idiv for consistency.               */
2510   },
2511   /* REG_F7 */
2512   {
2513     { "testQ",  { Ev, Iv } },
2514     { "(bad)",  { XX } },
2515     { "notQ",   { Ev } },
2516     { "negQ",   { Ev } },
2517     { "mulQ",   { Ev } },       /* Don't print the implicit register.  */
2518     { "imulQ",  { Ev } },
2519     { "divQ",   { Ev } },
2520     { "idivQ",  { Ev } },
2521   },
2522   /* REG_FE */
2523   {
2524     { "incA",   { Eb } },
2525     { "decA",   { Eb } },
2526     { "(bad)",  { XX } },
2527     { "(bad)",  { XX } },
2528     { "(bad)",  { XX } },
2529     { "(bad)",  { XX } },
2530     { "(bad)",  { XX } },
2531     { "(bad)",  { XX } },
2532   },
2533   /* REG_FF */
2534   {
2535     { "incQ",   { Ev } },
2536     { "decQ",   { Ev } },
2537     { "callT",  { indirEv } },
2538     { "JcallT", { indirEp } },
2539     { "jmpT",   { indirEv } },
2540     { "JjmpT",  { indirEp } },
2541     { "pushU",  { stackEv } },
2542     { "(bad)",  { XX } },
2543   },
2544   /* REG_0F00 */
2545   {
2546     { "sldtD",  { Sv } },
2547     { "strD",   { Sv } },
2548     { "lldt",   { Ew } },
2549     { "ltr",    { Ew } },
2550     { "verr",   { Ew } },
2551     { "verw",   { Ew } },
2552     { "(bad)",  { XX } },
2553     { "(bad)",  { XX } },
2554   },
2555   /* REG_0F01 */
2556   {
2557     { MOD_TABLE (MOD_0F01_REG_0) },
2558     { MOD_TABLE (MOD_0F01_REG_1) },
2559     { MOD_TABLE (MOD_0F01_REG_2) },
2560     { MOD_TABLE (MOD_0F01_REG_3) },
2561     { "smswD",  { Sv } },
2562     { "(bad)",  { XX } },
2563     { "lmsw",   { Ew } },
2564     { MOD_TABLE (MOD_0F01_REG_7) },
2565   },
2566   /* REG_0F0D */
2567   {
2568     { "prefetch",       { Eb } },
2569     { "prefetchw",      { Eb } },
2570     { "(bad)",          { XX } },
2571     { "(bad)",          { XX } },
2572     { "(bad)",          { XX } },
2573     { "(bad)",          { XX } },
2574     { "(bad)",          { XX } },
2575     { "(bad)",          { XX } },
2576   },
2577   /* REG_0F18 */
2578   {
2579     { MOD_TABLE (MOD_0F18_REG_0) },
2580     { MOD_TABLE (MOD_0F18_REG_1) },
2581     { MOD_TABLE (MOD_0F18_REG_2) },
2582     { MOD_TABLE (MOD_0F18_REG_3) },
2583     { "(bad)",  { XX } },
2584     { "(bad)",  { XX } },
2585     { "(bad)",  { XX } },
2586     { "(bad)",  { XX } },
2587   },
2588   /* REG_0F71 */
2589   {
2590     { "(bad)",  { XX } },
2591     { "(bad)",  { XX } },
2592     { MOD_TABLE (MOD_0F71_REG_2) },
2593     { "(bad)",  { XX } },
2594     { MOD_TABLE (MOD_0F71_REG_4) },
2595     { "(bad)",  { XX } },
2596     { MOD_TABLE (MOD_0F71_REG_6) },
2597     { "(bad)",  { XX } },
2598   },
2599   /* REG_0F72 */
2600   {
2601     { "(bad)",  { XX } },
2602     { "(bad)",  { XX } },
2603     { MOD_TABLE (MOD_0F72_REG_2) },
2604     { "(bad)",  { XX } },
2605     { MOD_TABLE (MOD_0F72_REG_4) },
2606     { "(bad)",  { XX } },
2607     { MOD_TABLE (MOD_0F72_REG_6) },
2608     { "(bad)",  { XX } },
2609   },
2610   /* REG_0F73 */
2611   {
2612     { "(bad)",  { XX } },
2613     { "(bad)",  { XX } },
2614     { MOD_TABLE (MOD_0F73_REG_2) },
2615     { MOD_TABLE (MOD_0F73_REG_3) },
2616     { "(bad)",  { XX } },
2617     { "(bad)",  { XX } },
2618     { MOD_TABLE (MOD_0F73_REG_6) },
2619     { MOD_TABLE (MOD_0F73_REG_7) },
2620   },
2621   /* REG_0FA6 */
2622   {
2623     { "montmul",        { { OP_0f07, 0 } } },
2624     { "xsha1",          { { OP_0f07, 0 } } },
2625     { "xsha256",        { { OP_0f07, 0 } } },
2626     { "(bad)",          { { OP_0f07, 0 } } },
2627     { "(bad)",          { { OP_0f07, 0 } } },
2628     { "(bad)",          { { OP_0f07, 0 } } },
2629     { "(bad)",          { { OP_0f07, 0 } } },
2630     { "(bad)",          { { OP_0f07, 0 } } },
2631   },
2632   /* REG_0FA7 */
2633   {
2634     { "xstore-rng",     { { OP_0f07, 0 } } },
2635     { "xcrypt-ecb",     { { OP_0f07, 0 } } },
2636     { "xcrypt-cbc",     { { OP_0f07, 0 } } },
2637     { "xcrypt-ctr",     { { OP_0f07, 0 } } },
2638     { "xcrypt-cfb",     { { OP_0f07, 0 } } },
2639     { "xcrypt-ofb",     { { OP_0f07, 0 } } },
2640     { "(bad)",          { { OP_0f07, 0 } } },
2641     { "(bad)",          { { OP_0f07, 0 } } },
2642   },
2643   /* REG_0FAE */
2644   {
2645     { MOD_TABLE (MOD_0FAE_REG_0) },
2646     { MOD_TABLE (MOD_0FAE_REG_1) },
2647     { MOD_TABLE (MOD_0FAE_REG_2) },
2648     { MOD_TABLE (MOD_0FAE_REG_3) },
2649     { MOD_TABLE (MOD_0FAE_REG_4) },
2650     { MOD_TABLE (MOD_0FAE_REG_5) },
2651     { MOD_TABLE (MOD_0FAE_REG_6) },
2652     { MOD_TABLE (MOD_0FAE_REG_7) },
2653   },
2654   /* REG_0FBA */
2655   {
2656     { "(bad)",  { XX } },
2657     { "(bad)",  { XX } },
2658     { "(bad)",  { XX } },
2659     { "(bad)",  { XX } },
2660     { "btQ",    { Ev, Ib } },
2661     { "btsQ",   { Ev, Ib } },
2662     { "btrQ",   { Ev, Ib } },
2663     { "btcQ",   { Ev, Ib } },
2664   },
2665   /* REG_0FC7 */
2666   {
2667     { "(bad)",  { XX } },
2668     { "cmpxchg8b", { { CMPXCHG8B_Fixup, q_mode } } },
2669     { "(bad)",  { XX } },
2670     { "(bad)",  { XX } },
2671     { "(bad)",  { XX } },
2672     { "(bad)",  { XX } },
2673     { MOD_TABLE (MOD_0FC7_REG_6) },
2674     { MOD_TABLE (MOD_0FC7_REG_7) },
2675   },
2676   /* REG_VEX_71 */
2677   {
2678     { "(bad)",  { XX } },
2679     { "(bad)",  { XX } },
2680     { MOD_TABLE (MOD_VEX_71_REG_2) },
2681     { "(bad)",  { XX } },
2682     { MOD_TABLE (MOD_VEX_71_REG_4) },
2683     { "(bad)",  { XX } },
2684     { MOD_TABLE (MOD_VEX_71_REG_6) },
2685     { "(bad)",  { XX } },
2686   },
2687   /* REG_VEX_72 */
2688   {
2689     { "(bad)",  { XX } },
2690     { "(bad)",  { XX } },
2691     { MOD_TABLE (MOD_VEX_72_REG_2) },
2692     { "(bad)",  { XX } },
2693     { MOD_TABLE (MOD_VEX_72_REG_4) },
2694     { "(bad)",  { XX } },
2695     { MOD_TABLE (MOD_VEX_72_REG_6) },
2696     { "(bad)",  { XX } },
2697   },
2698   /* REG_VEX_73 */
2699   {
2700     { "(bad)",  { XX } },
2701     { "(bad)",  { XX } },
2702     { MOD_TABLE (MOD_VEX_73_REG_2) },
2703     { MOD_TABLE (MOD_VEX_73_REG_3) },
2704     { "(bad)",  { XX } },
2705     { "(bad)",  { XX } },
2706     { MOD_TABLE (MOD_VEX_73_REG_6) },
2707     { MOD_TABLE (MOD_VEX_73_REG_7) },
2708   },
2709   /* REG_VEX_AE */
2710   {
2711     { "(bad)",  { XX } },
2712     { "(bad)",  { XX } },
2713     { MOD_TABLE (MOD_VEX_AE_REG_2) },
2714     { MOD_TABLE (MOD_VEX_AE_REG_3) },
2715     { "(bad)",  { XX } },
2716     { "(bad)",  { XX } },
2717     { "(bad)",  { XX } },
2718     { "(bad)",  { XX } },
2719   },
2720   /* REG_XOP_LWPCB */
2721   {
2722     { "llwpcb", { { OP_LWPCB_E, 0 } } },
2723     { "slwpcb", { { OP_LWPCB_E, 0 } } },
2724     { "(bad)",  { XX } },
2725     { "(bad)",  { XX } },
2726     { "(bad)",  { XX } },
2727     { "(bad)",  { XX } },
2728     { "(bad)",  { XX } },
2729     { "(bad)",  { XX } },
2730   },
2731   /* REG_XOP_LWP */
2732   {
2733     { "lwpins", { { OP_LWP_E, 0 }, Ed, { OP_LWP_I, 0 } } },
2734     { "lwpval", { { OP_LWP_E, 0 }, Ed, { OP_LWP_I, 0 } } },
2735     { "(bad)",  { XX } },
2736     { "(bad)",  { XX } },
2737     { "(bad)",  { XX } },
2738     { "(bad)",  { XX } },
2739     { "(bad)",  { XX } },
2740     { "(bad)",  { XX } },
2741   },
2742 };
2743
2744 static const struct dis386 prefix_table[][4] = {
2745   /* PREFIX_90 */
2746   {
2747     { "xchgS", { { NOP_Fixup1, eAX_reg }, { NOP_Fixup2, eAX_reg } } },
2748     { "pause", { XX } },
2749     { "xchgS", { { NOP_Fixup1, eAX_reg }, { NOP_Fixup2, eAX_reg } } },
2750     { "(bad)", { XX } },
2751   },
2752
2753   /* PREFIX_0F10 */
2754   {
2755     { "movups", { XM, EXx } },
2756     { "movss",  { XM, EXd } },
2757     { "movupd", { XM, EXx } },
2758     { "movsd",  { XM, EXq } },
2759   },
2760
2761   /* PREFIX_0F11 */
2762   {
2763     { "movups", { EXxS, XM } },
2764     { "movss",  { EXdS, XM } },
2765     { "movupd", { EXxS, XM } },
2766     { "movsd",  { EXqS, XM } },
2767   },
2768
2769   /* PREFIX_0F12 */
2770   {
2771     { MOD_TABLE (MOD_0F12_PREFIX_0) },
2772     { "movsldup", { XM, EXx } },
2773     { "movlpd", { XM, EXq } },
2774     { "movddup", { XM, EXq } },
2775   },
2776
2777   /* PREFIX_0F16 */
2778   {
2779     { MOD_TABLE (MOD_0F16_PREFIX_0) },
2780     { "movshdup", { XM, EXx } },
2781     { "movhpd", { XM, EXq } },
2782     { "(bad)",  { XX } },
2783   },
2784
2785   /* PREFIX_0F2A */
2786   {
2787     { "cvtpi2ps", { XM, EMCq } },
2788     { "cvtsi2ss%LQ", { XM, Ev } },
2789     { "cvtpi2pd", { XM, EMCq } },
2790     { "cvtsi2sd%LQ", { XM, Ev } },
2791   },
2792
2793   /* PREFIX_0F2B */
2794   {
2795     { MOD_TABLE (MOD_0F2B_PREFIX_0) },
2796     { MOD_TABLE (MOD_0F2B_PREFIX_1) },
2797     { MOD_TABLE (MOD_0F2B_PREFIX_2) },
2798     { MOD_TABLE (MOD_0F2B_PREFIX_3) },
2799   },
2800
2801   /* PREFIX_0F2C */
2802   {
2803     { "cvttps2pi", { MXC, EXq } },
2804     { "cvttss2siY", { Gv, EXd } },
2805     { "cvttpd2pi", { MXC, EXx } },
2806     { "cvttsd2siY", { Gv, EXq } },
2807   },
2808
2809   /* PREFIX_0F2D */
2810   {
2811     { "cvtps2pi", { MXC, EXq } },
2812     { "cvtss2siY", { Gv, EXd } },
2813     { "cvtpd2pi", { MXC, EXx } },
2814     { "cvtsd2siY", { Gv, EXq } },
2815   },
2816
2817   /* PREFIX_0F2E */
2818   {
2819     { "ucomiss",{ XM, EXd } }, 
2820     { "(bad)",  { XX } },
2821     { "ucomisd",{ XM, EXq } }, 
2822     { "(bad)",  { XX } },
2823   },
2824
2825   /* PREFIX_0F2F */
2826   {
2827     { "comiss", { XM, EXd } },
2828     { "(bad)",  { XX } },
2829     { "comisd", { XM, EXq } },
2830     { "(bad)",  { XX } },
2831   },
2832
2833   /* PREFIX_0F51 */
2834   {
2835     { "sqrtps", { XM, EXx } },
2836     { "sqrtss", { XM, EXd } },
2837     { "sqrtpd", { XM, EXx } },
2838     { "sqrtsd", { XM, EXq } },
2839   },
2840
2841   /* PREFIX_0F52 */
2842   {
2843     { "rsqrtps",{ XM, EXx } },
2844     { "rsqrtss",{ XM, EXd } },
2845     { "(bad)",  { XX } },
2846     { "(bad)",  { XX } },
2847   },
2848
2849   /* PREFIX_0F53 */
2850   {
2851     { "rcpps",  { XM, EXx } },
2852     { "rcpss",  { XM, EXd } },
2853     { "(bad)",  { XX } },
2854     { "(bad)",  { XX } },
2855   },
2856
2857   /* PREFIX_0F58 */
2858   {
2859     { "addps", { XM, EXx } },
2860     { "addss", { XM, EXd } },
2861     { "addpd", { XM, EXx } },
2862     { "addsd", { XM, EXq } },
2863   },
2864
2865   /* PREFIX_0F59 */
2866   {
2867     { "mulps",  { XM, EXx } },
2868     { "mulss",  { XM, EXd } },
2869     { "mulpd",  { XM, EXx } },
2870     { "mulsd",  { XM, EXq } },
2871   },
2872
2873   /* PREFIX_0F5A */
2874   {
2875     { "cvtps2pd", { XM, EXq } },
2876     { "cvtss2sd", { XM, EXd } },
2877     { "cvtpd2ps", { XM, EXx } },
2878     { "cvtsd2ss", { XM, EXq } },
2879   },
2880
2881   /* PREFIX_0F5B */
2882   {
2883     { "cvtdq2ps", { XM, EXx } },
2884     { "cvttps2dq", { XM, EXx } },
2885     { "cvtps2dq", { XM, EXx } },
2886     { "(bad)",  { XX } },
2887   },
2888
2889   /* PREFIX_0F5C */
2890   {
2891     { "subps",  { XM, EXx } },
2892     { "subss",  { XM, EXd } },
2893     { "subpd",  { XM, EXx } },
2894     { "subsd",  { XM, EXq } },
2895   },
2896
2897   /* PREFIX_0F5D */
2898   {
2899     { "minps",  { XM, EXx } },
2900     { "minss",  { XM, EXd } },
2901     { "minpd",  { XM, EXx } },
2902     { "minsd",  { XM, EXq } },
2903   },
2904
2905   /* PREFIX_0F5E */
2906   {
2907     { "divps",  { XM, EXx } },
2908     { "divss",  { XM, EXd } },
2909     { "divpd",  { XM, EXx } },
2910     { "divsd",  { XM, EXq } },
2911   },
2912
2913   /* PREFIX_0F5F */
2914   {
2915     { "maxps",  { XM, EXx } },
2916     { "maxss",  { XM, EXd } },
2917     { "maxpd",  { XM, EXx } },
2918     { "maxsd",  { XM, EXq } },
2919   },
2920
2921   /* PREFIX_0F60 */
2922   {
2923     { "punpcklbw",{ MX, EMd } },
2924     { "(bad)",  { XX } },
2925     { "punpcklbw",{ MX, EMx } },
2926     { "(bad)",  { XX } },
2927   },
2928
2929   /* PREFIX_0F61 */
2930   {
2931     { "punpcklwd",{ MX, EMd } },
2932     { "(bad)",  { XX } },
2933     { "punpcklwd",{ MX, EMx } },
2934     { "(bad)",  { XX } },
2935   },
2936
2937   /* PREFIX_0F62 */
2938   {
2939     { "punpckldq",{ MX, EMd } },
2940     { "(bad)",  { XX } },
2941     { "punpckldq",{ MX, EMx } },
2942     { "(bad)",  { XX } },
2943   },
2944
2945   /* PREFIX_0F6C */
2946   {
2947     { "(bad)",  { XX } },
2948     { "(bad)",  { XX } },
2949     { "punpcklqdq", { XM, EXx } },
2950     { "(bad)",  { XX } },
2951   },
2952
2953   /* PREFIX_0F6D */
2954   {
2955     { "(bad)",  { XX } },
2956     { "(bad)",  { XX } },
2957     { "punpckhqdq", { XM, EXx } },
2958     { "(bad)",  { XX } },
2959   },
2960
2961   /* PREFIX_0F6F */
2962   {
2963     { "movq",   { MX, EM } },
2964     { "movdqu", { XM, EXx } },
2965     { "movdqa", { XM, EXx } },
2966     { "(bad)",  { XX } },
2967   },
2968
2969   /* PREFIX_0F70 */
2970   {
2971     { "pshufw", { MX, EM, Ib } },
2972     { "pshufhw",{ XM, EXx, Ib } },
2973     { "pshufd", { XM, EXx, Ib } },
2974     { "pshuflw",{ XM, EXx, Ib } },
2975   },
2976
2977   /* PREFIX_0F73_REG_3 */
2978   {
2979     { "(bad)",  { XX } },
2980     { "(bad)",  { XX } },
2981     { "psrldq", { XS, Ib } },
2982     { "(bad)",  { XX } },
2983   },
2984
2985   /* PREFIX_0F73_REG_7 */
2986   {
2987     { "(bad)",  { XX } },
2988     { "(bad)",  { XX } },
2989     { "pslldq", { XS, Ib } },
2990     { "(bad)",  { XX } },
2991   },
2992
2993   /* PREFIX_0F78 */
2994   {
2995     {"vmread",  { Em, Gm } },
2996     {"(bad)",   { XX } },
2997     {"extrq",   { XS, Ib, Ib } },
2998     {"insertq", { XM, XS, Ib, Ib } },
2999   },
3000
3001   /* PREFIX_0F79 */
3002   {
3003     {"vmwrite", { Gm, Em } },
3004     {"(bad)",   { XX } },
3005     {"extrq",   { XM, XS } },
3006     {"insertq", { XM, XS } },
3007   },
3008
3009   /* PREFIX_0F7C */
3010   {
3011     { "(bad)",  { XX } },
3012     { "(bad)",  { XX } },
3013     { "haddpd", { XM, EXx } },
3014     { "haddps", { XM, EXx } },
3015   },
3016
3017   /* PREFIX_0F7D */
3018   {
3019     { "(bad)",  { XX } },
3020     { "(bad)",  { XX } },
3021     { "hsubpd", { XM, EXx } },
3022     { "hsubps", { XM, EXx } },
3023   },
3024
3025   /* PREFIX_0F7E */
3026   {
3027     { "movK",   { Edq, MX } },
3028     { "movq",   { XM, EXq } },
3029     { "movK",   { Edq, XM } },
3030     { "(bad)",  { XX } },
3031   },
3032
3033   /* PREFIX_0F7F */
3034   {
3035     { "movq",   { EMS, MX } },
3036     { "movdqu", { EXxS, XM } },
3037     { "movdqa", { EXxS, XM } },
3038     { "(bad)",  { XX } },
3039   },
3040
3041   /* PREFIX_0FB8 */
3042   {
3043     { "(bad)", { XX } },
3044     { "popcntS", { Gv, Ev } },
3045     { "(bad)", { XX } },
3046     { "(bad)", { XX } },
3047   },
3048
3049   /* PREFIX_0FBD */
3050   {
3051     { "bsrS",   { Gv, Ev } },
3052     { "lzcntS", { Gv, Ev } },
3053     { "bsrS",   { Gv, Ev } },
3054     { "(bad)",  { XX } },
3055   },
3056
3057   /* PREFIX_0FC2 */
3058   {
3059     { "cmpps",  { XM, EXx, CMP } },
3060     { "cmpss",  { XM, EXd, CMP } },
3061     { "cmppd",  { XM, EXx, CMP } },
3062     { "cmpsd",  { XM, EXq, CMP } },
3063   },
3064
3065   /* PREFIX_0FC3 */
3066   {
3067     { "movntiS", { Ma, Gv } },
3068     { "(bad)",  { XX } },
3069     { "(bad)",  { XX } },
3070     { "(bad)",  { XX } },
3071   },
3072
3073   /* PREFIX_0FC7_REG_6 */
3074   {
3075     { "vmptrld",{ Mq } },
3076     { "vmxon",  { Mq } },
3077     { "vmclear",{ Mq } },
3078     { "(bad)",  { XX } },
3079   },
3080
3081   /* PREFIX_0FD0 */
3082   {
3083     { "(bad)",  { XX } },
3084     { "(bad)",  { XX } },
3085     { "addsubpd", { XM, EXx } },
3086     { "addsubps", { XM, EXx } },
3087   },
3088
3089   /* PREFIX_0FD6 */
3090   {
3091     { "(bad)",  { XX } },
3092     { "movq2dq",{ XM, MS } },
3093     { "movq",   { EXqS, XM } },
3094     { "movdq2q",{ MX, XS } },
3095   },
3096
3097   /* PREFIX_0FE6 */
3098   {
3099     { "(bad)",  { XX } },
3100     { "cvtdq2pd", { XM, EXq } },
3101     { "cvttpd2dq", { XM, EXx } },
3102     { "cvtpd2dq", { XM, EXx } },
3103   },
3104
3105   /* PREFIX_0FE7 */
3106   {
3107     { "movntq", { Mq, MX } },
3108     { "(bad)",  { XX } },
3109     { MOD_TABLE (MOD_0FE7_PREFIX_2) },
3110     { "(bad)",  { XX } },
3111   },
3112
3113   /* PREFIX_0FF0 */
3114   {
3115     { "(bad)",  { XX } },
3116     { "(bad)",  { XX } },
3117     { "(bad)",  { XX } },
3118     { MOD_TABLE (MOD_0FF0_PREFIX_3) },
3119   },
3120
3121   /* PREFIX_0FF7 */
3122   {
3123     { "maskmovq", { MX, MS } },
3124     { "(bad)",  { XX } },
3125     { "maskmovdqu", { XM, XS } },
3126     { "(bad)",  { XX } },
3127   },
3128
3129   /* PREFIX_0F3810 */
3130   {
3131     { "(bad)",  { XX } },
3132     { "(bad)",  { XX } },
3133     { "pblendvb", { XM, EXx, XMM0 } },
3134     { "(bad)",  { XX } },
3135   },
3136
3137   /* PREFIX_0F3814 */
3138   {
3139     { "(bad)",  { XX } },
3140     { "(bad)",  { XX } },
3141     { "blendvps", { XM, EXx, XMM0 } },
3142     { "(bad)",  { XX } },
3143   },
3144
3145   /* PREFIX_0F3815 */
3146   {
3147     { "(bad)",  { XX } },
3148     { "(bad)",  { XX } },
3149     { "blendvpd", { XM, EXx, XMM0 } },
3150     { "(bad)",  { XX } },
3151   },
3152
3153   /* PREFIX_0F3817 */
3154   {
3155     { "(bad)",  { XX } },
3156     { "(bad)",  { XX } },
3157     { "ptest",  { XM, EXx } },
3158     { "(bad)",  { XX } },
3159   },
3160
3161   /* PREFIX_0F3820 */
3162   {
3163     { "(bad)",  { XX } },
3164     { "(bad)",  { XX } },
3165     { "pmovsxbw", { XM, EXq } },
3166     { "(bad)",  { XX } },
3167   },
3168
3169   /* PREFIX_0F3821 */
3170   {
3171     { "(bad)",  { XX } },
3172     { "(bad)",  { XX } },
3173     { "pmovsxbd", { XM, EXd } },
3174     { "(bad)",  { XX } },
3175   },
3176
3177   /* PREFIX_0F3822 */
3178   {
3179     { "(bad)",  { XX } },
3180     { "(bad)",  { XX } },
3181     { "pmovsxbq", { XM, EXw } },
3182     { "(bad)",  { XX } },
3183   },
3184
3185   /* PREFIX_0F3823 */
3186   {
3187     { "(bad)",  { XX } },
3188     { "(bad)",  { XX } },
3189     { "pmovsxwd", { XM, EXq } },
3190     { "(bad)",  { XX } },
3191   },
3192
3193   /* PREFIX_0F3824 */
3194   {
3195     { "(bad)",  { XX } },
3196     { "(bad)",  { XX } },
3197     { "pmovsxwq", { XM, EXd } },
3198     { "(bad)",  { XX } },
3199   },
3200
3201   /* PREFIX_0F3825 */
3202   {
3203     { "(bad)",  { XX } },
3204     { "(bad)",  { XX } },
3205     { "pmovsxdq", { XM, EXq } },
3206     { "(bad)",  { XX } },
3207   },
3208
3209   /* PREFIX_0F3828 */
3210   {
3211     { "(bad)",  { XX } },
3212     { "(bad)",  { XX } },
3213     { "pmuldq", { XM, EXx } },
3214     { "(bad)",  { XX } },
3215   },
3216
3217   /* PREFIX_0F3829 */
3218   {
3219     { "(bad)",  { XX } },
3220     { "(bad)",  { XX } },
3221     { "pcmpeqq", { XM, EXx } },
3222     { "(bad)",  { XX } },
3223   },
3224
3225   /* PREFIX_0F382A */
3226   {
3227     { "(bad)",  { XX } },
3228     { "(bad)",  { XX } },
3229     { MOD_TABLE (MOD_0F382A_PREFIX_2) },
3230     { "(bad)",  { XX } },
3231   },
3232
3233   /* PREFIX_0F382B */
3234   {
3235     { "(bad)",  { XX } },
3236     { "(bad)",  { XX } },
3237     { "packusdw", { XM, EXx } },
3238     { "(bad)",  { XX } },
3239   },
3240
3241   /* PREFIX_0F3830 */
3242   {
3243     { "(bad)",  { XX } },
3244     { "(bad)",  { XX } },
3245     { "pmovzxbw", { XM, EXq } },
3246     { "(bad)",  { XX } },
3247   },
3248
3249   /* PREFIX_0F3831 */
3250   {
3251     { "(bad)",  { XX } },
3252     { "(bad)",  { XX } },
3253     { "pmovzxbd", { XM, EXd } },
3254     { "(bad)",  { XX } },
3255   },
3256
3257   /* PREFIX_0F3832 */
3258   {
3259     { "(bad)",  { XX } },
3260     { "(bad)",  { XX } },
3261     { "pmovzxbq", { XM, EXw } },
3262     { "(bad)",  { XX } },
3263   },
3264
3265   /* PREFIX_0F3833 */
3266   {
3267     { "(bad)",  { XX } },
3268     { "(bad)",  { XX } },
3269     { "pmovzxwd", { XM, EXq } },
3270     { "(bad)",  { XX } },
3271   },
3272
3273   /* PREFIX_0F3834 */
3274   {
3275     { "(bad)",  { XX } },
3276     { "(bad)",  { XX } },
3277     { "pmovzxwq", { XM, EXd } },
3278     { "(bad)",  { XX } },
3279   },
3280
3281   /* PREFIX_0F3835 */
3282   {
3283     { "(bad)",  { XX } },
3284     { "(bad)",  { XX } },
3285     { "pmovzxdq", { XM, EXq } },
3286     { "(bad)",  { XX } },
3287   },
3288
3289   /* PREFIX_0F3837 */
3290   {
3291     { "(bad)",  { XX } },
3292     { "(bad)",  { XX } },
3293     { "pcmpgtq", { XM, EXx } },
3294     { "(bad)",  { XX } },
3295   },
3296
3297   /* PREFIX_0F3838 */
3298   {
3299     { "(bad)",  { XX } },
3300     { "(bad)",  { XX } },
3301     { "pminsb", { XM, EXx } },
3302     { "(bad)",  { XX } },
3303   },
3304
3305   /* PREFIX_0F3839 */
3306   {
3307     { "(bad)",  { XX } },
3308     { "(bad)",  { XX } },
3309     { "pminsd", { XM, EXx } },
3310     { "(bad)",  { XX } },
3311   },
3312
3313   /* PREFIX_0F383A */
3314   {
3315     { "(bad)",  { XX } },
3316     { "(bad)",  { XX } },
3317     { "pminuw", { XM, EXx } },
3318     { "(bad)",  { XX } },
3319   },
3320
3321   /* PREFIX_0F383B */
3322   {
3323     { "(bad)",  { XX } },
3324     { "(bad)",  { XX } },
3325     { "pminud", { XM, EXx } },
3326     { "(bad)",  { XX } },
3327   },
3328
3329   /* PREFIX_0F383C */
3330   {
3331     { "(bad)",  { XX } },
3332     { "(bad)",  { XX } },
3333     { "pmaxsb", { XM, EXx } },
3334     { "(bad)",  { XX } },
3335   },
3336
3337   /* PREFIX_0F383D */
3338   {
3339     { "(bad)",  { XX } },
3340     { "(bad)",  { XX } },
3341     { "pmaxsd", { XM, EXx } },
3342     { "(bad)",  { XX } },
3343   },
3344
3345   /* PREFIX_0F383E */
3346   {
3347     { "(bad)",  { XX } },
3348     { "(bad)",  { XX } },
3349     { "pmaxuw", { XM, EXx } },
3350     { "(bad)",  { XX } },
3351   },
3352
3353   /* PREFIX_0F383F */
3354   {
3355     { "(bad)",  { XX } },
3356     { "(bad)",  { XX } },
3357     { "pmaxud", { XM, EXx } },
3358     { "(bad)",  { XX } },
3359   },
3360
3361   /* PREFIX_0F3840 */
3362   {
3363     { "(bad)",  { XX } },
3364     { "(bad)",  { XX } },
3365     { "pmulld", { XM, EXx } },
3366     { "(bad)",  { XX } },
3367   },
3368
3369   /* PREFIX_0F3841 */
3370   {
3371     { "(bad)",  { XX } },
3372     { "(bad)",  { XX } },
3373     { "phminposuw", { XM, EXx } },
3374     { "(bad)",  { XX } },
3375   },
3376
3377   /* PREFIX_0F3880 */
3378   {
3379     { "(bad)",  { XX } },
3380     { "(bad)",  { XX } },
3381     { "invept", { Gm, Mo } },
3382     { "(bad)",  { XX } },
3383   },
3384
3385   /* PREFIX_0F3881 */
3386   {
3387     { "(bad)",  { XX } },
3388     { "(bad)",  { XX } },
3389     { "invvpid", { Gm, Mo } },
3390     { "(bad)",  { XX } },
3391   },
3392
3393   /* PREFIX_0F38DB */
3394   {
3395     { "(bad)",  { XX } },
3396     { "(bad)",  { XX } },
3397     { "aesimc", { XM, EXx } },
3398     { "(bad)",  { XX } },
3399   },
3400
3401   /* PREFIX_0F38DC */
3402   {
3403     { "(bad)",  { XX } },
3404     { "(bad)",  { XX } },
3405     { "aesenc", { XM, EXx } },
3406     { "(bad)",  { XX } },
3407   },
3408
3409   /* PREFIX_0F38DD */
3410   {
3411     { "(bad)",  { XX } },
3412     { "(bad)",  { XX } },
3413     { "aesenclast", { XM, EXx } },
3414     { "(bad)",  { XX } },
3415   },
3416
3417   /* PREFIX_0F38DE */
3418   {
3419     { "(bad)",  { XX } },
3420     { "(bad)",  { XX } },
3421     { "aesdec", { XM, EXx } },
3422     { "(bad)",  { XX } },
3423   },
3424
3425   /* PREFIX_0F38DF */
3426   {
3427     { "(bad)",  { XX } },
3428     { "(bad)",  { XX } },
3429     { "aesdeclast", { XM, EXx } },
3430     { "(bad)",  { XX } },
3431   },
3432
3433   /* PREFIX_0F38F0 */
3434   {
3435     { "movbeS", { Gv, { MOVBE_Fixup, v_mode } } },
3436     { "(bad)",  { XX } },
3437     { "movbeS", { Gv, { MOVBE_Fixup, v_mode } } },
3438     { "crc32",  { Gdq, { CRC32_Fixup, b_mode } } },     
3439   },
3440
3441   /* PREFIX_0F38F1 */
3442   {
3443     { "movbeS", { { MOVBE_Fixup, v_mode }, Gv } },
3444     { "(bad)",  { XX } },
3445     { "movbeS", { { MOVBE_Fixup, v_mode }, Gv } },
3446     { "crc32",  { Gdq, { CRC32_Fixup, v_mode } } },     
3447   },
3448
3449   /* PREFIX_0F3A08 */
3450   {
3451     { "(bad)",  { XX } },
3452     { "(bad)",  { XX } },
3453     { "roundps", { XM, EXx, Ib } },
3454     { "(bad)",  { XX } },
3455   },
3456
3457   /* PREFIX_0F3A09 */
3458   {
3459     { "(bad)",  { XX } },
3460     { "(bad)",  { XX } },
3461     { "roundpd", { XM, EXx, Ib } },
3462     { "(bad)",  { XX } },
3463   },
3464
3465   /* PREFIX_0F3A0A */
3466   {
3467     { "(bad)",  { XX } },
3468     { "(bad)",  { XX } },
3469     { "roundss", { XM, EXd, Ib } },
3470     { "(bad)",  { XX } },
3471   },
3472
3473   /* PREFIX_0F3A0B */
3474   {
3475     { "(bad)",  { XX } },
3476     { "(bad)",  { XX } },
3477     { "roundsd", { XM, EXq, Ib } },
3478     { "(bad)",  { XX } },
3479   },
3480
3481   /* PREFIX_0F3A0C */
3482   {
3483     { "(bad)",  { XX } },
3484     { "(bad)",  { XX } },
3485     { "blendps", { XM, EXx, Ib } },
3486     { "(bad)",  { XX } },
3487   },
3488
3489   /* PREFIX_0F3A0D */
3490   {
3491     { "(bad)",  { XX } },
3492     { "(bad)",  { XX } },
3493     { "blendpd", { XM, EXx, Ib } },
3494     { "(bad)",  { XX } },
3495   },
3496
3497   /* PREFIX_0F3A0E */
3498   {
3499     { "(bad)",  { XX } },
3500     { "(bad)",  { XX } },
3501     { "pblendw", { XM, EXx, Ib } },
3502     { "(bad)",  { XX } },
3503   },
3504
3505   /* PREFIX_0F3A14 */
3506   {
3507     { "(bad)",  { XX } },
3508     { "(bad)",  { XX } },
3509     { "pextrb", { Edqb, XM, Ib } },
3510     { "(bad)",  { XX } },
3511   },
3512
3513   /* PREFIX_0F3A15 */
3514   {
3515     { "(bad)",  { XX } },
3516     { "(bad)",  { XX } },
3517     { "pextrw", { Edqw, XM, Ib } },
3518     { "(bad)",  { XX } },
3519   },
3520
3521   /* PREFIX_0F3A16 */
3522   {
3523     { "(bad)",  { XX } },
3524     { "(bad)",  { XX } },
3525     { "pextrK", { Edq, XM, Ib } },
3526     { "(bad)",  { XX } },
3527   },
3528
3529   /* PREFIX_0F3A17 */
3530   {
3531     { "(bad)",  { XX } },
3532     { "(bad)",  { XX } },
3533     { "extractps", { Edqd, XM, Ib } },
3534     { "(bad)",  { XX } },
3535   },
3536
3537   /* PREFIX_0F3A20 */
3538   {
3539     { "(bad)",  { XX } },
3540     { "(bad)",  { XX } },
3541     { "pinsrb", { XM, Edqb, Ib } },
3542     { "(bad)",  { XX } },
3543   },
3544
3545   /* PREFIX_0F3A21 */
3546   {
3547     { "(bad)",  { XX } },
3548     { "(bad)",  { XX } },
3549     { "insertps", { XM, EXd, Ib } },
3550     { "(bad)",  { XX } },
3551   },
3552
3553   /* PREFIX_0F3A22 */
3554   {
3555     { "(bad)",  { XX } },
3556     { "(bad)",  { XX } },
3557     { "pinsrK", { XM, Edq, Ib } },
3558     { "(bad)",  { XX } },
3559   },
3560
3561   /* PREFIX_0F3A40 */
3562   {
3563     { "(bad)",  { XX } },
3564     { "(bad)",  { XX } },
3565     { "dpps",   { XM, EXx, Ib } },
3566     { "(bad)",  { XX } },
3567   },
3568
3569   /* PREFIX_0F3A41 */
3570   {
3571     { "(bad)",  { XX } },
3572     { "(bad)",  { XX } },
3573     { "dppd",   { XM, EXx, Ib } },
3574     { "(bad)",  { XX } },
3575   },
3576
3577   /* PREFIX_0F3A42 */
3578   {
3579     { "(bad)",  { XX } },
3580     { "(bad)",  { XX } },
3581     { "mpsadbw", { XM, EXx, Ib } },
3582     { "(bad)",  { XX } },
3583   },
3584
3585   /* PREFIX_0F3A44 */
3586   {
3587     { "(bad)",  { XX } },
3588     { "(bad)",  { XX } },
3589     { "pclmulqdq", { XM, EXx, PCLMUL } },
3590     { "(bad)",  { XX } },
3591   },
3592
3593   /* PREFIX_0F3A60 */
3594   {
3595     { "(bad)",  { XX } },
3596     { "(bad)",  { XX } },
3597     { "pcmpestrm", { XM, EXx, Ib } },
3598     { "(bad)",  { XX } },
3599   },
3600
3601   /* PREFIX_0F3A61 */
3602   {
3603     { "(bad)",  { XX } },
3604     { "(bad)",  { XX } },
3605     { "pcmpestri", { XM, EXx, Ib } },
3606     { "(bad)",  { XX } },
3607   },
3608
3609   /* PREFIX_0F3A62 */
3610   {
3611     { "(bad)",  { XX } },
3612     { "(bad)",  { XX } },
3613     { "pcmpistrm", { XM, EXx, Ib } },
3614     { "(bad)",  { XX } },
3615   },
3616
3617   /* PREFIX_0F3A63 */
3618   {
3619     { "(bad)",  { XX } },
3620     { "(bad)",  { XX } },
3621     { "pcmpistri", { XM, EXx, Ib } },
3622     { "(bad)",  { XX } },
3623   },
3624
3625   /* PREFIX_0F3ADF */
3626   {
3627     { "(bad)",  { XX } },
3628     { "(bad)",  { XX } },
3629     { "aeskeygenassist", { XM, EXx, Ib } },
3630     { "(bad)",  { XX } },
3631   },
3632
3633   /* PREFIX_VEX_10 */
3634   {
3635     { VEX_W_TABLE (VEX_W_10_P_0) },
3636     { VEX_LEN_TABLE (VEX_LEN_10_P_1) },
3637     { VEX_W_TABLE (VEX_W_10_P_2) },
3638     { VEX_LEN_TABLE (VEX_LEN_10_P_3) },
3639   },
3640
3641   /* PREFIX_VEX_11 */
3642   {
3643     { VEX_W_TABLE (VEX_W_11_P_0) },
3644     { VEX_LEN_TABLE (VEX_LEN_11_P_1) },
3645     { VEX_W_TABLE (VEX_W_11_P_2) },
3646     { VEX_LEN_TABLE (VEX_LEN_11_P_3) },
3647   },
3648
3649   /* PREFIX_VEX_12 */
3650   {
3651     { MOD_TABLE (MOD_VEX_12_PREFIX_0) },
3652     { VEX_W_TABLE (VEX_W_12_P_1) },
3653     { VEX_LEN_TABLE (VEX_LEN_12_P_2) },
3654     { VEX_W_TABLE (VEX_W_12_P_3) },
3655   },
3656
3657   /* PREFIX_VEX_16 */
3658   {
3659     { MOD_TABLE (MOD_VEX_16_PREFIX_0) },
3660     { VEX_W_TABLE (VEX_W_16_P_1) },
3661     { VEX_LEN_TABLE (VEX_LEN_16_P_2) },
3662     { "(bad)",  { XX } },
3663   },
3664
3665   /* PREFIX_VEX_2A */
3666   {
3667     { "(bad)",  { XX } },
3668     { VEX_LEN_TABLE (VEX_LEN_2A_P_1) },
3669     { "(bad)",  { XX } },
3670     { VEX_LEN_TABLE (VEX_LEN_2A_P_3) },
3671   },
3672
3673   /* PREFIX_VEX_2C */
3674   {
3675     { "(bad)",  { XX } },
3676     { VEX_LEN_TABLE (VEX_LEN_2C_P_1) },
3677     { "(bad)",  { XX } },
3678     { VEX_LEN_TABLE (VEX_LEN_2C_P_3) },
3679   },
3680
3681   /* PREFIX_VEX_2D */
3682   {
3683     { "(bad)",  { XX } },
3684     { VEX_LEN_TABLE (VEX_LEN_2D_P_1) },
3685     { "(bad)",  { XX } },
3686     { VEX_LEN_TABLE (VEX_LEN_2D_P_3) },
3687   },
3688
3689   /* PREFIX_VEX_2E */
3690   {
3691     { VEX_LEN_TABLE (VEX_LEN_2E_P_0) },
3692     { "(bad)",  { XX } },
3693     { VEX_LEN_TABLE (VEX_LEN_2E_P_2) },
3694     { "(bad)",  { XX } },
3695   },
3696
3697   /* PREFIX_VEX_2F */
3698   {
3699     { VEX_LEN_TABLE (VEX_LEN_2F_P_0) },
3700     { "(bad)",  { XX } },
3701     { VEX_LEN_TABLE (VEX_LEN_2F_P_2) },
3702     { "(bad)",  { XX } },
3703   },
3704
3705   /* PREFIX_VEX_51 */
3706   {
3707     { VEX_W_TABLE (VEX_W_51_P_0) },
3708     { VEX_LEN_TABLE (VEX_LEN_51_P_1) },
3709     { VEX_W_TABLE (VEX_W_51_P_2) },
3710     { VEX_LEN_TABLE (VEX_LEN_51_P_3) },
3711   },
3712
3713   /* PREFIX_VEX_52 */
3714   {
3715     { VEX_W_TABLE (VEX_W_52_P_0) },
3716     { VEX_LEN_TABLE (VEX_LEN_52_P_1) },
3717     { "(bad)",  { XX } },
3718     { "(bad)",  { XX } },
3719   },
3720
3721   /* PREFIX_VEX_53 */
3722   {
3723     { VEX_W_TABLE (VEX_W_53_P_0) },
3724     { VEX_LEN_TABLE (VEX_LEN_53_P_1) },
3725     { "(bad)",  { XX } },
3726     { "(bad)",  { XX } },
3727   },
3728
3729   /* PREFIX_VEX_58 */
3730   {
3731     { VEX_W_TABLE (VEX_W_58_P_0) },
3732     { VEX_LEN_TABLE (VEX_LEN_58_P_1) },
3733     { VEX_W_TABLE (VEX_W_58_P_2) },
3734     { VEX_LEN_TABLE (VEX_LEN_58_P_3) },
3735   },
3736
3737   /* PREFIX_VEX_59 */
3738   {
3739     { VEX_W_TABLE (VEX_W_59_P_0) },
3740     { VEX_LEN_TABLE (VEX_LEN_59_P_1) },
3741     { VEX_W_TABLE (VEX_W_59_P_2) },
3742     { VEX_LEN_TABLE (VEX_LEN_59_P_3) },
3743   },
3744
3745   /* PREFIX_VEX_5A */
3746   {
3747     { VEX_W_TABLE (VEX_W_5A_P_0) },
3748     { VEX_LEN_TABLE (VEX_LEN_5A_P_1) },
3749     { "vcvtpd2ps%XY", { XMM, EXx } },
3750     { VEX_LEN_TABLE (VEX_LEN_5A_P_3) },
3751   },
3752
3753   /* PREFIX_VEX_5B */
3754   {
3755     { VEX_W_TABLE (VEX_W_5B_P_0) },
3756     { VEX_W_TABLE (VEX_W_5B_P_1) },
3757     { VEX_W_TABLE (VEX_W_5B_P_2) },
3758     { "(bad)",  { XX } },
3759   },
3760
3761   /* PREFIX_VEX_5C */
3762   {
3763     { VEX_W_TABLE (VEX_W_5C_P_0) },
3764     { VEX_LEN_TABLE (VEX_LEN_5C_P_1) },
3765     { VEX_W_TABLE (VEX_W_5C_P_2) },
3766     { VEX_LEN_TABLE (VEX_LEN_5C_P_3) },
3767   },
3768
3769   /* PREFIX_VEX_5D */
3770   {
3771     { VEX_W_TABLE (VEX_W_5D_P_0) },
3772     { VEX_LEN_TABLE (VEX_LEN_5D_P_1) },
3773     { VEX_W_TABLE (VEX_W_5D_P_2) },
3774     { VEX_LEN_TABLE (VEX_LEN_5D_P_3) },
3775   },
3776
3777   /* PREFIX_VEX_5E */
3778   {
3779     { VEX_W_TABLE (VEX_W_5E_P_0) },
3780     { VEX_LEN_TABLE (VEX_LEN_5E_P_1) },
3781     { VEX_W_TABLE (VEX_W_5E_P_2) },
3782     { VEX_LEN_TABLE (VEX_LEN_5E_P_3) },
3783   },
3784
3785   /* PREFIX_VEX_5F */
3786   {
3787     { VEX_W_TABLE (VEX_W_5F_P_0) },
3788     { VEX_LEN_TABLE (VEX_LEN_5F_P_1) },
3789     { VEX_W_TABLE (VEX_W_5F_P_2) },
3790     { VEX_LEN_TABLE (VEX_LEN_5F_P_3) },
3791   },
3792
3793   /* PREFIX_VEX_60 */
3794   {
3795     { "(bad)",  { XX } },
3796     { "(bad)",  { XX } },
3797     { VEX_LEN_TABLE (VEX_LEN_60_P_2) },
3798     { "(bad)",  { XX } },
3799   },
3800
3801   /* PREFIX_VEX_61 */
3802   {
3803     { "(bad)",  { XX } },
3804     { "(bad)",  { XX } },
3805     { VEX_LEN_TABLE (VEX_LEN_61_P_2) },
3806     { "(bad)",  { XX } },
3807   },
3808
3809   /* PREFIX_VEX_62 */
3810   {
3811     { "(bad)",  { XX } },
3812     { "(bad)",  { XX } },
3813     { VEX_LEN_TABLE (VEX_LEN_62_P_2) },
3814     { "(bad)",  { XX } },
3815   },
3816
3817   /* PREFIX_VEX_63 */
3818   {
3819     { "(bad)",  { XX } },
3820     { "(bad)",  { XX } },
3821     { VEX_LEN_TABLE (VEX_LEN_63_P_2) },
3822     { "(bad)",  { XX } },
3823   },
3824
3825   /* PREFIX_VEX_64 */
3826   {
3827     { "(bad)",  { XX } },
3828     { "(bad)",  { XX } },
3829     { VEX_LEN_TABLE (VEX_LEN_64_P_2) },
3830     { "(bad)",  { XX } },
3831   },
3832
3833   /* PREFIX_VEX_65 */
3834   {
3835     { "(bad)",  { XX } },
3836     { "(bad)",  { XX } },
3837     { VEX_LEN_TABLE (VEX_LEN_65_P_2) },
3838     { "(bad)",  { XX } },
3839   },
3840
3841   /* PREFIX_VEX_66 */
3842   {
3843     { "(bad)",  { XX } },
3844     { "(bad)",  { XX } },
3845     { VEX_LEN_TABLE (VEX_LEN_66_P_2) },
3846     { "(bad)",  { XX } },
3847   },
3848
3849   /* PREFIX_VEX_67 */
3850   {
3851     { "(bad)",  { XX } },
3852     { "(bad)",  { XX } },
3853     { VEX_LEN_TABLE (VEX_LEN_67_P_2) },
3854     { "(bad)",  { XX } },
3855   },
3856
3857   /* PREFIX_VEX_68 */
3858   {
3859     { "(bad)",  { XX } },
3860     { "(bad)",  { XX } },
3861     { VEX_LEN_TABLE (VEX_LEN_68_P_2) },
3862     { "(bad)",  { XX } },
3863   },
3864
3865   /* PREFIX_VEX_69 */
3866   {
3867     { "(bad)",  { XX } },
3868     { "(bad)",  { XX } },
3869     { VEX_LEN_TABLE (VEX_LEN_69_P_2) },
3870     { "(bad)",  { XX } },
3871   },
3872
3873   /* PREFIX_VEX_6A */
3874   {
3875     { "(bad)",  { XX } },
3876     { "(bad)",  { XX } },
3877     { VEX_LEN_TABLE (VEX_LEN_6A_P_2) },
3878     { "(bad)",  { XX } },
3879   },
3880
3881   /* PREFIX_VEX_6B */
3882   {
3883     { "(bad)",  { XX } },
3884     { "(bad)",  { XX } },
3885     { VEX_LEN_TABLE (VEX_LEN_6B_P_2) },
3886     { "(bad)",  { XX } },
3887   },
3888
3889   /* PREFIX_VEX_6C */
3890   {
3891     { "(bad)",  { XX } },
3892     { "(bad)",  { XX } },
3893     { VEX_LEN_TABLE (VEX_LEN_6C_P_2) },
3894     { "(bad)",  { XX } },
3895   },
3896
3897   /* PREFIX_VEX_6D */
3898   {
3899     { "(bad)",  { XX } },
3900     { "(bad)",  { XX } },
3901     { VEX_LEN_TABLE (VEX_LEN_6D_P_2) },
3902     { "(bad)",  { XX } },
3903   },
3904
3905   /* PREFIX_VEX_6E */
3906   {
3907     { "(bad)",  { XX } },
3908     { "(bad)",  { XX } },
3909     { VEX_LEN_TABLE (VEX_LEN_6E_P_2) },
3910     { "(bad)",  { XX } },
3911   },
3912
3913   /* PREFIX_VEX_6F */
3914   {
3915     { "(bad)",  { XX } },
3916     { VEX_W_TABLE (VEX_W_6F_P_1) },
3917     { VEX_W_TABLE (VEX_W_6F_P_2) },
3918     { "(bad)",  { XX } },
3919   },
3920
3921   /* PREFIX_VEX_70 */
3922   {
3923     { "(bad)",  { XX } },
3924     { VEX_LEN_TABLE (VEX_LEN_70_P_1) },
3925     { VEX_LEN_TABLE (VEX_LEN_70_P_2) },
3926     { VEX_LEN_TABLE (VEX_LEN_70_P_3) },
3927   },
3928
3929   /* PREFIX_VEX_71_REG_2 */
3930   {
3931     { "(bad)",  { XX } },
3932     { "(bad)",  { XX } },
3933     { VEX_LEN_TABLE (VEX_LEN_71_R_2_P_2) },
3934     { "(bad)",  { XX } },
3935   },
3936
3937   /* PREFIX_VEX_71_REG_4 */
3938   {
3939     { "(bad)",  { XX } },
3940     { "(bad)",  { XX } },
3941     { VEX_LEN_TABLE (VEX_LEN_71_R_4_P_2) },
3942     { "(bad)",  { XX } },
3943   },
3944
3945   /* PREFIX_VEX_71_REG_6 */
3946   {
3947     { "(bad)",  { XX } },
3948     { "(bad)",  { XX } },
3949     { VEX_LEN_TABLE (VEX_LEN_71_R_6_P_2) },
3950     { "(bad)",  { XX } },
3951   },
3952
3953   /* PREFIX_VEX_72_REG_2 */
3954   {
3955     { "(bad)",  { XX } },
3956     { "(bad)",  { XX } },
3957     { VEX_LEN_TABLE (VEX_LEN_72_R_2_P_2) },
3958     { "(bad)",  { XX } },
3959   },
3960
3961   /* PREFIX_VEX_72_REG_4 */
3962   {
3963     { "(bad)",  { XX } },
3964     { "(bad)",  { XX } },
3965     { VEX_LEN_TABLE (VEX_LEN_72_R_4_P_2) },
3966     { "(bad)",  { XX } },
3967   },
3968
3969   /* PREFIX_VEX_72_REG_6 */
3970   {
3971     { "(bad)",  { XX } },
3972     { "(bad)",  { XX } },
3973     { VEX_LEN_TABLE (VEX_LEN_72_R_6_P_2) },
3974     { "(bad)",  { XX } },
3975   },
3976
3977   /* PREFIX_VEX_73_REG_2 */
3978   {
3979     { "(bad)",  { XX } },
3980     { "(bad)",  { XX } },
3981     { VEX_LEN_TABLE (VEX_LEN_73_R_2_P_2) },
3982     { "(bad)",  { XX } },
3983   },
3984
3985   /* PREFIX_VEX_73_REG_3 */
3986   {
3987     { "(bad)",  { XX } },
3988     { "(bad)",  { XX } },
3989     { VEX_LEN_TABLE (VEX_LEN_73_R_3_P_2) },
3990     { "(bad)",  { XX } },
3991   },
3992
3993   /* PREFIX_VEX_73_REG_6 */
3994   {
3995     { "(bad)",  { XX } },
3996     { "(bad)",  { XX } },
3997     { VEX_LEN_TABLE (VEX_LEN_73_R_6_P_2) },
3998     { "(bad)",  { XX } },
3999   },
4000
4001   /* PREFIX_VEX_73_REG_7 */
4002   {
4003     { "(bad)",  { XX } },
4004     { "(bad)",  { XX } },
4005     { VEX_LEN_TABLE (VEX_LEN_73_R_7_P_2) },
4006     { "(bad)",  { XX } },
4007   },
4008
4009   /* PREFIX_VEX_74 */
4010   {
4011     { "(bad)",  { XX } },
4012     { "(bad)",  { XX } },
4013     { VEX_LEN_TABLE (VEX_LEN_74_P_2) },
4014     { "(bad)",  { XX } },
4015   },
4016
4017   /* PREFIX_VEX_75 */
4018   {
4019     { "(bad)",  { XX } },
4020     { "(bad)",  { XX } },
4021     { VEX_LEN_TABLE (VEX_LEN_75_P_2) },
4022     { "(bad)",  { XX } },
4023   },
4024
4025   /* PREFIX_VEX_76 */
4026   {
4027     { "(bad)",  { XX } },
4028     { "(bad)",  { XX } },
4029     { VEX_LEN_TABLE (VEX_LEN_76_P_2) },
4030     { "(bad)",  { XX } },
4031   },
4032
4033   /* PREFIX_VEX_77 */
4034   {
4035     { VEX_W_TABLE (VEX_W_77_P_0) },
4036     { "(bad)",  { XX } },
4037     { "(bad)",  { XX } },
4038     { "(bad)",  { XX } },
4039   },
4040
4041   /* PREFIX_VEX_7C */
4042   {
4043     { "(bad)",  { XX } },
4044     { "(bad)",  { XX } },
4045     { VEX_W_TABLE (VEX_W_7C_P_2) },
4046     { VEX_W_TABLE (VEX_W_7C_P_3) },
4047   },
4048
4049   /* PREFIX_VEX_7D */
4050   {
4051     { "(bad)",  { XX } },
4052     { "(bad)",  { XX } },
4053     { VEX_W_TABLE (VEX_W_7D_P_2) },
4054     { VEX_W_TABLE (VEX_W_7D_P_3) },
4055   },
4056
4057   /* PREFIX_VEX_7E */
4058   {
4059     { "(bad)",  { XX } },
4060     { VEX_LEN_TABLE (VEX_LEN_7E_P_1) },
4061     { VEX_LEN_TABLE (VEX_LEN_7E_P_2) },
4062     { "(bad)",  { XX } },
4063   },
4064
4065   /* PREFIX_VEX_7F */
4066   {
4067     { "(bad)",  { XX } },
4068     { VEX_W_TABLE (VEX_W_7F_P_1) },
4069     { VEX_W_TABLE (VEX_W_7F_P_2) },
4070     { "(bad)",  { XX } },
4071   },
4072
4073   /* PREFIX_VEX_C2 */
4074   {
4075     { VEX_W_TABLE (VEX_W_C2_P_0) },
4076     { VEX_LEN_TABLE (VEX_LEN_C2_P_1) },
4077     { VEX_W_TABLE (VEX_W_C2_P_2) },
4078     { VEX_LEN_TABLE (VEX_LEN_C2_P_3) },
4079   },
4080
4081   /* PREFIX_VEX_C4 */
4082   {
4083     { "(bad)",  { XX } },
4084     { "(bad)",  { XX } },
4085     { VEX_LEN_TABLE (VEX_LEN_C4_P_2) },
4086     { "(bad)",  { XX } },
4087   },
4088
4089   /* PREFIX_VEX_C5 */
4090   {
4091     { "(bad)",  { XX } },
4092     { "(bad)",  { XX } },
4093     { VEX_LEN_TABLE (VEX_LEN_C5_P_2) },
4094     { "(bad)",  { XX } },
4095   },
4096
4097   /* PREFIX_VEX_D0 */
4098   {
4099     { "(bad)",  { XX } },
4100     { "(bad)",  { XX } },
4101     { VEX_W_TABLE (VEX_W_D0_P_2) },
4102     { VEX_W_TABLE (VEX_W_D0_P_3) },
4103   },
4104
4105   /* PREFIX_VEX_D1 */
4106   {
4107     { "(bad)",  { XX } },
4108     { "(bad)",  { XX } },
4109     { VEX_LEN_TABLE (VEX_LEN_D1_P_2) },
4110     { "(bad)",  { XX } },
4111   },
4112
4113   /* PREFIX_VEX_D2 */
4114   {
4115     { "(bad)",  { XX } },
4116     { "(bad)",  { XX } },
4117     { VEX_LEN_TABLE (VEX_LEN_D2_P_2) },
4118     { "(bad)",  { XX } },
4119   },
4120
4121   /* PREFIX_VEX_D3 */
4122   {
4123     { "(bad)",  { XX } },
4124     { "(bad)",  { XX } },
4125     { VEX_LEN_TABLE (VEX_LEN_D3_P_2) },
4126     { "(bad)",  { XX } },
4127   },
4128
4129   /* PREFIX_VEX_D4 */
4130   {
4131     { "(bad)",  { XX } },
4132     { "(bad)",  { XX } },
4133     { VEX_LEN_TABLE (VEX_LEN_D4_P_2) },
4134     { "(bad)",  { XX } },
4135   },
4136
4137   /* PREFIX_VEX_D5 */
4138   {
4139     { "(bad)",  { XX } },
4140     { "(bad)",  { XX } },
4141     { VEX_LEN_TABLE (VEX_LEN_D5_P_2) },
4142     { "(bad)",  { XX } },
4143   },
4144
4145   /* PREFIX_VEX_D6 */
4146   {
4147     { "(bad)",  { XX } },
4148     { "(bad)",  { XX } },
4149     { VEX_LEN_TABLE (VEX_LEN_D6_P_2) },
4150     { "(bad)",  { XX } },
4151   },
4152
4153   /* PREFIX_VEX_D7 */
4154   {
4155     { "(bad)",  { XX } },
4156     { "(bad)",  { XX } },
4157     { MOD_TABLE (MOD_VEX_D7_PREFIX_2) },
4158     { "(bad)",  { XX } },
4159   },
4160
4161   /* PREFIX_VEX_D8 */
4162   {
4163     { "(bad)",  { XX } },
4164     { "(bad)",  { XX } },
4165     { VEX_LEN_TABLE (VEX_LEN_D8_P_2) },
4166     { "(bad)",  { XX } },
4167   },
4168
4169   /* PREFIX_VEX_D9 */
4170   {
4171     { "(bad)",  { XX } },
4172     { "(bad)",  { XX } },
4173     { VEX_LEN_TABLE (VEX_LEN_D9_P_2) },
4174     { "(bad)",  { XX } },
4175   },
4176
4177   /* PREFIX_VEX_DA */
4178   {
4179     { "(bad)",  { XX } },
4180     { "(bad)",  { XX } },
4181     { VEX_LEN_TABLE (VEX_LEN_DA_P_2) },
4182     { "(bad)",  { XX } },
4183   },
4184
4185   /* PREFIX_VEX_DB */
4186   {
4187     { "(bad)",  { XX } },
4188     { "(bad)",  { XX } },
4189     { VEX_LEN_TABLE (VEX_LEN_DB_P_2) },
4190     { "(bad)",  { XX } },
4191   },
4192
4193   /* PREFIX_VEX_DC */
4194   {
4195     { "(bad)",  { XX } },
4196     { "(bad)",  { XX } },
4197     { VEX_LEN_TABLE (VEX_LEN_DC_P_2) },
4198     { "(bad)",  { XX } },
4199   },
4200
4201   /* PREFIX_VEX_DD */
4202   {
4203     { "(bad)",  { XX } },
4204     { "(bad)",  { XX } },
4205     { VEX_LEN_TABLE (VEX_LEN_DD_P_2) },
4206     { "(bad)",  { XX } },
4207   },
4208
4209   /* PREFIX_VEX_DE */
4210   {
4211     { "(bad)",  { XX } },
4212     { "(bad)",  { XX } },
4213     { VEX_LEN_TABLE (VEX_LEN_DE_P_2) },
4214     { "(bad)",  { XX } },
4215   },
4216
4217   /* PREFIX_VEX_DF */
4218   {
4219     { "(bad)",  { XX } },
4220     { "(bad)",  { XX } },
4221     { VEX_LEN_TABLE (VEX_LEN_DF_P_2) },
4222     { "(bad)",  { XX } },
4223   },
4224
4225   /* PREFIX_VEX_E0 */
4226   {
4227     { "(bad)",  { XX } },
4228     { "(bad)",  { XX } },
4229     { VEX_LEN_TABLE (VEX_LEN_E0_P_2) },
4230     { "(bad)",  { XX } },
4231   },
4232
4233   /* PREFIX_VEX_E1 */
4234   {
4235     { "(bad)",  { XX } },
4236     { "(bad)",  { XX } },
4237     { VEX_LEN_TABLE (VEX_LEN_E1_P_2) },
4238     { "(bad)",  { XX } },
4239   },
4240
4241   /* PREFIX_VEX_E2 */
4242   {
4243     { "(bad)",  { XX } },
4244     { "(bad)",  { XX } },
4245     { VEX_LEN_TABLE (VEX_LEN_E2_P_2) },
4246     { "(bad)",  { XX } },
4247   },
4248
4249   /* PREFIX_VEX_E3 */
4250   {
4251     { "(bad)",  { XX } },
4252     { "(bad)",  { XX } },
4253     { VEX_LEN_TABLE (VEX_LEN_E3_P_2) },
4254     { "(bad)",  { XX } },
4255   },
4256
4257   /* PREFIX_VEX_E4 */
4258   {
4259     { "(bad)",  { XX } },
4260     { "(bad)",  { XX } },
4261     { VEX_LEN_TABLE (VEX_LEN_E4_P_2) },
4262     { "(bad)",  { XX } },
4263   },
4264
4265   /* PREFIX_VEX_E5 */
4266   {
4267     { "(bad)",  { XX } },
4268     { "(bad)",  { XX } },
4269     { VEX_LEN_TABLE (VEX_LEN_E5_P_2) },
4270     { "(bad)",  { XX } },
4271   },
4272
4273   /* PREFIX_VEX_E6 */
4274   {
4275     { "(bad)",  { XX } },
4276     { VEX_W_TABLE (VEX_W_E6_P_1) },
4277     { VEX_W_TABLE (VEX_W_E6_P_2) },
4278     { VEX_W_TABLE (VEX_W_E6_P_3) },
4279   },
4280
4281   /* PREFIX_VEX_E7 */
4282   {
4283     { "(bad)",  { XX } },
4284     { "(bad)",  { XX } },
4285     { MOD_TABLE (MOD_VEX_E7_PREFIX_2) },
4286     { "(bad)",  { XX } },
4287   },
4288
4289   /* PREFIX_VEX_E8 */
4290   {
4291     { "(bad)",  { XX } },
4292     { "(bad)",  { XX } },
4293     { VEX_LEN_TABLE (VEX_LEN_E8_P_2) },
4294     { "(bad)",  { XX } },
4295   },
4296
4297   /* PREFIX_VEX_E9 */
4298   {
4299     { "(bad)",  { XX } },
4300     { "(bad)",  { XX } },
4301     { VEX_LEN_TABLE (VEX_LEN_E9_P_2) },
4302     { "(bad)",  { XX } },
4303   },
4304
4305   /* PREFIX_VEX_EA */
4306   {
4307     { "(bad)",  { XX } },
4308     { "(bad)",  { XX } },
4309     { VEX_LEN_TABLE (VEX_LEN_EA_P_2) },
4310     { "(bad)",  { XX } },
4311   },
4312
4313   /* PREFIX_VEX_EB */
4314   {
4315     { "(bad)",  { XX } },
4316     { "(bad)",  { XX } },
4317     { VEX_LEN_TABLE (VEX_LEN_EB_P_2) },
4318     { "(bad)",  { XX } },
4319   },
4320
4321   /* PREFIX_VEX_EC */
4322   {
4323     { "(bad)",  { XX } },
4324     { "(bad)",  { XX } },
4325     { VEX_LEN_TABLE (VEX_LEN_EC_P_2) },
4326     { "(bad)",  { XX } },
4327   },
4328
4329   /* PREFIX_VEX_ED */
4330   {
4331     { "(bad)",  { XX } },
4332     { "(bad)",  { XX } },
4333     { VEX_LEN_TABLE (VEX_LEN_ED_P_2) },
4334     { "(bad)",  { XX } },
4335   },
4336
4337   /* PREFIX_VEX_EE */
4338   {
4339     { "(bad)",  { XX } },
4340     { "(bad)",  { XX } },
4341     { VEX_LEN_TABLE (VEX_LEN_EE_P_2) },
4342     { "(bad)",  { XX } },
4343   },
4344
4345   /* PREFIX_VEX_EF */
4346   {
4347     { "(bad)",  { XX } },
4348     { "(bad)",  { XX } },
4349     { VEX_LEN_TABLE (VEX_LEN_EF_P_2) },
4350     { "(bad)",  { XX } },
4351   },
4352
4353   /* PREFIX_VEX_F0 */
4354   {
4355     { "(bad)",  { XX } },
4356     { "(bad)",  { XX } },
4357     { "(bad)",  { XX } },
4358     { MOD_TABLE (MOD_VEX_F0_PREFIX_3) },
4359   },
4360
4361   /* PREFIX_VEX_F1 */
4362   {
4363     { "(bad)",  { XX } },
4364     { "(bad)",  { XX } },
4365     { VEX_LEN_TABLE (VEX_LEN_F1_P_2) },
4366     { "(bad)",  { XX } },
4367   },
4368
4369   /* PREFIX_VEX_F2 */
4370   {
4371     { "(bad)",  { XX } },
4372     { "(bad)",  { XX } },
4373     { VEX_LEN_TABLE (VEX_LEN_F2_P_2) },
4374     { "(bad)",  { XX } },
4375   },
4376
4377   /* PREFIX_VEX_F3 */
4378   {
4379     { "(bad)",  { XX } },
4380     { "(bad)",  { XX } },
4381     { VEX_LEN_TABLE (VEX_LEN_F3_P_2) },
4382     { "(bad)",  { XX } },
4383   },
4384
4385   /* PREFIX_VEX_F4 */
4386   {
4387     { "(bad)",  { XX } },
4388     { "(bad)",  { XX } },
4389     { VEX_LEN_TABLE (VEX_LEN_F4_P_2) },
4390     { "(bad)",  { XX } },
4391   },
4392
4393   /* PREFIX_VEX_F5 */
4394   {
4395     { "(bad)",  { XX } },
4396     { "(bad)",  { XX } },
4397     { VEX_LEN_TABLE (VEX_LEN_F5_P_2) },
4398     { "(bad)",  { XX } },
4399   },
4400
4401   /* PREFIX_VEX_F6 */
4402   {
4403     { "(bad)",  { XX } },
4404     { "(bad)",  { XX } },
4405     { VEX_LEN_TABLE (VEX_LEN_F6_P_2) },
4406     { "(bad)",  { XX } },
4407   },
4408
4409   /* PREFIX_VEX_F7 */
4410   {
4411     { "(bad)",  { XX } },
4412     { "(bad)",  { XX } },
4413     { VEX_LEN_TABLE (VEX_LEN_F7_P_2) },
4414     { "(bad)",  { XX } },
4415   },
4416
4417   /* PREFIX_VEX_F8 */
4418   {
4419     { "(bad)",  { XX } },
4420     { "(bad)",  { XX } },
4421     { VEX_LEN_TABLE (VEX_LEN_F8_P_2) },
4422     { "(bad)",  { XX } },
4423   },
4424
4425   /* PREFIX_VEX_F9 */
4426   {
4427     { "(bad)",  { XX } },
4428     { "(bad)",  { XX } },
4429     { VEX_LEN_TABLE (VEX_LEN_F9_P_2) },
4430     { "(bad)",  { XX } },
4431   },
4432
4433   /* PREFIX_VEX_FA */
4434   {
4435     { "(bad)",  { XX } },
4436     { "(bad)",  { XX } },
4437     { VEX_LEN_TABLE (VEX_LEN_FA_P_2) },
4438     { "(bad)",  { XX } },
4439   },
4440
4441   /* PREFIX_VEX_FB */
4442   {
4443     { "(bad)",  { XX } },
4444     { "(bad)",  { XX } },
4445     { VEX_LEN_TABLE (VEX_LEN_FB_P_2) },
4446     { "(bad)",  { XX } },
4447   },
4448
4449   /* PREFIX_VEX_FC */
4450   {
4451     { "(bad)",  { XX } },
4452     { "(bad)",  { XX } },
4453     { VEX_LEN_TABLE (VEX_LEN_FC_P_2) },
4454     { "(bad)",  { XX } },
4455   },
4456
4457   /* PREFIX_VEX_FD */
4458   {
4459     { "(bad)",  { XX } },
4460     { "(bad)",  { XX } },
4461     { VEX_LEN_TABLE (VEX_LEN_FD_P_2) },
4462     { "(bad)",  { XX } },
4463   },
4464
4465   /* PREFIX_VEX_FE */
4466   {
4467     { "(bad)",  { XX } },
4468     { "(bad)",  { XX } },
4469     { VEX_LEN_TABLE (VEX_LEN_FE_P_2) },
4470     { "(bad)",  { XX } },
4471   },
4472
4473   /* PREFIX_VEX_3800 */
4474   {
4475     { "(bad)",  { XX } },
4476     { "(bad)",  { XX } },
4477     { VEX_LEN_TABLE (VEX_LEN_3800_P_2) },
4478     { "(bad)",  { XX } },
4479   },
4480
4481   /* PREFIX_VEX_3801 */
4482   {
4483     { "(bad)",  { XX } },
4484     { "(bad)",  { XX } },
4485     { VEX_LEN_TABLE (VEX_LEN_3801_P_2) },
4486     { "(bad)",  { XX } },
4487   },
4488
4489   /* PREFIX_VEX_3802 */
4490   {
4491     { "(bad)",  { XX } },
4492     { "(bad)",  { XX } },
4493     { VEX_LEN_TABLE (VEX_LEN_3802_P_2) },
4494     { "(bad)",  { XX } },
4495   },
4496
4497   /* PREFIX_VEX_3803 */
4498   {
4499     { "(bad)",  { XX } },
4500     { "(bad)",  { XX } },
4501     { VEX_LEN_TABLE (VEX_LEN_3803_P_2) },
4502     { "(bad)",  { XX } },
4503   },
4504
4505   /* PREFIX_VEX_3804 */
4506   {
4507     { "(bad)",  { XX } },
4508     { "(bad)",  { XX } },
4509     { VEX_LEN_TABLE (VEX_LEN_3804_P_2) },
4510     { "(bad)",  { XX } },
4511   },
4512
4513   /* PREFIX_VEX_3805 */
4514   {
4515     { "(bad)",  { XX } },
4516     { "(bad)",  { XX } },
4517     { VEX_LEN_TABLE (VEX_LEN_3805_P_2) },
4518     { "(bad)",  { XX } },
4519   },
4520
4521   /* PREFIX_VEX_3806 */
4522   {
4523     { "(bad)",  { XX } },
4524     { "(bad)",  { XX } },
4525     { VEX_LEN_TABLE (VEX_LEN_3806_P_2) },
4526     { "(bad)",  { XX } },
4527   },
4528
4529   /* PREFIX_VEX_3807 */
4530   {
4531     { "(bad)",  { XX } },
4532     { "(bad)",  { XX } },
4533     { VEX_LEN_TABLE (VEX_LEN_3807_P_2) },
4534     { "(bad)",  { XX } },
4535   },
4536
4537   /* PREFIX_VEX_3808 */
4538   {
4539     { "(bad)",  { XX } },
4540     { "(bad)",  { XX } },
4541     { VEX_LEN_TABLE (VEX_LEN_3808_P_2) },
4542     { "(bad)",  { XX } },
4543   },
4544
4545   /* PREFIX_VEX_3809 */
4546   {
4547     { "(bad)",  { XX } },
4548     { "(bad)",  { XX } },
4549     { VEX_LEN_TABLE (VEX_LEN_3809_P_2) },
4550     { "(bad)",  { XX } },
4551   },
4552
4553   /* PREFIX_VEX_380A */
4554   {
4555     { "(bad)",  { XX } },
4556     { "(bad)",  { XX } },
4557     { VEX_LEN_TABLE (VEX_LEN_380A_P_2) },
4558     { "(bad)",  { XX } },
4559   },
4560
4561   /* PREFIX_VEX_380B */
4562   {
4563     { "(bad)",  { XX } },
4564     { "(bad)",  { XX } },
4565     { VEX_LEN_TABLE (VEX_LEN_380B_P_2) },
4566     { "(bad)",  { XX } },
4567   },
4568
4569   /* PREFIX_VEX_380C */
4570   {
4571     { "(bad)",  { XX } },
4572     { "(bad)",  { XX } },
4573     { VEX_W_TABLE (VEX_W_380C_P_2) },
4574     { "(bad)",  { XX } },
4575   },
4576
4577   /* PREFIX_VEX_380D */
4578   {
4579     { "(bad)",  { XX } },
4580     { "(bad)",  { XX } },
4581     { VEX_W_TABLE (VEX_W_380D_P_2) },
4582     { "(bad)",  { XX } },
4583   },
4584
4585   /* PREFIX_VEX_380E */
4586   {
4587     { "(bad)",  { XX } },
4588     { "(bad)",  { XX } },
4589     { VEX_W_TABLE (VEX_W_380E_P_2) },
4590     { "(bad)",  { XX } },
4591   },
4592
4593   /* PREFIX_VEX_380F */
4594   {
4595     { "(bad)",  { XX } },
4596     { "(bad)",  { XX } },
4597     { VEX_W_TABLE (VEX_W_380F_P_2) },
4598     { "(bad)",  { XX } },
4599   },
4600
4601   /* PREFIX_VEX_3817 */
4602   {
4603     { "(bad)",  { XX } },
4604     { "(bad)",  { XX } },
4605     { VEX_W_TABLE (VEX_W_3817_P_2) },
4606     { "(bad)",  { XX } },
4607   },
4608
4609   /* PREFIX_VEX_3818 */
4610   {
4611     { "(bad)",  { XX } },
4612     { "(bad)",  { XX } },
4613     { MOD_TABLE (MOD_VEX_3818_PREFIX_2) },
4614     { "(bad)",  { XX } },
4615   },
4616
4617   /* PREFIX_VEX_3819 */
4618   {
4619     { "(bad)",  { XX } },
4620     { "(bad)",  { XX } },
4621     { MOD_TABLE (MOD_VEX_3819_PREFIX_2) },
4622     { "(bad)",  { XX } },
4623   },
4624
4625   /* PREFIX_VEX_381A */
4626   {
4627     { "(bad)",  { XX } },
4628     { "(bad)",  { XX } },
4629     { MOD_TABLE (MOD_VEX_381A_PREFIX_2) },
4630     { "(bad)",  { XX } },
4631   },
4632
4633   /* PREFIX_VEX_381C */
4634   {
4635     { "(bad)",  { XX } },
4636     { "(bad)",  { XX } },
4637     { VEX_LEN_TABLE (VEX_LEN_381C_P_2) },
4638     { "(bad)",  { XX } },
4639   },
4640
4641   /* PREFIX_VEX_381D */
4642   {
4643     { "(bad)",  { XX } },
4644     { "(bad)",  { XX } },
4645     { VEX_LEN_TABLE (VEX_LEN_381D_P_2) },
4646     { "(bad)",  { XX } },
4647   },
4648
4649   /* PREFIX_VEX_381E */
4650   {
4651     { "(bad)",  { XX } },
4652     { "(bad)",  { XX } },
4653     { VEX_LEN_TABLE (VEX_LEN_381E_P_2) },
4654     { "(bad)",  { XX } },
4655   },
4656
4657   /* PREFIX_VEX_3820 */
4658   {
4659     { "(bad)",  { XX } },
4660     { "(bad)",  { XX } },
4661     { VEX_LEN_TABLE (VEX_LEN_3820_P_2) },
4662     { "(bad)",  { XX } },
4663   },
4664
4665   /* PREFIX_VEX_3821 */
4666   {
4667     { "(bad)",  { XX } },
4668     { "(bad)",  { XX } },
4669     { VEX_LEN_TABLE (VEX_LEN_3821_P_2) },
4670     { "(bad)",  { XX } },
4671   },
4672
4673   /* PREFIX_VEX_3822 */
4674   {
4675     { "(bad)",  { XX } },
4676     { "(bad)",  { XX } },
4677     { VEX_LEN_TABLE (VEX_LEN_3822_P_2) },
4678     { "(bad)",  { XX } },
4679   },
4680
4681   /* PREFIX_VEX_3823 */
4682   {
4683     { "(bad)",  { XX } },
4684     { "(bad)",  { XX } },
4685     { VEX_LEN_TABLE (VEX_LEN_3823_P_2) },
4686     { "(bad)",  { XX } },
4687   },
4688
4689   /* PREFIX_VEX_3824 */
4690   {
4691     { "(bad)",  { XX } },
4692     { "(bad)",  { XX } },
4693     { VEX_LEN_TABLE (VEX_LEN_3824_P_2) },
4694     { "(bad)",  { XX } },
4695   },
4696
4697   /* PREFIX_VEX_3825 */
4698   {
4699     { "(bad)",  { XX } },
4700     { "(bad)",  { XX } },
4701     { VEX_LEN_TABLE (VEX_LEN_3825_P_2) },
4702     { "(bad)",  { XX } },
4703   },
4704
4705   /* PREFIX_VEX_3828 */
4706   {
4707     { "(bad)",  { XX } },
4708     { "(bad)",  { XX } },
4709     { VEX_LEN_TABLE (VEX_LEN_3828_P_2) },
4710     { "(bad)",  { XX } },
4711   },
4712
4713   /* PREFIX_VEX_3829 */
4714   {
4715     { "(bad)",  { XX } },
4716     { "(bad)",  { XX } },
4717     { VEX_LEN_TABLE (VEX_LEN_3829_P_2) },
4718     { "(bad)",  { XX } },
4719   },
4720
4721   /* PREFIX_VEX_382A */
4722   {
4723     { "(bad)",  { XX } },
4724     { "(bad)",  { XX } },
4725     { MOD_TABLE (MOD_VEX_382A_PREFIX_2) },
4726     { "(bad)",  { XX } },
4727   },
4728
4729   /* PREFIX_VEX_382B */
4730   {
4731     { "(bad)",  { XX } },
4732     { "(bad)",  { XX } },
4733     { VEX_LEN_TABLE (VEX_LEN_382B_P_2) },
4734     { "(bad)",  { XX } },
4735   },
4736
4737   /* PREFIX_VEX_382C */
4738   {
4739     { "(bad)",  { XX } },
4740     { "(bad)",  { XX } },
4741      { MOD_TABLE (MOD_VEX_382C_PREFIX_2) },
4742     { "(bad)",  { XX } },
4743   },
4744
4745   /* PREFIX_VEX_382D */
4746   {
4747     { "(bad)",  { XX } },
4748     { "(bad)",  { XX } },
4749      { MOD_TABLE (MOD_VEX_382D_PREFIX_2) },
4750     { "(bad)",  { XX } },
4751   },
4752
4753   /* PREFIX_VEX_382E */
4754   {
4755     { "(bad)",  { XX } },
4756     { "(bad)",  { XX } },
4757      { MOD_TABLE (MOD_VEX_382E_PREFIX_2) },
4758     { "(bad)",  { XX } },
4759   },
4760
4761   /* PREFIX_VEX_382F */
4762   {
4763     { "(bad)",  { XX } },
4764     { "(bad)",  { XX } },
4765      { MOD_TABLE (MOD_VEX_382F_PREFIX_2) },
4766     { "(bad)",  { XX } },
4767   },
4768
4769   /* PREFIX_VEX_3830 */
4770   {
4771     { "(bad)",  { XX } },
4772     { "(bad)",  { XX } },
4773     { VEX_LEN_TABLE (VEX_LEN_3830_P_2) },
4774     { "(bad)",  { XX } },
4775   },
4776
4777   /* PREFIX_VEX_3831 */
4778   {
4779     { "(bad)",  { XX } },
4780     { "(bad)",  { XX } },
4781     { VEX_LEN_TABLE (VEX_LEN_3831_P_2) },
4782     { "(bad)",  { XX } },
4783   },
4784
4785   /* PREFIX_VEX_3832 */
4786   {
4787     { "(bad)",  { XX } },
4788     { "(bad)",  { XX } },
4789     { VEX_LEN_TABLE (VEX_LEN_3832_P_2) },
4790     { "(bad)",  { XX } },
4791   },
4792
4793   /* PREFIX_VEX_3833 */
4794   {
4795     { "(bad)",  { XX } },
4796     { "(bad)",  { XX } },
4797     { VEX_LEN_TABLE (VEX_LEN_3833_P_2) },
4798     { "(bad)",  { XX } },
4799   },
4800
4801   /* PREFIX_VEX_3834 */
4802   {
4803     { "(bad)",  { XX } },
4804     { "(bad)",  { XX } },
4805     { VEX_LEN_TABLE (VEX_LEN_3834_P_2) },
4806     { "(bad)",  { XX } },
4807   },
4808
4809   /* PREFIX_VEX_3835 */
4810   {
4811     { "(bad)",  { XX } },
4812     { "(bad)",  { XX } },
4813     { VEX_LEN_TABLE (VEX_LEN_3835_P_2) },
4814     { "(bad)",  { XX } },
4815   },
4816
4817   /* PREFIX_VEX_3837 */
4818   {
4819     { "(bad)",  { XX } },
4820     { "(bad)",  { XX } },
4821     { VEX_LEN_TABLE (VEX_LEN_3837_P_2) },
4822     { "(bad)",  { XX } },
4823   },
4824
4825   /* PREFIX_VEX_3838 */
4826   {
4827     { "(bad)",  { XX } },
4828     { "(bad)",  { XX } },
4829     { VEX_LEN_TABLE (VEX_LEN_3838_P_2) },
4830     { "(bad)",  { XX } },
4831   },
4832
4833   /* PREFIX_VEX_3839 */
4834   {
4835     { "(bad)",  { XX } },
4836     { "(bad)",  { XX } },
4837     { VEX_LEN_TABLE (VEX_LEN_3839_P_2) },
4838     { "(bad)",  { XX } },
4839   },
4840
4841   /* PREFIX_VEX_383A */
4842   {
4843     { "(bad)",  { XX } },
4844     { "(bad)",  { XX } },
4845     { VEX_LEN_TABLE (VEX_LEN_383A_P_2) },
4846     { "(bad)",  { XX } },
4847   },
4848
4849   /* PREFIX_VEX_383B */
4850   {
4851     { "(bad)",  { XX } },
4852     { "(bad)",  { XX } },
4853     { VEX_LEN_TABLE (VEX_LEN_383B_P_2) },
4854     { "(bad)",  { XX } },
4855   },
4856
4857   /* PREFIX_VEX_383C */
4858   {
4859     { "(bad)",  { XX } },
4860     { "(bad)",  { XX } },
4861     { VEX_LEN_TABLE (VEX_LEN_383C_P_2) },
4862     { "(bad)",  { XX } },
4863   },
4864
4865   /* PREFIX_VEX_383D */
4866   {
4867     { "(bad)",  { XX } },
4868     { "(bad)",  { XX } },
4869     { VEX_LEN_TABLE (VEX_LEN_383D_P_2) },
4870     { "(bad)",  { XX } },
4871   },
4872
4873   /* PREFIX_VEX_383E */
4874   {
4875     { "(bad)",  { XX } },
4876     { "(bad)",  { XX } },
4877     { VEX_LEN_TABLE (VEX_LEN_383E_P_2) },
4878     { "(bad)",  { XX } },
4879   },
4880
4881   /* PREFIX_VEX_383F */
4882   {
4883     { "(bad)",  { XX } },
4884     { "(bad)",  { XX } },
4885     { VEX_LEN_TABLE (VEX_LEN_383F_P_2) },
4886     { "(bad)",  { XX } },
4887   },
4888
4889   /* PREFIX_VEX_3840 */
4890   {
4891     { "(bad)",  { XX } },
4892     { "(bad)",  { XX } },
4893     { VEX_LEN_TABLE (VEX_LEN_3840_P_2) },
4894     { "(bad)",  { XX } },
4895   },
4896
4897   /* PREFIX_VEX_3841 */
4898   {
4899     { "(bad)",  { XX } },
4900     { "(bad)",  { XX } },
4901     { VEX_LEN_TABLE (VEX_LEN_3841_P_2) },
4902     { "(bad)",  { XX } },
4903   },
4904
4905   /* PREFIX_VEX_3896 */
4906   {
4907     { "(bad)",  { XX } },
4908     { "(bad)",  { XX } },
4909     { "vfmaddsub132p%XW", { XM, Vex, EXx } },
4910     { "(bad)",  { XX } },
4911   },
4912
4913   /* PREFIX_VEX_3897 */
4914   {
4915     { "(bad)",  { XX } },
4916     { "(bad)",  { XX } },
4917     { "vfmsubadd132p%XW", { XM, Vex, EXx } },
4918     { "(bad)",  { XX } },
4919   },
4920
4921   /* PREFIX_VEX_3898 */
4922   {
4923     { "(bad)",  { XX } },
4924     { "(bad)",  { XX } },
4925     { "vfmadd132p%XW", { XM, Vex, EXx } },
4926     { "(bad)",  { XX } },
4927   },
4928
4929   /* PREFIX_VEX_3899 */
4930   {
4931     { "(bad)",  { XX } },
4932     { "(bad)",  { XX } },
4933     { "vfmadd132s%XW", { XM, Vex, EXVexWdq } },
4934     { "(bad)",  { XX } },
4935   },
4936
4937   /* PREFIX_VEX_389A */
4938   {
4939     { "(bad)",  { XX } },
4940     { "(bad)",  { XX } },
4941     { "vfmsub132p%XW", { XM, Vex, EXx } },
4942     { "(bad)",  { XX } },
4943   },
4944
4945   /* PREFIX_VEX_389B */
4946   {
4947     { "(bad)",  { XX } },
4948     { "(bad)",  { XX } },
4949     { "vfmsub132s%XW", { XM, Vex, EXVexWdq } },
4950     { "(bad)",  { XX } },
4951   },
4952
4953   /* PREFIX_VEX_389C */
4954   {
4955     { "(bad)",  { XX } },
4956     { "(bad)",  { XX } },
4957     { "vfnmadd132p%XW", { XM, Vex, EXx } },
4958     { "(bad)",  { XX } },
4959   },
4960
4961   /* PREFIX_VEX_389D */
4962   {
4963     { "(bad)",  { XX } },
4964     { "(bad)",  { XX } },
4965     { "vfnmadd132s%XW", { XM, Vex, EXVexWdq } },
4966     { "(bad)",  { XX } },
4967   },
4968
4969   /* PREFIX_VEX_389E */
4970   {
4971     { "(bad)",  { XX } },
4972     { "(bad)",  { XX } },
4973     { "vfnmsub132p%XW", { XM, Vex, EXx } },
4974     { "(bad)",  { XX } },
4975   },
4976
4977   /* PREFIX_VEX_389F */
4978   {
4979     { "(bad)",  { XX } },
4980     { "(bad)",  { XX } },
4981     { "vfnmsub132s%XW", { XM, Vex, EXVexWdq } },
4982     { "(bad)",  { XX } },
4983   },
4984
4985   /* PREFIX_VEX_38A6 */
4986   {
4987     { "(bad)",  { XX } },
4988     { "(bad)",  { XX } },
4989     { "vfmaddsub213p%XW", { XM, Vex, EXx } },
4990     { "(bad)",  { XX } },
4991   },
4992
4993   /* PREFIX_VEX_38A7 */
4994   {
4995     { "(bad)",  { XX } },
4996     { "(bad)",  { XX } },
4997     { "vfmsubadd213p%XW", { XM, Vex, EXx } },
4998     { "(bad)",  { XX } },
4999   },
5000
5001   /* PREFIX_VEX_38A8 */
5002   {
5003     { "(bad)",  { XX } },
5004     { "(bad)",  { XX } },
5005     { "vfmadd213p%XW", { XM, Vex, EXx } },
5006     { "(bad)",  { XX } },
5007   },
5008
5009   /* PREFIX_VEX_38A9 */
5010   {
5011     { "(bad)",  { XX } },
5012     { "(bad)",  { XX } },
5013     { "vfmadd213s%XW", { XM, Vex, EXVexWdq } },
5014     { "(bad)",  { XX } },
5015   },
5016
5017   /* PREFIX_VEX_38AA */
5018   {
5019     { "(bad)",  { XX } },
5020     { "(bad)",  { XX } },
5021     { "vfmsub213p%XW", { XM, Vex, EXx } },
5022     { "(bad)",  { XX } },
5023   },
5024
5025   /* PREFIX_VEX_38AB */
5026   {
5027     { "(bad)",  { XX } },
5028     { "(bad)",  { XX } },
5029     { "vfmsub213s%XW", { XM, Vex, EXVexWdq } },
5030     { "(bad)",  { XX } },
5031   },
5032
5033   /* PREFIX_VEX_38AC */
5034   {
5035     { "(bad)",  { XX } },
5036     { "(bad)",  { XX } },
5037     { "vfnmadd213p%XW", { XM, Vex, EXx } },
5038     { "(bad)",  { XX } },
5039   },
5040
5041   /* PREFIX_VEX_38AD */
5042   {
5043     { "(bad)",  { XX } },
5044     { "(bad)",  { XX } },
5045     { "vfnmadd213s%XW", { XM, Vex, EXVexWdq } },
5046     { "(bad)",  { XX } },
5047   },
5048
5049   /* PREFIX_VEX_38AE */
5050   {
5051     { "(bad)",  { XX } },
5052     { "(bad)",  { XX } },
5053     { "vfnmsub213p%XW", { XM, Vex, EXx } },
5054     { "(bad)",  { XX } },
5055   },
5056
5057   /* PREFIX_VEX_38AF */
5058   {
5059     { "(bad)",  { XX } },
5060     { "(bad)",  { XX } },
5061     { "vfnmsub213s%XW", { XM, Vex, EXVexWdq } },
5062     { "(bad)",  { XX } },
5063   },
5064
5065   /* PREFIX_VEX_38B6 */
5066   {
5067     { "(bad)",  { XX } },
5068     { "(bad)",  { XX } },
5069     { "vfmaddsub231p%XW", { XM, Vex, EXx } },
5070     { "(bad)",  { XX } },
5071   },
5072
5073   /* PREFIX_VEX_38B7 */
5074   {
5075     { "(bad)",  { XX } },
5076     { "(bad)",  { XX } },
5077     { "vfmsubadd231p%XW", { XM, Vex, EXx } },
5078     { "(bad)",  { XX } },
5079   },
5080
5081   /* PREFIX_VEX_38B8 */
5082   {
5083     { "(bad)",  { XX } },
5084     { "(bad)",  { XX } },
5085     { "vfmadd231p%XW", { XM, Vex, EXx } },
5086     { "(bad)",  { XX } },
5087   },
5088
5089   /* PREFIX_VEX_38B9 */
5090   {
5091     { "(bad)",  { XX } },
5092     { "(bad)",  { XX } },
5093     { "vfmadd231s%XW", { XM, Vex, EXVexWdq } },
5094     { "(bad)",  { XX } },
5095   },
5096
5097   /* PREFIX_VEX_38BA */
5098   {
5099     { "(bad)",  { XX } },
5100     { "(bad)",  { XX } },
5101     { "vfmsub231p%XW", { XM, Vex, EXx } },
5102     { "(bad)",  { XX } },
5103   },
5104
5105   /* PREFIX_VEX_38BB */
5106   {
5107     { "(bad)",  { XX } },
5108     { "(bad)",  { XX } },
5109     { "vfmsub231s%XW", { XM, Vex, EXVexWdq } },
5110     { "(bad)",  { XX } },
5111   },
5112
5113   /* PREFIX_VEX_38BC */
5114   {
5115     { "(bad)",  { XX } },
5116     { "(bad)",  { XX } },
5117     { "vfnmadd231p%XW", { XM, Vex, EXx } },
5118     { "(bad)",  { XX } },
5119   },
5120
5121   /* PREFIX_VEX_38BD */
5122   {
5123     { "(bad)",  { XX } },
5124     { "(bad)",  { XX } },
5125     { "vfnmadd231s%XW", { XM, Vex, EXVexWdq } },
5126     { "(bad)",  { XX } },
5127   },
5128
5129   /* PREFIX_VEX_38BE */
5130   {
5131     { "(bad)",  { XX } },
5132     { "(bad)",  { XX } },
5133     { "vfnmsub231p%XW", { XM, Vex, EXx } },
5134     { "(bad)",  { XX } },
5135   },
5136
5137   /* PREFIX_VEX_38BF */
5138   {
5139     { "(bad)",  { XX } },
5140     { "(bad)",  { XX } },
5141     { "vfnmsub231s%XW", { XM, Vex, EXVexWdq } },
5142     { "(bad)",  { XX } },
5143   },
5144
5145   /* PREFIX_VEX_38DB */
5146   {
5147     { "(bad)",  { XX } },
5148     { "(bad)",  { XX } },
5149     { VEX_LEN_TABLE (VEX_LEN_38DB_P_2) },
5150     { "(bad)",  { XX } },
5151   },
5152
5153   /* PREFIX_VEX_38DC */
5154   {
5155     { "(bad)",  { XX } },
5156     { "(bad)",  { XX } },
5157     { VEX_LEN_TABLE (VEX_LEN_38DC_P_2) },
5158     { "(bad)",  { XX } },
5159   },
5160
5161   /* PREFIX_VEX_38DD */
5162   {
5163     { "(bad)",  { XX } },
5164     { "(bad)",  { XX } },
5165     { VEX_LEN_TABLE (VEX_LEN_38DD_P_2) },
5166     { "(bad)",  { XX } },
5167   },
5168
5169   /* PREFIX_VEX_38DE */
5170   {
5171     { "(bad)",  { XX } },
5172     { "(bad)",  { XX } },
5173     { VEX_LEN_TABLE (VEX_LEN_38DE_P_2) },
5174     { "(bad)",  { XX } },
5175   },
5176
5177   /* PREFIX_VEX_38DF */
5178   {
5179     { "(bad)",  { XX } },
5180     { "(bad)",  { XX } },
5181     { VEX_LEN_TABLE (VEX_LEN_38DF_P_2) },
5182     { "(bad)",  { XX } },
5183   },
5184
5185   /* PREFIX_VEX_3A04 */
5186   {
5187     { "(bad)",  { XX } },
5188     { "(bad)",  { XX } },
5189     { VEX_W_TABLE (VEX_W_3A04_P_2) },
5190     { "(bad)",  { XX } },
5191   },
5192
5193   /* PREFIX_VEX_3A05 */
5194   {
5195     { "(bad)",  { XX } },
5196     { "(bad)",  { XX } },
5197     { VEX_W_TABLE (VEX_W_3A05_P_2) },
5198     { "(bad)",  { XX } },
5199   },
5200
5201   /* PREFIX_VEX_3A06 */
5202   {
5203     { "(bad)",  { XX } },
5204     { "(bad)",  { XX } },
5205     { VEX_LEN_TABLE (VEX_LEN_3A06_P_2) },
5206     { "(bad)",  { XX } },
5207   },
5208
5209   /* PREFIX_VEX_3A08 */
5210   {
5211     { "(bad)",  { XX } },
5212     { "(bad)",  { XX } },
5213     { VEX_W_TABLE (VEX_W_3A08_P_2) },
5214     { "(bad)",  { XX } },
5215   },
5216
5217   /* PREFIX_VEX_3A09 */
5218   {
5219     { "(bad)",  { XX } },
5220     { "(bad)",  { XX } },
5221     { VEX_W_TABLE (VEX_W_3A09_P_2) },
5222     { "(bad)",  { XX } },
5223   },
5224
5225   /* PREFIX_VEX_3A0A */
5226   {
5227     { "(bad)",  { XX } },
5228     { "(bad)",  { XX } },
5229     { VEX_LEN_TABLE (VEX_LEN_3A0A_P_2) },
5230     { "(bad)",  { XX } },
5231   },
5232
5233   /* PREFIX_VEX_3A0B */
5234   {
5235     { "(bad)",  { XX } },
5236     { "(bad)",  { XX } },
5237     { VEX_LEN_TABLE (VEX_LEN_3A0B_P_2) },
5238     { "(bad)",  { XX } },
5239   },
5240
5241   /* PREFIX_VEX_3A0C */
5242   {
5243     { "(bad)",  { XX } },
5244     { "(bad)",  { XX } },
5245     { VEX_W_TABLE (VEX_W_3A0C_P_2) },
5246     { "(bad)",  { XX } },
5247   },
5248
5249   /* PREFIX_VEX_3A0D */
5250   {
5251     { "(bad)",  { XX } },
5252     { "(bad)",  { XX } },
5253     { VEX_W_TABLE (VEX_W_3A0D_P_2) },
5254     { "(bad)",  { XX } },
5255   },
5256
5257   /* PREFIX_VEX_3A0E */
5258   {
5259     { "(bad)",  { XX } },
5260     { "(bad)",  { XX } },
5261     { VEX_LEN_TABLE (VEX_LEN_3A0E_P_2) },
5262     { "(bad)",  { XX } },
5263   },
5264
5265   /* PREFIX_VEX_3A0F */
5266   {
5267     { "(bad)",  { XX } },
5268     { "(bad)",  { XX } },
5269     { VEX_LEN_TABLE (VEX_LEN_3A0F_P_2) },
5270     { "(bad)",  { XX } },
5271   },
5272
5273   /* PREFIX_VEX_3A14 */
5274   {
5275     { "(bad)",  { XX } },
5276     { "(bad)",  { XX } },
5277     { VEX_LEN_TABLE (VEX_LEN_3A14_P_2) },
5278     { "(bad)",  { XX } },
5279   },
5280
5281   /* PREFIX_VEX_3A15 */
5282   {
5283     { "(bad)",  { XX } },
5284     { "(bad)",  { XX } },
5285     { VEX_LEN_TABLE (VEX_LEN_3A15_P_2) },
5286     { "(bad)",  { XX } },
5287   },
5288
5289   /* PREFIX_VEX_3A16 */
5290   {
5291     { "(bad)",  { XX } },
5292     { "(bad)",  { XX } },
5293     { VEX_LEN_TABLE (VEX_LEN_3A16_P_2) },
5294     { "(bad)",  { XX } },
5295   },
5296
5297   /* PREFIX_VEX_3A17 */
5298   {
5299     { "(bad)",  { XX } },
5300     { "(bad)",  { XX } },
5301     { VEX_LEN_TABLE (VEX_LEN_3A17_P_2) },
5302     { "(bad)",  { XX } },
5303   },
5304
5305   /* PREFIX_VEX_3A18 */
5306   {
5307     { "(bad)",  { XX } },
5308     { "(bad)",  { XX } },
5309     { VEX_LEN_TABLE (VEX_LEN_3A18_P_2) },
5310     { "(bad)",  { XX } },
5311   },
5312
5313   /* PREFIX_VEX_3A19 */
5314   {
5315     { "(bad)",  { XX } },
5316     { "(bad)",  { XX } },
5317     { VEX_LEN_TABLE (VEX_LEN_3A19_P_2) },
5318     { "(bad)",  { XX } },
5319   },
5320
5321   /* PREFIX_VEX_3A20 */
5322   {
5323     { "(bad)",  { XX } },
5324     { "(bad)",  { XX } },
5325     { VEX_LEN_TABLE (VEX_LEN_3A20_P_2) },
5326     { "(bad)",  { XX } },
5327   },
5328
5329   /* PREFIX_VEX_3A21 */
5330   {
5331     { "(bad)",  { XX } },
5332     { "(bad)",  { XX } },
5333     { VEX_LEN_TABLE (VEX_LEN_3A21_P_2) },
5334     { "(bad)",  { XX } },
5335   },
5336
5337   /* PREFIX_VEX_3A22 */
5338   {
5339     { "(bad)",  { XX } },
5340     { "(bad)",  { XX } },
5341     { VEX_LEN_TABLE (VEX_LEN_3A22_P_2) },
5342     { "(bad)",  { XX } },
5343   },
5344
5345   /* PREFIX_VEX_3A40 */
5346   {
5347     { "(bad)",  { XX } },
5348     { "(bad)",  { XX } },
5349     { VEX_W_TABLE (VEX_W_3A40_P_2) },
5350     { "(bad)",  { XX } },
5351   },
5352
5353   /* PREFIX_VEX_3A41 */
5354   {
5355     { "(bad)",  { XX } },
5356     { "(bad)",  { XX } },
5357     { VEX_LEN_TABLE (VEX_LEN_3A41_P_2) },
5358     { "(bad)",  { XX } },
5359   },
5360
5361   /* PREFIX_VEX_3A42 */
5362   {
5363     { "(bad)",  { XX } },
5364     { "(bad)",  { XX } },
5365     { VEX_LEN_TABLE (VEX_LEN_3A42_P_2) },
5366     { "(bad)",  { XX } },
5367   },
5368
5369   /* PREFIX_VEX_3A44 */
5370   {
5371     { "(bad)",  { XX } },
5372     { "(bad)",  { XX } },
5373     { VEX_LEN_TABLE (VEX_LEN_3A44_P_2) },
5374     { "(bad)",  { XX } },
5375   },
5376
5377   /* PREFIX_VEX_3A4A */
5378   {
5379     { "(bad)",  { XX } },
5380     { "(bad)",  { XX } },
5381     { VEX_W_TABLE (VEX_W_3A4A_P_2) },
5382     { "(bad)",  { XX } },
5383   },
5384
5385   /* PREFIX_VEX_3A4B */
5386   {
5387     { "(bad)",  { XX } },
5388     { "(bad)",  { XX } },
5389     { VEX_W_TABLE (VEX_W_3A4B_P_2) },
5390     { "(bad)",  { XX } },
5391   },
5392
5393   /* PREFIX_VEX_3A4C */
5394   {
5395     { "(bad)",  { XX } },
5396     { "(bad)",  { XX } },
5397     { VEX_LEN_TABLE (VEX_LEN_3A4C_P_2) },
5398     { "(bad)",  { XX } },
5399   },
5400
5401   /* PREFIX_VEX_3A5C */
5402   {
5403     { "(bad)",  { XX } },
5404     { "(bad)",  { XX } },
5405     { "vfmaddsubps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5406     { "(bad)",  { XX } },
5407   },
5408
5409   /* PREFIX_VEX_3A5D */
5410   {
5411     { "(bad)",  { XX } },
5412     { "(bad)",  { XX } },
5413     { "vfmaddsubpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5414     { "(bad)",  { XX } },
5415   },
5416
5417   /* PREFIX_VEX_3A5E */
5418   {
5419     { "(bad)",  { XX } },
5420     { "(bad)",  { XX } },
5421     { "vfmsubaddps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5422     { "(bad)",  { XX } },
5423   },
5424
5425   /* PREFIX_VEX_3A5F */
5426   {
5427     { "(bad)",  { XX } },
5428     { "(bad)",  { XX } },
5429     { "vfmsubaddpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5430     { "(bad)",  { XX } },
5431   },
5432
5433   /* PREFIX_VEX_3A60 */
5434   {
5435     { "(bad)",  { XX } },
5436     { "(bad)",  { XX } },
5437     { VEX_LEN_TABLE (VEX_LEN_3A60_P_2) },
5438     { "(bad)",  { XX } },
5439   },
5440
5441   /* PREFIX_VEX_3A61 */
5442   {
5443     { "(bad)",  { XX } },
5444     { "(bad)",  { XX } },
5445     { VEX_LEN_TABLE (VEX_LEN_3A61_P_2) },
5446     { "(bad)",  { XX } },
5447   },
5448
5449   /* PREFIX_VEX_3A62 */
5450   {
5451     { "(bad)",  { XX } },
5452     { "(bad)",  { XX } },
5453     { VEX_LEN_TABLE (VEX_LEN_3A62_P_2) },
5454     { "(bad)",  { XX } },
5455   },
5456
5457   /* PREFIX_VEX_3A63 */
5458   {
5459     { "(bad)",  { XX } },
5460     { "(bad)",  { XX } },
5461     { VEX_LEN_TABLE (VEX_LEN_3A63_P_2) },
5462     { "(bad)",  { XX } },
5463   },
5464
5465   /* PREFIX_VEX_3A68 */
5466   {
5467     { "(bad)",  { XX } },
5468     { "(bad)",  { XX } },
5469     { "vfmaddps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5470     { "(bad)",  { XX } },
5471   },
5472
5473   /* PREFIX_VEX_3A69 */
5474   {
5475     { "(bad)",  { XX } },
5476     { "(bad)",  { XX } },
5477     { "vfmaddpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5478     { "(bad)",  { XX } },
5479   },
5480
5481   /* PREFIX_VEX_3A6A */
5482   {
5483     { "(bad)",  { XX } },
5484     { "(bad)",  { XX } },
5485     { VEX_LEN_TABLE (VEX_LEN_3A6A_P_2) },
5486     { "(bad)",  { XX } },
5487   },
5488
5489   /* PREFIX_VEX_3A6B */
5490   {
5491     { "(bad)",  { XX } },
5492     { "(bad)",  { XX } },
5493     { VEX_LEN_TABLE (VEX_LEN_3A6B_P_2) },
5494     { "(bad)",  { XX } },
5495   },
5496
5497   /* PREFIX_VEX_3A6C */
5498   {
5499     { "(bad)",  { XX } },
5500     { "(bad)",  { XX } },
5501     { "vfmsubps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5502     { "(bad)",  { XX } },
5503   },
5504
5505   /* PREFIX_VEX_3A6D */
5506   {
5507     { "(bad)",  { XX } },
5508     { "(bad)",  { XX } },
5509     { "vfmsubpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5510     { "(bad)",  { XX } },
5511   },
5512
5513   /* PREFIX_VEX_3A6E */
5514   {
5515     { "(bad)",  { XX } },
5516     { "(bad)",  { XX } },
5517     { VEX_LEN_TABLE (VEX_LEN_3A6E_P_2) },
5518     { "(bad)",  { XX } },
5519   },
5520
5521   /* PREFIX_VEX_3A6F */
5522   {
5523     { "(bad)",  { XX } },
5524     { "(bad)",  { XX } },
5525     { VEX_LEN_TABLE (VEX_LEN_3A6F_P_2) },
5526     { "(bad)",  { XX } },
5527   },
5528
5529   /* PREFIX_VEX_3A78 */
5530   {
5531     { "(bad)",  { XX } },
5532     { "(bad)",  { XX } },
5533     { "vfnmaddps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5534     { "(bad)",  { XX } },
5535   },
5536
5537   /* PREFIX_VEX_3A79 */
5538   {
5539     { "(bad)",  { XX } },
5540     { "(bad)",  { XX } },
5541     { "vfnmaddpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5542     { "(bad)",  { XX } },
5543   },
5544
5545   /* PREFIX_VEX_3A7A */
5546   {
5547     { "(bad)",  { XX } },
5548     { "(bad)",  { XX } },
5549     { VEX_LEN_TABLE (VEX_LEN_3A7A_P_2) },
5550     { "(bad)",  { XX } },
5551   },
5552
5553   /* PREFIX_VEX_3A7B */
5554   {
5555     { "(bad)",  { XX } },
5556     { "(bad)",  { XX } },
5557     { VEX_LEN_TABLE (VEX_LEN_3A7B_P_2) },
5558     { "(bad)",  { XX } },
5559   },
5560
5561   /* PREFIX_VEX_3A7C */
5562   {
5563     { "(bad)",  { XX } },
5564     { "(bad)",  { XX } },
5565     { "vfnmsubps", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5566     { "(bad)",  { XX } },
5567   },
5568
5569   /* PREFIX_VEX_3A7D */
5570   {
5571     { "(bad)",  { XX } },
5572     { "(bad)",  { XX } },
5573     { "vfnmsubpd", { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
5574     { "(bad)",  { XX } },
5575   },
5576
5577   /* PREFIX_VEX_3A7E */
5578   {
5579     { "(bad)",  { XX } },
5580     { "(bad)",  { XX } },
5581     { VEX_LEN_TABLE (VEX_LEN_3A7E_P_2) },
5582     { "(bad)",  { XX } },
5583   },
5584
5585   /* PREFIX_VEX_3A7F */
5586   {
5587     { "(bad)",  { XX } },
5588     { "(bad)",  { XX } },
5589     { VEX_LEN_TABLE (VEX_LEN_3A7F_P_2) },
5590     { "(bad)",  { XX } },
5591   },
5592
5593   /* PREFIX_VEX_3ADF */
5594   {
5595     { "(bad)",  { XX } },
5596     { "(bad)",  { XX } },
5597     { VEX_LEN_TABLE (VEX_LEN_3ADF_P_2) },
5598     { "(bad)",  { XX } },
5599   },
5600 };
5601
5602 static const struct dis386 x86_64_table[][2] = {
5603   /* X86_64_06 */
5604   {
5605     { "push{T|}", { es } },
5606     { "(bad)", { XX } },
5607   },
5608
5609   /* X86_64_07 */
5610   {
5611     { "pop{T|}", { es } },
5612     { "(bad)", { XX } },
5613   },
5614
5615   /* X86_64_0D */
5616   {
5617     { "push{T|}", { cs } },
5618     { "(bad)", { XX } },
5619   },
5620
5621   /* X86_64_16 */
5622   {
5623     { "push{T|}", { ss } },
5624     { "(bad)", { XX } },
5625   },
5626
5627   /* X86_64_17 */
5628   {
5629     { "pop{T|}", { ss } },
5630     { "(bad)", { XX } },
5631   },
5632
5633   /* X86_64_1E */
5634   {
5635     { "push{T|}", { ds } },
5636     { "(bad)", { XX } },
5637   },
5638
5639   /* X86_64_1F */
5640   {
5641     { "pop{T|}", { ds } },
5642     { "(bad)", { XX } },
5643   },
5644
5645   /* X86_64_27 */
5646   {
5647     { "daa", { XX } },
5648     { "(bad)", { XX } },
5649   },
5650
5651   /* X86_64_2F */
5652   {
5653     { "das", { XX } },
5654     { "(bad)", { XX } },
5655   },
5656
5657   /* X86_64_37 */
5658   {
5659     { "aaa", { XX } },
5660     { "(bad)", { XX } },
5661   },
5662
5663   /* X86_64_3F */
5664   {
5665     { "aas", { XX } },
5666     { "(bad)", { XX } },
5667   },
5668
5669   /* X86_64_60 */
5670   {
5671     { "pusha{P|}", { XX } },
5672     { "(bad)", { XX } },
5673   },
5674
5675   /* X86_64_61 */
5676   {
5677     { "popa{P|}", { XX } },
5678     { "(bad)", { XX } },
5679   },
5680
5681   /* X86_64_62 */
5682   {
5683     { MOD_TABLE (MOD_62_32BIT) },
5684     { "(bad)", { XX } },
5685   },
5686
5687   /* X86_64_63 */
5688   {
5689     { "arpl", { Ew, Gw } },
5690     { "movs{lq|xd}", { Gv, Ed } },
5691   },
5692
5693   /* X86_64_6D */
5694   {
5695     { "ins{R|}", { Yzr, indirDX } },
5696     { "ins{G|}", { Yzr, indirDX } },
5697   },
5698
5699   /* X86_64_6F */
5700   {
5701     { "outs{R|}", { indirDXr, Xz } },
5702     { "outs{G|}", { indirDXr, Xz } },
5703   },
5704
5705   /* X86_64_9A */
5706   {
5707     { "Jcall{T|}", { Ap } },
5708     { "(bad)", { XX } },
5709   },
5710
5711   /* X86_64_C4 */
5712   {
5713     { MOD_TABLE (MOD_C4_32BIT) },
5714     { VEX_C4_TABLE (VEX_0F) },
5715   },
5716
5717   /* X86_64_C5 */
5718   {
5719     { MOD_TABLE (MOD_C5_32BIT) },
5720     { VEX_C5_TABLE (VEX_0F) },
5721   },
5722
5723   /* X86_64_CE */
5724   {
5725     { "into", { XX } },
5726     { "(bad)", { XX } },
5727   },
5728
5729   /* X86_64_D4 */
5730   {
5731     { "aam", { sIb } },
5732     { "(bad)", { XX } },
5733   },
5734
5735   /* X86_64_D5 */
5736   {
5737     { "aad", { sIb } },
5738     { "(bad)", { XX } },
5739   },
5740
5741   /* X86_64_EA */
5742   {
5743     { "Jjmp{T|}", { Ap } },
5744     { "(bad)", { XX } },
5745   },
5746
5747   /* X86_64_0F01_REG_0 */
5748   {
5749     { "sgdt{Q|IQ}", { M } },
5750     { "sgdt", { M } },
5751   },
5752
5753   /* X86_64_0F01_REG_1 */
5754   {
5755     { "sidt{Q|IQ}", { M } },
5756     { "sidt", { M } },
5757   },
5758
5759   /* X86_64_0F01_REG_2 */
5760   {
5761     { "lgdt{Q|Q}", { M } },
5762     { "lgdt", { M } },
5763   },
5764
5765   /* X86_64_0F01_REG_3 */
5766   {
5767     { "lidt{Q|Q}", { M } },
5768     { "lidt", { M } },
5769   },
5770 };
5771
5772 static const struct dis386 three_byte_table[][256] = {
5773
5774   /* THREE_BYTE_0F38 */
5775   {
5776     /* 00 */
5777     { "pshufb",         { MX, EM } },
5778     { "phaddw",         { MX, EM } },
5779     { "phaddd",         { MX, EM } },
5780     { "phaddsw",        { MX, EM } },
5781     { "pmaddubsw",      { MX, EM } },
5782     { "phsubw",         { MX, EM } },
5783     { "phsubd",         { MX, EM } },
5784     { "phsubsw",        { MX, EM } },
5785     /* 08 */
5786     { "psignb",         { MX, EM } },
5787     { "psignw",         { MX, EM } },
5788     { "psignd",         { MX, EM } },
5789     { "pmulhrsw",       { MX, EM } },
5790     { "(bad)",          { XX } },
5791     { "(bad)",          { XX } },
5792     { "(bad)",          { XX } },
5793     { "(bad)",          { XX } },
5794     /* 10 */
5795     { PREFIX_TABLE (PREFIX_0F3810) },
5796     { "(bad)",          { XX } },
5797     { "(bad)",          { XX } },
5798     { "(bad)",          { XX } },
5799     { PREFIX_TABLE (PREFIX_0F3814) },
5800     { PREFIX_TABLE (PREFIX_0F3815) },
5801     { "(bad)",          { XX } },
5802     { PREFIX_TABLE (PREFIX_0F3817) },
5803     /* 18 */
5804     { "(bad)",          { XX } },
5805     { "(bad)",          { XX } },
5806     { "(bad)",          { XX } },
5807     { "(bad)",          { XX } },
5808     { "pabsb",          { MX, EM } },
5809     { "pabsw",          { MX, EM } },
5810     { "pabsd",          { MX, EM } },
5811     { "(bad)",          { XX } },
5812     /* 20 */
5813     { PREFIX_TABLE (PREFIX_0F3820) },
5814     { PREFIX_TABLE (PREFIX_0F3821) },
5815     { PREFIX_TABLE (PREFIX_0F3822) },
5816     { PREFIX_TABLE (PREFIX_0F3823) },
5817     { PREFIX_TABLE (PREFIX_0F3824) },
5818     { PREFIX_TABLE (PREFIX_0F3825) },
5819     { "(bad)",          { XX } },
5820     { "(bad)",          { XX } },
5821     /* 28 */
5822     { PREFIX_TABLE (PREFIX_0F3828) },
5823     { PREFIX_TABLE (PREFIX_0F3829) },
5824     { PREFIX_TABLE (PREFIX_0F382A) },
5825     { PREFIX_TABLE (PREFIX_0F382B) },
5826     { "(bad)",          { XX } },
5827     { "(bad)",          { XX } },
5828     { "(bad)",          { XX } },
5829     { "(bad)",          { XX } },
5830     /* 30 */
5831     { PREFIX_TABLE (PREFIX_0F3830) },
5832     { PREFIX_TABLE (PREFIX_0F3831) },
5833     { PREFIX_TABLE (PREFIX_0F3832) },
5834     { PREFIX_TABLE (PREFIX_0F3833) },
5835     { PREFIX_TABLE (PREFIX_0F3834) },
5836     { PREFIX_TABLE (PREFIX_0F3835) },
5837     { "(bad)",          { XX } },
5838     { PREFIX_TABLE (PREFIX_0F3837) },
5839     /* 38 */
5840     { PREFIX_TABLE (PREFIX_0F3838) },
5841     { PREFIX_TABLE (PREFIX_0F3839) },
5842     { PREFIX_TABLE (PREFIX_0F383A) },
5843     { PREFIX_TABLE (PREFIX_0F383B) },
5844     { PREFIX_TABLE (PREFIX_0F383C) },
5845     { PREFIX_TABLE (PREFIX_0F383D) },
5846     { PREFIX_TABLE (PREFIX_0F383E) },
5847     { PREFIX_TABLE (PREFIX_0F383F) },
5848     /* 40 */
5849     { PREFIX_TABLE (PREFIX_0F3840) },
5850     { PREFIX_TABLE (PREFIX_0F3841) },
5851     { "(bad)",          { XX } },
5852     { "(bad)",          { XX } },
5853     { "(bad)",          { XX } },
5854     { "(bad)",          { XX } },
5855     { "(bad)",          { XX } },
5856     { "(bad)",          { XX } },
5857     /* 48 */
5858     { "(bad)",          { XX } },
5859     { "(bad)",          { XX } },
5860     { "(bad)",          { XX } },
5861     { "(bad)",          { XX } },
5862     { "(bad)",          { XX } },
5863     { "(bad)",          { XX } },
5864     { "(bad)",          { XX } },
5865     { "(bad)",          { XX } },
5866     /* 50 */
5867     { "(bad)",          { XX } },
5868     { "(bad)",          { XX } },
5869     { "(bad)",          { XX } },
5870     { "(bad)",          { XX } },
5871     { "(bad)",          { XX } },
5872     { "(bad)",          { XX } },
5873     { "(bad)",          { XX } },
5874     { "(bad)",          { XX } },
5875     /* 58 */
5876     { "(bad)",          { XX } },
5877     { "(bad)",          { XX } },
5878     { "(bad)",          { XX } },
5879     { "(bad)",          { XX } },
5880     { "(bad)",          { XX } },
5881     { "(bad)",          { XX } },
5882     { "(bad)",          { XX } },
5883     { "(bad)",          { XX } },
5884     /* 60 */
5885     { "(bad)",          { XX } },
5886     { "(bad)",          { XX } },
5887     { "(bad)",          { XX } },
5888     { "(bad)",          { XX } },
5889     { "(bad)",          { XX } },
5890     { "(bad)",          { XX } },
5891     { "(bad)",          { XX } },
5892     { "(bad)",          { XX } },
5893     /* 68 */
5894     { "(bad)",          { XX } },
5895     { "(bad)",          { XX } },
5896     { "(bad)",          { XX } },
5897     { "(bad)",          { XX } },
5898     { "(bad)",          { XX } },
5899     { "(bad)",          { XX } },
5900     { "(bad)",          { XX } },
5901     { "(bad)",          { XX } },
5902     /* 70 */
5903     { "(bad)",          { XX } },
5904     { "(bad)",          { XX } },
5905     { "(bad)",          { XX } },
5906     { "(bad)",          { XX } },
5907     { "(bad)",          { XX } },
5908     { "(bad)",          { XX } },
5909     { "(bad)",          { XX } },
5910     { "(bad)",          { XX } },
5911     /* 78 */
5912     { "(bad)",          { XX } },
5913     { "(bad)",          { XX } },
5914     { "(bad)",          { XX } },
5915     { "(bad)",          { XX } },
5916     { "(bad)",          { XX } },
5917     { "(bad)",          { XX } },
5918     { "(bad)",          { XX } },
5919     { "(bad)",          { XX } },
5920     /* 80 */
5921     { PREFIX_TABLE (PREFIX_0F3880) },
5922     { PREFIX_TABLE (PREFIX_0F3881) },
5923     { "(bad)",          { XX } },
5924     { "(bad)",          { XX } },
5925     { "(bad)",          { XX } },
5926     { "(bad)",          { XX } },
5927     { "(bad)",          { XX } },
5928     { "(bad)",          { XX } },
5929     /* 88 */
5930     { "(bad)",          { XX } },
5931     { "(bad)",          { XX } },
5932     { "(bad)",          { XX } },
5933     { "(bad)",          { XX } },
5934     { "(bad)",          { XX } },
5935     { "(bad)",          { XX } },
5936     { "(bad)",          { XX } },
5937     { "(bad)",          { XX } },
5938     /* 90 */
5939     { "(bad)",          { XX } },
5940     { "(bad)",          { XX } },
5941     { "(bad)",          { XX } },
5942     { "(bad)",          { XX } },
5943     { "(bad)",          { XX } },
5944     { "(bad)",          { XX } },
5945     { "(bad)",          { XX } },
5946     { "(bad)",          { XX } },
5947     /* 98 */
5948     { "(bad)",          { XX } },
5949     { "(bad)",          { XX } },
5950     { "(bad)",          { XX } },
5951     { "(bad)",          { XX } },
5952     { "(bad)",          { XX } },
5953     { "(bad)",          { XX } },
5954     { "(bad)",          { XX } },
5955     { "(bad)",          { XX } },
5956     /* a0 */
5957     { "(bad)",          { XX } },
5958     { "(bad)",          { XX } },
5959     { "(bad)",          { XX } },
5960     { "(bad)",          { XX } },
5961     { "(bad)",          { XX } },
5962     { "(bad)",          { XX } },
5963     { "(bad)",          { XX } },
5964     { "(bad)",          { XX } },
5965     /* a8 */
5966     { "(bad)",          { XX } },
5967     { "(bad)",          { XX } },
5968     { "(bad)",          { XX } },
5969     { "(bad)",          { XX } },
5970     { "(bad)",          { XX } },
5971     { "(bad)",          { XX } },
5972     { "(bad)",          { XX } },
5973     { "(bad)",          { XX } },
5974     /* b0 */
5975     { "(bad)",          { XX } },
5976     { "(bad)",          { XX } },
5977     { "(bad)",          { XX } },
5978     { "(bad)",          { XX } },
5979     { "(bad)",          { XX } },
5980     { "(bad)",          { XX } },
5981     { "(bad)",          { XX } },
5982     { "(bad)",          { XX } },
5983     /* b8 */
5984     { "(bad)",          { XX } },
5985     { "(bad)",          { XX } },
5986     { "(bad)",          { XX } },
5987     { "(bad)",          { XX } },
5988     { "(bad)",          { XX } },
5989     { "(bad)",          { XX } },
5990     { "(bad)",          { XX } },
5991     { "(bad)",          { XX } },
5992     /* c0 */
5993     { "(bad)",          { XX } },
5994     { "(bad)",          { XX } },
5995     { "(bad)",          { XX } },
5996     { "(bad)",          { XX } },
5997     { "(bad)",          { XX } },
5998     { "(bad)",          { XX } },
5999     { "(bad)",          { XX } },
6000     { "(bad)",          { XX } },
6001     /* c8 */
6002     { "(bad)",          { XX } },
6003     { "(bad)",          { XX } },
6004     { "(bad)",          { XX } },
6005     { "(bad)",          { XX } },
6006     { "(bad)",          { XX } },
6007     { "(bad)",          { XX } },
6008     { "(bad)",          { XX } },
6009     { "(bad)",          { XX } },
6010     /* d0 */
6011     { "(bad)",          { XX } },
6012     { "(bad)",          { XX } },
6013     { "(bad)",          { XX } },
6014     { "(bad)",          { XX } },
6015     { "(bad)",          { XX } },
6016     { "(bad)",          { XX } },
6017     { "(bad)",          { XX } },
6018     { "(bad)",          { XX } },
6019     /* d8 */
6020     { "(bad)",          { XX } },
6021     { "(bad)",          { XX } },
6022     { "(bad)",          { XX } },
6023     { PREFIX_TABLE (PREFIX_0F38DB) },
6024     { PREFIX_TABLE (PREFIX_0F38DC) },
6025     { PREFIX_TABLE (PREFIX_0F38DD) },
6026     { PREFIX_TABLE (PREFIX_0F38DE) },
6027     { PREFIX_TABLE (PREFIX_0F38DF) },
6028     /* e0 */
6029     { "(bad)",          { XX } },
6030     { "(bad)",          { XX } },
6031     { "(bad)",          { XX } },
6032     { "(bad)",          { XX } },
6033     { "(bad)",          { XX } },
6034     { "(bad)",          { XX } },
6035     { "(bad)",          { XX } },
6036     { "(bad)",          { XX } },
6037     /* e8 */
6038     { "(bad)",          { XX } },
6039     { "(bad)",          { XX } },
6040     { "(bad)",          { XX } },
6041     { "(bad)",          { XX } },
6042     { "(bad)",          { XX } },
6043     { "(bad)",          { XX } },
6044     { "(bad)",          { XX } },
6045     { "(bad)",          { XX } },
6046     /* f0 */
6047     { PREFIX_TABLE (PREFIX_0F38F0) },
6048     { PREFIX_TABLE (PREFIX_0F38F1) },
6049     { "(bad)",          { XX } },
6050     { "(bad)",          { XX } },
6051     { "(bad)",          { XX } },
6052     { "(bad)",          { XX } },
6053     { "(bad)",          { XX } },
6054     { "(bad)",          { XX } },
6055     /* f8 */
6056     { "(bad)",          { XX } },
6057     { "(bad)",          { XX } },
6058     { "(bad)",          { XX } },
6059     { "(bad)",          { XX } },
6060     { "(bad)",          { XX } },
6061     { "(bad)",          { XX } },
6062     { "(bad)",          { XX } },
6063     { "(bad)",          { XX } },
6064   },
6065   /* THREE_BYTE_0F3A */
6066   {
6067     /* 00 */
6068     { "(bad)",          { XX } },
6069     { "(bad)",          { XX } },
6070     { "(bad)",          { XX } },
6071     { "(bad)",          { XX } },
6072     { "(bad)",          { XX } },
6073     { "(bad)",          { XX } },
6074     { "(bad)",          { XX } },
6075     { "(bad)",          { XX } },
6076     /* 08 */
6077     { PREFIX_TABLE (PREFIX_0F3A08) },
6078     { PREFIX_TABLE (PREFIX_0F3A09) },
6079     { PREFIX_TABLE (PREFIX_0F3A0A) },
6080     { PREFIX_TABLE (PREFIX_0F3A0B) },
6081     { PREFIX_TABLE (PREFIX_0F3A0C) },
6082     { PREFIX_TABLE (PREFIX_0F3A0D) },
6083     { PREFIX_TABLE (PREFIX_0F3A0E) },
6084     { "palignr",        { MX, EM, Ib } },
6085     /* 10 */
6086     { "(bad)",          { XX } },
6087     { "(bad)",          { XX } },
6088     { "(bad)",          { XX } },
6089     { "(bad)",          { XX } },
6090     { PREFIX_TABLE (PREFIX_0F3A14) },
6091     { PREFIX_TABLE (PREFIX_0F3A15) },
6092     { PREFIX_TABLE (PREFIX_0F3A16) },
6093     { PREFIX_TABLE (PREFIX_0F3A17) },
6094     /* 18 */
6095     { "(bad)",          { XX } },
6096     { "(bad)",          { XX } },
6097     { "(bad)",          { XX } },
6098     { "(bad)",          { XX } },
6099     { "(bad)",          { XX } },
6100     { "(bad)",          { XX } },
6101     { "(bad)",          { XX } },
6102     { "(bad)",          { XX } },
6103     /* 20 */
6104     { PREFIX_TABLE (PREFIX_0F3A20) },
6105     { PREFIX_TABLE (PREFIX_0F3A21) },
6106     { PREFIX_TABLE (PREFIX_0F3A22) },
6107     { "(bad)",          { XX } },
6108     { "(bad)",          { XX } },
6109     { "(bad)",          { XX } },
6110     { "(bad)",          { XX } },
6111     { "(bad)",          { XX } },
6112     /* 28 */
6113     { "(bad)",          { XX } },
6114     { "(bad)",          { XX } },
6115     { "(bad)",          { XX } },
6116     { "(bad)",          { XX } },
6117     { "(bad)",          { XX } },
6118     { "(bad)",          { XX } },
6119     { "(bad)",          { XX } },
6120     { "(bad)",          { XX } },
6121     /* 30 */
6122     { "(bad)",          { XX } },
6123     { "(bad)",          { XX } },
6124     { "(bad)",          { XX } },
6125     { "(bad)",          { XX } },
6126     { "(bad)",          { XX } },
6127     { "(bad)",          { XX } },
6128     { "(bad)",          { XX } },
6129     { "(bad)",          { XX } },
6130     /* 38 */
6131     { "(bad)",          { XX } },
6132     { "(bad)",          { XX } },
6133     { "(bad)",          { XX } },
6134     { "(bad)",          { XX } },
6135     { "(bad)",          { XX } },
6136     { "(bad)",          { XX } },
6137     { "(bad)",          { XX } },
6138     { "(bad)",          { XX } },
6139     /* 40 */
6140     { PREFIX_TABLE (PREFIX_0F3A40) },
6141     { PREFIX_TABLE (PREFIX_0F3A41) },
6142     { PREFIX_TABLE (PREFIX_0F3A42) },
6143     { "(bad)",          { XX } },
6144     { PREFIX_TABLE (PREFIX_0F3A44) },
6145     { "(bad)",          { XX } },
6146     { "(bad)",          { XX } },
6147     { "(bad)",          { XX } },
6148     /* 48 */
6149     { "(bad)",          { XX } },
6150     { "(bad)",          { XX } },
6151     { "(bad)",          { XX } },
6152     { "(bad)",          { XX } },
6153     { "(bad)",          { XX } },
6154     { "(bad)",          { XX } },
6155     { "(bad)",          { XX } },
6156     { "(bad)",          { XX } },
6157     /* 50 */
6158     { "(bad)",          { XX } },
6159     { "(bad)",          { XX } },
6160     { "(bad)",          { XX } },
6161     { "(bad)",          { XX } },
6162     { "(bad)",          { XX } },
6163     { "(bad)",          { XX } },
6164     { "(bad)",          { XX } },
6165     { "(bad)",          { XX } },
6166     /* 58 */
6167     { "(bad)",          { XX } },
6168     { "(bad)",          { XX } },
6169     { "(bad)",          { XX } },
6170     { "(bad)",          { XX } },
6171     { "(bad)",          { XX } },
6172     { "(bad)",          { XX } },
6173     { "(bad)",          { XX } },
6174     { "(bad)",          { XX } },
6175     /* 60 */
6176     { PREFIX_TABLE (PREFIX_0F3A60) },
6177     { PREFIX_TABLE (PREFIX_0F3A61) },
6178     { PREFIX_TABLE (PREFIX_0F3A62) },
6179     { PREFIX_TABLE (PREFIX_0F3A63) },
6180     { "(bad)",          { XX } },
6181     { "(bad)",          { XX } },
6182     { "(bad)",          { XX } },
6183     { "(bad)",          { XX } },
6184     /* 68 */
6185     { "(bad)",          { XX } },
6186     { "(bad)",          { XX } },
6187     { "(bad)",          { XX } },
6188     { "(bad)",          { XX } },
6189     { "(bad)",          { XX } },
6190     { "(bad)",          { XX } },
6191     { "(bad)",          { XX } },
6192     { "(bad)",          { XX } },
6193     /* 70 */
6194     { "(bad)",          { XX } },
6195     { "(bad)",          { XX } },
6196     { "(bad)",          { XX } },
6197     { "(bad)",          { XX } },
6198     { "(bad)",          { XX } },
6199     { "(bad)",          { XX } },
6200     { "(bad)",          { XX } },
6201     { "(bad)",          { XX } },
6202     /* 78 */
6203     { "(bad)",          { XX } },
6204     { "(bad)",          { XX } },
6205     { "(bad)",          { XX } },
6206     { "(bad)",          { XX } },
6207     { "(bad)",          { XX } },
6208     { "(bad)",          { XX } },
6209     { "(bad)",          { XX } },
6210     { "(bad)",          { XX } },
6211     /* 80 */
6212     { "(bad)",          { XX } },
6213     { "(bad)",          { XX } },
6214     { "(bad)",          { XX } },
6215     { "(bad)",          { XX } },
6216     { "(bad)",          { XX } },
6217     { "(bad)",          { XX } },
6218     { "(bad)",          { XX } },
6219     { "(bad)",          { XX } },
6220     /* 88 */
6221     { "(bad)",          { XX } },
6222     { "(bad)",          { XX } },
6223     { "(bad)",          { XX } },
6224     { "(bad)",          { XX } },
6225     { "(bad)",          { XX } },
6226     { "(bad)",          { XX } },
6227     { "(bad)",          { XX } },
6228     { "(bad)",          { XX } },
6229     /* 90 */
6230     { "(bad)",          { XX } },
6231     { "(bad)",          { XX } },
6232     { "(bad)",          { XX } },
6233     { "(bad)",          { XX } },
6234     { "(bad)",          { XX } },
6235     { "(bad)",          { XX } },
6236     { "(bad)",          { XX } },
6237     { "(bad)",          { XX } },
6238     /* 98 */
6239     { "(bad)",          { XX } },
6240     { "(bad)",          { XX } },
6241     { "(bad)",          { XX } },
6242     { "(bad)",          { XX } },
6243     { "(bad)",          { XX } },
6244     { "(bad)",          { XX } },
6245     { "(bad)",          { XX } },
6246     { "(bad)",          { XX } },
6247     /* a0 */
6248     { "(bad)",          { XX } },
6249     { "(bad)",          { XX } },
6250     { "(bad)",          { XX } },
6251     { "(bad)",          { XX } },
6252     { "(bad)",          { XX } },
6253     { "(bad)",          { XX } },
6254     { "(bad)",          { XX } },
6255     { "(bad)",          { XX } },
6256     /* a8 */
6257     { "(bad)",          { XX } },
6258     { "(bad)",          { XX } },
6259     { "(bad)",          { XX } },
6260     { "(bad)",          { XX } },
6261     { "(bad)",          { XX } },
6262     { "(bad)",          { XX } },
6263     { "(bad)",          { XX } },
6264     { "(bad)",          { XX } },
6265     /* b0 */
6266     { "(bad)",          { XX } },
6267     { "(bad)",          { XX } },
6268     { "(bad)",          { XX } },
6269     { "(bad)",          { XX } },
6270     { "(bad)",          { XX } },
6271     { "(bad)",          { XX } },
6272     { "(bad)",          { XX } },
6273     { "(bad)",          { XX } },
6274     /* b8 */
6275     { "(bad)",          { XX } },
6276     { "(bad)",          { XX } },
6277     { "(bad)",          { XX } },
6278     { "(bad)",          { XX } },
6279     { "(bad)",          { XX } },
6280     { "(bad)",          { XX } },
6281     { "(bad)",          { XX } },
6282     { "(bad)",          { XX } },
6283     /* c0 */
6284     { "(bad)",          { XX } },
6285     { "(bad)",          { XX } },
6286     { "(bad)",          { XX } },
6287     { "(bad)",          { XX } },
6288     { "(bad)",          { XX } },
6289     { "(bad)",          { XX } },
6290     { "(bad)",          { XX } },
6291     { "(bad)",          { XX } },
6292     /* c8 */
6293     { "(bad)",          { XX } },
6294     { "(bad)",          { XX } },
6295     { "(bad)",          { XX } },
6296     { "(bad)",          { XX } },
6297     { "(bad)",          { XX } },
6298     { "(bad)",          { XX } },
6299     { "(bad)",          { XX } },
6300     { "(bad)",          { XX } },
6301     /* d0 */
6302     { "(bad)",          { XX } },
6303     { "(bad)",          { XX } },
6304     { "(bad)",          { XX } },
6305     { "(bad)",          { XX } },
6306     { "(bad)",          { XX } },
6307     { "(bad)",          { XX } },
6308     { "(bad)",          { XX } },
6309     { "(bad)",          { XX } },
6310     /* d8 */
6311     { "(bad)",          { XX } },
6312     { "(bad)",          { XX } },
6313     { "(bad)",          { XX } },
6314     { "(bad)",          { XX } },
6315     { "(bad)",          { XX } },
6316     { "(bad)",          { XX } },
6317     { "(bad)",          { XX } },
6318     { PREFIX_TABLE (PREFIX_0F3ADF) },
6319     /* e0 */
6320     { "(bad)",          { XX } },
6321     { "(bad)",          { XX } },
6322     { "(bad)",          { XX } },
6323     { "(bad)",          { XX } },
6324     { "(bad)",          { XX } },
6325     { "(bad)",          { XX } },
6326     { "(bad)",          { XX } },
6327     { "(bad)",          { XX } },
6328     /* e8 */
6329     { "(bad)",          { XX } },
6330     { "(bad)",          { XX } },
6331     { "(bad)",          { XX } },
6332     { "(bad)",          { XX } },
6333     { "(bad)",          { XX } },
6334     { "(bad)",          { XX } },
6335     { "(bad)",          { XX } },
6336     { "(bad)",          { XX } },
6337     /* f0 */
6338     { "(bad)",          { XX } },
6339     { "(bad)",          { XX } },
6340     { "(bad)",          { XX } },
6341     { "(bad)",          { XX } },
6342     { "(bad)",          { XX } },
6343     { "(bad)",          { XX } },
6344     { "(bad)",          { XX } },
6345     { "(bad)",          { XX } },
6346     /* f8 */
6347     { "(bad)",          { XX } },
6348     { "(bad)",          { XX } },
6349     { "(bad)",          { XX } },
6350     { "(bad)",          { XX } },
6351     { "(bad)",          { XX } },
6352     { "(bad)",          { XX } },
6353     { "(bad)",          { XX } },
6354     { "(bad)",          { XX } },
6355   },
6356
6357   /* THREE_BYTE_0F7A */
6358   {
6359     /* 00 */
6360     { "(bad)",          { XX } },
6361     { "(bad)",          { XX } },
6362     { "(bad)",          { XX } },
6363     { "(bad)",          { XX } },
6364     { "(bad)",          { XX } },
6365     { "(bad)",          { XX } },
6366     { "(bad)",          { XX } },
6367     { "(bad)",          { XX } },
6368     /* 08 */
6369     { "(bad)",          { XX } },
6370     { "(bad)",          { XX } },
6371     { "(bad)",          { XX } },
6372     { "(bad)",          { XX } },
6373     { "(bad)",          { XX } },
6374     { "(bad)",          { XX } },
6375     { "(bad)",          { XX } },
6376     { "(bad)",          { XX } },
6377     /* 10 */
6378     { "(bad)",          { XX } },
6379     { "(bad)",          { XX } },
6380     { "(bad)",          { XX } },
6381     { "(bad)",          { XX } },
6382     { "(bad)",          { XX } },
6383     { "(bad)",          { XX } },
6384     { "(bad)",          { XX } },
6385     { "(bad)",          { XX } },
6386     /* 18 */
6387     { "(bad)",          { XX } },
6388     { "(bad)",          { XX } },
6389     { "(bad)",          { XX } },
6390     { "(bad)",          { XX } },
6391     { "(bad)",          { XX } },
6392     { "(bad)",          { XX } },
6393     { "(bad)",          { XX } },
6394     { "(bad)",          { XX } },
6395     /* 20 */
6396     { "ptest",          { XX } },
6397     { "(bad)",          { XX } },
6398     { "(bad)",          { XX } },
6399     { "(bad)",          { XX } },
6400     { "(bad)",          { XX } },
6401     { "(bad)",          { XX } },
6402     { "(bad)",          { XX } },
6403     { "(bad)",          { XX } },
6404     /* 28 */
6405     { "(bad)",          { XX } },
6406     { "(bad)",          { XX } },
6407     { "(bad)",          { XX } },
6408     { "(bad)",          { XX } },
6409     { "(bad)",          { XX } },
6410     { "(bad)",          { XX } },
6411     { "(bad)",          { XX } },
6412     { "(bad)",          { XX } },
6413     /* 30 */
6414     { "(bad)",          { XX } },
6415     { "(bad)",          { XX } },
6416     { "(bad)",          { XX } },
6417     { "(bad)",          { XX } },
6418     { "(bad)",          { XX } },
6419     { "(bad)",          { XX } },
6420     { "(bad)",          { XX } },
6421     { "(bad)",          { XX } },
6422     /* 38 */
6423     { "(bad)",          { XX } },
6424     { "(bad)",          { XX } },
6425     { "(bad)",          { XX } },
6426     { "(bad)",          { XX } },
6427     { "(bad)",          { XX } },
6428     { "(bad)",          { XX } },
6429     { "(bad)",          { XX } },
6430     { "(bad)",          { XX } },
6431     /* 40 */
6432     { "(bad)",          { XX } },
6433     { "phaddbw",        { XM, EXq } },
6434     { "phaddbd",        { XM, EXq } },
6435     { "phaddbq",        { XM, EXq } },
6436     { "(bad)",          { XX } },
6437     { "(bad)",          { XX } },
6438     { "phaddwd",        { XM, EXq } },
6439     { "phaddwq",        { XM, EXq } },
6440     /* 48 */
6441     { "(bad)",          { XX } },
6442     { "(bad)",          { XX } },
6443     { "(bad)",          { XX } },
6444     { "phadddq",        { XM, EXq } },
6445     { "(bad)",          { XX } },
6446     { "(bad)",          { XX } },
6447     { "(bad)",          { XX } },
6448     { "(bad)",          { XX } },
6449     /* 50 */
6450     { "(bad)",          { XX } },
6451     { "phaddubw",       { XM, EXq } },
6452     { "phaddubd",       { XM, EXq } },
6453     { "phaddubq",       { XM, EXq } },
6454     { "(bad)",          { XX } },
6455     { "(bad)",          { XX } },
6456     { "phadduwd",       { XM, EXq } },
6457     { "phadduwq",       { XM, EXq } },
6458     /* 58 */
6459     { "(bad)",          { XX } },
6460     { "(bad)",          { XX } },
6461     { "(bad)",          { XX } },
6462     { "phaddudq",       { XM, EXq } },
6463     { "(bad)",          { XX } },
6464     { "(bad)",          { XX } },
6465     { "(bad)",          { XX } },
6466     { "(bad)",          { XX } },
6467     /* 60 */
6468     { "(bad)",          { XX } },
6469     { "phsubbw",        { XM, EXq } },
6470     { "phsubbd",        { XM, EXq } },
6471     { "phsubbq",        { XM, EXq } },
6472     { "(bad)",          { XX } },
6473     { "(bad)",          { XX } },
6474     { "(bad)",          { XX } },
6475     { "(bad)",          { XX } },
6476     /* 68 */
6477     { "(bad)",          { XX } },
6478     { "(bad)",          { XX } },
6479     { "(bad)",          { XX } },
6480     { "(bad)",          { XX } },
6481     { "(bad)",          { XX } },
6482     { "(bad)",          { XX } },
6483     { "(bad)",          { XX } },
6484     { "(bad)",          { XX } },
6485     /* 70 */
6486     { "(bad)",          { XX } },
6487     { "(bad)",          { XX } },
6488     { "(bad)",          { XX } },
6489     { "(bad)",          { XX } },
6490     { "(bad)",          { XX } },
6491     { "(bad)",          { XX } },
6492     { "(bad)",          { XX } },
6493     { "(bad)",          { XX } },
6494     /* 78 */
6495     { "(bad)",          { XX } },
6496     { "(bad)",          { XX } },
6497     { "(bad)",          { XX } },
6498     { "(bad)",          { XX } },
6499     { "(bad)",          { XX } },
6500     { "(bad)",          { XX } },
6501     { "(bad)",          { XX } },
6502     { "(bad)",          { XX } },
6503     /* 80 */
6504     { "(bad)",          { XX } },
6505     { "(bad)",          { XX } },
6506     { "(bad)",          { XX } },
6507     { "(bad)",          { XX } },
6508     { "(bad)",          { XX } },
6509     { "(bad)",          { XX } },
6510     { "(bad)",          { XX } },
6511     { "(bad)",          { XX } },
6512     /* 88 */
6513     { "(bad)",          { XX } },
6514     { "(bad)",          { XX } },
6515     { "(bad)",          { XX } },
6516     { "(bad)",          { XX } },
6517     { "(bad)",          { XX } },
6518     { "(bad)",          { XX } },
6519     { "(bad)",          { XX } },
6520     { "(bad)",          { XX } },
6521     /* 90 */
6522     { "(bad)",          { XX } },
6523     { "(bad)",          { XX } },
6524     { "(bad)",          { XX } },
6525     { "(bad)",          { XX } },
6526     { "(bad)",          { XX } },
6527     { "(bad)",          { XX } },
6528     { "(bad)",          { XX } },
6529     { "(bad)",          { XX } },
6530     /* 98 */
6531     { "(bad)",          { XX } },
6532     { "(bad)",          { XX } },
6533     { "(bad)",          { XX } },
6534     { "(bad)",          { XX } },
6535     { "(bad)",          { XX } },
6536     { "(bad)",          { XX } },
6537     { "(bad)",          { XX } },
6538     { "(bad)",          { XX } },
6539     /* a0 */
6540     { "(bad)",          { XX } },
6541     { "(bad)",          { XX } },
6542     { "(bad)",          { XX } },
6543     { "(bad)",          { XX } },
6544     { "(bad)",          { XX } },
6545     { "(bad)",          { XX } },
6546     { "(bad)",          { XX } },
6547     { "(bad)",          { XX } },
6548     /* a8 */
6549     { "(bad)",          { XX } },
6550     { "(bad)",          { XX } },
6551     { "(bad)",          { XX } },
6552     { "(bad)",          { XX } },
6553     { "(bad)",          { XX } },
6554     { "(bad)",          { XX } },
6555     { "(bad)",          { XX } },
6556     { "(bad)",          { XX } },
6557     /* b0 */
6558     { "(bad)",          { XX } },
6559     { "(bad)",          { XX } },
6560     { "(bad)",          { XX } },
6561     { "(bad)",          { XX } },
6562     { "(bad)",          { XX } },
6563     { "(bad)",          { XX } },
6564     { "(bad)",          { XX } },
6565     { "(bad)",          { XX } },
6566     /* b8 */
6567     { "(bad)",          { XX } },
6568     { "(bad)",          { XX } },
6569     { "(bad)",          { XX } },
6570     { "(bad)",          { XX } },
6571     { "(bad)",          { XX } },
6572     { "(bad)",          { XX } },
6573     { "(bad)",          { XX } },
6574     { "(bad)",          { XX } },
6575     /* c0 */
6576     { "(bad)",          { XX } },
6577     { "(bad)",          { XX } },
6578     { "(bad)",          { XX } },
6579     { "(bad)",          { XX } },
6580     { "(bad)",          { XX } },
6581     { "(bad)",          { XX } },
6582     { "(bad)",          { XX } },
6583     { "(bad)",          { XX } },
6584     /* c8 */
6585     { "(bad)",          { XX } },
6586     { "(bad)",          { XX } },
6587     { "(bad)",          { XX } },
6588     { "(bad)",          { XX } },
6589     { "(bad)",          { XX } },
6590     { "(bad)",          { XX } },
6591     { "(bad)",          { XX } },
6592     { "(bad)",          { XX } },
6593     /* d0 */
6594     { "(bad)",          { XX } },
6595     { "(bad)",          { XX } },
6596     { "(bad)",          { XX } },
6597     { "(bad)",          { XX } },
6598     { "(bad)",          { XX } },
6599     { "(bad)",          { XX } },
6600     { "(bad)",          { XX } },
6601     { "(bad)",          { XX } },
6602     /* d8 */
6603     { "(bad)",          { XX } },
6604     { "(bad)",          { XX } },
6605     { "(bad)",          { XX } },
6606     { "(bad)",          { XX } },
6607     { "(bad)",          { XX } },
6608     { "(bad)",          { XX } },
6609     { "(bad)",          { XX } },
6610     { "(bad)",          { XX } },
6611     /* e0 */
6612     { "(bad)",          { XX } },
6613     { "(bad)",          { XX } },
6614     { "(bad)",          { XX } },
6615     { "(bad)",          { XX } },
6616     { "(bad)",          { XX } },
6617     { "(bad)",          { XX } },
6618     { "(bad)",          { XX } },
6619     { "(bad)",          { XX } },
6620     /* e8 */
6621     { "(bad)",          { XX } },
6622     { "(bad)",          { XX } },
6623     { "(bad)",          { XX } },
6624     { "(bad)",          { XX } },
6625     { "(bad)",          { XX } },
6626     { "(bad)",          { XX } },
6627     { "(bad)",          { XX } },
6628     { "(bad)",          { XX } },
6629     /* f0 */
6630     { "(bad)",          { XX } },
6631     { "(bad)",          { XX } },
6632     { "(bad)",          { XX } },
6633     { "(bad)",          { XX } },
6634     { "(bad)",          { XX } },
6635     { "(bad)",          { XX } },
6636     { "(bad)",          { XX } },
6637     { "(bad)",          { XX } },
6638     /* f8 */
6639     { "(bad)",          { XX } },
6640     { "(bad)",          { XX } },
6641     { "(bad)",          { XX } },
6642     { "(bad)",          { XX } },
6643     { "(bad)",          { XX } },
6644     { "(bad)",          { XX } },
6645     { "(bad)",          { XX } },
6646     { "(bad)",          { XX } },
6647   },
6648 };
6649
6650 static const struct dis386 xop_table[][256] = {
6651   /* XOP_08 */
6652   {
6653     /* 00 */
6654     { "(bad)",          { XX } },
6655     { "(bad)",          { XX } },
6656     { "(bad)",          { XX } },
6657     { "(bad)",          { XX } },
6658     { "(bad)",          { XX } },
6659     { "(bad)",          { XX } },
6660     { "(bad)",          { XX } },
6661     { "(bad)",          { XX } },
6662     /* 08 */
6663     { "(bad)",          { XX } },
6664     { "(bad)",          { XX } },
6665     { "(bad)",          { XX } },
6666     { "(bad)",          { XX } },
6667     { "(bad)",          { XX } },
6668     { "(bad)",          { XX } },
6669     { "(bad)",          { XX } },
6670     { "(bad)",          { XX } },
6671     /* 10 */
6672     { "(bad)",          { XX } },
6673     { "(bad)",          { XX } },
6674     { "(bad)",          { XX } },
6675     { "(bad)",          { XX } },
6676     { "(bad)",          { XX } },
6677     { "(bad)",          { XX } },
6678     { "(bad)",          { XX } },
6679     { "(bad)",          { XX } },
6680     /* 18 */
6681     { "(bad)",          { XX } },
6682     { "(bad)",          { XX } },
6683     { "(bad)",          { XX } },
6684     { "(bad)",          { XX } },
6685     { "(bad)",          { XX } },
6686     { "(bad)",          { XX } },
6687     { "(bad)",          { XX } },
6688     { "(bad)",          { XX } },
6689     /* 20 */
6690     { "(bad)",          { XX } },
6691     { "(bad)",          { XX } },
6692     { "(bad)",          { XX } },
6693     { "(bad)",          { XX } },
6694     { "(bad)",          { XX } },
6695     { "(bad)",          { XX } },
6696     { "(bad)",          { XX } },
6697     { "(bad)",          { XX } },
6698     /* 28 */
6699     { "(bad)",          { XX } },
6700     { "(bad)",          { XX } },
6701     { "(bad)",          { XX } },
6702     { "(bad)",          { XX } },
6703     { "(bad)",          { XX } },
6704     { "(bad)",          { XX } },
6705     { "(bad)",          { XX } },
6706     { "(bad)",          { XX } },
6707     /* 30 */
6708     { "(bad)",          { XX } },
6709     { "(bad)",          { XX } },
6710     { "(bad)",          { XX } },
6711     { "(bad)",          { XX } },
6712     { "(bad)",          { XX } },
6713     { "(bad)",          { XX } },
6714     { "(bad)",          { XX } },
6715     { "(bad)",          { XX } },
6716     /* 38 */
6717     { "(bad)",          { XX } },
6718     { "(bad)",          { XX } },
6719     { "(bad)",          { XX } },
6720     { "(bad)",          { XX } },
6721     { "(bad)",          { XX } },
6722     { "(bad)",          { XX } },
6723     { "(bad)",          { XX } },
6724     { "(bad)",          { XX } },
6725     /* 40 */
6726     { "(bad)",          { XX } },
6727     { "(bad)",          { XX } },
6728     { "(bad)",          { XX } },
6729     { "(bad)",          { XX } },
6730     { "(bad)",          { XX } },
6731     { "(bad)",          { XX } },
6732     { "(bad)",          { XX } },
6733     { "(bad)",          { XX } },
6734     /* 48 */
6735     { "(bad)",          { XX } },
6736     { "(bad)",          { XX } },
6737     { "(bad)",          { XX } },
6738     { "(bad)",          { XX } },
6739     { "(bad)",          { XX } },
6740     { "(bad)",          { XX } },
6741     { "(bad)",          { XX } },
6742     { "(bad)",          { XX } },
6743     /* 50 */
6744     { "(bad)",          { XX } },
6745     { "(bad)",          { XX } },
6746     { "(bad)",          { XX } },
6747     { "(bad)",          { XX } },
6748     { "(bad)",          { XX } },
6749     { "(bad)",          { XX } },
6750     { "(bad)",          { XX } },
6751     { "(bad)",          { XX } },
6752     /* 58 */
6753     { "(bad)",          { XX } },
6754     { "(bad)",          { XX } },
6755     { "(bad)",          { XX } },
6756     { "(bad)",          { XX } },
6757     { "(bad)",          { XX } },
6758     { "(bad)",          { XX } },
6759     { "(bad)",          { XX } },
6760     { "(bad)",          { XX } },
6761     /* 60 */
6762     { "(bad)",          { XX } },
6763     { "(bad)",          { XX } },
6764     { "(bad)",          { XX } },
6765     { "(bad)",          { XX } },
6766     { "(bad)",          { XX } },
6767     { "(bad)",          { XX } },
6768     { "(bad)",          { XX } },
6769     { "(bad)",          { XX } },
6770     /* 68 */
6771     { "(bad)",          { XX } },
6772     { "(bad)",          { XX } },
6773     { "(bad)",          { XX } },
6774     { "(bad)",          { XX } },
6775     { "(bad)",          { XX } },
6776     { "(bad)",          { XX } },
6777     { "(bad)",          { XX } },
6778     { "(bad)",          { XX } },
6779     /* 70 */
6780     { "(bad)",          { XX } },
6781     { "(bad)",          { XX } },
6782     { "(bad)",          { XX } },
6783     { "(bad)",          { XX } },
6784     { "(bad)",          { XX } },
6785     { "(bad)",          { XX } },
6786     { "(bad)",          { XX } },
6787     { "(bad)",          { XX } },
6788     /* 78 */
6789     { "(bad)",          { XX } },
6790     { "(bad)",          { XX } },
6791     { "(bad)",          { XX } },
6792     { "(bad)",          { XX } },
6793     { "(bad)",          { XX } },
6794     { "(bad)",          { XX } },
6795     { "(bad)",          { XX } },
6796     { "(bad)",          { XX } },
6797     /* 80 */
6798     { "(bad)",          { XX } },
6799     { "(bad)",          { XX } },
6800     { "(bad)",          { XX } },
6801     { "(bad)",          { XX } },
6802     { "(bad)",          { XX } },
6803     { "vpmacssww",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6804     { "vpmacsswd",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6805     { "vpmacssdql",     { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6806     /* 88 */
6807     { "(bad)",          { XX } },
6808     { "(bad)",          { XX } },
6809     { "(bad)",          { XX } },
6810     { "(bad)",          { XX } },
6811     { "(bad)",          { XX } },
6812     { "(bad)",          { XX } },
6813     { "vpmacssdd",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6814     { "vpmacssdqh",     { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6815     /* 90 */
6816     { "(bad)",          { XX } },
6817     { "(bad)",          { XX } },
6818     { "(bad)",          { XX } },
6819     { "(bad)",          { XX } },
6820     { "(bad)",          { XX } },
6821     { "vpmacsww",       { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6822     { "vpmacswd",       { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6823     { "vpmacsdql",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6824     /* 98 */
6825     { "(bad)",          { XX } },
6826     { "(bad)",          { XX } },
6827     { "(bad)",          { XX } },
6828     { "(bad)",          { XX } },
6829     { "(bad)",          { XX } },
6830     { "(bad)",          { XX } },
6831     { "vpmacsdd",       { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6832     { "vpmacsdqh",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6833     /* a0 */
6834     { "(bad)",          { XX } },
6835     { "(bad)",          { XX } },
6836     { "vpcmov",         { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6837     { "vpperm",         { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6838     { "(bad)",          { XX } },
6839     { "(bad)",          { XX } },
6840     { "vpmadcsswd",     { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6841     { "(bad)",          { XX } },
6842     /* a8 */
6843     { "(bad)",          { XX } },
6844     { "(bad)",          { XX } },
6845     { "(bad)",          { XX } },
6846     { "(bad)",          { XX } },
6847     { "(bad)",          { XX } },
6848     { "(bad)",          { XX } },
6849     { "(bad)",          { XX } },
6850     { "(bad)",          { XX } },
6851     /* b0 */
6852     { "(bad)",          { XX } },
6853     { "(bad)",          { XX } },
6854     { "(bad)",          { XX } },
6855     { "(bad)",          { XX } },
6856     { "(bad)",          { XX } },
6857     { "(bad)",          { XX } },
6858     { "vpmadcswd",      { XMVexW, Vex, EXVexW, EXVexW, VexI4 } },
6859     { "(bad)",          { XX } },
6860     /* b8 */
6861     { "(bad)",          { XX } },
6862     { "(bad)",          { XX } },
6863     { "(bad)",          { XX } },
6864     { "(bad)",          { XX } },
6865     { "(bad)",          { XX } },
6866     { "(bad)",          { XX } },
6867     { "(bad)",          { XX } },
6868     { "(bad)",          { XX } },
6869     /* c0 */
6870     { "vprotb",         { XM, Vex_2src_1, Ib } },
6871     { "vprotw",         { XM, Vex_2src_1, Ib } },
6872     { "vprotd",         { XM, Vex_2src_1, Ib } },
6873     { "vprotq",         { XM, Vex_2src_1, Ib } },
6874     { "(bad)",          { XX } },
6875     { "(bad)",          { XX } },
6876     { "(bad)",          { XX } },
6877     { "(bad)",          { XX } },
6878     /* c8 */
6879     { "(bad)",          { XX } },
6880     { "(bad)",          { XX } },
6881     { "(bad)",          { XX } },
6882     { "(bad)",          { XX } },
6883     { "vpcomb",         { XM, Vex128, EXx, Ib } },
6884     { "vpcomw",         { XM, Vex128, EXx, Ib } },
6885     { "vpcomd",         { XM, Vex128, EXx, Ib } },
6886     { "vpcomq",         { XM, Vex128, EXx, Ib } },
6887     /* d0 */
6888     { "(bad)",          { XX } },
6889     { "(bad)",          { XX } },
6890     { "(bad)",          { XX } },
6891     { "(bad)",          { XX } },
6892     { "(bad)",          { XX } },
6893     { "(bad)",          { XX } },
6894     { "(bad)",          { XX } },
6895     { "(bad)",          { XX } },
6896     /* d8 */
6897     { "(bad)",          { XX } },
6898     { "(bad)",          { XX } },
6899     { "(bad)",          { XX } },
6900     { "(bad)",          { XX } },
6901     { "(bad)",          { XX } },
6902     { "(bad)",          { XX } },
6903     { "(bad)",          { XX } },
6904     { "(bad)",          { XX } },
6905     /* e0 */
6906     { "(bad)",          { XX } },
6907     { "(bad)",          { XX } },
6908     { "(bad)",          { XX } },
6909     { "(bad)",          { XX } },
6910     { "(bad)",          { XX } },
6911     { "(bad)",          { XX } },
6912     { "(bad)",          { XX } },
6913     { "(bad)",          { XX } },
6914     /* e8 */
6915     { "(bad)",          { XX } },
6916     { "(bad)",          { XX } },
6917     { "(bad)",          { XX } },
6918     { "(bad)",          { XX } },
6919     { "vpcomub",        { XM, Vex128, EXx, Ib } },
6920     { "vpcomuw",        { XM, Vex128, EXx, Ib } },
6921     { "vpcomud",        { XM, Vex128, EXx, Ib } },
6922     { "vpcomuq",        { XM, Vex128, EXx, Ib } },
6923     /* f0 */
6924     { "(bad)",          { XX } },
6925     { "(bad)",          { XX } },
6926     { "(bad)",          { XX } },
6927     { "(bad)",          { XX } },
6928     { "(bad)",          { XX } },
6929     { "(bad)",          { XX } },
6930     { "(bad)",          { XX } },
6931     { "(bad)",          { XX } },
6932     /* f8 */
6933     { "(bad)",          { XX } },
6934     { "(bad)",          { XX } },
6935     { "(bad)",          { XX } },
6936     { "(bad)",          { XX } },
6937     { "(bad)",          { XX } },
6938     { "(bad)",          { XX } },
6939     { "(bad)",          { XX } },
6940     { "(bad)",          { XX } },
6941   },
6942   /* XOP_09 */
6943   {
6944     /* 00 */
6945     { "(bad)",          { XX } },
6946     { "(bad)",          { XX } },
6947     { "(bad)",          { XX } },
6948     { "(bad)",          { XX } },
6949     { "(bad)",          { XX } },
6950     { "(bad)",          { XX } },
6951     { "(bad)",          { XX } },
6952     { "(bad)",          { XX } },
6953     /* 08 */
6954     { "(bad)",          { XX } },
6955     { "(bad)",          { XX } },
6956     { "(bad)",          { XX } },
6957     { "(bad)",          { XX } },
6958     { "(bad)",          { XX } },
6959     { "(bad)",          { XX } },
6960     { "(bad)",          { XX } },
6961     { "(bad)",          { XX } },
6962     /* 10 */
6963     { "(bad)",          { XX } },
6964     { "(bad)",          { XX } },
6965     { REG_TABLE (REG_XOP_LWPCB) },
6966     { "(bad)",          { XX } },
6967     { "(bad)",          { XX } },
6968     { "(bad)",          { XX } },
6969     { "(bad)",          { XX } },
6970     { "(bad)",          { XX } },
6971     /* 18 */
6972     { "(bad)",          { XX } },
6973     { "(bad)",          { XX } },
6974     { "(bad)",          { XX } },
6975     { "(bad)",          { XX } },
6976     { "(bad)",          { XX } },
6977     { "(bad)",          { XX } },
6978     { "(bad)",          { XX } },
6979     { "(bad)",          { XX } },
6980     /* 20 */
6981     { "(bad)",          { XX } },
6982     { "(bad)",          { XX } },
6983     { "(bad)",          { XX } },
6984     { "(bad)",          { XX } },
6985     { "(bad)",          { XX } },
6986     { "(bad)",          { XX } },
6987     { "(bad)",          { XX } },
6988     { "(bad)",          { XX } },
6989     /* 28 */
6990     { "(bad)",          { XX } },
6991     { "(bad)",          { XX } },
6992     { "(bad)",          { XX } },
6993     { "(bad)",          { XX } },
6994     { "(bad)",          { XX } },
6995     { "(bad)",          { XX } },
6996     { "(bad)",          { XX } },
6997     { "(bad)",          { XX } },
6998     /* 30 */
6999     { "(bad)",          { XX } },
7000     { "(bad)",          { XX } },
7001     { "(bad)",          { XX } },
7002     { "(bad)",          { XX } },
7003     { "(bad)",          { XX } },
7004     { "(bad)",          { XX } },
7005     { "(bad)",          { XX } },
7006     { "(bad)",          { XX } },
7007     /* 38 */
7008     { "(bad)",          { XX } },
7009     { "(bad)",          { XX } },
7010     { "(bad)",          { XX } },
7011     { "(bad)",          { XX } },
7012     { "(bad)",          { XX } },
7013     { "(bad)",          { XX } },
7014     { "(bad)",          { XX } },
7015     { "(bad)",          { XX } },
7016     /* 40 */
7017     { "(bad)",          { XX } },
7018     { "(bad)",          { XX } },
7019     { "(bad)",          { XX } },
7020     { "(bad)",          { XX } },
7021     { "(bad)",          { XX } },
7022     { "(bad)",          { XX } },
7023     { "(bad)",          { XX } },
7024     { "(bad)",          { XX } },
7025     /* 48 */
7026     { "(bad)",          { XX } },
7027     { "(bad)",          { XX } },
7028     { "(bad)",          { XX } },
7029     { "(bad)",          { XX } },
7030     { "(bad)",          { XX } },
7031     { "(bad)",          { XX } },
7032     { "(bad)",          { XX } },
7033     { "(bad)",          { XX } },
7034     /* 50 */
7035     { "(bad)",          { XX } },
7036     { "(bad)",          { XX } },
7037     { "(bad)",          { XX } },
7038     { "(bad)",          { XX } },
7039     { "(bad)",          { XX } },
7040     { "(bad)",          { XX } },
7041     { "(bad)",          { XX } },
7042     { "(bad)",          { XX } },
7043     /* 58 */
7044     { "(bad)",          { XX } },
7045     { "(bad)",          { XX } },
7046     { "(bad)",          { XX } },
7047     { "(bad)",          { XX } },
7048     { "(bad)",          { XX } },
7049     { "(bad)",          { XX } },
7050     { "(bad)",          { XX } },
7051     { "(bad)",          { XX } },
7052     /* 60 */
7053     { "(bad)",          { XX } },
7054     { "(bad)",          { XX } },
7055     { "(bad)",          { XX } },
7056     { "(bad)",          { XX } },
7057     { "(bad)",          { XX } },
7058     { "(bad)",          { XX } },
7059     { "(bad)",          { XX } },
7060     { "(bad)",          { XX } },
7061     /* 68 */
7062     { "(bad)",          { XX } },
7063     { "(bad)",          { XX } },
7064     { "(bad)",          { XX } },
7065     { "(bad)",          { XX } },
7066     { "(bad)",          { XX } },
7067     { "(bad)",          { XX } },
7068     { "(bad)",          { XX } },
7069     { "(bad)",          { XX } },
7070     /* 70 */
7071     { "(bad)",          { XX } },
7072     { "(bad)",          { XX } },
7073     { "(bad)",          { XX } },
7074     { "(bad)",          { XX } },
7075     { "(bad)",          { XX } },
7076     { "(bad)",          { XX } },
7077     { "(bad)",          { XX } },
7078     { "(bad)",          { XX } },
7079     /* 78 */
7080     { "(bad)",          { XX } },
7081     { "(bad)",          { XX } },
7082     { "(bad)",          { XX } },
7083     { "(bad)",          { XX } },
7084     { "(bad)",          { XX } },
7085     { "(bad)",          { XX } },
7086     { "(bad)",          { XX } },
7087     { "(bad)",          { XX } },
7088     /* 80 */
7089     { VEX_LEN_TABLE (VEX_LEN_XOP_09_80) },
7090     { VEX_LEN_TABLE (VEX_LEN_XOP_09_81) },
7091     { "vfrczss",        { XM, EXd } },
7092     { "vfrczsd",        { XM, EXq } },
7093     { "(bad)",          { XX } },
7094     { "(bad)",          { XX } },
7095     { "(bad)",          { XX } },
7096     { "(bad)",          { XX } },
7097     /* 88 */
7098     { "(bad)",          { XX } },
7099     { "(bad)",          { XX } },
7100     { "(bad)",          { XX } },
7101     { "(bad)",          { XX } },
7102     { "(bad)",          { XX } },
7103     { "(bad)",          { XX } },
7104     { "(bad)",          { XX } },
7105     { "(bad)",          { XX } },
7106     /* 90 */
7107     { "vprotb",         { XM, Vex_2src_1, Vex_2src_2 } },
7108     { "vprotw",         { XM, Vex_2src_1, Vex_2src_2 } },
7109     { "vprotd",         { XM, Vex_2src_1, Vex_2src_2 } },
7110     { "vprotq",         { XM, Vex_2src_1, Vex_2src_2 } },
7111     { "vpshlb",         { XM, Vex_2src_1, Vex_2src_2 } },
7112     { "vpshlw",         { XM, Vex_2src_1, Vex_2src_2 } },
7113     { "vpshld",         { XM, Vex_2src_1, Vex_2src_2 } },
7114     { "vpshlq",         { XM, Vex_2src_1, Vex_2src_2 } },
7115     /* 98 */
7116     { "vpshab",         { XM, Vex_2src_1, Vex_2src_2 } },
7117     { "vpshaw",         { XM, Vex_2src_1, Vex_2src_2 } },
7118     { "vpshad",         { XM, Vex_2src_1, Vex_2src_2 } },
7119     { "vpshaq",         { XM, Vex_2src_1, Vex_2src_2 } },
7120     { "(bad)",          { XX } },
7121     { "(bad)",          { XX } },
7122     { "(bad)",          { XX } },
7123     { "(bad)",          { XX } },
7124     /* a0 */
7125     { "(bad)",          { XX } },
7126     { "(bad)",          { XX } },
7127     { "(bad)",          { XX } },
7128     { "(bad)",          { XX } },
7129     { "(bad)",          { XX } },
7130     { "(bad)",          { XX } },
7131     { "(bad)",          { XX } },
7132     { "(bad)",          { XX } },
7133     /* a8 */
7134     { "(bad)",          { XX } },
7135     { "(bad)",          { XX } },
7136     { "(bad)",          { XX } },
7137     { "(bad)",          { XX } },
7138     { "(bad)",          { XX } },
7139     { "(bad)",          { XX } },
7140     { "(bad)",          { XX } },
7141     { "(bad)",          { XX } },
7142     /* b0 */
7143     { "(bad)",          { XX } },
7144     { "(bad)",          { XX } },
7145     { "(bad)",          { XX } },
7146     { "(bad)",          { XX } },
7147     { "(bad)",          { XX } },
7148     { "(bad)",          { XX } },
7149     { "(bad)",          { XX } },
7150     { "(bad)",          { XX } },
7151     /* b8 */
7152     { "(bad)",          { XX } },
7153     { "(bad)",          { XX } },
7154     { "(bad)",          { XX } },
7155     { "(bad)",          { XX } },
7156     { "(bad)",          { XX } },
7157     { "(bad)",          { XX } },
7158     { "(bad)",          { XX } },
7159     { "(bad)",          { XX } },
7160     /* c0 */
7161     { "(bad)",          { XX } },
7162     { "vphaddbw",       { XM, EXxmm } },
7163     { "vphaddbd",       { XM, EXxmm } },
7164     { "vphaddbq",       { XM, EXxmm } },
7165     { "(bad)",          { XX } },
7166     { "(bad)",          { XX } },
7167     { "vphaddwd",       { XM, EXxmm } },
7168     { "vphaddwq",       { XM, EXxmm } },
7169     /* c8 */
7170     { "(bad)",          { XX } },
7171     { "(bad)",          { XX } },
7172     { "(bad)",          { XX } },
7173     { "vphadddq",       { XM, EXxmm } },
7174     { "(bad)",          { XX } },
7175     { "(bad)",          { XX } },
7176     { "(bad)",          { XX } },
7177     { "(bad)",          { XX } },
7178     /* d0 */
7179     { "(bad)",          { XX } },
7180     { "vphaddubw",      { XM, EXxmm } },
7181     { "vphaddubd",      { XM, EXxmm } },
7182     { "vphaddubq",      { XM, EXxmm } },
7183     { "(bad)",          { XX } },
7184     { "(bad)",          { XX } },
7185     { "vphadduwd",      { XM, EXxmm } },
7186     { "vphadduwq",      { XM, EXxmm } },
7187     /* d8 */
7188     { "(bad)",          { XX } },
7189     { "(bad)",          { XX } },
7190     { "(bad)",          { XX } },
7191     { "vphaddudq",      { XM, EXxmm } },
7192     { "(bad)",          { XX } },
7193     { "(bad)",          { XX } },
7194     { "(bad)",          { XX } },
7195     { "(bad)",          { XX } },
7196     /* e0 */
7197     { "(bad)",          { XX } },
7198     { "vphsubbw",       { XM, EXxmm } },
7199     { "vphsubwd",       { XM, EXxmm } },
7200     { "vphsubdq",       { XM, EXxmm } },
7201     { "(bad)",          { XX } },
7202     { "(bad)",          { XX } },
7203     { "(bad)",          { XX } },
7204     { "(bad)",          { XX } },
7205     /* e8 */
7206     { "(bad)",          { XX } },
7207     { "(bad)",          { XX } },
7208     { "(bad)",          { XX } },
7209     { "(bad)",          { XX } },
7210     { "(bad)",          { XX } },
7211     { "(bad)",          { XX } },
7212     { "(bad)",          { XX } },
7213     { "(bad)",          { XX } },
7214     /* f0 */
7215     { "(bad)",          { XX } },
7216     { "(bad)",          { XX } },
7217     { "(bad)",          { XX } },
7218     { "(bad)",          { XX } },
7219     { "(bad)",          { XX } },
7220     { "(bad)",          { XX } },
7221     { "(bad)",          { XX } },
7222     { "(bad)",          { XX } },
7223     /* f8 */
7224     { "(bad)",          { XX } },
7225     { "(bad)",          { XX } },
7226     { "(bad)",          { XX } },
7227     { "(bad)",          { XX } },
7228     { "(bad)",          { XX } },
7229     { "(bad)",          { XX } },
7230     { "(bad)",          { XX } },
7231     { "(bad)",          { XX } },
7232   },
7233   /* XOP_0A */
7234   {
7235     /* 00 */
7236     { "(bad)",          { XX } },
7237     { "(bad)",          { XX } },
7238     { "(bad)",          { XX } },
7239     { "(bad)",          { XX } },
7240     { "(bad)",          { XX } },
7241     { "(bad)",          { XX } },
7242     { "(bad)",          { XX } },
7243     { "(bad)",          { XX } },
7244     /* 08 */
7245     { "(bad)",          { XX } },
7246     { "(bad)",          { XX } },
7247     { "(bad)",          { XX } },
7248     { "(bad)",          { XX } },
7249     { "(bad)",          { XX } },
7250     { "(bad)",          { XX } },
7251     { "(bad)",          { XX } },
7252     { "(bad)",          { XX } },
7253     /* 10 */
7254     { "(bad)",          { XX } },
7255     { "(bad)",          { XX } },
7256     { REG_TABLE (REG_XOP_LWP) },
7257     { "(bad)",          { XX } },
7258     { "(bad)",          { XX } },
7259     { "(bad)",          { XX } },
7260     { "(bad)",          { XX } },
7261     { "(bad)",          { XX } },
7262     /* 18 */
7263     { "(bad)",          { XX } },
7264     { "(bad)",          { XX } },
7265     { "(bad)",          { XX } },
7266     { "(bad)",          { XX } },
7267     { "(bad)",          { XX } },
7268     { "(bad)",          { XX } },
7269     { "(bad)",          { XX } },
7270     { "(bad)",          { XX } },
7271     /* 20 */
7272     { "(bad)",          { XX } },
7273     { "(bad)",          { XX } },
7274     { "(bad)",          { XX } },
7275     { "(bad)",          { XX } },
7276     { "(bad)",          { XX } },
7277     { "(bad)",          { XX } },
7278     { "(bad)",          { XX } },
7279     { "(bad)",          { XX } },
7280     /* 28 */
7281     { "(bad)",          { XX } },
7282     { "(bad)",          { XX } },
7283     { "(bad)",          { XX } },
7284     { "(bad)",          { XX } },
7285     { "(bad)",          { XX } },
7286     { "(bad)",          { XX } },
7287     { "(bad)",          { XX } },
7288     { "(bad)",          { XX } },
7289     /* 30 */
7290     { "(bad)",          { XX } },
7291     { "(bad)",          { XX } },
7292     { "(bad)",          { XX } },
7293     { "(bad)",          { XX } },
7294     { "(bad)",          { XX } },
7295     { "(bad)",          { XX } },
7296     { "(bad)",          { XX } },
7297     { "(bad)",          { XX } },
7298     /* 38 */
7299     { "(bad)",          { XX } },
7300     { "(bad)",          { XX } },
7301     { "(bad)",          { XX } },
7302     { "(bad)",          { XX } },
7303     { "(bad)",          { XX } },
7304     { "(bad)",          { XX } },
7305     { "(bad)",          { XX } },
7306     { "(bad)",          { XX } },
7307     /* 40 */
7308     { "(bad)",          { XX } },
7309     { "(bad)",          { XX } },
7310     { "(bad)",          { XX } },
7311     { "(bad)",          { XX } },
7312     { "(bad)",          { XX } },
7313     { "(bad)",          { XX } },
7314     { "(bad)",          { XX } },
7315     { "(bad)",          { XX } },
7316     /* 48 */
7317     { "(bad)",          { XX } },
7318     { "(bad)",          { XX } },
7319     { "(bad)",          { XX } },
7320     { "(bad)",          { XX } },
7321     { "(bad)",          { XX } },
7322     { "(bad)",          { XX } },
7323     { "(bad)",          { XX } },
7324     { "(bad)",          { XX } },
7325     /* 50 */
7326     { "(bad)",          { XX } },
7327     { "(bad)",          { XX } },
7328     { "(bad)",          { XX } },
7329     { "(bad)",          { XX } },
7330     { "(bad)",          { XX } },
7331     { "(bad)",          { XX } },
7332     { "(bad)",          { XX } },
7333     { "(bad)",          { XX } },
7334     /* 58 */
7335     { "(bad)",          { XX } },
7336     { "(bad)",          { XX } },
7337     { "(bad)",          { XX } },
7338     { "(bad)",          { XX } },
7339     { "(bad)",          { XX } },
7340     { "(bad)",          { XX } },
7341     { "(bad)",          { XX } },
7342     { "(bad)",          { XX } },
7343     /* 60 */
7344     { "(bad)",          { XX } },
7345     { "(bad)",          { XX } },
7346     { "(bad)",          { XX } },
7347     { "(bad)",          { XX } },
7348     { "(bad)",          { XX } },
7349     { "(bad)",          { XX } },
7350     { "(bad)",          { XX } },
7351     { "(bad)",          { XX } },
7352     /* 68 */
7353     { "(bad)",          { XX } },
7354     { "(bad)",          { XX } },
7355     { "(bad)",          { XX } },
7356     { "(bad)",          { XX } },
7357     { "(bad)",          { XX } },
7358     { "(bad)",          { XX } },
7359     { "(bad)",          { XX } },
7360     { "(bad)",          { XX } },
7361     /* 70 */
7362     { "(bad)",          { XX } },
7363     { "(bad)",          { XX } },
7364     { "(bad)",          { XX } },
7365     { "(bad)",          { XX } },
7366     { "(bad)",          { XX } },
7367     { "(bad)",          { XX } },
7368     { "(bad)",          { XX } },
7369     { "(bad)",          { XX } },
7370     /* 78 */
7371     { "(bad)",          { XX } },
7372     { "(bad)",          { XX } },
7373     { "(bad)",          { XX } },
7374     { "(bad)",          { XX } },
7375     { "(bad)",          { XX } },
7376     { "(bad)",          { XX } },
7377     { "(bad)",          { XX } },
7378     { "(bad)",          { XX } },
7379     /* 80 */
7380     { "(bad)",          { XX } },
7381     { "(bad)",          { XX } },
7382     { "(bad)",          { XX } },
7383     { "(bad)",          { XX } },
7384     { "(bad)",          { XX } },
7385     { "(bad)",          { XX } },
7386     { "(bad)",          { XX } },
7387     { "(bad)",          { XX } },
7388     /* 88 */
7389     { "(bad)",          { XX } },
7390     { "(bad)",          { XX } },
7391     { "(bad)",          { XX } },
7392     { "(bad)",          { XX } },
7393     { "(bad)",          { XX } },
7394     { "(bad)",          { XX } },
7395     { "(bad)",          { XX } },
7396     { "(bad)",          { XX } },
7397     /* 90 */
7398     { "(bad)",          { XX } },
7399     { "(bad)",          { XX } },
7400     { "(bad)",          { XX } },
7401     { "(bad)",          { XX } },
7402     { "(bad)",          { XX } },
7403     { "(bad)",          { XX } },
7404     { "(bad)",          { XX } },
7405     { "(bad)",          { XX } },
7406     /* 98 */
7407     { "(bad)",          { XX } },
7408     { "(bad)",          { XX } },
7409     { "(bad)",          { XX } },
7410     { "(bad)",          { XX } },
7411     { "(bad)",          { XX } },
7412     { "(bad)",          { XX } },
7413     { "(bad)",          { XX } },
7414     { "(bad)",          { XX } },
7415     /* a0 */
7416     { "(bad)",          { XX } },
7417     { "(bad)",          { XX } },
7418     { "(bad)",          { XX } },
7419     { "(bad)",          { XX } },
7420     { "(bad)",          { XX } },
7421     { "(bad)",          { XX } },
7422     { "(bad)",          { XX } },
7423     { "(bad)",          { XX } },
7424     /* a8 */
7425     { "(bad)",          { XX } },
7426     { "(bad)",          { XX } },
7427     { "(bad)",          { XX } },
7428     { "(bad)",          { XX } },
7429     { "(bad)",          { XX } },
7430     { "(bad)",          { XX } },
7431     { "(bad)",          { XX } },
7432     { "(bad)",          { XX } },
7433     /* b0 */
7434     { "(bad)",          { XX } },
7435     { "(bad)",          { XX } },
7436     { "(bad)",          { XX } },
7437     { "(bad)",          { XX } },
7438     { "(bad)",          { XX } },
7439     { "(bad)",          { XX } },
7440     { "(bad)",          { XX } },
7441     { "(bad)",          { XX } },
7442     /* b8 */
7443     { "(bad)",          { XX } },
7444     { "(bad)",          { XX } },
7445     { "(bad)",          { XX } },
7446     { "(bad)",          { XX } },
7447     { "(bad)",          { XX } },
7448     { "(bad)",          { XX } },
7449     { "(bad)",          { XX } },
7450     { "(bad)",          { XX } },
7451     /* c0 */
7452     { "(bad)",          { XX } },
7453     { "(bad)",          { XX } },
7454     { "(bad)",          { XX } },
7455     { "(bad)",          { XX } },
7456     { "(bad)",          { XX } },
7457     { "(bad)",          { XX } },
7458     { "(bad)",          { XX } },
7459     { "(bad)",          { XX } },
7460     /* c8 */
7461     { "(bad)",          { XX } },
7462     { "(bad)",          { XX } },
7463     { "(bad)",          { XX } },
7464     { "(bad)",          { XX } },
7465     { "(bad)",          { XX } },
7466     { "(bad)",          { XX } },
7467     { "(bad)",          { XX } },
7468     { "(bad)",          { XX } },
7469     /* d0 */
7470     { "(bad)",          { XX } },
7471     { "(bad)",          { XX } },
7472     { "(bad)",          { XX } },
7473     { "(bad)",          { XX } },
7474     { "(bad)",          { XX } },
7475     { "(bad)",          { XX } },
7476     { "(bad)",          { XX } },
7477     { "(bad)",          { XX } },
7478     /* d8 */
7479     { "(bad)",          { XX } },
7480     { "(bad)",          { XX } },
7481     { "(bad)",          { XX } },
7482     { "(bad)",          { XX } },
7483     { "(bad)",          { XX } },
7484     { "(bad)",          { XX } },
7485     { "(bad)",          { XX } },
7486     { "(bad)",          { XX } },
7487     /* e0 */
7488     { "(bad)",          { XX } },
7489     { "(bad)",          { XX } },
7490     { "(bad)",          { XX } },
7491     { "(bad)",          { XX } },
7492     { "(bad)",          { XX } },
7493     { "(bad)",          { XX } },
7494     { "(bad)",          { XX } },
7495     { "(bad)",          { XX } },
7496     /* e8 */
7497     { "(bad)",          { XX } },
7498     { "(bad)",          { XX } },
7499     { "(bad)",          { XX } },
7500     { "(bad)",          { XX } },
7501     { "(bad)",          { XX } },
7502     { "(bad)",          { XX } },
7503     { "(bad)",          { XX } },
7504     { "(bad)",          { XX } },
7505     /* f0 */
7506     { "(bad)",          { XX } },
7507     { "(bad)",          { XX } },
7508     { "(bad)",          { XX } },
7509     { "(bad)",          { XX } },
7510     { "(bad)",          { XX } },
7511     { "(bad)",          { XX } },
7512     { "(bad)",          { XX } },
7513     { "(bad)",          { XX } },
7514     /* f8 */
7515     { "(bad)",          { XX } },
7516     { "(bad)",          { XX } },
7517     { "(bad)",          { XX } },
7518     { "(bad)",          { XX } },
7519     { "(bad)",          { XX } },
7520     { "(bad)",          { XX } },
7521     { "(bad)",          { XX } },
7522     { "(bad)",          { XX } },
7523   },
7524 };
7525
7526 static const struct dis386 vex_table[][256] = {
7527   /* VEX_0F */
7528   {
7529     /* 00 */
7530     { "(bad)",          { XX } },
7531     { "(bad)",          { XX } },
7532     { "(bad)",          { XX } },
7533     { "(bad)",          { XX } },
7534     { "(bad)",          { XX } },
7535     { "(bad)",          { XX } },
7536     { "(bad)",          { XX } },
7537     { "(bad)",          { XX } },
7538     /* 08 */
7539     { "(bad)",          { XX } },
7540     { "(bad)",          { XX } },
7541     { "(bad)",          { XX } },
7542     { "(bad)",          { XX } },
7543     { "(bad)",          { XX } },
7544     { "(bad)",          { XX } },
7545     { "(bad)",          { XX } },
7546     { "(bad)",          { XX } },
7547     /* 10 */
7548     { PREFIX_TABLE (PREFIX_VEX_10) },
7549     { PREFIX_TABLE (PREFIX_VEX_11) },
7550     { PREFIX_TABLE (PREFIX_VEX_12) },
7551     { MOD_TABLE (MOD_VEX_13) },
7552     { VEX_W_TABLE (VEX_W_14) },
7553     { VEX_W_TABLE (VEX_W_15) },
7554     { PREFIX_TABLE (PREFIX_VEX_16) },
7555     { MOD_TABLE (MOD_VEX_17) },
7556     /* 18 */
7557     { "(bad)",          { XX } },
7558     { "(bad)",          { XX } },
7559     { "(bad)",          { XX } },
7560     { "(bad)",          { XX } },
7561     { "(bad)",          { XX } },
7562     { "(bad)",          { XX } },
7563     { "(bad)",          { XX } },
7564     { "(bad)",          { XX } },
7565     /* 20 */
7566     { "(bad)",          { XX } },
7567     { "(bad)",          { XX } },
7568     { "(bad)",          { XX } },
7569     { "(bad)",          { XX } },
7570     { "(bad)",          { XX } },
7571     { "(bad)",          { XX } },
7572     { "(bad)",          { XX } },
7573     { "(bad)",          { XX } },
7574     /* 28 */
7575     { VEX_W_TABLE (VEX_W_28) },
7576     { VEX_W_TABLE (VEX_W_29) },
7577     { PREFIX_TABLE (PREFIX_VEX_2A) },
7578     { MOD_TABLE (MOD_VEX_2B) },
7579     { PREFIX_TABLE (PREFIX_VEX_2C) },
7580     { PREFIX_TABLE (PREFIX_VEX_2D) },
7581     { PREFIX_TABLE (PREFIX_VEX_2E) },
7582     { PREFIX_TABLE (PREFIX_VEX_2F) },
7583     /* 30 */
7584     { "(bad)",          { XX } },
7585     { "(bad)",          { XX } },
7586     { "(bad)",          { XX } },
7587     { "(bad)",          { XX } },
7588     { "(bad)",          { XX } },
7589     { "(bad)",          { XX } },
7590     { "(bad)",          { XX } },
7591     { "(bad)",          { XX } },
7592     /* 38 */
7593     { "(bad)",          { XX } },
7594     { "(bad)",          { XX } },
7595     { "(bad)",          { XX } },
7596     { "(bad)",          { XX } },
7597     { "(bad)",          { XX } },
7598     { "(bad)",          { XX } },
7599     { "(bad)",          { XX } },
7600     { "(bad)",          { XX } },
7601     /* 40 */
7602     { "(bad)",          { XX } },
7603     { "(bad)",          { XX } },
7604     { "(bad)",          { XX } },
7605     { "(bad)",          { XX } },
7606     { "(bad)",          { XX } },
7607     { "(bad)",          { XX } },
7608     { "(bad)",          { XX } },
7609     { "(bad)",          { XX } },
7610     /* 48 */
7611     { "(bad)",          { XX } },
7612     { "(bad)",          { XX } },
7613     { "(bad)",          { XX } },
7614     { "(bad)",          { XX } },
7615     { "(bad)",          { XX } },
7616     { "(bad)",          { XX } },
7617     { "(bad)",          { XX } },
7618     { "(bad)",          { XX } },
7619     /* 50 */
7620     { MOD_TABLE (MOD_VEX_50) },
7621     { PREFIX_TABLE (PREFIX_VEX_51) },
7622     { PREFIX_TABLE (PREFIX_VEX_52) },
7623     { PREFIX_TABLE (PREFIX_VEX_53) },
7624     { "vandpX",         { XM, Vex, EXx } },
7625     { "vandnpX",        { XM, Vex, EXx } },
7626     { "vorpX",          { XM, Vex, EXx } },
7627     { "vxorpX",         { XM, Vex, EXx } },
7628     /* 58 */
7629     { PREFIX_TABLE (PREFIX_VEX_58) },
7630     { PREFIX_TABLE (PREFIX_VEX_59) },
7631     { PREFIX_TABLE (PREFIX_VEX_5A) },
7632     { PREFIX_TABLE (PREFIX_VEX_5B) },
7633     { PREFIX_TABLE (PREFIX_VEX_5C) },
7634     { PREFIX_TABLE (PREFIX_VEX_5D) },
7635     { PREFIX_TABLE (PREFIX_VEX_5E) },
7636     { PREFIX_TABLE (PREFIX_VEX_5F) },
7637     /* 60 */
7638     { PREFIX_TABLE (PREFIX_VEX_60) },
7639     { PREFIX_TABLE (PREFIX_VEX_61) },
7640     { PREFIX_TABLE (PREFIX_VEX_62) },
7641     { PREFIX_TABLE (PREFIX_VEX_63) },
7642     { PREFIX_TABLE (PREFIX_VEX_64) },
7643     { PREFIX_TABLE (PREFIX_VEX_65) },
7644     { PREFIX_TABLE (PREFIX_VEX_66) },
7645     { PREFIX_TABLE (PREFIX_VEX_67) },
7646     /* 68 */
7647     { PREFIX_TABLE (PREFIX_VEX_68) },
7648     { PREFIX_TABLE (PREFIX_VEX_69) },
7649     { PREFIX_TABLE (PREFIX_VEX_6A) },
7650     { PREFIX_TABLE (PREFIX_VEX_6B) },
7651     { PREFIX_TABLE (PREFIX_VEX_6C) },
7652     { PREFIX_TABLE (PREFIX_VEX_6D) },
7653     { PREFIX_TABLE (PREFIX_VEX_6E) },
7654     { PREFIX_TABLE (PREFIX_VEX_6F) },
7655     /* 70 */
7656     { PREFIX_TABLE (PREFIX_VEX_70) },
7657     { REG_TABLE (REG_VEX_71) },
7658     { REG_TABLE (REG_VEX_72) },
7659     { REG_TABLE (REG_VEX_73) },
7660     { PREFIX_TABLE (PREFIX_VEX_74) },
7661     { PREFIX_TABLE (PREFIX_VEX_75) },
7662     { PREFIX_TABLE (PREFIX_VEX_76) },
7663     { PREFIX_TABLE (PREFIX_VEX_77) },
7664     /* 78 */
7665     { "(bad)",          { XX } },
7666     { "(bad)",          { XX } },
7667     { "(bad)",          { XX } },
7668     { "(bad)",          { XX } },
7669     { PREFIX_TABLE (PREFIX_VEX_7C) },
7670     { PREFIX_TABLE (PREFIX_VEX_7D) },
7671     { PREFIX_TABLE (PREFIX_VEX_7E) },
7672     { PREFIX_TABLE (PREFIX_VEX_7F) },
7673     /* 80 */
7674     { "(bad)",          { XX } },
7675     { "(bad)",          { XX } },
7676     { "(bad)",          { XX } },
7677     { "(bad)",          { XX } },
7678     { "(bad)",          { XX } },
7679     { "(bad)",          { XX } },
7680     { "(bad)",          { XX } },
7681     { "(bad)",          { XX } },
7682     /* 88 */
7683     { "(bad)",          { XX } },
7684     { "(bad)",          { XX } },
7685     { "(bad)",          { XX } },
7686     { "(bad)",          { XX } },
7687     { "(bad)",          { XX } },
7688     { "(bad)",          { XX } },
7689     { "(bad)",          { XX } },
7690     { "(bad)",          { XX } },
7691     /* 90 */
7692     { "(bad)",          { XX } },
7693     { "(bad)",          { XX } },
7694     { "(bad)",          { XX } },
7695     { "(bad)",          { XX } },
7696     { "(bad)",          { XX } },
7697     { "(bad)",          { XX } },
7698     { "(bad)",          { XX } },
7699     { "(bad)",          { XX } },
7700     /* 98 */
7701     { "(bad)",          { XX } },
7702     { "(bad)",          { XX } },
7703     { "(bad)",          { XX } },
7704     { "(bad)",          { XX } },
7705     { "(bad)",          { XX } },
7706     { "(bad)",          { XX } },
7707     { "(bad)",          { XX } },
7708     { "(bad)",          { XX } },
7709     /* a0 */
7710     { "(bad)",          { XX } },
7711     { "(bad)",          { XX } },
7712     { "(bad)",          { XX } },
7713     { "(bad)",          { XX } },
7714     { "(bad)",          { XX } },
7715     { "(bad)",          { XX } },
7716     { "(bad)",          { XX } },
7717     { "(bad)",          { XX } },
7718     /* a8 */
7719     { "(bad)",          { XX } },
7720     { "(bad)",          { XX } },
7721     { "(bad)",          { XX } },
7722     { "(bad)",          { XX } },
7723     { "(bad)",          { XX } },
7724     { "(bad)",          { XX } },
7725     { REG_TABLE (REG_VEX_AE) },
7726     { "(bad)",          { XX } },
7727     /* b0 */
7728     { "(bad)",          { XX } },
7729     { "(bad)",          { XX } },
7730     { "(bad)",          { XX } },
7731     { "(bad)",          { XX } },
7732     { "(bad)",          { XX } },
7733     { "(bad)",          { XX } },
7734     { "(bad)",          { XX } },
7735     { "(bad)",          { XX } },
7736     /* b8 */
7737     { "(bad)",          { XX } },
7738     { "(bad)",          { XX } },
7739     { "(bad)",          { XX } },
7740     { "(bad)",          { XX } },
7741     { "(bad)",          { XX } },
7742     { "(bad)",          { XX } },
7743     { "(bad)",          { XX } },
7744     { "(bad)",          { XX } },
7745     /* c0 */
7746     { "(bad)",          { XX } },
7747     { "(bad)",          { XX } },
7748     { PREFIX_TABLE (PREFIX_VEX_C2) },
7749     { "(bad)",          { XX } },
7750     { PREFIX_TABLE (PREFIX_VEX_C4) },
7751     { PREFIX_TABLE (PREFIX_VEX_C5) },
7752     { "vshufpX",        { XM, Vex, EXx, Ib } },
7753     { "(bad)",          { XX } },
7754     /* c8 */
7755     { "(bad)",          { XX } },
7756     { "(bad)",          { XX } },
7757     { "(bad)",          { XX } },
7758     { "(bad)",          { XX } },
7759     { "(bad)",          { XX } },
7760     { "(bad)",          { XX } },
7761     { "(bad)",          { XX } },
7762     { "(bad)",          { XX } },
7763     /* d0 */
7764     { PREFIX_TABLE (PREFIX_VEX_D0) },
7765     { PREFIX_TABLE (PREFIX_VEX_D1) },
7766     { PREFIX_TABLE (PREFIX_VEX_D2) },
7767     { PREFIX_TABLE (PREFIX_VEX_D3) },
7768     { PREFIX_TABLE (PREFIX_VEX_D4) },
7769     { PREFIX_TABLE (PREFIX_VEX_D5) },
7770     { PREFIX_TABLE (PREFIX_VEX_D6) },
7771     { PREFIX_TABLE (PREFIX_VEX_D7) },
7772     /* d8 */
7773     { PREFIX_TABLE (PREFIX_VEX_D8) },
7774     { PREFIX_TABLE (PREFIX_VEX_D9) },
7775     { PREFIX_TABLE (PREFIX_VEX_DA) },
7776     { PREFIX_TABLE (PREFIX_VEX_DB) },
7777     { PREFIX_TABLE (PREFIX_VEX_DC) },
7778     { PREFIX_TABLE (PREFIX_VEX_DD) },
7779     { PREFIX_TABLE (PREFIX_VEX_DE) },
7780     { PREFIX_TABLE (PREFIX_VEX_DF) },
7781     /* e0 */
7782     { PREFIX_TABLE (PREFIX_VEX_E0) },
7783     { PREFIX_TABLE (PREFIX_VEX_E1) },
7784     { PREFIX_TABLE (PREFIX_VEX_E2) },
7785     { PREFIX_TABLE (PREFIX_VEX_E3) },
7786     { PREFIX_TABLE (PREFIX_VEX_E4) },
7787     { PREFIX_TABLE (PREFIX_VEX_E5) },
7788     { PREFIX_TABLE (PREFIX_VEX_E6) },
7789     { PREFIX_TABLE (PREFIX_VEX_E7) },
7790     /* e8 */
7791     { PREFIX_TABLE (PREFIX_VEX_E8) },
7792     { PREFIX_TABLE (PREFIX_VEX_E9) },
7793     { PREFIX_TABLE (PREFIX_VEX_EA) },
7794     { PREFIX_TABLE (PREFIX_VEX_EB) },
7795     { PREFIX_TABLE (PREFIX_VEX_EC) },
7796     { PREFIX_TABLE (PREFIX_VEX_ED) },
7797     { PREFIX_TABLE (PREFIX_VEX_EE) },
7798     { PREFIX_TABLE (PREFIX_VEX_EF) },
7799     /* f0 */
7800     { PREFIX_TABLE (PREFIX_VEX_F0) },
7801     { PREFIX_TABLE (PREFIX_VEX_F1) },
7802     { PREFIX_TABLE (PREFIX_VEX_F2) },
7803     { PREFIX_TABLE (PREFIX_VEX_F3) },
7804     { PREFIX_TABLE (PREFIX_VEX_F4) },
7805     { PREFIX_TABLE (PREFIX_VEX_F5) },
7806     { PREFIX_TABLE (PREFIX_VEX_F6) },
7807     { PREFIX_TABLE (PREFIX_VEX_F7) },
7808     /* f8 */
7809     { PREFIX_TABLE (PREFIX_VEX_F8) },
7810     { PREFIX_TABLE (PREFIX_VEX_F9) },
7811     { PREFIX_TABLE (PREFIX_VEX_FA) },
7812     { PREFIX_TABLE (PREFIX_VEX_FB) },
7813     { PREFIX_TABLE (PREFIX_VEX_FC) },
7814     { PREFIX_TABLE (PREFIX_VEX_FD) },
7815     { PREFIX_TABLE (PREFIX_VEX_FE) },
7816     { "(bad)",          { XX } },
7817   },
7818   /* VEX_0F38 */
7819   {
7820     /* 00 */
7821     { PREFIX_TABLE (PREFIX_VEX_3800) },
7822     { PREFIX_TABLE (PREFIX_VEX_3801) },
7823     { PREFIX_TABLE (PREFIX_VEX_3802) },
7824     { PREFIX_TABLE (PREFIX_VEX_3803) },
7825     { PREFIX_TABLE (PREFIX_VEX_3804) },
7826     { PREFIX_TABLE (PREFIX_VEX_3805) },
7827     { PREFIX_TABLE (PREFIX_VEX_3806) },
7828     { PREFIX_TABLE (PREFIX_VEX_3807) },
7829     /* 08 */
7830     { PREFIX_TABLE (PREFIX_VEX_3808) },
7831     { PREFIX_TABLE (PREFIX_VEX_3809) },
7832     { PREFIX_TABLE (PREFIX_VEX_380A) },
7833     { PREFIX_TABLE (PREFIX_VEX_380B) },
7834     { PREFIX_TABLE (PREFIX_VEX_380C) },
7835     { PREFIX_TABLE (PREFIX_VEX_380D) },
7836     { PREFIX_TABLE (PREFIX_VEX_380E) },
7837     { PREFIX_TABLE (PREFIX_VEX_380F) },
7838     /* 10 */
7839     { "(bad)",          { XX } },
7840     { "(bad)",          { XX } },
7841     { "(bad)",          { XX } },
7842     { "(bad)",          { XX } },
7843     { "(bad)",          { XX } },
7844     { "(bad)",          { XX } },
7845     { "(bad)",          { XX } },
7846     { PREFIX_TABLE (PREFIX_VEX_3817) },
7847     /* 18 */
7848     { PREFIX_TABLE (PREFIX_VEX_3818) },
7849     { PREFIX_TABLE (PREFIX_VEX_3819) },
7850     { PREFIX_TABLE (PREFIX_VEX_381A) },
7851     { "(bad)",          { XX } },
7852     { PREFIX_TABLE (PREFIX_VEX_381C) },
7853     { PREFIX_TABLE (PREFIX_VEX_381D) },
7854     { PREFIX_TABLE (PREFIX_VEX_381E) },
7855     { "(bad)",          { XX } },
7856     /* 20 */
7857     { PREFIX_TABLE (PREFIX_VEX_3820) },
7858     { PREFIX_TABLE (PREFIX_VEX_3821) },
7859     { PREFIX_TABLE (PREFIX_VEX_3822) },
7860     { PREFIX_TABLE (PREFIX_VEX_3823) },
7861     { PREFIX_TABLE (PREFIX_VEX_3824) },
7862     { PREFIX_TABLE (PREFIX_VEX_3825) },
7863     { "(bad)",          { XX } },
7864     { "(bad)",          { XX } },
7865     /* 28 */
7866     { PREFIX_TABLE (PREFIX_VEX_3828) },
7867     { PREFIX_TABLE (PREFIX_VEX_3829) },
7868     { PREFIX_TABLE (PREFIX_VEX_382A) },
7869     { PREFIX_TABLE (PREFIX_VEX_382B) },
7870     { PREFIX_TABLE (PREFIX_VEX_382C) },
7871     { PREFIX_TABLE (PREFIX_VEX_382D) },
7872     { PREFIX_TABLE (PREFIX_VEX_382E) },
7873     { PREFIX_TABLE (PREFIX_VEX_382F) },
7874     /* 30 */
7875     { PREFIX_TABLE (PREFIX_VEX_3830) },
7876     { PREFIX_TABLE (PREFIX_VEX_3831) },
7877     { PREFIX_TABLE (PREFIX_VEX_3832) },
7878     { PREFIX_TABLE (PREFIX_VEX_3833) },
7879     { PREFIX_TABLE (PREFIX_VEX_3834) },
7880     { PREFIX_TABLE (PREFIX_VEX_3835) },
7881     { "(bad)",          { XX } },
7882     { PREFIX_TABLE (PREFIX_VEX_3837) },
7883     /* 38 */
7884     { PREFIX_TABLE (PREFIX_VEX_3838) },
7885     { PREFIX_TABLE (PREFIX_VEX_3839) },
7886     { PREFIX_TABLE (PREFIX_VEX_383A) },
7887     { PREFIX_TABLE (PREFIX_VEX_383B) },
7888     { PREFIX_TABLE (PREFIX_VEX_383C) },
7889     { PREFIX_TABLE (PREFIX_VEX_383D) },
7890     { PREFIX_TABLE (PREFIX_VEX_383E) },
7891     { PREFIX_TABLE (PREFIX_VEX_383F) },
7892     /* 40 */
7893     { PREFIX_TABLE (PREFIX_VEX_3840) },
7894     { PREFIX_TABLE (PREFIX_VEX_3841) },
7895     { "(bad)",          { XX } },
7896     { "(bad)",          { XX } },
7897     { "(bad)",          { XX } },
7898     { "(bad)",          { XX } },
7899     { "(bad)",          { XX } },
7900     { "(bad)",          { XX } },
7901     /* 48 */
7902     { "(bad)",          { XX } },
7903     { "(bad)",          { XX } },
7904     { "(bad)",          { XX } },
7905     { "(bad)",          { XX } },
7906     { "(bad)",          { XX } },
7907     { "(bad)",          { XX } },
7908     { "(bad)",          { XX } },
7909     { "(bad)",          { XX } },
7910     /* 50 */
7911     { "(bad)",          { XX } },
7912     { "(bad)",          { XX } },
7913     { "(bad)",          { XX } },
7914     { "(bad)",          { XX } },
7915     { "(bad)",          { XX } },
7916     { "(bad)",          { XX } },
7917     { "(bad)",          { XX } },
7918     { "(bad)",          { XX } },
7919     /* 58 */
7920     { "(bad)",          { XX } },
7921     { "(bad)",          { XX } },
7922     { "(bad)",          { XX } },
7923     { "(bad)",          { XX } },
7924     { "(bad)",          { XX } },
7925     { "(bad)",          { XX } },
7926     { "(bad)",          { XX } },
7927     { "(bad)",          { XX } },
7928     /* 60 */
7929     { "(bad)",          { XX } },
7930     { "(bad)",          { XX } },
7931     { "(bad)",          { XX } },
7932     { "(bad)",          { XX } },
7933     { "(bad)",          { XX } },
7934     { "(bad)",          { XX } },
7935     { "(bad)",          { XX } },
7936     { "(bad)",          { XX } },
7937     /* 68 */
7938     { "(bad)",          { XX } },
7939     { "(bad)",          { XX } },
7940     { "(bad)",          { XX } },
7941     { "(bad)",          { XX } },
7942     { "(bad)",          { XX } },
7943     { "(bad)",          { XX } },
7944     { "(bad)",          { XX } },
7945     { "(bad)",          { XX } },
7946     /* 70 */
7947     { "(bad)",          { XX } },
7948     { "(bad)",          { XX } },
7949     { "(bad)",          { XX } },
7950     { "(bad)",          { XX } },
7951     { "(bad)",          { XX } },
7952     { "(bad)",          { XX } },
7953     { "(bad)",          { XX } },
7954     { "(bad)",          { XX } },
7955     /* 78 */
7956     { "(bad)",          { XX } },
7957     { "(bad)",          { XX } },
7958     { "(bad)",          { XX } },
7959     { "(bad)",          { XX } },
7960     { "(bad)",          { XX } },
7961     { "(bad)",          { XX } },
7962     { "(bad)",          { XX } },
7963     { "(bad)",          { XX } },
7964     /* 80 */
7965     { "(bad)",          { XX } },
7966     { "(bad)",          { XX } },
7967     { "(bad)",          { XX } },
7968     { "(bad)",          { XX } },
7969     { "(bad)",          { XX } },
7970     { "(bad)",          { XX } },
7971     { "(bad)",          { XX } },
7972     { "(bad)",          { XX } },
7973     /* 88 */
7974     { "(bad)",          { XX } },
7975     { "(bad)",          { XX } },
7976     { "(bad)",          { XX } },
7977     { "(bad)",          { XX } },
7978     { "(bad)",          { XX } },
7979     { "(bad)",          { XX } },
7980     { "(bad)",          { XX } },
7981     { "(bad)",          { XX } },
7982     /* 90 */
7983     { "(bad)",          { XX } },
7984     { "(bad)",          { XX } },
7985     { "(bad)",          { XX } },
7986     { "(bad)",          { XX } },
7987     { "(bad)",          { XX } },
7988     { "(bad)",          { XX } },
7989     { PREFIX_TABLE (PREFIX_VEX_3896) },
7990     { PREFIX_TABLE (PREFIX_VEX_3897) },
7991     /* 98 */
7992     { PREFIX_TABLE (PREFIX_VEX_3898) },
7993     { PREFIX_TABLE (PREFIX_VEX_3899) },
7994     { PREFIX_TABLE (PREFIX_VEX_389A) },
7995     { PREFIX_TABLE (PREFIX_VEX_389B) },
7996     { PREFIX_TABLE (PREFIX_VEX_389C) },
7997     { PREFIX_TABLE (PREFIX_VEX_389D) },
7998     { PREFIX_TABLE (PREFIX_VEX_389E) },
7999     { PREFIX_TABLE (PREFIX_VEX_389F) },
8000     /* a0 */
8001     { "(bad)",          { XX } },
8002     { "(bad)",          { XX } },
8003     { "(bad)",          { XX } },
8004     { "(bad)",          { XX } },
8005     { "(bad)",          { XX } },
8006     { "(bad)",          { XX } },
8007     { PREFIX_TABLE (PREFIX_VEX_38A6) },
8008     { PREFIX_TABLE (PREFIX_VEX_38A7) },
8009     /* a8 */
8010     { PREFIX_TABLE (PREFIX_VEX_38A8) },
8011     { PREFIX_TABLE (PREFIX_VEX_38A9) },
8012     { PREFIX_TABLE (PREFIX_VEX_38AA) },
8013     { PREFIX_TABLE (PREFIX_VEX_38AB) },
8014     { PREFIX_TABLE (PREFIX_VEX_38AC) },
8015     { PREFIX_TABLE (PREFIX_VEX_38AD) },
8016     { PREFIX_TABLE (PREFIX_VEX_38AE) },
8017     { PREFIX_TABLE (PREFIX_VEX_38AF) },
8018     /* b0 */
8019     { "(bad)",          { XX } },
8020     { "(bad)",          { XX } },
8021     { "(bad)",          { XX } },
8022     { "(bad)",          { XX } },
8023     { "(bad)",          { XX } },
8024     { "(bad)",          { XX } },
8025     { PREFIX_TABLE (PREFIX_VEX_38B6) },
8026     { PREFIX_TABLE (PREFIX_VEX_38B7) },
8027     /* b8 */
8028     { PREFIX_TABLE (PREFIX_VEX_38B8) },
8029     { PREFIX_TABLE (PREFIX_VEX_38B9) },
8030     { PREFIX_TABLE (PREFIX_VEX_38BA) },
8031     { PREFIX_TABLE (PREFIX_VEX_38BB) },
8032     { PREFIX_TABLE (PREFIX_VEX_38BC) },
8033     { PREFIX_TABLE (PREFIX_VEX_38BD) },
8034     { PREFIX_TABLE (PREFIX_VEX_38BE) },
8035     { PREFIX_TABLE (PREFIX_VEX_38BF) },
8036     /* c0 */
8037     { "(bad)",          { XX } },
8038     { "(bad)",          { XX } },
8039     { "(bad)",          { XX } },
8040     { "(bad)",          { XX } },
8041     { "(bad)",          { XX } },
8042     { "(bad)",          { XX } },
8043     { "(bad)",          { XX } },
8044     { "(bad)",          { XX } },
8045     /* c8 */
8046     { "(bad)",          { XX } },
8047     { "(bad)",          { XX } },
8048     { "(bad)",          { XX } },
8049     { "(bad)",          { XX } },
8050     { "(bad)",          { XX } },
8051     { "(bad)",          { XX } },
8052     { "(bad)",          { XX } },
8053     { "(bad)",          { XX } },
8054     /* d0 */
8055     { "(bad)",          { XX } },
8056     { "(bad)",          { XX } },
8057     { "(bad)",          { XX } },
8058     { "(bad)",          { XX } },
8059     { "(bad)",          { XX } },
8060     { "(bad)",          { XX } },
8061     { "(bad)",          { XX } },
8062     { "(bad)",          { XX } },
8063     /* d8 */
8064     { "(bad)",          { XX } },
8065     { "(bad)",          { XX } },
8066     { "(bad)",          { XX } },
8067     { PREFIX_TABLE (PREFIX_VEX_38DB) },
8068     { PREFIX_TABLE (PREFIX_VEX_38DC) },
8069     { PREFIX_TABLE (PREFIX_VEX_38DD) },
8070     { PREFIX_TABLE (PREFIX_VEX_38DE) },
8071     { PREFIX_TABLE (PREFIX_VEX_38DF) },
8072     /* e0 */
8073     { "(bad)",          { XX } },
8074     { "(bad)",          { XX } },
8075     { "(bad)",          { XX } },
8076     { "(bad)",          { XX } },
8077     { "(bad)",          { XX } },
8078     { "(bad)",          { XX } },
8079     { "(bad)",          { XX } },
8080     { "(bad)",          { XX } },
8081     /* e8 */
8082     { "(bad)",          { XX } },
8083     { "(bad)",          { XX } },
8084     { "(bad)",          { XX } },
8085     { "(bad)",          { XX } },
8086     { "(bad)",          { XX } },
8087     { "(bad)",          { XX } },
8088     { "(bad)",          { XX } },
8089     { "(bad)",          { XX } },
8090     /* f0 */
8091     { "(bad)",          { XX } },
8092     { "(bad)",          { XX } },
8093     { "(bad)",          { XX } },
8094     { "(bad)",          { XX } },
8095     { "(bad)",          { XX } },
8096     { "(bad)",          { XX } },
8097     { "(bad)",          { XX } },
8098     { "(bad)",          { XX } },
8099     /* f8 */
8100     { "(bad)",          { XX } },
8101     { "(bad)",          { XX } },
8102     { "(bad)",          { XX } },
8103     { "(bad)",          { XX } },
8104     { "(bad)",          { XX } },
8105     { "(bad)",          { XX } },
8106     { "(bad)",          { XX } },
8107     { "(bad)",          { XX } },
8108   },
8109   /* VEX_0F3A */
8110   {
8111     /* 00 */
8112     { "(bad)",          { XX } },
8113     { "(bad)",          { XX } },
8114     { "(bad)",          { XX } },
8115     { "(bad)",          { XX } },
8116     { PREFIX_TABLE (PREFIX_VEX_3A04) },
8117     { PREFIX_TABLE (PREFIX_VEX_3A05) },
8118     { PREFIX_TABLE (PREFIX_VEX_3A06) },
8119     { "(bad)",          { XX } },
8120     /* 08 */
8121     { PREFIX_TABLE (PREFIX_VEX_3A08) },
8122     { PREFIX_TABLE (PREFIX_VEX_3A09) },
8123     { PREFIX_TABLE (PREFIX_VEX_3A0A) },
8124     { PREFIX_TABLE (PREFIX_VEX_3A0B) },
8125     { PREFIX_TABLE (PREFIX_VEX_3A0C) },
8126     { PREFIX_TABLE (PREFIX_VEX_3A0D) },
8127     { PREFIX_TABLE (PREFIX_VEX_3A0E) },
8128     { PREFIX_TABLE (PREFIX_VEX_3A0F) },
8129     /* 10 */
8130     { "(bad)",          { XX } },
8131     { "(bad)",          { XX } },
8132     { "(bad)",          { XX } },
8133     { "(bad)",          { XX } },
8134     { PREFIX_TABLE (PREFIX_VEX_3A14) },
8135     { PREFIX_TABLE (PREFIX_VEX_3A15) },
8136     { PREFIX_TABLE (PREFIX_VEX_3A16) },
8137     { PREFIX_TABLE (PREFIX_VEX_3A17) },
8138     /* 18 */
8139     { PREFIX_TABLE (PREFIX_VEX_3A18) },
8140     { PREFIX_TABLE (PREFIX_VEX_3A19) },
8141     { "(bad)",          { XX } },
8142     { "(bad)",          { XX } },
8143     { "(bad)",          { XX } },
8144     { "(bad)",          { XX } },
8145     { "(bad)",          { XX } },
8146     { "(bad)",          { XX } },
8147     /* 20 */
8148     { PREFIX_TABLE (PREFIX_VEX_3A20) },
8149     { PREFIX_TABLE (PREFIX_VEX_3A21) },
8150     { PREFIX_TABLE (PREFIX_VEX_3A22) },
8151     { "(bad)",          { XX } },
8152     { "(bad)",          { XX } },
8153     { "(bad)",          { XX } },
8154     { "(bad)",          { XX } },
8155     { "(bad)",          { XX } },
8156     /* 28 */
8157     { "(bad)",          { XX } },
8158     { "(bad)",          { XX } },
8159     { "(bad)",          { XX } },
8160     { "(bad)",          { XX } },
8161     { "(bad)",          { XX } },
8162     { "(bad)",          { XX } },
8163     { "(bad)",          { XX } },
8164     { "(bad)",          { XX } },
8165     /* 30 */
8166     { "(bad)",          { XX } },
8167     { "(bad)",          { XX } },
8168     { "(bad)",          { XX } },
8169     { "(bad)",          { XX } },
8170     { "(bad)",          { XX } },
8171     { "(bad)",          { XX } },
8172     { "(bad)",          { XX } },
8173     { "(bad)",          { XX } },
8174     /* 38 */
8175     { "(bad)",          { XX } },
8176     { "(bad)",          { XX } },
8177     { "(bad)",          { XX } },
8178     { "(bad)",          { XX } },
8179     { "(bad)",          { XX } },
8180     { "(bad)",          { XX } },
8181     { "(bad)",          { XX } },
8182     { "(bad)",          { XX } },
8183     /* 40 */
8184     { PREFIX_TABLE (PREFIX_VEX_3A40) },
8185     { PREFIX_TABLE (PREFIX_VEX_3A41) },
8186     { PREFIX_TABLE (PREFIX_VEX_3A42) },
8187     { "(bad)",          { XX } },
8188     { PREFIX_TABLE (PREFIX_VEX_3A44) },
8189     { "(bad)",          { XX } },
8190     { "(bad)",          { XX } },
8191     { "(bad)",          { XX } },
8192     /* 48 */
8193     { "(bad)",          { XX } },
8194     { "(bad)",          { XX } },
8195     { PREFIX_TABLE (PREFIX_VEX_3A4A) },
8196     { PREFIX_TABLE (PREFIX_VEX_3A4B) },
8197     { PREFIX_TABLE (PREFIX_VEX_3A4C) },
8198     { "(bad)",          { XX } },
8199     { "(bad)",          { XX } },
8200     { "(bad)",          { XX } },
8201     /* 50 */
8202     { "(bad)",          { XX } },
8203     { "(bad)",          { XX } },
8204     { "(bad)",          { XX } },
8205     { "(bad)",          { XX } },
8206     { "(bad)",          { XX } },
8207     { "(bad)",          { XX } },
8208     { "(bad)",          { XX } },
8209     { "(bad)",          { XX } },
8210     /* 58 */
8211     { "(bad)",          { XX } },
8212     { "(bad)",          { XX } },
8213     { "(bad)",          { XX } },
8214     { "(bad)",          { XX } },
8215     { PREFIX_TABLE (PREFIX_VEX_3A5C) },
8216     { PREFIX_TABLE (PREFIX_VEX_3A5D) },
8217     { PREFIX_TABLE (PREFIX_VEX_3A5E) },
8218     { PREFIX_TABLE (PREFIX_VEX_3A5F) },
8219     /* 60 */
8220     { PREFIX_TABLE (PREFIX_VEX_3A60) },
8221     { PREFIX_TABLE (PREFIX_VEX_3A61) },
8222     { PREFIX_TABLE (PREFIX_VEX_3A62) },
8223     { PREFIX_TABLE (PREFIX_VEX_3A63) },
8224     { "(bad)",          { XX } },
8225     { "(bad)",          { XX } },
8226     { "(bad)",          { XX } },
8227     { "(bad)",          { XX } },
8228     /* 68 */
8229     { PREFIX_TABLE (PREFIX_VEX_3A68) },
8230     { PREFIX_TABLE (PREFIX_VEX_3A69) },
8231     { PREFIX_TABLE (PREFIX_VEX_3A6A) },
8232     { PREFIX_TABLE (PREFIX_VEX_3A6B) },
8233     { PREFIX_TABLE (PREFIX_VEX_3A6C) },
8234     { PREFIX_TABLE (PREFIX_VEX_3A6D) },
8235     { PREFIX_TABLE (PREFIX_VEX_3A6E) },
8236     { PREFIX_TABLE (PREFIX_VEX_3A6F) },
8237     /* 70 */
8238     { "(bad)",          { XX } },
8239     { "(bad)",          { XX } },
8240     { "(bad)",          { XX } },
8241     { "(bad)",          { XX } },
8242     { "(bad)",          { XX } },
8243     { "(bad)",          { XX } },
8244     { "(bad)",          { XX } },
8245     { "(bad)",          { XX } },
8246     /* 78 */
8247     { PREFIX_TABLE (PREFIX_VEX_3A78) },
8248     { PREFIX_TABLE (PREFIX_VEX_3A79) },
8249     { PREFIX_TABLE (PREFIX_VEX_3A7A) },
8250     { PREFIX_TABLE (PREFIX_VEX_3A7B) },
8251     { PREFIX_TABLE (PREFIX_VEX_3A7C) },
8252     { PREFIX_TABLE (PREFIX_VEX_3A7D) },
8253     { PREFIX_TABLE (PREFIX_VEX_3A7E) },
8254     { PREFIX_TABLE (PREFIX_VEX_3A7F) },
8255     /* 80 */
8256     { "(bad)",          { XX } },
8257     { "(bad)",          { XX } },
8258     { "(bad)",          { XX } },
8259     { "(bad)",          { XX } },
8260     { "(bad)",          { XX } },
8261     { "(bad)",          { XX } },
8262     { "(bad)",          { XX } },
8263     { "(bad)",          { XX } },
8264     /* 88 */
8265     { "(bad)",          { XX } },
8266     { "(bad)",          { XX } },
8267     { "(bad)",          { XX } },
8268     { "(bad)",          { XX } },
8269     { "(bad)",          { XX } },
8270     { "(bad)",          { XX } },
8271     { "(bad)",          { XX } },
8272     { "(bad)",          { XX } },
8273     /* 90 */
8274     { "(bad)",          { XX } },
8275     { "(bad)",          { XX } },
8276     { "(bad)",          { XX } },
8277     { "(bad)",          { XX } },
8278     { "(bad)",          { XX } },
8279     { "(bad)",          { XX } },
8280     { "(bad)",          { XX } },
8281     { "(bad)",          { XX } },
8282     /* 98 */
8283     { "(bad)",          { XX } },
8284     { "(bad)",          { XX } },
8285     { "(bad)",          { XX } },
8286     { "(bad)",          { XX } },
8287     { "(bad)",          { XX } },
8288     { "(bad)",          { XX } },
8289     { "(bad)",          { XX } },
8290     { "(bad)",          { XX } },
8291     /* a0 */
8292     { "(bad)",          { XX } },
8293     { "(bad)",          { XX } },
8294     { "(bad)",          { XX } },
8295     { "(bad)",          { XX } },
8296     { "(bad)",          { XX } },
8297     { "(bad)",          { XX } },
8298     { "(bad)",          { XX } },
8299     { "(bad)",          { XX } },
8300     /* a8 */
8301     { "(bad)",          { XX } },
8302     { "(bad)",          { XX } },
8303     { "(bad)",          { XX } },
8304     { "(bad)",          { XX } },
8305     { "(bad)",          { XX } },
8306     { "(bad)",          { XX } },
8307     { "(bad)",          { XX } },
8308     { "(bad)",          { XX } },
8309     /* b0 */
8310     { "(bad)",          { XX } },
8311     { "(bad)",          { XX } },
8312     { "(bad)",          { XX } },
8313     { "(bad)",          { XX } },
8314     { "(bad)",          { XX } },
8315     { "(bad)",          { XX } },
8316     { "(bad)",          { XX } },
8317     { "(bad)",          { XX } },
8318     /* b8 */
8319     { "(bad)",          { XX } },
8320     { "(bad)",          { XX } },
8321     { "(bad)",          { XX } },
8322     { "(bad)",          { XX } },
8323     { "(bad)",          { XX } },
8324     { "(bad)",          { XX } },
8325     { "(bad)",          { XX } },
8326     { "(bad)",          { XX } },
8327     /* c0 */
8328     { "(bad)",          { XX } },
8329     { "(bad)",          { XX } },
8330     { "(bad)",          { XX } },
8331     { "(bad)",          { XX } },
8332     { "(bad)",          { XX } },
8333     { "(bad)",          { XX } },
8334     { "(bad)",          { XX } },
8335     { "(bad)",          { XX } },
8336     /* c8 */
8337     { "(bad)",          { XX } },
8338     { "(bad)",          { XX } },
8339     { "(bad)",          { XX } },
8340     { "(bad)",          { XX } },
8341     { "(bad)",          { XX } },
8342     { "(bad)",          { XX } },
8343     { "(bad)",          { XX } },
8344     { "(bad)",          { XX } },
8345     /* d0 */
8346     { "(bad)",          { XX } },
8347     { "(bad)",          { XX } },
8348     { "(bad)",          { XX } },
8349     { "(bad)",          { XX } },
8350     { "(bad)",          { XX } },
8351     { "(bad)",          { XX } },
8352     { "(bad)",          { XX } },
8353     { "(bad)",          { XX } },
8354     /* d8 */
8355     { "(bad)",          { XX } },
8356     { "(bad)",          { XX } },
8357     { "(bad)",          { XX } },
8358     { "(bad)",          { XX } },
8359     { "(bad)",          { XX } },
8360     { "(bad)",          { XX } },
8361     { "(bad)",          { XX } },
8362     { PREFIX_TABLE (PREFIX_VEX_3ADF) },
8363     /* e0 */
8364     { "(bad)",          { XX } },
8365     { "(bad)",          { XX } },
8366     { "(bad)",          { XX } },
8367     { "(bad)",          { XX } },
8368     { "(bad)",          { XX } },
8369     { "(bad)",          { XX } },
8370     { "(bad)",          { XX } },
8371     { "(bad)",          { XX } },
8372     /* e8 */
8373     { "(bad)",          { XX } },
8374     { "(bad)",          { XX } },
8375     { "(bad)",          { XX } },
8376     { "(bad)",          { XX } },
8377     { "(bad)",          { XX } },
8378     { "(bad)",          { XX } },
8379     { "(bad)",          { XX } },
8380     { "(bad)",          { XX } },
8381     /* f0 */
8382     { "(bad)",          { XX } },
8383     { "(bad)",          { XX } },
8384     { "(bad)",          { XX } },
8385     { "(bad)",          { XX } },
8386     { "(bad)",          { XX } },
8387     { "(bad)",          { XX } },
8388     { "(bad)",          { XX } },
8389     { "(bad)",          { XX } },
8390     /* f8 */
8391     { "(bad)",          { XX } },
8392     { "(bad)",          { XX } },
8393     { "(bad)",          { XX } },
8394     { "(bad)",          { XX } },
8395     { "(bad)",          { XX } },
8396     { "(bad)",          { XX } },
8397     { "(bad)",          { XX } },
8398     { "(bad)",          { XX } },
8399   },
8400 };
8401
8402 static const struct dis386 vex_len_table[][2] = {
8403   /* VEX_LEN_10_P_1 */
8404   {
8405     { VEX_W_TABLE (VEX_W_10_P_1) },
8406     { "(bad)",          { XX } },
8407   },
8408
8409   /* VEX_LEN_10_P_3 */
8410   {
8411     { VEX_W_TABLE (VEX_W_10_P_3) },
8412     { "(bad)",          { XX } },
8413   },
8414
8415   /* VEX_LEN_11_P_1 */
8416   {
8417     { VEX_W_TABLE (VEX_W_11_P_1) },
8418     { "(bad)",          { XX } },
8419   },
8420
8421   /* VEX_LEN_11_P_3 */
8422   {
8423     { VEX_W_TABLE (VEX_W_11_P_3) },
8424     { "(bad)",          { XX } },
8425   },
8426
8427   /* VEX_LEN_12_P_0_M_0 */
8428   {
8429     { VEX_W_TABLE (VEX_W_12_P_0_M_0) },
8430     { "(bad)",          { XX } },
8431   },
8432
8433   /* VEX_LEN_12_P_0_M_1 */
8434   {
8435     { VEX_W_TABLE (VEX_W_12_P_0_M_1) },
8436     { "(bad)",          { XX } },
8437   },
8438
8439   /* VEX_LEN_12_P_2 */
8440   {
8441     { VEX_W_TABLE (VEX_W_12_P_2) },
8442     { "(bad)",          { XX } },
8443   },
8444
8445   /* VEX_LEN_13_M_0 */
8446   {
8447     { VEX_W_TABLE (VEX_W_13_M_0) },
8448     { "(bad)",          { XX } },
8449   },
8450
8451   /* VEX_LEN_16_P_0_M_0 */
8452   {
8453     { VEX_W_TABLE (VEX_W_16_P_0_M_0) },
8454     { "(bad)",          { XX } },
8455   },
8456
8457   /* VEX_LEN_16_P_0_M_1 */
8458   {
8459     { VEX_W_TABLE (VEX_W_16_P_0_M_1) },
8460     { "(bad)",          { XX } },
8461   },
8462
8463   /* VEX_LEN_16_P_2 */
8464   {
8465     { VEX_W_TABLE (VEX_W_16_P_2) },
8466     { "(bad)",          { XX } },
8467   },
8468
8469   /* VEX_LEN_17_M_0 */
8470   {
8471     { VEX_W_TABLE (VEX_W_17_M_0) },
8472     { "(bad)",          { XX } },
8473   },
8474
8475   /* VEX_LEN_2A_P_1 */
8476   {
8477     { "vcvtsi2ss%LQ",   { XM, Vex128, Ev } },
8478     { "(bad)",          { XX } },
8479   },
8480
8481   /* VEX_LEN_2A_P_3 */
8482   {
8483     { "vcvtsi2sd%LQ",   { XM, Vex128, Ev } },
8484     { "(bad)",          { XX } },
8485   },
8486
8487   /* VEX_LEN_2C_P_1 */
8488   {
8489     { "vcvttss2siY",    { Gv, EXd } },
8490     { "(bad)",          { XX } },
8491   },
8492
8493   /* VEX_LEN_2C_P_3 */
8494   {
8495     { "vcvttsd2siY",    { Gv, EXq } },
8496     { "(bad)",          { XX } },
8497   },
8498
8499   /* VEX_LEN_2D_P_1 */
8500   {
8501     { "vcvtss2siY",     { Gv, EXd } },
8502     { "(bad)",          { XX } },
8503   },
8504
8505   /* VEX_LEN_2D_P_3 */
8506   {
8507     { "vcvtsd2siY",     { Gv, EXq } },
8508     { "(bad)",          { XX } },
8509   },
8510
8511   /* VEX_LEN_2E_P_0 */
8512   {
8513     { VEX_W_TABLE (VEX_W_2E_P_0) },
8514     { "(bad)",          { XX } },
8515   },
8516
8517   /* VEX_LEN_2E_P_2 */
8518   {
8519     { VEX_W_TABLE (VEX_W_2E_P_2) },
8520     { "(bad)",          { XX } },
8521   },
8522
8523   /* VEX_LEN_2F_P_0 */
8524   {
8525     { VEX_W_TABLE (VEX_W_2F_P_0) },
8526     { "(bad)",          { XX } },
8527   },
8528
8529   /* VEX_LEN_2F_P_2 */
8530   {
8531     { VEX_W_TABLE (VEX_W_2F_P_2) },
8532     { "(bad)",          { XX } },
8533   },
8534
8535   /* VEX_LEN_51_P_1 */
8536   {
8537     { VEX_W_TABLE (VEX_W_51_P_1) },
8538     { "(bad)",          { XX } },
8539   },
8540
8541   /* VEX_LEN_51_P_3 */
8542   {
8543     { VEX_W_TABLE (VEX_W_51_P_3) },
8544     { "(bad)",          { XX } },
8545   },
8546
8547   /* VEX_LEN_52_P_1 */
8548   {
8549     { VEX_W_TABLE (VEX_W_52_P_1) },
8550     { "(bad)",          { XX } },
8551   },
8552
8553   /* VEX_LEN_53_P_1 */
8554   {
8555     { VEX_W_TABLE (VEX_W_53_P_1) },
8556     { "(bad)",          { XX } },
8557   },
8558
8559   /* VEX_LEN_58_P_1 */
8560   {
8561     { VEX_W_TABLE (VEX_W_58_P_1) },
8562     { "(bad)",          { XX } },
8563   },
8564
8565   /* VEX_LEN_58_P_3 */
8566   {
8567     { VEX_W_TABLE (VEX_W_58_P_3) },
8568     { "(bad)",          { XX } },
8569   },
8570
8571   /* VEX_LEN_59_P_1 */
8572   {
8573     { VEX_W_TABLE (VEX_W_59_P_1) },
8574     { "(bad)",          { XX } },
8575   },
8576
8577   /* VEX_LEN_59_P_3 */
8578   {
8579     { VEX_W_TABLE (VEX_W_59_P_3) },
8580     { "(bad)",          { XX } },
8581   },
8582
8583   /* VEX_LEN_5A_P_1 */
8584   {
8585     { VEX_W_TABLE (VEX_W_5A_P_1) },
8586     { "(bad)",          { XX } },
8587   },
8588
8589   /* VEX_LEN_5A_P_3 */
8590   {
8591     { VEX_W_TABLE (VEX_W_5A_P_3) },
8592     { "(bad)",          { XX } },
8593   },
8594
8595   /* VEX_LEN_5C_P_1 */
8596   {
8597     { VEX_W_TABLE (VEX_W_5C_P_1) },
8598     { "(bad)",          { XX } },
8599   },
8600
8601   /* VEX_LEN_5C_P_3 */
8602   {
8603     { VEX_W_TABLE (VEX_W_5C_P_3) },
8604     { "(bad)",          { XX } },
8605   },
8606
8607   /* VEX_LEN_5D_P_1 */
8608   {
8609     { VEX_W_TABLE (VEX_W_5D_P_1) },
8610     { "(bad)",          { XX } },
8611   },
8612
8613   /* VEX_LEN_5D_P_3 */
8614   {
8615     { VEX_W_TABLE (VEX_W_5D_P_3) },
8616     { "(bad)",          { XX } },
8617   },
8618
8619   /* VEX_LEN_5E_P_1 */
8620   {
8621     { VEX_W_TABLE (VEX_W_5E_P_1) },
8622     { "(bad)",          { XX } },
8623   },
8624
8625   /* VEX_LEN_5E_P_3 */
8626   {
8627     { VEX_W_TABLE (VEX_W_5E_P_3) },
8628     { "(bad)",          { XX } },
8629   },
8630
8631   /* VEX_LEN_5F_P_1 */
8632   {
8633     { VEX_W_TABLE (VEX_W_5F_P_1) },
8634     { "(bad)",          { XX } },
8635   },
8636
8637   /* VEX_LEN_5F_P_3 */
8638   {
8639     { VEX_W_TABLE (VEX_W_5F_P_3) },
8640     { "(bad)",          { XX } },
8641   },
8642
8643   /* VEX_LEN_60_P_2 */
8644   {
8645     { VEX_W_TABLE (VEX_W_60_P_2) },
8646     { "(bad)",          { XX } },
8647   },
8648
8649   /* VEX_LEN_61_P_2 */
8650   {
8651     { VEX_W_TABLE (VEX_W_61_P_2) },
8652     { "(bad)",          { XX } },
8653   },
8654
8655   /* VEX_LEN_62_P_2 */
8656   {
8657     { VEX_W_TABLE (VEX_W_62_P_2) },
8658     { "(bad)",          { XX } },
8659   },
8660
8661   /* VEX_LEN_63_P_2 */
8662   {
8663     { VEX_W_TABLE (VEX_W_63_P_2) },
8664     { "(bad)",          { XX } },
8665   },
8666
8667   /* VEX_LEN_64_P_2 */
8668   {
8669     { VEX_W_TABLE (VEX_W_64_P_2) },
8670     { "(bad)",          { XX } },
8671   },
8672
8673   /* VEX_LEN_65_P_2 */
8674   {
8675     { VEX_W_TABLE (VEX_W_65_P_2) },
8676     { "(bad)",          { XX } },
8677   },
8678
8679   /* VEX_LEN_66_P_2 */
8680   {
8681     { VEX_W_TABLE (VEX_W_66_P_2) },
8682     { "(bad)",          { XX } },
8683   },
8684
8685   /* VEX_LEN_67_P_2 */
8686   {
8687     { VEX_W_TABLE (VEX_W_67_P_2) },
8688     { "(bad)",          { XX } },
8689   },
8690
8691   /* VEX_LEN_68_P_2 */
8692   {
8693     { VEX_W_TABLE (VEX_W_68_P_2) },
8694     { "(bad)",          { XX } },
8695   },
8696
8697   /* VEX_LEN_69_P_2 */
8698   {
8699     { VEX_W_TABLE (VEX_W_69_P_2) },
8700     { "(bad)",          { XX } },
8701   },
8702
8703   /* VEX_LEN_6A_P_2 */
8704   {
8705     { VEX_W_TABLE (VEX_W_6A_P_2) },
8706     { "(bad)",          { XX } },
8707   },
8708
8709   /* VEX_LEN_6B_P_2 */
8710   {
8711     { VEX_W_TABLE (VEX_W_6B_P_2) },
8712     { "(bad)",          { XX } },
8713   },
8714
8715   /* VEX_LEN_6C_P_2 */
8716   {
8717     { VEX_W_TABLE (VEX_W_6C_P_2) },
8718     { "(bad)",          { XX } },
8719   },
8720
8721   /* VEX_LEN_6D_P_2 */
8722   {
8723     { VEX_W_TABLE (VEX_W_6D_P_2) },
8724     { "(bad)",          { XX } },
8725   },
8726
8727   /* VEX_LEN_6E_P_2 */
8728   {
8729     { "vmovK",          { XM, Edq } },
8730     { "(bad)",          { XX } },
8731   },
8732
8733   /* VEX_LEN_70_P_1 */
8734   {
8735     { VEX_W_TABLE (VEX_W_70_P_1) },
8736     { "(bad)",          { XX } },
8737   },
8738
8739   /* VEX_LEN_70_P_2 */
8740   {
8741     { VEX_W_TABLE (VEX_W_70_P_2) },
8742     { "(bad)",          { XX } },
8743   },
8744
8745   /* VEX_LEN_70_P_3 */
8746   {
8747     { VEX_W_TABLE (VEX_W_70_P_3) },
8748     { "(bad)",          { XX } },
8749   },
8750
8751   /* VEX_LEN_71_R_2_P_2 */
8752   {
8753     { VEX_W_TABLE (VEX_W_71_R_2_P_2) },
8754     { "(bad)",          { XX } },
8755   },
8756
8757   /* VEX_LEN_71_R_4_P_2 */
8758   {
8759     { VEX_W_TABLE (VEX_W_71_R_4_P_2) },
8760     { "(bad)",          { XX } },
8761   },
8762
8763   /* VEX_LEN_71_R_6_P_2 */
8764   {
8765     { VEX_W_TABLE (VEX_W_71_R_6_P_2) },
8766     { "(bad)",          { XX } },
8767   },
8768
8769   /* VEX_LEN_72_R_2_P_2 */
8770   {
8771     { VEX_W_TABLE (VEX_W_72_R_2_P_2) },
8772     { "(bad)",          { XX } },
8773   },
8774
8775   /* VEX_LEN_72_R_4_P_2 */
8776   {
8777     { VEX_W_TABLE (VEX_W_72_R_4_P_2) },
8778     { "(bad)",          { XX } },
8779   },
8780
8781   /* VEX_LEN_72_R_6_P_2 */
8782   {
8783     { VEX_W_TABLE (VEX_W_72_R_6_P_2) },
8784     { "(bad)",          { XX } },
8785   },
8786
8787   /* VEX_LEN_73_R_2_P_2 */
8788   {
8789     { VEX_W_TABLE (VEX_W_73_R_2_P_2) },
8790     { "(bad)",          { XX } },
8791   },
8792
8793   /* VEX_LEN_73_R_3_P_2 */
8794   {
8795     { VEX_W_TABLE (VEX_W_73_R_3_P_2) },
8796     { "(bad)",          { XX } },
8797   },
8798
8799   /* VEX_LEN_73_R_6_P_2 */
8800   {
8801     { VEX_W_TABLE (VEX_W_73_R_6_P_2) },
8802     { "(bad)",          { XX } },
8803   },
8804
8805   /* VEX_LEN_73_R_7_P_2 */
8806   {
8807     { VEX_W_TABLE (VEX_W_73_R_7_P_2) },
8808     { "(bad)",          { XX } },
8809   },
8810
8811   /* VEX_LEN_74_P_2 */
8812   {
8813     { VEX_W_TABLE (VEX_W_74_P_2) },
8814     { "(bad)",          { XX } },
8815   },
8816
8817   /* VEX_LEN_75_P_2 */
8818   {
8819     { VEX_W_TABLE (VEX_W_75_P_2) },
8820     { "(bad)",          { XX } },
8821   },
8822
8823   /* VEX_LEN_76_P_2 */
8824   {
8825     { VEX_W_TABLE (VEX_W_76_P_2) },
8826     { "(bad)",          { XX } },
8827   },
8828
8829   /* VEX_LEN_7E_P_1 */
8830   {
8831     { VEX_W_TABLE (VEX_W_7E_P_1) },
8832     { "(bad)",          { XX } },
8833   },
8834
8835   /* VEX_LEN_7E_P_2 */
8836   {
8837     { "vmovK",          { Edq, XM } },
8838     { "(bad)",          { XX } },
8839   },
8840
8841   /* VEX_LEN_AE_R_2_M_0 */
8842   {
8843     { VEX_W_TABLE (VEX_W_AE_R_2_M_0) },
8844     { "(bad)",          { XX } },
8845   },
8846
8847   /* VEX_LEN_AE_R_3_M_0 */
8848   {
8849     { VEX_W_TABLE (VEX_W_AE_R_3_M_0) },
8850     { "(bad)",          { XX } },
8851   },
8852
8853   /* VEX_LEN_C2_P_1 */
8854   {
8855     { VEX_W_TABLE (VEX_W_C2_P_1) },
8856     { "(bad)",          { XX } },
8857   },
8858
8859   /* VEX_LEN_C2_P_3 */
8860   {
8861     { VEX_W_TABLE (VEX_W_C2_P_3) },
8862     { "(bad)",          { XX } },
8863   },
8864
8865   /* VEX_LEN_C4_P_2 */
8866   {
8867     { VEX_W_TABLE (VEX_W_C4_P_2) },
8868     { "(bad)",          { XX } },
8869   },
8870
8871   /* VEX_LEN_C5_P_2 */
8872   {
8873     { VEX_W_TABLE (VEX_W_C5_P_2) },
8874     { "(bad)",          { XX } },
8875   },
8876
8877   /* VEX_LEN_D1_P_2 */
8878   {
8879     { VEX_W_TABLE (VEX_W_D1_P_2) },
8880     { "(bad)",          { XX } },
8881   },
8882
8883   /* VEX_LEN_D2_P_2 */
8884   {
8885     { VEX_W_TABLE (VEX_W_D2_P_2) },
8886     { "(bad)",          { XX } },
8887   },
8888
8889   /* VEX_LEN_D3_P_2 */
8890   {
8891     { VEX_W_TABLE (VEX_W_D3_P_2) },
8892     { "(bad)",          { XX } },
8893   },
8894
8895   /* VEX_LEN_D4_P_2 */
8896   {
8897     { VEX_W_TABLE (VEX_W_D4_P_2) },
8898     { "(bad)",          { XX } },
8899   },
8900
8901   /* VEX_LEN_D5_P_2 */
8902   {
8903     { VEX_W_TABLE (VEX_W_D5_P_2) },
8904     { "(bad)",          { XX } },
8905   },
8906
8907   /* VEX_LEN_D6_P_2 */
8908   {
8909     { VEX_W_TABLE (VEX_W_D6_P_2) },
8910     { "(bad)",          { XX } },
8911   },
8912
8913   /* VEX_LEN_D7_P_2_M_1 */
8914   {
8915     { VEX_W_TABLE (VEX_W_D7_P_2_M_1) },
8916     { "(bad)",          { XX } },
8917   },
8918
8919   /* VEX_LEN_D8_P_2 */
8920   {
8921     { VEX_W_TABLE (VEX_W_D8_P_2) },
8922     { "(bad)",          { XX } },
8923   },
8924
8925   /* VEX_LEN_D9_P_2 */
8926   {
8927     { VEX_W_TABLE (VEX_W_D9_P_2) },
8928     { "(bad)",          { XX } },
8929   },
8930
8931   /* VEX_LEN_DA_P_2 */
8932   {
8933     { VEX_W_TABLE (VEX_W_DA_P_2) },
8934     { "(bad)",          { XX } },
8935   },
8936
8937   /* VEX_LEN_DB_P_2 */
8938   {
8939     { VEX_W_TABLE (VEX_W_DB_P_2) },
8940     { "(bad)",          { XX } },
8941   },
8942
8943   /* VEX_LEN_DC_P_2 */
8944   {
8945     { VEX_W_TABLE (VEX_W_DC_P_2) },
8946     { "(bad)",          { XX } },
8947   },
8948
8949   /* VEX_LEN_DD_P_2 */
8950   {
8951     { VEX_W_TABLE (VEX_W_DD_P_2) },
8952     { "(bad)",          { XX } },
8953   },
8954
8955   /* VEX_LEN_DE_P_2 */
8956   {
8957     { VEX_W_TABLE (VEX_W_DE_P_2) },
8958     { "(bad)",          { XX } },
8959   },
8960
8961   /* VEX_LEN_DF_P_2 */
8962   {
8963     { VEX_W_TABLE (VEX_W_DF_P_2) },
8964     { "(bad)",          { XX } },
8965   },
8966
8967   /* VEX_LEN_E0_P_2 */
8968   {
8969     { VEX_W_TABLE (VEX_W_E0_P_2) },
8970     { "(bad)",          { XX } },
8971   },
8972
8973   /* VEX_LEN_E1_P_2 */
8974   {
8975     { VEX_W_TABLE (VEX_W_E1_P_2) },
8976     { "(bad)",          { XX } },
8977   },
8978
8979   /* VEX_LEN_E2_P_2 */
8980   {
8981     { VEX_W_TABLE (VEX_W_E2_P_2) },
8982     { "(bad)",          { XX } },
8983   },
8984
8985   /* VEX_LEN_E3_P_2 */
8986   {
8987     { VEX_W_TABLE (VEX_W_E3_P_2) },
8988     { "(bad)",          { XX } },
8989   },
8990
8991   /* VEX_LEN_E4_P_2 */
8992   {
8993     { VEX_W_TABLE (VEX_W_E4_P_2) },
8994     { "(bad)",          { XX } },
8995   },
8996
8997   /* VEX_LEN_E5_P_2 */
8998   {
8999     { VEX_W_TABLE (VEX_W_E5_P_2) },
9000     { "(bad)",          { XX } },
9001   },
9002
9003   /* VEX_LEN_E8_P_2 */
9004   {
9005     { VEX_W_TABLE (VEX_W_E8_P_2) },
9006     { "(bad)",          { XX } },
9007   },
9008
9009   /* VEX_LEN_E9_P_2 */
9010   {
9011     { VEX_W_TABLE (VEX_W_E9_P_2) },
9012     { "(bad)",          { XX } },
9013   },
9014
9015   /* VEX_LEN_EA_P_2 */
9016   {
9017     { VEX_W_TABLE (VEX_W_EA_P_2) },
9018     { "(bad)",          { XX } },
9019   },
9020
9021   /* VEX_LEN_EB_P_2 */
9022   {
9023     { VEX_W_TABLE (VEX_W_EB_P_2) },
9024     { "(bad)",          { XX } },
9025   },
9026
9027   /* VEX_LEN_EC_P_2 */
9028   {
9029     { VEX_W_TABLE (VEX_W_EC_P_2) },
9030     { "(bad)",          { XX } },
9031   },
9032
9033   /* VEX_LEN_ED_P_2 */
9034   {
9035     { VEX_W_TABLE (VEX_W_ED_P_2) },
9036     { "(bad)",          { XX } },
9037   },
9038
9039   /* VEX_LEN_EE_P_2 */
9040   {
9041     { VEX_W_TABLE (VEX_W_EE_P_2) },
9042     { "(bad)",          { XX } },
9043   },
9044
9045   /* VEX_LEN_EF_P_2 */
9046   {
9047     { VEX_W_TABLE (VEX_W_EF_P_2) },
9048     { "(bad)",          { XX } },
9049   },
9050
9051   /* VEX_LEN_F1_P_2 */
9052   {
9053     { VEX_W_TABLE (VEX_W_F1_P_2) },
9054     { "(bad)",          { XX } },
9055   },
9056
9057   /* VEX_LEN_F2_P_2 */
9058   {
9059     { VEX_W_TABLE (VEX_W_F2_P_2) },
9060     { "(bad)",          { XX } },
9061   },
9062
9063   /* VEX_LEN_F3_P_2 */
9064   {
9065     { VEX_W_TABLE (VEX_W_F3_P_2) },
9066     { "(bad)",          { XX } },
9067   },
9068
9069   /* VEX_LEN_F4_P_2 */
9070   {
9071     { VEX_W_TABLE (VEX_W_F4_P_2) },
9072     { "(bad)",          { XX } },
9073   },
9074
9075   /* VEX_LEN_F5_P_2 */
9076   {
9077     { VEX_W_TABLE (VEX_W_F5_P_2) },
9078     { "(bad)",          { XX } },
9079   },
9080
9081   /* VEX_LEN_F6_P_2 */
9082   {
9083     { VEX_W_TABLE (VEX_W_F6_P_2) },
9084     { "(bad)",          { XX } },
9085   },
9086
9087   /* VEX_LEN_F7_P_2 */
9088   {
9089     { VEX_W_TABLE (VEX_W_F7_P_2) },
9090     { "(bad)",          { XX } },
9091   },
9092
9093   /* VEX_LEN_F8_P_2 */
9094   {
9095     { VEX_W_TABLE (VEX_W_F8_P_2) },
9096     { "(bad)",          { XX } },
9097   },
9098
9099   /* VEX_LEN_F9_P_2 */
9100   {
9101     { VEX_W_TABLE (VEX_W_F9_P_2) },
9102     { "(bad)",          { XX } },
9103   },
9104
9105   /* VEX_LEN_FA_P_2 */
9106   {
9107     { VEX_W_TABLE (VEX_W_FA_P_2) },
9108     { "(bad)",          { XX } },
9109   },
9110
9111   /* VEX_LEN_FB_P_2 */
9112   {
9113     { VEX_W_TABLE (VEX_W_FB_P_2) },
9114     { "(bad)",          { XX } },
9115   },
9116
9117   /* VEX_LEN_FC_P_2 */
9118   {
9119     { VEX_W_TABLE (VEX_W_FC_P_2) },
9120     { "(bad)",          { XX } },
9121   },
9122
9123   /* VEX_LEN_FD_P_2 */
9124   {
9125     { VEX_W_TABLE (VEX_W_FD_P_2) },
9126     { "(bad)",          { XX } },
9127   },
9128
9129   /* VEX_LEN_FE_P_2 */
9130   {
9131     { VEX_W_TABLE (VEX_W_FE_P_2) },
9132     { "(bad)",          { XX } },
9133   },
9134
9135   /* VEX_LEN_3800_P_2 */
9136   {
9137     { VEX_W_TABLE (VEX_W_3800_P_2) },
9138     { "(bad)",          { XX } },
9139   },
9140
9141   /* VEX_LEN_3801_P_2 */
9142   {
9143     { VEX_W_TABLE (VEX_W_3801_P_2) },
9144     { "(bad)",          { XX } },
9145   },
9146
9147   /* VEX_LEN_3802_P_2 */
9148   {
9149     { VEX_W_TABLE (VEX_W_3802_P_2) },
9150     { "(bad)",          { XX } },
9151   },
9152
9153   /* VEX_LEN_3803_P_2 */
9154   {
9155     { VEX_W_TABLE (VEX_W_3803_P_2) },
9156     { "(bad)",          { XX } },
9157   },
9158
9159   /* VEX_LEN_3804_P_2 */
9160   {
9161     { VEX_W_TABLE (VEX_W_3804_P_2) },
9162     { "(bad)",          { XX } },
9163   },
9164
9165   /* VEX_LEN_3805_P_2 */
9166   {
9167     { VEX_W_TABLE (VEX_W_3805_P_2) },
9168     { "(bad)",          { XX } },
9169   },
9170
9171   /* VEX_LEN_3806_P_2 */
9172   {
9173     { VEX_W_TABLE (VEX_W_3806_P_2) },
9174     { "(bad)",          { XX } },
9175   },
9176
9177   /* VEX_LEN_3807_P_2 */
9178   {
9179     { VEX_W_TABLE (VEX_W_3807_P_2) },
9180     { "(bad)",          { XX } },
9181   },
9182
9183   /* VEX_LEN_3808_P_2 */
9184   {
9185     { VEX_W_TABLE (VEX_W_3808_P_2) },
9186     { "(bad)",          { XX } },
9187   },
9188
9189   /* VEX_LEN_3809_P_2 */
9190   {
9191     { VEX_W_TABLE (VEX_W_3809_P_2) },
9192     { "(bad)",          { XX } },
9193   },
9194
9195   /* VEX_LEN_380A_P_2 */
9196   {
9197     { VEX_W_TABLE (VEX_W_380A_P_2) },
9198     { "(bad)",          { XX } },
9199   },
9200
9201   /* VEX_LEN_380B_P_2 */
9202   {
9203     { VEX_W_TABLE (VEX_W_380B_P_2) },
9204     { "(bad)",          { XX } },
9205   },
9206
9207   /* VEX_LEN_3819_P_2_M_0 */
9208   {
9209     { "(bad)",          { XX } },
9210     { VEX_W_TABLE (VEX_W_3819_P_2_M_0) },
9211   },
9212
9213   /* VEX_LEN_381A_P_2_M_0 */
9214   {
9215     { "(bad)",          { XX } },
9216     { VEX_W_TABLE (VEX_W_381A_P_2_M_0) },
9217   },
9218
9219   /* VEX_LEN_381C_P_2 */
9220   {
9221     { VEX_W_TABLE (VEX_W_381C_P_2) },
9222     { "(bad)",          { XX } },
9223   },
9224
9225   /* VEX_LEN_381D_P_2 */
9226   {
9227     { VEX_W_TABLE (VEX_W_381D_P_2) },
9228     { "(bad)",          { XX } },
9229   },
9230
9231   /* VEX_LEN_381E_P_2 */
9232   {
9233     { VEX_W_TABLE (VEX_W_381E_P_2) },
9234     { "(bad)",          { XX } },
9235   },
9236
9237   /* VEX_LEN_3820_P_2 */
9238   {
9239     { VEX_W_TABLE (VEX_W_3820_P_2) },
9240     { "(bad)",          { XX } },
9241   },
9242
9243   /* VEX_LEN_3821_P_2 */
9244   {
9245     { VEX_W_TABLE (VEX_W_3821_P_2) },
9246     { "(bad)",          { XX } },
9247   },
9248
9249   /* VEX_LEN_3822_P_2 */
9250   {
9251     { VEX_W_TABLE (VEX_W_3822_P_2) },
9252     { "(bad)",          { XX } },
9253   },
9254
9255   /* VEX_LEN_3823_P_2 */
9256   {
9257     { VEX_W_TABLE (VEX_W_3823_P_2) },
9258     { "(bad)",          { XX } },
9259   },
9260
9261   /* VEX_LEN_3824_P_2 */
9262   {
9263     { VEX_W_TABLE (VEX_W_3824_P_2) },
9264     { "(bad)",          { XX } },
9265   },
9266
9267   /* VEX_LEN_3825_P_2 */
9268   {
9269     { VEX_W_TABLE (VEX_W_3825_P_2) },
9270     { "(bad)",          { XX } },
9271   },
9272
9273   /* VEX_LEN_3828_P_2 */
9274   {
9275     { VEX_W_TABLE (VEX_W_3828_P_2) },
9276     { "(bad)",          { XX } },
9277   },
9278
9279   /* VEX_LEN_3829_P_2 */
9280   {
9281     { VEX_W_TABLE (VEX_W_3829_P_2) },
9282     { "(bad)",          { XX } },
9283   },
9284
9285   /* VEX_LEN_382A_P_2_M_0 */
9286   {
9287     { VEX_W_TABLE (VEX_W_382A_P_2_M_0) },
9288     { "(bad)",          { XX } },
9289   },
9290
9291   /* VEX_LEN_382B_P_2 */
9292   {
9293     { VEX_W_TABLE (VEX_W_382B_P_2) },
9294     { "(bad)",          { XX } },
9295   },
9296
9297   /* VEX_LEN_3830_P_2 */
9298   {
9299     { VEX_W_TABLE (VEX_W_3830_P_2) },
9300     { "(bad)",          { XX } },
9301   },
9302
9303   /* VEX_LEN_3831_P_2 */
9304   {
9305     { VEX_W_TABLE (VEX_W_3831_P_2) },
9306     { "(bad)",          { XX } },
9307   },
9308
9309   /* VEX_LEN_3832_P_2 */
9310   {
9311     { VEX_W_TABLE (VEX_W_3832_P_2) },
9312     { "(bad)",          { XX } },
9313   },
9314
9315   /* VEX_LEN_3833_P_2 */
9316   {
9317     { VEX_W_TABLE (VEX_W_3833_P_2) },
9318     { "(bad)",          { XX } },
9319   },
9320
9321   /* VEX_LEN_3834_P_2 */
9322   {
9323     { VEX_W_TABLE (VEX_W_3834_P_2) },
9324     { "(bad)",          { XX } },
9325   },
9326
9327   /* VEX_LEN_3835_P_2 */
9328   {
9329     { VEX_W_TABLE (VEX_W_3835_P_2) },
9330     { "(bad)",          { XX } },
9331   },
9332
9333   /* VEX_LEN_3837_P_2 */
9334   {
9335     { VEX_W_TABLE (VEX_W_3837_P_2) },
9336     { "(bad)",          { XX } },
9337   },
9338
9339   /* VEX_LEN_3838_P_2 */
9340   {
9341     { VEX_W_TABLE (VEX_W_3838_P_2) },
9342     { "(bad)",          { XX } },
9343   },
9344
9345   /* VEX_LEN_3839_P_2 */
9346   {
9347     { VEX_W_TABLE (VEX_W_3839_P_2) },
9348     { "(bad)",          { XX } },
9349   },
9350
9351   /* VEX_LEN_383A_P_2 */
9352   {
9353     { VEX_W_TABLE (VEX_W_383A_P_2) },
9354     { "(bad)",          { XX } },
9355   },
9356
9357   /* VEX_LEN_383B_P_2 */
9358   {
9359     { VEX_W_TABLE (VEX_W_383B_P_2) },
9360     { "(bad)",          { XX } },
9361   },
9362
9363   /* VEX_LEN_383C_P_2 */
9364   {
9365     { VEX_W_TABLE (VEX_W_383C_P_2) },
9366     { "(bad)",          { XX } },
9367   },
9368
9369   /* VEX_LEN_383D_P_2 */
9370   {
9371     { VEX_W_TABLE (VEX_W_383D_P_2) },
9372     { "(bad)",          { XX } },
9373   },
9374
9375   /* VEX_LEN_383E_P_2 */
9376   {
9377     { VEX_W_TABLE (VEX_W_383E_P_2) },
9378     { "(bad)",          { XX } },
9379   },
9380
9381   /* VEX_LEN_383F_P_2 */
9382   {
9383     { VEX_W_TABLE (VEX_W_383F_P_2) },
9384     { "(bad)",          { XX } },
9385   },
9386
9387   /* VEX_LEN_3840_P_2 */
9388   {
9389     { VEX_W_TABLE (VEX_W_3840_P_2) },
9390     { "(bad)",          { XX } },
9391   },
9392
9393   /* VEX_LEN_3841_P_2 */
9394   {
9395     { VEX_W_TABLE (VEX_W_3841_P_2) },
9396     { "(bad)",          { XX } },
9397   },
9398
9399   /* VEX_LEN_38DB_P_2 */
9400   {
9401     { VEX_W_TABLE (VEX_W_38DB_P_2) },
9402     { "(bad)",          { XX } },
9403   },
9404
9405   /* VEX_LEN_38DC_P_2 */
9406   {
9407     { VEX_W_TABLE (VEX_W_38DC_P_2) },
9408     { "(bad)",          { XX } },
9409   },
9410
9411   /* VEX_LEN_38DD_P_2 */
9412   {
9413     { VEX_W_TABLE (VEX_W_38DD_P_2) },
9414     { "(bad)",          { XX } },
9415   },
9416
9417   /* VEX_LEN_38DE_P_2 */
9418   {
9419     { VEX_W_TABLE (VEX_W_38DE_P_2) },
9420     { "(bad)",          { XX } },
9421   },
9422
9423   /* VEX_LEN_38DF_P_2 */
9424   {
9425     { VEX_W_TABLE (VEX_W_38DF_P_2) },
9426     { "(bad)",          { XX } },
9427   },
9428
9429   /* VEX_LEN_3A06_P_2 */
9430   {
9431     { "(bad)",          { XX } },
9432     { VEX_W_TABLE (VEX_W_3A06_P_2) },
9433   },
9434
9435   /* VEX_LEN_3A0A_P_2 */
9436   {
9437     { VEX_W_TABLE (VEX_W_3A0A_P_2) },
9438     { "(bad)",          { XX } },
9439   },
9440
9441   /* VEX_LEN_3A0B_P_2 */
9442   {
9443     { VEX_W_TABLE (VEX_W_3A0B_P_2) },
9444     { "(bad)",          { XX } },
9445   },
9446
9447   /* VEX_LEN_3A0E_P_2 */
9448   {
9449     { VEX_W_TABLE (VEX_W_3A0E_P_2) },
9450     { "(bad)",          { XX } },
9451   },
9452
9453   /* VEX_LEN_3A0F_P_2 */
9454   {
9455     { VEX_W_TABLE (VEX_W_3A0F_P_2) },
9456     { "(bad)",          { XX } },
9457   },
9458
9459   /* VEX_LEN_3A14_P_2 */
9460   {
9461     { VEX_W_TABLE (VEX_W_3A14_P_2) },
9462     { "(bad)",          { XX } },
9463   },
9464
9465   /* VEX_LEN_3A15_P_2 */
9466   {
9467     { VEX_W_TABLE (VEX_W_3A15_P_2) },
9468     { "(bad)",          { XX } },
9469   },
9470
9471   /* VEX_LEN_3A16_P_2  */
9472   {
9473     { "vpextrK",        { Edq, XM, Ib } },
9474     { "(bad)",          { XX } },
9475   },
9476
9477   /* VEX_LEN_3A17_P_2 */
9478   {
9479     { "vextractps",     { Edqd, XM, Ib } },
9480     { "(bad)",          { XX } },
9481   },
9482
9483   /* VEX_LEN_3A18_P_2 */
9484   {
9485     { "(bad)",          { XX } },
9486     { VEX_W_TABLE (VEX_W_3A18_P_2) },
9487   },
9488
9489   /* VEX_LEN_3A19_P_2 */
9490   {
9491     { "(bad)",          { XX } },
9492     { VEX_W_TABLE (VEX_W_3A19_P_2) },
9493   },
9494
9495   /* VEX_LEN_3A20_P_2 */
9496   {
9497     { VEX_W_TABLE (VEX_W_3A20_P_2) },
9498     { "(bad)",          { XX } },
9499   },
9500
9501   /* VEX_LEN_3A21_P_2 */
9502   {
9503     { VEX_W_TABLE (VEX_W_3A21_P_2) },
9504     { "(bad)",          { XX } },
9505   },
9506
9507   /* VEX_LEN_3A22_P_2 */
9508   {
9509     { "vpinsrK",        { XM, Vex128, Edq, Ib } },
9510     { "(bad)",          { XX } },
9511   },
9512
9513   /* VEX_LEN_3A41_P_2 */
9514   {
9515     { VEX_W_TABLE (VEX_W_3A41_P_2) },
9516     { "(bad)",          { XX } },
9517   },
9518
9519   /* VEX_LEN_3A42_P_2 */
9520   {
9521     { VEX_W_TABLE (VEX_W_3A42_P_2) },
9522     { "(bad)",          { XX } },
9523   },
9524
9525   /* VEX_LEN_3A44_P_2 */
9526   {
9527     { VEX_W_TABLE (VEX_W_3A44_P_2) },
9528     { "(bad)",          { XX } },
9529   },
9530
9531   /* VEX_LEN_3A4C_P_2 */
9532   {
9533     { VEX_W_TABLE (VEX_W_3A4C_P_2) },
9534     { "(bad)",          { XX } },
9535   },
9536
9537   /* VEX_LEN_3A60_P_2 */
9538   {
9539     { VEX_W_TABLE (VEX_W_3A60_P_2) },
9540     { "(bad)",          { XX } },
9541   },
9542
9543   /* VEX_LEN_3A61_P_2 */
9544   {
9545     { VEX_W_TABLE (VEX_W_3A61_P_2) },
9546     { "(bad)",          { XX } },
9547   },
9548
9549   /* VEX_LEN_3A62_P_2 */
9550   {
9551     { VEX_W_TABLE (VEX_W_3A62_P_2) },
9552     { "(bad)",          { XX } },
9553   },
9554
9555   /* VEX_LEN_3A63_P_2 */
9556   {
9557     { VEX_W_TABLE (VEX_W_3A63_P_2) },
9558     { "(bad)",          { XX } },
9559   },
9560
9561   /* VEX_LEN_3A6A_P_2 */
9562   {
9563     { "vfmaddss",       { XMVexW, Vex128, EXdVexW, EXdVexW, VexI4 } },
9564     { "(bad)",          { XX } },
9565   },
9566
9567   /* VEX_LEN_3A6B_P_2 */
9568   {
9569     { "vfmaddsd",       { XMVexW, Vex128, EXqVexW, EXqVexW, VexI4 } },
9570     { "(bad)",          { XX } },
9571   },
9572
9573   /* VEX_LEN_3A6E_P_2 */
9574   {
9575     { "vfmsubss",       { XMVexW, Vex128, EXdVexW, EXdVexW, VexI4 } },
9576     { "(bad)",          { XX } },
9577   },
9578
9579   /* VEX_LEN_3A6F_P_2 */
9580   {
9581     { "vfmsubsd",       { XMVexW, Vex128, EXqVexW, EXqVexW, VexI4 } },
9582     { "(bad)",          { XX } },
9583   },
9584
9585   /* VEX_LEN_3A7A_P_2 */
9586   {
9587     { "vfnmaddss",      { XMVexW, Vex128, EXdVexW, EXdVexW, VexI4 } },
9588     { "(bad)",          { XX } },
9589   },
9590
9591   /* VEX_LEN_3A7B_P_2 */
9592   {
9593     { "vfnmaddsd",      { XMVexW, Vex128, EXqVexW, EXqVexW, VexI4 } },
9594     { "(bad)",          { XX } },
9595   },
9596
9597   /* VEX_LEN_3A7E_P_2 */
9598   {
9599     { "vfnmsubss",      { XMVexW, Vex128, EXdVexW, EXdVexW, VexI4 } },
9600     { "(bad)",          { XX } },
9601   },
9602
9603   /* VEX_LEN_3A7F_P_2 */
9604   {
9605     { "vfnmsubsd",      { XMVexW, Vex128, EXqVexW, EXqVexW, VexI4 } },
9606     { "(bad)",          { XX } },
9607   },
9608
9609   /* VEX_LEN_3ADF_P_2 */
9610   {
9611     { VEX_W_TABLE (VEX_W_3ADF_P_2) },
9612     { "(bad)",          { XX } },
9613   },
9614
9615   /* VEX_LEN_XOP_09_80 */
9616   {
9617     { "vfrczps",        { XM, EXxmm } },
9618     { "vfrczps",        { XM, EXymmq } },
9619   },
9620
9621   /* VEX_LEN_XOP_09_81 */
9622   {
9623     { "vfrczpd",        { XM, EXxmm } },
9624     { "vfrczpd",        { XM, EXymmq } },
9625   },
9626 };
9627
9628 static const struct dis386 vex_w_table[][2] = {
9629   {
9630     /* VEX_W_10_P_0 */
9631     { "vmovups",        { XM, EXx } },
9632     { "(bad)",          { XX } },
9633   },
9634   {
9635     /* VEX_W_10_P_1 */
9636     { "vmovss",         { XMVex, Vex128, EXd } },
9637     { "(bad)",          { XX } },
9638   },
9639   {
9640     /* VEX_W_10_P_2 */
9641     { "vmovupd",        { XM, EXx } },
9642     { "(bad)",          { XX } },
9643   },
9644   {
9645     /* VEX_W_10_P_3 */
9646     { "vmovsd",         { XMVex, Vex128, EXq } },
9647     { "(bad)",          { XX } },
9648   },
9649   {
9650     /* VEX_W_11_P_0 */
9651     { "vmovups",        { EXxS, XM } },
9652     { "(bad)",          { XX } },
9653   },
9654   {
9655     /* VEX_W_11_P_1 */
9656     { "vmovss",         { EXdVexS, Vex128, XM } },
9657     { "(bad)",          { XX } },
9658   },
9659   {
9660     /* VEX_W_11_P_2 */
9661     { "vmovupd",        { EXxS, XM } },
9662     { "(bad)",          { XX } },
9663   },
9664   {
9665     /* VEX_W_11_P_3 */
9666     { "vmovsd",         { EXqVexS, Vex128, XM } },
9667     { "(bad)",          { XX } },
9668   },
9669   {
9670     /* VEX_W_12_P_0_M_0 */
9671     { "vmovlps",        { XM, Vex128, EXq } },
9672     { "(bad)",          { XX } },
9673   },
9674   {
9675     /* VEX_W_12_P_0_M_1 */
9676     { "vmovhlps",       { XM, Vex128, EXq } },
9677     { "(bad)",          { XX } },
9678   },
9679   {
9680     /* VEX_W_12_P_1 */
9681     { "vmovsldup",      { XM, EXx } },
9682     { "(bad)",          { XX } },
9683   },
9684   {
9685     /* VEX_W_12_P_2 */
9686     { "vmovlpd",        { XM, Vex128, EXq } },
9687     { "(bad)",          { XX } },
9688   },
9689   {
9690     /* VEX_W_12_P_3 */
9691     { "vmovddup",       { XM, EXymmq } },
9692     { "(bad)",          { XX } },
9693   },
9694   {
9695     /* VEX_W_13_M_0 */
9696     { "vmovlpX",        { EXq, XM } },
9697     { "(bad)",          { XX } },
9698   },
9699   {
9700     /* VEX_W_14 */
9701     { "vunpcklpX",      { XM, Vex, EXx } },
9702     { "(bad)",          { XX } },
9703   },
9704   {
9705     /* VEX_W_15 */
9706     { "vunpckhpX",      { XM, Vex, EXx } },
9707     { "(bad)",          { XX } },
9708   },
9709   {
9710     /* VEX_W_16_P_0_M_0 */
9711     { "vmovhps",        { XM, Vex128, EXq } },
9712     { "(bad)",          { XX } },
9713   },
9714   {
9715     /* VEX_W_16_P_0_M_1 */
9716     { "vmovlhps",       { XM, Vex128, EXq } },
9717     { "(bad)",          { XX } },
9718   },
9719   {
9720     /* VEX_W_16_P_1 */
9721     { "vmovshdup",      { XM, EXx } },
9722     { "(bad)",          { XX } },
9723   },
9724   {
9725     /* VEX_W_16_P_2 */
9726     { "vmovhpd",        { XM, Vex128, EXq } },
9727     { "(bad)",          { XX } },
9728   },
9729   {
9730     /* VEX_W_17_M_0 */
9731     { "vmovhpX",        { EXq, XM } },
9732     { "(bad)",          { XX } },
9733   },
9734   {
9735     /* VEX_W_28 */
9736     { "vmovapX",        { XM, EXx } },
9737     { "(bad)",          { XX } },
9738   },
9739   {
9740     /* VEX_W_29 */
9741     { "vmovapX",        { EXxS, XM } },
9742     { "(bad)",          { XX } },
9743   },
9744   {
9745     /* VEX_W_2B_M_0 */
9746     { "vmovntpX",       { Mx, XM } },
9747     { "(bad)",          { XX } },
9748   },
9749   {
9750     /* VEX_W_2E_P_0 */
9751     { "vucomiss",       { XM, EXd } }, 
9752     { "(bad)",          { XX } },
9753   },
9754   {
9755     /* VEX_W_2E_P_2 */
9756     { "vucomisd",       { XM, EXq } }, 
9757     { "(bad)",          { XX } },
9758   },
9759   {
9760     /* VEX_W_2F_P_0 */
9761     { "vcomiss",        { XM, EXd } },
9762     { "(bad)",          { XX } },
9763   },
9764   {
9765     /* VEX_W_2F_P_2 */
9766     { "vcomisd",        { XM, EXq } },
9767     { "(bad)",          { XX } },
9768   },
9769   {
9770     /* VEX_W_50_M_0 */
9771     { "vmovmskpX",      { Gdq, XS } },
9772     { "(bad)",          { XX } },
9773   },
9774   {
9775     /* VEX_W_51_P_0 */
9776     { "vsqrtps",        { XM, EXx } },
9777     { "(bad)",          { XX } },
9778   },
9779   {
9780     /* VEX_W_51_P_1 */
9781     { "vsqrtss",        { XM, Vex128, EXd } },
9782     { "(bad)",          { XX } },
9783   },
9784   {
9785     /* VEX_W_51_P_2  */
9786     { "vsqrtpd",        { XM, EXx } },
9787     { "(bad)",          { XX } },
9788   },
9789   {
9790     /* VEX_W_51_P_3 */
9791     { "vsqrtsd",        { XM, Vex128, EXq } },
9792     { "(bad)",          { XX } },
9793   },
9794   {
9795     /* VEX_W_52_P_0 */
9796     { "vrsqrtps",       { XM, EXx } },
9797     { "(bad)",          { XX } },
9798   },
9799   {
9800     /* VEX_W_52_P_1 */
9801     { "vrsqrtss",       { XM, Vex128, EXd } },
9802     { "(bad)",          { XX } },
9803   },
9804   {
9805     /* VEX_W_53_P_0  */
9806     { "vrcpps",         { XM, EXx } },
9807     { "(bad)",          { XX } },
9808   },
9809   {
9810     /* VEX_W_53_P_1  */
9811     { "vrcpss",         { XM, Vex128, EXd } },
9812     { "(bad)",          { XX } },
9813   },
9814   {
9815     /* VEX_W_58_P_0  */
9816     { "vaddps",         { XM, Vex, EXx } },
9817     { "(bad)",          { XX } },
9818   },
9819   {
9820     /* VEX_W_58_P_1  */
9821     { "vaddss",         { XM, Vex128, EXd } },
9822     { "(bad)",          { XX } },
9823   },
9824   {
9825     /* VEX_W_58_P_2  */
9826     { "vaddpd",         { XM, Vex, EXx } },
9827     { "(bad)",          { XX } },
9828   },
9829   {
9830     /* VEX_W_58_P_3  */
9831     { "vaddsd",         { XM, Vex128, EXq } },
9832     { "(bad)",          { XX } },
9833   },
9834   {
9835     /* VEX_W_59_P_0  */
9836     { "vmulps",         { XM, Vex, EXx } },
9837     { "(bad)",          { XX } },
9838   },
9839   {
9840     /* VEX_W_59_P_1  */
9841     { "vmulss",         { XM, Vex128, EXd } },
9842     { "(bad)",          { XX } },
9843   },
9844   {
9845     /* VEX_W_59_P_2  */
9846     { "vmulpd",         { XM, Vex, EXx } },
9847     { "(bad)",          { XX } },
9848   },
9849   {
9850     /* VEX_W_59_P_3  */
9851     { "vmulsd",         { XM, Vex128, EXq } },
9852     { "(bad)",          { XX } },
9853   },
9854   {
9855     /* VEX_W_5A_P_0  */
9856     { "vcvtps2pd",      { XM, EXxmmq } },
9857     { "(bad)",          { XX } },
9858   },
9859   {
9860     /* VEX_W_5A_P_1  */
9861     { "vcvtss2sd",      { XM, Vex128, EXd } },
9862     { "(bad)",          { XX } },
9863   },
9864   {
9865     /* VEX_W_5A_P_3  */
9866     { "vcvtsd2ss",      { XM, Vex128, EXq } },
9867     { "(bad)",          { XX } },
9868   },
9869   {
9870     /* VEX_W_5B_P_0  */
9871     { "vcvtdq2ps",      { XM, EXx } },
9872     { "(bad)",          { XX } },
9873   },
9874   {
9875     /* VEX_W_5B_P_1  */
9876     { "vcvttps2dq",     { XM, EXx } },
9877     { "(bad)",          { XX } },
9878   },
9879   {
9880     /* VEX_W_5B_P_2  */
9881     { "vcvtps2dq",      { XM, EXx } },
9882     { "(bad)",          { XX } },
9883   },
9884   {
9885     /* VEX_W_5C_P_0  */
9886     { "vsubps",         { XM, Vex, EXx } },
9887     { "(bad)",          { XX } },
9888   },
9889   {
9890     /* VEX_W_5C_P_1  */
9891     { "vsubss",         { XM, Vex128, EXd } },
9892     { "(bad)",          { XX } },
9893   },
9894   {
9895     /* VEX_W_5C_P_2  */
9896     { "vsubpd",         { XM, Vex, EXx } },
9897     { "(bad)",          { XX } },
9898   },
9899   {
9900     /* VEX_W_5C_P_3  */
9901     { "vsubsd",         { XM, Vex128, EXq } },
9902     { "(bad)",          { XX } },
9903   },
9904   {
9905     /* VEX_W_5D_P_0  */
9906     { "vminps",         { XM, Vex, EXx } },
9907     { "(bad)",          { XX } },
9908   },
9909   {
9910     /* VEX_W_5D_P_1  */
9911     { "vminss",         { XM, Vex128, EXd } },
9912     { "(bad)",          { XX } },
9913   },
9914   {
9915     /* VEX_W_5D_P_2  */
9916     { "vminpd",         { XM, Vex, EXx } },
9917     { "(bad)",          { XX } },
9918   },
9919   {
9920     /* VEX_W_5D_P_3  */
9921     { "vminsd",         { XM, Vex128, EXq } },
9922     { "(bad)",          { XX } },
9923   },
9924   {
9925     /* VEX_W_5E_P_0  */
9926     { "vdivps",         { XM, Vex, EXx } },
9927     { "(bad)",          { XX } },
9928   },
9929   {
9930     /* VEX_W_5E_P_1  */
9931     { "vdivss",         { XM, Vex128, EXd } },
9932     { "(bad)",          { XX } },
9933   },
9934   {
9935     /* VEX_W_5E_P_2  */
9936     { "vdivpd",         { XM, Vex, EXx } },
9937     { "(bad)",          { XX } },
9938   },
9939   {
9940     /* VEX_W_5E_P_3  */
9941     { "vdivsd",         { XM, Vex128, EXq } },
9942     { "(bad)",          { XX } },
9943   },
9944   {
9945     /* VEX_W_5F_P_0  */
9946     { "vmaxps",         { XM, Vex, EXx } },
9947     { "(bad)",          { XX } },
9948   },
9949   {
9950     /* VEX_W_5F_P_1  */
9951     { "vmaxss",         { XM, Vex128, EXd } },
9952     { "(bad)",          { XX } },
9953   },
9954   {
9955     /* VEX_W_5F_P_2  */
9956     { "vmaxpd",         { XM, Vex, EXx } },
9957     { "(bad)",          { XX } },
9958   },
9959   {
9960     /* VEX_W_5F_P_3  */
9961     { "vmaxsd",         { XM, Vex128, EXq } },
9962     { "(bad)",          { XX } },
9963   },
9964   {
9965     /* VEX_W_60_P_2  */
9966     { "vpunpcklbw",     { XM, Vex128, EXx } },
9967     { "(bad)",          { XX } },
9968   },
9969   {
9970     /* VEX_W_61_P_2  */
9971     { "vpunpcklwd",     { XM, Vex128, EXx } },
9972     { "(bad)",          { XX } },
9973   },
9974   {
9975     /* VEX_W_62_P_2  */
9976     { "vpunpckldq",     { XM, Vex128, EXx } },
9977     { "(bad)",          { XX } },
9978   },
9979   {
9980     /* VEX_W_63_P_2  */
9981     { "vpacksswb",      { XM, Vex128, EXx } },
9982     { "(bad)",          { XX } },
9983   },
9984   {
9985     /* VEX_W_64_P_2  */
9986     { "vpcmpgtb",       { XM, Vex128, EXx } },
9987     { "(bad)",          { XX } },
9988   },
9989   {
9990     /* VEX_W_65_P_2  */
9991     { "vpcmpgtw",       { XM, Vex128, EXx } },
9992     { "(bad)",          { XX } },
9993   },
9994   {
9995     /* VEX_W_66_P_2  */
9996     { "vpcmpgtd",       { XM, Vex128, EXx } },
9997     { "(bad)",          { XX } },
9998   },
9999   {
10000     /* VEX_W_67_P_2  */
10001     { "vpackuswb",      { XM, Vex128, EXx } },
10002     { "(bad)",          { XX } },
10003   },
10004   {
10005     /* VEX_W_68_P_2  */
10006     { "vpunpckhbw",     { XM, Vex128, EXx } },
10007     { "(bad)",          { XX } },
10008   },
10009   {
10010     /* VEX_W_69_P_2  */
10011     { "vpunpckhwd",     { XM, Vex128, EXx } },
10012     { "(bad)",          { XX } },
10013   },
10014   {
10015     /* VEX_W_6A_P_2  */
10016     { "vpunpckhdq",     { XM, Vex128, EXx } },
10017     { "(bad)",          { XX } },
10018   },
10019   {
10020     /* VEX_W_6B_P_2  */
10021     { "vpackssdw",      { XM, Vex128, EXx } },
10022     { "(bad)",          { XX } },
10023   },
10024   {
10025     /* VEX_W_6C_P_2  */
10026     { "vpunpcklqdq",    { XM, Vex128, EXx } },
10027     { "(bad)",          { XX } },
10028   },
10029   {
10030     /* VEX_W_6D_P_2  */
10031     { "vpunpckhqdq",    { XM, Vex128, EXx } },
10032     { "(bad)",          { XX } },
10033   },
10034   {
10035     /* VEX_W_6F_P_1  */
10036     { "vmovdqu",        { XM, EXx } },
10037     { "(bad)",          { XX } },
10038   },
10039   {
10040     /* VEX_W_6F_P_2  */
10041     { "vmovdqa",        { XM, EXx } },
10042     { "(bad)",          { XX } },
10043   },
10044   {
10045     /* VEX_W_70_P_1 */
10046     { "vpshufhw",       { XM, EXx, Ib } },
10047     { "(bad)",          { XX } },
10048   },
10049   {
10050     /* VEX_W_70_P_2 */
10051     { "vpshufd",        { XM, EXx, Ib } },
10052     { "(bad)",          { XX } },
10053   },
10054   {
10055     /* VEX_W_70_P_3 */
10056     { "vpshuflw",       { XM, EXx, Ib } },
10057     { "(bad)",          { XX } },
10058   },
10059   {
10060     /* VEX_W_71_R_2_P_2  */
10061     { "vpsrlw",         { Vex128, XS, Ib } },
10062     { "(bad)",          { XX } },
10063   },
10064   {
10065     /* VEX_W_71_R_4_P_2  */
10066     { "vpsraw",         { Vex128, XS, Ib } },
10067     { "(bad)",          { XX } },
10068   },
10069   {
10070     /* VEX_W_71_R_6_P_2  */
10071     { "vpsllw",         { Vex128, XS, Ib } },
10072     { "(bad)",          { XX } },
10073   },
10074   {
10075     /* VEX_W_72_R_2_P_2  */
10076     { "vpsrld",         { Vex128, XS, Ib } },
10077     { "(bad)",          { XX } },
10078   },
10079   {
10080     /* VEX_W_72_R_4_P_2  */
10081     { "vpsrad",         { Vex128, XS, Ib } },
10082     { "(bad)",          { XX } },
10083   },
10084   {
10085     /* VEX_W_72_R_6_P_2  */
10086     { "vpslld",         { Vex128, XS, Ib } },
10087     { "(bad)",          { XX } },
10088   },
10089   {
10090     /* VEX_W_73_R_2_P_2  */
10091     { "vpsrlq",         { Vex128, XS, Ib } },
10092     { "(bad)",          { XX } },
10093   },
10094   {
10095     /* VEX_W_73_R_3_P_2  */
10096     { "vpsrldq",        { Vex128, XS, Ib } },
10097     { "(bad)",          { XX } },
10098   },
10099   {
10100     /* VEX_W_73_R_6_P_2  */
10101     { "vpsllq",         { Vex128, XS, Ib } },
10102     { "(bad)",          { XX } },
10103   },
10104   {
10105     /* VEX_W_73_R_7_P_2  */
10106     { "vpslldq",        { Vex128, XS, Ib } },
10107     { "(bad)",          { XX } },
10108   },
10109   {
10110     /* VEX_W_74_P_2 */
10111     { "vpcmpeqb",       { XM, Vex128, EXx } },
10112     { "(bad)",          { XX } },
10113   },
10114   {
10115     /* VEX_W_75_P_2 */
10116     { "vpcmpeqw",       { XM, Vex128, EXx } },
10117     { "(bad)",          { XX } },
10118   },
10119   {
10120     /* VEX_W_76_P_2 */
10121     { "vpcmpeqd",       { XM, Vex128, EXx } },
10122     { "(bad)",          { XX } },
10123   },
10124   {
10125     /* VEX_W_77_P_0 */
10126     { "",               { VZERO } },
10127     { "(bad)",          { XX } },
10128   },
10129   {
10130     /* VEX_W_7C_P_2 */
10131     { "vhaddpd",        { XM, Vex, EXx } },
10132     { "(bad)",          { XX } },
10133   },
10134   {
10135     /* VEX_W_7C_P_3 */
10136     { "vhaddps",        { XM, Vex, EXx } },
10137     { "(bad)",          { XX } },
10138   },
10139   {
10140     /* VEX_W_7D_P_2 */
10141     { "vhsubpd",        { XM, Vex, EXx } },
10142     { "(bad)",          { XX } },
10143   },
10144   {
10145     /* VEX_W_7D_P_3 */
10146     { "vhsubps",        { XM, Vex, EXx } },
10147     { "(bad)",          { XX } },
10148   },
10149   {
10150     /* VEX_W_7E_P_1 */
10151     { "vmovq",          { XM, EXq } },
10152     { "(bad)",          { XX } },
10153   },
10154   {
10155     /* VEX_W_7F_P_1 */
10156     { "vmovdqu",        { EXxS, XM } },
10157     { "(bad)",          { XX } },
10158   },
10159   {
10160     /* VEX_W_7F_P_2 */
10161     { "vmovdqa",        { EXxS, XM } },
10162     { "(bad)",          { XX } },
10163   },
10164   {
10165     /* VEX_W_AE_R_2_M_0 */
10166     { "vldmxcsr",       { Md } },
10167     { "(bad)",          { XX } },
10168   },
10169   {
10170     /* VEX_W_AE_R_3_M_0 */
10171     { "vstmxcsr",       { Md } },
10172     { "(bad)",          { XX } },
10173   },
10174   {
10175     /* VEX_W_C2_P_0 */
10176     { "vcmpps",         { XM, Vex, EXx, VCMP } },
10177     { "(bad)",          { XX } },
10178   },
10179   {
10180     /* VEX_W_C2_P_1 */
10181     { "vcmpss",         { XM, Vex128, EXd, VCMP } },
10182     { "(bad)",          { XX } },
10183   },
10184   {
10185     /* VEX_W_C2_P_2 */
10186     { "vcmppd",         { XM, Vex, EXx, VCMP } },
10187     { "(bad)",          { XX } },
10188   },
10189   {
10190     /* VEX_W_C2_P_3 */
10191     { "vcmpsd",         { XM, Vex128, EXq, VCMP } },
10192     { "(bad)",          { XX } },
10193   },
10194   {
10195     /* VEX_W_C4_P_2 */
10196     { "vpinsrw",        { XM, Vex128, Edqw, Ib } },
10197     { "(bad)",          { XX } },
10198   },
10199   {
10200     /* VEX_W_C5_P_2 */
10201     { "vpextrw",        { Gdq, XS, Ib } },
10202     { "(bad)",          { XX } },
10203   },
10204   {
10205     /* VEX_W_D0_P_2 */
10206     { "vaddsubpd",      { XM, Vex, EXx } },
10207     { "(bad)",          { XX } },
10208   },
10209   {
10210     /* VEX_W_D0_P_3 */
10211     { "vaddsubps",      { XM, Vex, EXx } },
10212     { "(bad)",          { XX } },
10213   },
10214   {
10215     /* VEX_W_D1_P_2 */
10216     { "vpsrlw",         { XM, Vex128, EXx } },
10217     { "(bad)",          { XX } },
10218   },
10219   {
10220     /* VEX_W_D2_P_2 */
10221     { "vpsrld",         { XM, Vex128, EXx } },
10222     { "(bad)",          { XX } },
10223   },
10224   {
10225     /* VEX_W_D3_P_2 */
10226     { "vpsrlq",         { XM, Vex128, EXx } },
10227     { "(bad)",          { XX } },
10228   },
10229   {
10230     /* VEX_W_D4_P_2 */
10231     { "vpaddq",         { XM, Vex128, EXx } },
10232     { "(bad)",          { XX } },
10233   },
10234   {
10235     /* VEX_W_D5_P_2 */
10236     { "vpmullw",        { XM, Vex128, EXx } },
10237     { "(bad)",          { XX } },
10238   },
10239   {
10240     /* VEX_W_D6_P_2 */
10241     { "vmovq",          { EXqS, XM } },
10242     { "(bad)",          { XX } },
10243   },
10244   {
10245     /* VEX_W_D7_P_2_M_1 */
10246     { "vpmovmskb",      { Gdq, XS } },
10247     { "(bad)",          { XX } },
10248   },
10249   {
10250     /* VEX_W_D8_P_2 */
10251     { "vpsubusb",       { XM, Vex128, EXx } },
10252     { "(bad)",          { XX } },
10253   },
10254   {
10255     /* VEX_W_D9_P_2 */
10256     { "vpsubusw",       { XM, Vex128, EXx } },
10257     { "(bad)",          { XX } },
10258   },
10259   {
10260     /* VEX_W_DA_P_2 */
10261     { "vpminub",        { XM, Vex128, EXx } },
10262     { "(bad)",          { XX } },
10263   },
10264   {
10265     /* VEX_W_DB_P_2 */
10266     { "vpand",          { XM, Vex128, EXx } },
10267     { "(bad)",          { XX } },
10268   },
10269   {
10270     /* VEX_W_DC_P_2 */
10271     { "vpaddusb",       { XM, Vex128, EXx } },
10272     { "(bad)",          { XX } },
10273   },
10274   {
10275     /* VEX_W_DD_P_2 */
10276     { "vpaddusw",       { XM, Vex128, EXx } },
10277     { "(bad)",          { XX } },
10278   },
10279   {
10280     /* VEX_W_DE_P_2 */
10281     { "vpmaxub",        { XM, Vex128, EXx } },
10282     { "(bad)",          { XX } },
10283   },
10284   {
10285     /* VEX_W_DF_P_2 */
10286     { "vpandn",         { XM, Vex128, EXx } },
10287     { "(bad)",          { XX } },
10288   },
10289   {
10290     /* VEX_W_E0_P_2  */
10291     { "vpavgb",         { XM, Vex128, EXx } },
10292     { "(bad)",          { XX } },
10293   },
10294   {
10295     /* VEX_W_E1_P_2  */
10296     { "vpsraw",         { XM, Vex128, EXx } },
10297     { "(bad)",          { XX } },
10298   },
10299   {
10300     /* VEX_W_E2_P_2  */
10301     { "vpsrad",         { XM, Vex128, EXx } },
10302     { "(bad)",          { XX } },
10303   },
10304   {
10305     /* VEX_W_E3_P_2  */
10306     { "vpavgw",         { XM, Vex128, EXx } },
10307     { "(bad)",          { XX } },
10308   },
10309   {
10310     /* VEX_W_E4_P_2  */
10311     { "vpmulhuw",       { XM, Vex128, EXx } },
10312     { "(bad)",          { XX } },
10313   },
10314   {
10315     /* VEX_W_E5_P_2  */
10316     { "vpmulhw",        { XM, Vex128, EXx } },
10317     { "(bad)",          { XX } },
10318   },
10319   {
10320     /* VEX_W_E6_P_1  */
10321     { "vcvtdq2pd",      { XM, EXxmmq } },
10322     { "(bad)",          { XX } },
10323   },
10324   {
10325     /* VEX_W_E6_P_2  */
10326     { "vcvttpd2dq%XY", { XMM, EXx } },
10327     { "(bad)",          { XX } },
10328   },
10329   {
10330     /* VEX_W_E6_P_3  */
10331     { "vcvtpd2dq%XY", { XMM, EXx } },
10332     { "(bad)",          { XX } },
10333   },
10334   {
10335     /* VEX_W_E7_P_2_M_0 */
10336     { "vmovntdq",       { Mx, XM } },
10337     { "(bad)",          { XX } },
10338   },
10339   {
10340     /* VEX_W_E8_P_2  */
10341     { "vpsubsb",        { XM, Vex128, EXx } },
10342     { "(bad)",          { XX } },
10343   },
10344   {
10345     /* VEX_W_E9_P_2  */
10346     { "vpsubsw",        { XM, Vex128, EXx } },
10347     { "(bad)",          { XX } },
10348   },
10349   {
10350     /* VEX_W_EA_P_2  */
10351     { "vpminsw",        { XM, Vex128, EXx } },
10352     { "(bad)",          { XX } },
10353   },
10354   {
10355     /* VEX_W_EB_P_2  */
10356     { "vpor",           { XM, Vex128, EXx } },
10357     { "(bad)",          { XX } },
10358   },
10359   {
10360     /* VEX_W_EC_P_2  */
10361     { "vpaddsb",        { XM, Vex128, EXx } },
10362     { "(bad)",          { XX } },
10363   },
10364   {
10365     /* VEX_W_ED_P_2  */
10366     { "vpaddsw",        { XM, Vex128, EXx } },
10367     { "(bad)",          { XX } },
10368   },
10369   {
10370     /* VEX_W_EE_P_2  */
10371     { "vpmaxsw",        { XM, Vex128, EXx } },
10372     { "(bad)",          { XX } },
10373   },
10374   {
10375     /* VEX_W_EF_P_2  */
10376     { "vpxor",          { XM, Vex128, EXx } },
10377     { "(bad)",          { XX } },
10378   },
10379   {
10380     /* VEX_W_F0_P_3_M_0 */
10381     { "vlddqu",         { XM, M } },
10382     { "(bad)",          { XX } },
10383   },
10384   {
10385     /* VEX_W_F1_P_2 */
10386     { "vpsllw",         { XM, Vex128, EXx } },
10387     { "(bad)",          { XX } },
10388   },
10389   {
10390     /* VEX_W_F2_P_2 */
10391     { "vpslld",         { XM, Vex128, EXx } },
10392     { "(bad)",          { XX } },
10393   },
10394   {
10395     /* VEX_W_F3_P_2 */
10396     { "vpsllq",         { XM, Vex128, EXx } },
10397     { "(bad)",          { XX } },
10398   },
10399   {
10400     /* VEX_W_F4_P_2 */
10401     { "vpmuludq",       { XM, Vex128, EXx } },
10402     { "(bad)",          { XX } },
10403   },
10404   {
10405     /* VEX_W_F5_P_2 */
10406     { "vpmaddwd",       { XM, Vex128, EXx } },
10407     { "(bad)",          { XX } },
10408   },
10409   {
10410     /* VEX_W_F6_P_2 */
10411     { "vpsadbw",        { XM, Vex128, EXx } },
10412     { "(bad)",          { XX } },
10413   },
10414   {
10415     /* VEX_W_F7_P_2 */
10416     { "vmaskmovdqu",    { XM, XS } },
10417     { "(bad)",          { XX } },
10418   },
10419   {
10420     /* VEX_W_F8_P_2 */
10421     { "vpsubb",         { XM, Vex128, EXx } },
10422     { "(bad)",          { XX } },
10423   },
10424   {
10425     /* VEX_W_F9_P_2 */
10426     { "vpsubw",         { XM, Vex128, EXx } },
10427     { "(bad)",          { XX } },
10428   },
10429   {
10430     /* VEX_W_FA_P_2 */
10431     { "vpsubd",         { XM, Vex128, EXx } },
10432     { "(bad)",          { XX } },
10433   },
10434   {
10435     /* VEX_W_FB_P_2 */
10436     { "vpsubq",         { XM, Vex128, EXx } },
10437     { "(bad)",          { XX } },
10438   },
10439   {
10440     /* VEX_W_FC_P_2 */
10441     { "vpaddb",         { XM, Vex128, EXx } },
10442     { "(bad)",          { XX } },
10443   },
10444   {
10445     /* VEX_W_FD_P_2 */
10446     { "vpaddw",         { XM, Vex128, EXx } },
10447     { "(bad)",          { XX } },
10448   },
10449   {
10450     /* VEX_W_FE_P_2 */
10451     { "vpaddd",         { XM, Vex128, EXx } },
10452     { "(bad)",          { XX } },
10453   },
10454   {
10455     /* VEX_W_3800_P_2  */
10456     { "vpshufb",        { XM, Vex128, EXx } },
10457     { "(bad)",          { XX } },
10458   },
10459   {
10460     /* VEX_W_3801_P_2  */
10461     { "vphaddw",        { XM, Vex128, EXx } },
10462     { "(bad)",          { XX } },
10463   },
10464   {
10465     /* VEX_W_3802_P_2  */
10466     { "vphaddd",        { XM, Vex128, EXx } },
10467     { "(bad)",          { XX } },
10468   },
10469   {
10470     /* VEX_W_3803_P_2  */
10471     { "vphaddsw",       { XM, Vex128, EXx } },
10472     { "(bad)",          { XX } },
10473   },
10474   {
10475     /* VEX_W_3804_P_2  */
10476     { "vpmaddubsw",     { XM, Vex128, EXx } },
10477     { "(bad)",          { XX } },
10478   },
10479   {
10480     /* VEX_W_3805_P_2  */
10481     { "vphsubw",        { XM, Vex128, EXx } },
10482     { "(bad)",          { XX } },
10483   },
10484   {
10485     /* VEX_W_3806_P_2  */
10486     { "vphsubd",        { XM, Vex128, EXx } },
10487     { "(bad)",          { XX } },
10488   },
10489   {
10490     /* VEX_W_3807_P_2  */
10491     { "vphsubsw",       { XM, Vex128, EXx } },
10492     { "(bad)",          { XX } },
10493   },
10494   {
10495     /* VEX_W_3808_P_2  */
10496     { "vpsignb",        { XM, Vex128, EXx } },
10497     { "(bad)",          { XX } },
10498   },
10499   {
10500     /* VEX_W_3809_P_2  */
10501     { "vpsignw",        { XM, Vex128, EXx } },
10502     { "(bad)",          { XX } },
10503   },
10504   {
10505     /* VEX_W_380A_P_2  */
10506     { "vpsignd",        { XM, Vex128, EXx } },
10507     { "(bad)",          { XX } },
10508   },
10509   {
10510     /* VEX_W_380B_P_2  */
10511     { "vpmulhrsw",      { XM, Vex128, EXx } },
10512     { "(bad)",          { XX } },
10513   },
10514   {
10515     /* VEX_W_380C_P_2  */
10516     { "vpermilps",      { XM, Vex, EXx } },
10517     { "(bad)",          { XX } },
10518   },
10519   {
10520     /* VEX_W_380D_P_2  */
10521     { "vpermilpd",      { XM, Vex, EXx } },
10522     { "(bad)",          { XX } },
10523   },
10524   {
10525     /* VEX_W_380E_P_2  */
10526     { "vtestps",        { XM, EXx } },
10527     { "(bad)",          { XX } },
10528   },
10529   {
10530     /* VEX_W_380F_P_2  */
10531     { "vtestpd",        { XM, EXx } },
10532     { "(bad)",          { XX } },
10533   },
10534   {
10535     /* VEX_W_3817_P_2 */
10536     { "vptest",         { XM, EXx } },
10537     { "(bad)",          { XX } },
10538   },
10539   {
10540     /* VEX_W_3819_P_2_M_0 */
10541     { "vbroadcastsd",   { XM, Mq } },
10542     { "(bad)",          { XX } },
10543   },
10544   {
10545     /* VEX_W_381A_P_2_M_0 */
10546     { "vbroadcastf128", { XM, Mxmm } },
10547     { "(bad)",          { XX } },
10548   },
10549   {
10550     /* VEX_W_381C_P_2 */
10551     { "vpabsb",         { XM, EXx } },
10552     { "(bad)",          { XX } },
10553   },
10554   {
10555     /* VEX_W_381D_P_2 */
10556     { "vpabsw",         { XM, EXx } },
10557     { "(bad)",          { XX } },
10558   },
10559   {
10560     /* VEX_W_381E_P_2 */
10561     { "vpabsd",         { XM, EXx } },
10562     { "(bad)",          { XX } },
10563   },
10564   {
10565     /* VEX_W_3820_P_2 */
10566     { "vpmovsxbw",      { XM, EXq } },
10567     { "(bad)",          { XX } },
10568   },
10569   {
10570     /* VEX_W_3821_P_2 */
10571     { "vpmovsxbd",      { XM, EXd } },
10572     { "(bad)",          { XX } },
10573   },
10574   {
10575     /* VEX_W_3822_P_2 */
10576     { "vpmovsxbq",      { XM, EXw } },
10577     { "(bad)",          { XX } },
10578   },
10579   {
10580     /* VEX_W_3823_P_2 */
10581     { "vpmovsxwd",      { XM, EXq } },
10582     { "(bad)",          { XX } },
10583   },
10584   {
10585     /* VEX_W_3824_P_2 */
10586     { "vpmovsxwq",      { XM, EXd } },
10587     { "(bad)",          { XX } },
10588   },
10589   {
10590     /* VEX_W_3825_P_2 */
10591     { "vpmovsxdq",      { XM, EXq } },
10592     { "(bad)",          { XX } },
10593   },
10594   {
10595     /* VEX_W_3828_P_2 */
10596     { "vpmuldq",        { XM, Vex128, EXx } },
10597     { "(bad)",          { XX } },
10598   },
10599   {
10600     /* VEX_W_3829_P_2 */
10601     { "vpcmpeqq",       { XM, Vex128, EXx } },
10602     { "(bad)",          { XX } },
10603   },
10604   {
10605     /* VEX_W_382A_P_2_M_0 */
10606     { "vmovntdqa",      { XM, Mx } },
10607     { "(bad)",          { XX } },
10608   },
10609   {
10610     /* VEX_W_382B_P_2 */
10611     { "vpackusdw",      { XM, Vex128, EXx } },
10612     { "(bad)",          { XX } },
10613   },
10614   {
10615     /* VEX_W_382C_P_2_M_0 */
10616     { "vmaskmovps",     { XM, Vex, Mx } },
10617     { "(bad)",          { XX } },
10618   },
10619   {
10620     /* VEX_W_382D_P_2_M_0 */
10621     { "vmaskmovpd",     { XM, Vex, Mx } },
10622     { "(bad)",          { XX } },
10623   },
10624   {
10625     /* VEX_W_382E_P_2_M_0 */
10626     { "vmaskmovps",     { Mx, Vex, XM } },
10627     { "(bad)",          { XX } },
10628   },
10629   {
10630     /* VEX_W_382F_P_2_M_0 */
10631     { "vmaskmovpd",     { Mx, Vex, XM } },
10632     { "(bad)",          { XX } },
10633   },
10634   {
10635     /* VEX_W_3830_P_2 */
10636     { "vpmovzxbw",      { XM, EXq } },
10637     { "(bad)",          { XX } },
10638   },
10639   {
10640     /* VEX_W_3831_P_2 */
10641     { "vpmovzxbd",      { XM, EXd } },
10642     { "(bad)",          { XX } },
10643   },
10644   {
10645     /* VEX_W_3832_P_2 */
10646     { "vpmovzxbq",      { XM, EXw } },
10647     { "(bad)",          { XX } },
10648   },
10649   {
10650     /* VEX_W_3833_P_2 */
10651     { "vpmovzxwd",      { XM, EXq } },
10652     { "(bad)",          { XX } },
10653   },
10654   {
10655     /* VEX_W_3834_P_2 */
10656     { "vpmovzxwq",      { XM, EXd } },
10657     { "(bad)",          { XX } },
10658   },
10659   {
10660     /* VEX_W_3835_P_2 */
10661     { "vpmovzxdq",      { XM, EXq } },
10662     { "(bad)",          { XX } },
10663   },
10664   {
10665     /* VEX_W_3837_P_2 */
10666     { "vpcmpgtq",       { XM, Vex128, EXx } },
10667     { "(bad)",          { XX } },
10668   },
10669   {
10670     /* VEX_W_3838_P_2 */
10671     { "vpminsb",        { XM, Vex128, EXx } },
10672     { "(bad)",          { XX } },
10673   },
10674   {
10675     /* VEX_W_3839_P_2 */
10676     { "vpminsd",        { XM, Vex128, EXx } },
10677     { "(bad)",          { XX } },
10678   },
10679   {
10680     /* VEX_W_383A_P_2 */
10681     { "vpminuw",        { XM, Vex128, EXx } },
10682     { "(bad)",          { XX } },
10683   },
10684   {
10685     /* VEX_W_383B_P_2 */
10686     { "vpminud",        { XM, Vex128, EXx } },
10687     { "(bad)",          { XX } },
10688   },
10689   {
10690     /* VEX_W_383C_P_2 */
10691     { "vpmaxsb",        { XM, Vex128, EXx } },
10692     { "(bad)",          { XX } },
10693   },
10694   {
10695     /* VEX_W_383D_P_2 */
10696     { "vpmaxsd",        { XM, Vex128, EXx } },
10697     { "(bad)",          { XX } },
10698   },
10699   {
10700     /* VEX_W_383E_P_2 */
10701     { "vpmaxuw",        { XM, Vex128, EXx } },
10702     { "(bad)",          { XX } },
10703   },
10704   {
10705     /* VEX_W_383F_P_2 */
10706     { "vpmaxud",        { XM, Vex128, EXx } },
10707     { "(bad)",          { XX } },
10708   },
10709   {
10710     /* VEX_W_3840_P_2 */
10711     { "vpmulld",        { XM, Vex128, EXx } },
10712     { "(bad)",          { XX } },
10713   },
10714   {
10715     /* VEX_W_3841_P_2 */
10716     { "vphminposuw",    { XM, EXx } },
10717     { "(bad)",          { XX } },
10718   },
10719   {
10720     /* VEX_W_38DB_P_2 */
10721     { "vaesimc",        { XM, EXx } },
10722     { "(bad)",          { XX } },
10723   },
10724   {
10725     /* VEX_W_38DC_P_2 */
10726     { "vaesenc",        { XM, Vex128, EXx } },
10727     { "(bad)",          { XX } },
10728   },
10729   {
10730     /* VEX_W_38DD_P_2 */
10731     { "vaesenclast",    { XM, Vex128, EXx } },
10732     { "(bad)",          { XX } },
10733   },
10734   {
10735     /* VEX_W_38DE_P_2 */
10736     { "vaesdec",        { XM, Vex128, EXx } },
10737     { "(bad)",          { XX } },
10738   },
10739   {
10740     /* VEX_W_38DF_P_2 */
10741     { "vaesdeclast",    { XM, Vex128, EXx } },
10742     { "(bad)",          { XX } },
10743   },
10744   {
10745     /* VEX_W_3A04_P_2 */
10746     { "vpermilps",      { XM, EXx, Ib } },
10747     { "(bad)",          { XX } },
10748   },
10749   {
10750     /* VEX_W_3A05_P_2 */
10751     { "vpermilpd",      { XM, EXx, Ib } },
10752     { "(bad)",          { XX } },
10753   },
10754   {
10755     /* VEX_W_3A06_P_2 */
10756     { "vperm2f128",     { XM, Vex256, EXx, Ib } },
10757     { "(bad)",          { XX } },
10758   },
10759   {
10760     /* VEX_W_3A08_P_2 */
10761     { "vroundps",       { XM, EXx, Ib } },
10762     { "(bad)",          { XX } },
10763   },
10764   {
10765     /* VEX_W_3A09_P_2 */
10766     { "vroundpd",       { XM, EXx, Ib } },
10767     { "(bad)",          { XX } },
10768   },
10769   {
10770     /* VEX_W_3A0A_P_2 */
10771     { "vroundss",       { XM, Vex128, EXd, Ib } },
10772     { "(bad)",          { XX } },
10773   },
10774   {
10775     /* VEX_W_3A0B_P_2 */
10776     { "vroundsd",       { XM, Vex128, EXq, Ib } },
10777     { "(bad)",          { XX } },
10778   },
10779   {
10780     /* VEX_W_3A0C_P_2 */
10781     { "vblendps",       { XM, Vex, EXx, Ib } },
10782     { "(bad)",          { XX } },
10783   },
10784   {
10785     /* VEX_W_3A0D_P_2 */
10786     { "vblendpd",       { XM, Vex, EXx, Ib } },
10787     { "(bad)",          { XX } },
10788   },
10789   {
10790     /* VEX_W_3A0E_P_2 */
10791     { "vpblendw",       { XM, Vex128, EXx, Ib } },
10792     { "(bad)",          { XX } },
10793   },
10794   {
10795     /* VEX_W_3A0F_P_2 */
10796     { "vpalignr",       { XM, Vex128, EXx, Ib } },
10797     { "(bad)",          { XX } },
10798   },
10799   {
10800     /* VEX_W_3A14_P_2 */
10801     { "vpextrb",        { Edqb, XM, Ib } },
10802     { "(bad)",          { XX } },
10803   },
10804   {
10805     /* VEX_W_3A15_P_2 */
10806     { "vpextrw",        { Edqw, XM, Ib } },
10807     { "(bad)",          { XX } },
10808   },
10809   {
10810     /* VEX_W_3A18_P_2 */
10811     { "vinsertf128",    { XM, Vex256, EXxmm, Ib } },
10812     { "(bad)",          { XX } },
10813   },
10814   {
10815     /* VEX_W_3A19_P_2 */
10816     { "vextractf128",   { EXxmm, XM, Ib } },
10817     { "(bad)",          { XX } },
10818   },
10819   {
10820     /* VEX_W_3A20_P_2 */
10821     { "vpinsrb",        { XM, Vex128, Edqb, Ib } },
10822     { "(bad)",          { XX } },
10823   },
10824   {
10825     /* VEX_W_3A21_P_2 */
10826     { "vinsertps",      { XM, Vex128, EXd, Ib } },
10827     { "(bad)",          { XX } },
10828   },
10829   {
10830     /* VEX_W_3A40_P_2 */
10831     { "vdpps",          { XM, Vex, EXx, Ib } },
10832     { "(bad)",          { XX } },
10833   },
10834   {
10835     /* VEX_W_3A41_P_2 */
10836     { "vdppd",          { XM, Vex128, EXx, Ib } },
10837     { "(bad)",          { XX } },
10838   },
10839   {
10840     /* VEX_W_3A42_P_2 */
10841     { "vmpsadbw",       { XM, Vex128, EXx, Ib } },
10842     { "(bad)",          { XX } },
10843   },
10844   {
10845     /* VEX_W_3A44_P_2 */
10846     { "vpclmulqdq",     { XM, Vex128, EXx, PCLMUL } },
10847     { "(bad)",          { XX } },
10848   },
10849   {
10850     /* VEX_W_3A4A_P_2 */
10851     { "vblendvps",      { XM, Vex, EXx, XMVexI4 } },
10852     { "(bad)",          { XX } },
10853   },
10854   {
10855     /* VEX_W_3A4B_P_2 */
10856     { "vblendvpd",      { XM, Vex, EXx, XMVexI4 } },
10857     { "(bad)",          { XX } },
10858   },
10859   {
10860     /* VEX_W_3A4C_P_2 */
10861     { "vpblendvb",      { XM, Vex128, EXx, XMVexI4 } },
10862     { "(bad)",          { XX } },
10863   },
10864   {
10865     /* VEX_W_3A60_P_2 */
10866     { "vpcmpestrm",     { XM, EXx, Ib } },
10867     { "(bad)",          { XX } },
10868   },
10869   {
10870     /* VEX_W_3A61_P_2 */
10871     { "vpcmpestri",     { XM, EXx, Ib } },
10872     { "(bad)",          { XX } },
10873   },
10874   {
10875     /* VEX_W_3A62_P_2 */
10876     { "vpcmpistrm",     { XM, EXx, Ib } },
10877     { "(bad)",          { XX } },
10878   },
10879   {
10880     /* VEX_W_3A63_P_2 */
10881     { "vpcmpistri",     { XM, EXx, Ib } },
10882     { "(bad)",          { XX } },
10883   },
10884   {
10885     /* VEX_W_3ADF_P_2 */
10886     { "vaeskeygenassist", { XM, EXx, Ib } },
10887     { "(bad)",          { XX } },
10888   },
10889 };
10890
10891 static const struct dis386 mod_table[][2] = {
10892   {
10893     /* MOD_8D */
10894     { "leaS",           { Gv, M } },
10895     { "(bad)",          { XX } },
10896   },
10897   {
10898     /* MOD_0F01_REG_0 */
10899     { X86_64_TABLE (X86_64_0F01_REG_0) },
10900     { RM_TABLE (RM_0F01_REG_0) },
10901   },
10902   {
10903     /* MOD_0F01_REG_1 */
10904     { X86_64_TABLE (X86_64_0F01_REG_1) },
10905     { RM_TABLE (RM_0F01_REG_1) },
10906   },
10907   {
10908     /* MOD_0F01_REG_2 */
10909     { X86_64_TABLE (X86_64_0F01_REG_2) },
10910     { RM_TABLE (RM_0F01_REG_2) },
10911   },
10912   {
10913     /* MOD_0F01_REG_3 */
10914     { X86_64_TABLE (X86_64_0F01_REG_3) },
10915     { RM_TABLE (RM_0F01_REG_3) },
10916   },
10917   {
10918     /* MOD_0F01_REG_7 */
10919     { "invlpg",         { Mb } },
10920     { RM_TABLE (RM_0F01_REG_7) },
10921   },
10922   {
10923     /* MOD_0F12_PREFIX_0 */
10924     { "movlps",         { XM, EXq } },
10925     { "movhlps",        { XM, EXq } },
10926   },
10927   {
10928     /* MOD_0F13 */
10929     { "movlpX",         { EXq, XM } },
10930     { "(bad)",          { XX } },
10931   },
10932   {
10933     /* MOD_0F16_PREFIX_0 */
10934     { "movhps",         { XM, EXq } },
10935     { "movlhps",        { XM, EXq } },
10936   },
10937   {
10938     /* MOD_0F17 */
10939     { "movhpX",         { EXq, XM } },
10940     { "(bad)",          { XX } },
10941   },
10942   {
10943     /* MOD_0F18_REG_0 */
10944     { "prefetchnta",    { Mb } },
10945     { "(bad)",          { XX } },
10946   },
10947   {
10948     /* MOD_0F18_REG_1 */
10949     { "prefetcht0",     { Mb } },
10950     { "(bad)",          { XX } },
10951   },
10952   {
10953     /* MOD_0F18_REG_2 */
10954     { "prefetcht1",     { Mb } },
10955     { "(bad)",          { XX } },
10956   },
10957   {
10958     /* MOD_0F18_REG_3 */
10959     { "prefetcht2",     { Mb } },
10960     { "(bad)",          { XX } },
10961   },
10962   {
10963     /* MOD_0F20 */
10964     { "(bad)",          { XX } },
10965     { "movZ",           { Rm, Cm } },
10966   },
10967   {
10968     /* MOD_0F21 */
10969     { "(bad)",          { XX } },
10970     { "movZ",           { Rm, Dm } },
10971   },
10972   {
10973     /* MOD_0F22 */
10974     { "(bad)",          { XX } },
10975     { "movZ",           { Cm, Rm } },
10976   },
10977   {
10978     /* MOD_0F23 */
10979     { "(bad)",          { XX } },
10980     { "movZ",           { Dm, Rm } },
10981   },
10982   {
10983     /* MOD_0F24 */
10984     { "(bad)",          { XX } },    
10985     { "movL",           { Rd, Td } },
10986   },
10987   {
10988     /* MOD_0F26 */
10989     { "(bad)",          { XX } },
10990     { "movL",           { Td, Rd } },
10991   },
10992   {
10993     /* MOD_0F2B_PREFIX_0 */
10994     {"movntps",         { Mx, XM } },
10995     { "(bad)",          { XX } },
10996   },
10997   {
10998     /* MOD_0F2B_PREFIX_1 */
10999     {"movntss",         { Md, XM } },
11000     { "(bad)",          { XX } },
11001   },
11002   {
11003     /* MOD_0F2B_PREFIX_2 */
11004     {"movntpd",         { Mx, XM } },
11005     { "(bad)",          { XX } },
11006   },
11007   {
11008     /* MOD_0F2B_PREFIX_3 */
11009     {"movntsd",         { Mq, XM } },
11010     { "(bad)",          { XX } },
11011   },
11012   {
11013     /* MOD_0F51 */
11014     { "(bad)",          { XX } },
11015     { "movmskpX",       { Gdq, XS } },
11016   },
11017   {
11018     /* MOD_0F71_REG_2 */
11019     { "(bad)",          { XX } },
11020     { "psrlw",          { MS, Ib } },
11021   },
11022   {
11023     /* MOD_0F71_REG_4 */
11024     { "(bad)",          { XX } },
11025     { "psraw",          { MS, Ib } },
11026   },
11027   {
11028     /* MOD_0F71_REG_6 */
11029     { "(bad)",          { XX } },
11030     { "psllw",          { MS, Ib } },
11031   },
11032   {
11033     /* MOD_0F72_REG_2 */
11034     { "(bad)",          { XX } },
11035     { "psrld",          { MS, Ib } },
11036   },
11037   {
11038     /* MOD_0F72_REG_4 */
11039     { "(bad)",          { XX } },
11040     { "psrad",          { MS, Ib } },
11041   },
11042   {
11043     /* MOD_0F72_REG_6 */
11044     { "(bad)",          { XX } },
11045     { "pslld",          { MS, Ib } },
11046   },
11047   {
11048     /* MOD_0F73_REG_2 */
11049     { "(bad)",          { XX } },
11050     { "psrlq",          { MS, Ib } },
11051   },
11052   {
11053     /* MOD_0F73_REG_3 */
11054     { "(bad)",          { XX } },
11055     { PREFIX_TABLE (PREFIX_0F73_REG_3) },
11056   },
11057   {
11058     /* MOD_0F73_REG_6 */
11059     { "(bad)",          { XX } },
11060     { "psllq",          { MS, Ib } },
11061   },
11062   {
11063     /* MOD_0F73_REG_7 */
11064     { "(bad)",          { XX } },
11065     { PREFIX_TABLE (PREFIX_0F73_REG_7) },
11066   },
11067   {
11068     /* MOD_0FAE_REG_0 */
11069     { "fxsave",         { FXSAVE } },
11070     { "(bad)",          { XX } },
11071   },
11072   {
11073     /* MOD_0FAE_REG_1 */
11074     { "fxrstor",        { FXSAVE } },
11075     { "(bad)",          { XX } },
11076   },
11077   {
11078     /* MOD_0FAE_REG_2 */
11079     { "ldmxcsr",        { Md } },
11080     { "(bad)",          { XX } },
11081   },
11082   {
11083     /* MOD_0FAE_REG_3 */
11084     { "stmxcsr",        { Md } },
11085     { "(bad)",          { XX } },
11086   },
11087   {
11088     /* MOD_0FAE_REG_4 */
11089     { "xsave",          { M } },
11090     { "(bad)",          { XX } },
11091   },
11092   {
11093     /* MOD_0FAE_REG_5 */
11094     { "xrstor",         { M } },
11095     { RM_TABLE (RM_0FAE_REG_5) },
11096   },
11097   {
11098     /* MOD_0FAE_REG_6 */
11099     { "xsaveopt",       { M } },
11100     { RM_TABLE (RM_0FAE_REG_6) },
11101   },
11102   {
11103     /* MOD_0FAE_REG_7 */
11104     { "clflush",        { Mb } },
11105     { RM_TABLE (RM_0FAE_REG_7) },
11106   },
11107   {
11108     /* MOD_0FB2 */
11109     { "lssS",           { Gv, Mp } },
11110     { "(bad)",          { XX } },
11111   },
11112   {
11113     /* MOD_0FB4 */
11114     { "lfsS",           { Gv, Mp } },
11115     { "(bad)",          { XX } },
11116   },
11117   {
11118     /* MOD_0FB5 */
11119     { "lgsS",           { Gv, Mp } },
11120     { "(bad)",          { XX } },
11121   },
11122   {
11123     /* MOD_0FC7_REG_6 */
11124     { PREFIX_TABLE (PREFIX_0FC7_REG_6) },
11125     { "(bad)",          { XX } },
11126   },
11127   {
11128     /* MOD_0FC7_REG_7 */
11129     { "vmptrst",        { Mq } },
11130     { "(bad)",          { XX } },
11131   },
11132   {
11133     /* MOD_0FD7 */
11134     { "(bad)",          { XX } },
11135     { "pmovmskb",       { Gdq, MS } },
11136   },
11137   {
11138     /* MOD_0FE7_PREFIX_2 */
11139     { "movntdq",        { Mx, XM } },
11140     { "(bad)",          { XX } },
11141   },
11142   {
11143     /* MOD_0FF0_PREFIX_3 */
11144     { "lddqu",          { XM, M } },
11145     { "(bad)",          { XX } },
11146   },
11147   {
11148     /* MOD_0F382A_PREFIX_2 */
11149     { "movntdqa",       { XM, Mx } },
11150     { "(bad)",          { XX } },
11151   },
11152   {
11153     /* MOD_62_32BIT */
11154     { "bound{S|}",      { Gv, Ma } },
11155     { "(bad)",          { XX } },
11156   },
11157   {
11158     /* MOD_C4_32BIT */
11159     { "lesS",           { Gv, Mp } },
11160     { VEX_C4_TABLE (VEX_0F) },
11161   },
11162   {
11163     /* MOD_C5_32BIT */
11164     { "ldsS",           { Gv, Mp } },
11165     { VEX_C5_TABLE (VEX_0F) },
11166   },
11167   {
11168     /* MOD_VEX_12_PREFIX_0 */
11169     { VEX_LEN_TABLE (VEX_LEN_12_P_0_M_0) },
11170     { VEX_LEN_TABLE (VEX_LEN_12_P_0_M_1) },
11171   },
11172   {
11173     /* MOD_VEX_13 */
11174     { VEX_LEN_TABLE (VEX_LEN_13_M_0) },
11175     { "(bad)",          { XX } },
11176   },
11177   {
11178     /* MOD_VEX_16_PREFIX_0 */
11179     { VEX_LEN_TABLE (VEX_LEN_16_P_0_M_0) },
11180     { VEX_LEN_TABLE (VEX_LEN_16_P_0_M_1) },
11181   },
11182   {
11183     /* MOD_VEX_17 */
11184     { VEX_LEN_TABLE (VEX_LEN_17_M_0) },
11185     { "(bad)",          { XX } },
11186   },
11187   {
11188     /* MOD_VEX_2B */
11189     { VEX_W_TABLE (VEX_W_2B_M_0) },
11190     { "(bad)",          { XX } },
11191   },
11192   {
11193     /* MOD_VEX_50 */
11194     { "(bad)",          { XX } },
11195     { VEX_W_TABLE (VEX_W_50_M_0) },
11196   },
11197   {
11198     /* MOD_VEX_71_REG_2 */
11199     { "(bad)",          { XX } },
11200     { PREFIX_TABLE (PREFIX_VEX_71_REG_2) },
11201   },
11202   {
11203     /* MOD_VEX_71_REG_4 */
11204     { "(bad)",          { XX } },
11205     { PREFIX_TABLE (PREFIX_VEX_71_REG_4) },
11206   },
11207   {
11208     /* MOD_VEX_71_REG_6 */
11209     { "(bad)",          { XX } },
11210     { PREFIX_TABLE (PREFIX_VEX_71_REG_6) },
11211   },
11212   {
11213     /* MOD_VEX_72_REG_2 */
11214     { "(bad)",          { XX } },
11215     { PREFIX_TABLE (PREFIX_VEX_72_REG_2) },
11216   },
11217   {
11218     /* MOD_VEX_72_REG_4 */
11219     { "(bad)",          { XX } },
11220     { PREFIX_TABLE (PREFIX_VEX_72_REG_4) },
11221   },
11222   {
11223     /* MOD_VEX_72_REG_6 */
11224     { "(bad)",          { XX } },
11225     { PREFIX_TABLE (PREFIX_VEX_72_REG_6) },
11226   },
11227   {
11228     /* MOD_VEX_73_REG_2 */
11229     { "(bad)",          { XX } },
11230     { PREFIX_TABLE (PREFIX_VEX_73_REG_2) },
11231   },
11232   {
11233     /* MOD_VEX_73_REG_3 */
11234     { "(bad)",          { XX } },
11235     { PREFIX_TABLE (PREFIX_VEX_73_REG_3) },
11236   },
11237   {
11238     /* MOD_VEX_73_REG_6 */
11239     { "(bad)",          { XX } },
11240     { PREFIX_TABLE (PREFIX_VEX_73_REG_6) },
11241   },
11242   {
11243     /* MOD_VEX_73_REG_7 */
11244     { "(bad)",          { XX } },
11245     { PREFIX_TABLE (PREFIX_VEX_73_REG_7) },
11246   },
11247   {
11248     /* MOD_VEX_AE_REG_2 */
11249     { VEX_LEN_TABLE (VEX_LEN_AE_R_2_M_0) },
11250     { "(bad)",          { XX } },
11251   },
11252   {
11253     /* MOD_VEX_AE_REG_3 */
11254     { VEX_LEN_TABLE (VEX_LEN_AE_R_3_M_0) },
11255     { "(bad)",          { XX } },
11256   },
11257   {
11258     /* MOD_VEX_D7_PREFIX_2 */
11259     { "(bad)",          { XX } },
11260     { VEX_LEN_TABLE (VEX_LEN_D7_P_2_M_1) },
11261   },
11262   {
11263     /* MOD_VEX_E7_PREFIX_2 */
11264     { VEX_W_TABLE (VEX_W_E7_P_2_M_0) },
11265     { "(bad)",          { XX } },
11266   },
11267   {
11268     /* MOD_VEX_F0_PREFIX_3 */
11269     { VEX_W_TABLE (VEX_W_F0_P_3_M_0) },
11270     { "(bad)",          { XX } },
11271   },
11272   {
11273     /* MOD_VEX_3818_PREFIX_2 */
11274     { "vbroadcastss",   { XM, Md } },
11275     { "(bad)",          { XX } },
11276   },
11277   {
11278     /* MOD_VEX_3819_PREFIX_2 */
11279     { VEX_LEN_TABLE (VEX_LEN_3819_P_2_M_0) },
11280     { "(bad)",          { XX } },
11281   },
11282   {
11283     /* MOD_VEX_381A_PREFIX_2 */
11284     { VEX_LEN_TABLE (VEX_LEN_381A_P_2_M_0) },
11285     { "(bad)",          { XX } },
11286   },
11287   {
11288     /* MOD_VEX_382A_PREFIX_2 */
11289     { VEX_LEN_TABLE (VEX_LEN_382A_P_2_M_0) },
11290     { "(bad)",          { XX } },
11291   },
11292   {
11293     /* MOD_VEX_382C_PREFIX_2 */
11294     { VEX_W_TABLE (VEX_W_382C_P_2_M_0) },
11295     { "(bad)",          { XX } },
11296   },
11297   {
11298     /* MOD_VEX_382D_PREFIX_2 */
11299     { VEX_W_TABLE (VEX_W_382D_P_2_M_0) },
11300     { "(bad)",          { XX } },
11301   },
11302   {
11303     /* MOD_VEX_382E_PREFIX_2 */
11304     { VEX_W_TABLE (VEX_W_382E_P_2_M_0) },
11305     { "(bad)",          { XX } },
11306   },
11307   {
11308     /* MOD_VEX_382F_PREFIX_2 */
11309     { VEX_W_TABLE (VEX_W_382F_P_2_M_0) },
11310     { "(bad)",          { XX } },
11311   },
11312 };
11313
11314 static const struct dis386 rm_table[][8] = {
11315   {
11316     /* RM_0F01_REG_0 */
11317     { "(bad)",          { XX } },
11318     { "vmcall",         { Skip_MODRM } },
11319     { "vmlaunch",       { Skip_MODRM } },
11320     { "vmresume",       { Skip_MODRM } },
11321     { "vmxoff",         { Skip_MODRM } },
11322     { "(bad)",          { XX } },
11323     { "(bad)",          { XX } },
11324     { "(bad)",          { XX } },
11325   },
11326   {
11327     /* RM_0F01_REG_1 */
11328     { "monitor",        { { OP_Monitor, 0 } } },
11329     { "mwait",          { { OP_Mwait, 0 } } },
11330     { "(bad)",          { XX } },
11331     { "(bad)",          { XX } },
11332     { "(bad)",          { XX } },
11333     { "(bad)",          { XX } },
11334     { "(bad)",          { XX } },
11335     { "(bad)",          { XX } },
11336   },
11337   {
11338     /* RM_0F01_REG_2 */
11339     { "xgetbv",         { Skip_MODRM } },
11340     { "xsetbv",         { Skip_MODRM } },
11341     { "(bad)",          { XX } },
11342     { "(bad)",          { XX } },
11343     { "(bad)",          { XX } },
11344     { "(bad)",          { XX } },
11345     { "(bad)",          { XX } },
11346     { "(bad)",          { XX } },
11347   },
11348   {
11349     /* RM_0F01_REG_3 */
11350     { "vmrun",          { Skip_MODRM } },
11351     { "vmmcall",        { Skip_MODRM } },
11352     { "vmload",         { Skip_MODRM } },
11353     { "vmsave",         { Skip_MODRM } },
11354     { "stgi",           { Skip_MODRM } },
11355     { "clgi",           { Skip_MODRM } },
11356     { "skinit",         { Skip_MODRM } },
11357     { "invlpga",        { Skip_MODRM } },
11358   },
11359   {
11360     /* RM_0F01_REG_7 */
11361     { "swapgs",         { Skip_MODRM } },
11362     { "rdtscp",         { Skip_MODRM } },
11363     { "(bad)",          { XX } },
11364     { "(bad)",          { XX } },
11365     { "(bad)",          { XX } },
11366     { "(bad)",          { XX } },
11367     { "(bad)",          { XX } },
11368     { "(bad)",          { XX } },
11369   },
11370   {
11371     /* RM_0FAE_REG_5 */
11372     { "lfence",         { Skip_MODRM } },
11373     { "(bad)",          { XX } },
11374     { "(bad)",          { XX } },
11375     { "(bad)",          { XX } },
11376     { "(bad)",          { XX } },
11377     { "(bad)",          { XX } },
11378     { "(bad)",          { XX } },
11379     { "(bad)",          { XX } },
11380   },
11381   {
11382     /* RM_0FAE_REG_6 */
11383     { "mfence",         { Skip_MODRM } },
11384     { "(bad)",          { XX } },
11385     { "(bad)",          { XX } },
11386     { "(bad)",          { XX } },
11387     { "(bad)",          { XX } },
11388     { "(bad)",          { XX } },
11389     { "(bad)",          { XX } },
11390     { "(bad)",          { XX } },
11391   },
11392   {
11393     /* RM_0FAE_REG_7 */
11394     { "sfence",         { Skip_MODRM } },
11395     { "(bad)",          { XX } },
11396     { "(bad)",          { XX } },
11397     { "(bad)",          { XX } },
11398     { "(bad)",          { XX } },
11399     { "(bad)",          { XX } },
11400     { "(bad)",          { XX } },
11401     { "(bad)",          { XX } },
11402   },
11403 };
11404
11405 #define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
11406
11407 /* We use the high bit to indicate different name for the same
11408    prefix.  */
11409 #define ADDR16_PREFIX   (0x67 | 0x100)
11410 #define ADDR32_PREFIX   (0x67 | 0x200)
11411 #define DATA16_PREFIX   (0x66 | 0x100)
11412 #define DATA32_PREFIX   (0x66 | 0x200)
11413 #define REP_PREFIX      (0xf3 | 0x100)
11414
11415 static int
11416 ckprefix (void)
11417 {
11418   int newrex, i, length;
11419   rex = 0;
11420   rex_original = 0;
11421   rex_ignored = 0;
11422   prefixes = 0;
11423   used_prefixes = 0;
11424   rex_used = 0;
11425   last_lock_prefix = -1;
11426   last_repz_prefix = -1;
11427   last_repnz_prefix = -1;
11428   last_data_prefix = -1;
11429   last_addr_prefix = -1;
11430   last_rex_prefix = -1;
11431   last_seg_prefix = -1;
11432   for (i = 0; i < (int) ARRAY_SIZE (all_prefixes); i++)
11433     all_prefixes[i] = 0;
11434   i = 0;
11435   length = 0;
11436   /* The maximum instruction length is 15bytes.  */
11437   while (length < MAX_CODE_LENGTH - 1)
11438     {
11439       FETCH_DATA (the_info, codep + 1);
11440       newrex = 0;
11441       switch (*codep)
11442         {
11443         /* REX prefixes family.  */
11444         case 0x40:
11445         case 0x41:
11446         case 0x42:
11447         case 0x43:
11448         case 0x44:
11449         case 0x45:
11450         case 0x46:
11451         case 0x47:
11452         case 0x48:
11453         case 0x49:
11454         case 0x4a:
11455         case 0x4b:
11456         case 0x4c:
11457         case 0x4d:
11458         case 0x4e:
11459         case 0x4f:
11460           if (address_mode == mode_64bit)
11461             newrex = *codep;
11462           else
11463             return 1;
11464           last_rex_prefix = i;
11465           break;
11466         case 0xf3:
11467           prefixes |= PREFIX_REPZ;
11468           last_repz_prefix = i;
11469           break;
11470         case 0xf2:
11471           prefixes |= PREFIX_REPNZ;
11472           last_repnz_prefix = i;
11473           break;
11474         case 0xf0:
11475           prefixes |= PREFIX_LOCK;
11476           last_lock_prefix = i;
11477           break;
11478         case 0x2e:
11479           prefixes |= PREFIX_CS;
11480           last_seg_prefix = i;
11481           break;
11482         case 0x36:
11483           prefixes |= PREFIX_SS;
11484           last_seg_prefix = i;
11485           break;
11486         case 0x3e:
11487           prefixes |= PREFIX_DS;
11488           last_seg_prefix = i;
11489           break;
11490         case 0x26:
11491           prefixes |= PREFIX_ES;
11492           last_seg_prefix = i;
11493           break;
11494         case 0x64:
11495           prefixes |= PREFIX_FS;
11496           last_seg_prefix = i;
11497           break;
11498         case 0x65:
11499           prefixes |= PREFIX_GS;
11500           last_seg_prefix = i;
11501           break;
11502         case 0x66:
11503           prefixes |= PREFIX_DATA;
11504           last_data_prefix = i;
11505           break;
11506         case 0x67:
11507           prefixes |= PREFIX_ADDR;
11508           last_addr_prefix = i;
11509           break;
11510         case FWAIT_OPCODE:
11511           /* fwait is really an instruction.  If there are prefixes
11512              before the fwait, they belong to the fwait, *not* to the
11513              following instruction.  */
11514           if (prefixes || rex)
11515             {
11516               prefixes |= PREFIX_FWAIT;
11517               codep++;
11518               return 1;
11519             }
11520           prefixes = PREFIX_FWAIT;
11521           break;
11522         default:
11523           return 1;
11524         }
11525       /* Rex is ignored when followed by another prefix.  */
11526       if (rex)
11527         {
11528           rex_used = rex;
11529           return 1;
11530         }
11531       if (*codep != FWAIT_OPCODE)
11532         all_prefixes[i++] = *codep;
11533       rex = newrex;
11534       rex_original = rex;
11535       codep++;
11536       length++;
11537     }
11538   return 0;
11539 }
11540
11541 static int
11542 seg_prefix (int pref)
11543 {
11544   switch (pref)
11545     {
11546     case 0x2e:
11547       return PREFIX_CS;
11548     case 0x36:
11549       return PREFIX_SS;
11550     case 0x3e:
11551       return PREFIX_DS;
11552     case 0x26:
11553       return PREFIX_ES;
11554     case 0x64:
11555       return PREFIX_FS;
11556     case 0x65:
11557       return PREFIX_GS;
11558     default:
11559       return 0;
11560     }
11561 }
11562
11563 /* Return the name of the prefix byte PREF, or NULL if PREF is not a
11564    prefix byte.  */
11565
11566 static const char *
11567 prefix_name (int pref, int sizeflag)
11568 {
11569   static const char *rexes [16] =
11570     {
11571       "rex",            /* 0x40 */
11572       "rex.B",          /* 0x41 */
11573       "rex.X",          /* 0x42 */
11574       "rex.XB",         /* 0x43 */
11575       "rex.R",          /* 0x44 */
11576       "rex.RB",         /* 0x45 */
11577       "rex.RX",         /* 0x46 */
11578       "rex.RXB",        /* 0x47 */
11579       "rex.W",          /* 0x48 */
11580       "rex.WB",         /* 0x49 */
11581       "rex.WX",         /* 0x4a */
11582       "rex.WXB",        /* 0x4b */
11583       "rex.WR",         /* 0x4c */
11584       "rex.WRB",        /* 0x4d */
11585       "rex.WRX",        /* 0x4e */
11586       "rex.WRXB",       /* 0x4f */
11587     };
11588
11589   switch (pref)
11590     {
11591     /* REX prefixes family.  */
11592     case 0x40:
11593     case 0x41:
11594     case 0x42:
11595     case 0x43:
11596     case 0x44:
11597     case 0x45:
11598     case 0x46:
11599     case 0x47:
11600     case 0x48:
11601     case 0x49:
11602     case 0x4a:
11603     case 0x4b:
11604     case 0x4c:
11605     case 0x4d:
11606     case 0x4e:
11607     case 0x4f:
11608       return rexes [pref - 0x40];
11609     case 0xf3:
11610       return "repz";
11611     case 0xf2:
11612       return "repnz";
11613     case 0xf0:
11614       return "lock";
11615     case 0x2e:
11616       return "cs";
11617     case 0x36:
11618       return "ss";
11619     case 0x3e:
11620       return "ds";
11621     case 0x26:
11622       return "es";
11623     case 0x64:
11624       return "fs";
11625     case 0x65:
11626       return "gs";
11627     case 0x66:
11628       return (sizeflag & DFLAG) ? "data16" : "data32";
11629     case 0x67:
11630       if (address_mode == mode_64bit)
11631         return (sizeflag & AFLAG) ? "addr32" : "addr64";
11632       else
11633         return (sizeflag & AFLAG) ? "addr16" : "addr32";
11634     case FWAIT_OPCODE:
11635       return "fwait";
11636     case ADDR16_PREFIX:
11637       return "addr16";
11638     case ADDR32_PREFIX:
11639       return "addr32";
11640     case DATA16_PREFIX:
11641       return "data16";
11642     case DATA32_PREFIX:
11643       return "data32";
11644     case REP_PREFIX:
11645       return "rep";
11646     default:
11647       return NULL;
11648     }
11649 }
11650
11651 static char op_out[MAX_OPERANDS][100];
11652 static int op_ad, op_index[MAX_OPERANDS];
11653 static int two_source_ops;
11654 static bfd_vma op_address[MAX_OPERANDS];
11655 static bfd_vma op_riprel[MAX_OPERANDS];
11656 static bfd_vma start_pc;
11657
11658 /*
11659  *   On the 386's of 1988, the maximum length of an instruction is 15 bytes.
11660  *   (see topic "Redundant prefixes" in the "Differences from 8086"
11661  *   section of the "Virtual 8086 Mode" chapter.)
11662  * 'pc' should be the address of this instruction, it will
11663  *   be used to print the target address if this is a relative jump or call
11664  * The function returns the length of this instruction in bytes.
11665  */
11666
11667 static char intel_syntax;
11668 static char intel_mnemonic = !SYSV386_COMPAT;
11669 static char open_char;
11670 static char close_char;
11671 static char separator_char;
11672 static char scale_char;
11673
11674 /* Here for backwards compatibility.  When gdb stops using
11675    print_insn_i386_att and print_insn_i386_intel these functions can
11676    disappear, and print_insn_i386 be merged into print_insn.  */
11677 int
11678 print_insn_i386_att (bfd_vma pc, disassemble_info *info)
11679 {
11680   intel_syntax = 0;
11681
11682   return print_insn (pc, info);
11683 }
11684
11685 int
11686 print_insn_i386_intel (bfd_vma pc, disassemble_info *info)
11687 {
11688   intel_syntax = 1;
11689
11690   return print_insn (pc, info);
11691 }
11692
11693 int
11694 print_insn_i386 (bfd_vma pc, disassemble_info *info)
11695 {
11696   intel_syntax = -1;
11697
11698   return print_insn (pc, info);
11699 }
11700
11701 void
11702 print_i386_disassembler_options (FILE *stream)
11703 {
11704   fprintf (stream, _("\n\
11705 The following i386/x86-64 specific disassembler options are supported for use\n\
11706 with the -M switch (multiple options should be separated by commas):\n"));
11707
11708   fprintf (stream, _("  x86-64      Disassemble in 64bit mode\n"));
11709   fprintf (stream, _("  i386        Disassemble in 32bit mode\n"));
11710   fprintf (stream, _("  i8086       Disassemble in 16bit mode\n"));
11711   fprintf (stream, _("  att         Display instruction in AT&T syntax\n"));
11712   fprintf (stream, _("  intel       Display instruction in Intel syntax\n"));
11713   fprintf (stream, _("  att-mnemonic\n"
11714                      "              Display instruction in AT&T mnemonic\n"));
11715   fprintf (stream, _("  intel-mnemonic\n"
11716                      "              Display instruction in Intel mnemonic\n"));
11717   fprintf (stream, _("  addr64      Assume 64bit address size\n"));
11718   fprintf (stream, _("  addr32      Assume 32bit address size\n"));
11719   fprintf (stream, _("  addr16      Assume 16bit address size\n"));
11720   fprintf (stream, _("  data32      Assume 32bit data size\n"));
11721   fprintf (stream, _("  data16      Assume 16bit data size\n"));
11722   fprintf (stream, _("  suffix      Always display instruction suffix in AT&T syntax\n"));
11723 }
11724
11725 /* Get a pointer to struct dis386 with a valid name.  */
11726
11727 static const struct dis386 *
11728 get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
11729 {
11730   int vindex, vex_table_index;
11731
11732   if (dp->name != NULL)
11733     return dp;
11734
11735   switch (dp->op[0].bytemode)
11736     {
11737     case USE_REG_TABLE:
11738       dp = &reg_table[dp->op[1].bytemode][modrm.reg];
11739       break;
11740
11741     case USE_MOD_TABLE:
11742       vindex = modrm.mod == 0x3 ? 1 : 0;
11743       dp = &mod_table[dp->op[1].bytemode][vindex];
11744       break;
11745
11746     case USE_RM_TABLE:
11747       dp = &rm_table[dp->op[1].bytemode][modrm.rm];
11748       break;
11749
11750     case USE_PREFIX_TABLE:
11751       if (need_vex)
11752         {
11753           /* The prefix in VEX is implicit.  */
11754           switch (vex.prefix)
11755             {
11756             case 0:
11757               vindex = 0;
11758               break;
11759             case REPE_PREFIX_OPCODE:
11760               vindex = 1;
11761               break;
11762             case DATA_PREFIX_OPCODE:
11763               vindex = 2;
11764               break;
11765             case REPNE_PREFIX_OPCODE:
11766               vindex = 3;
11767               break;
11768             default:
11769               abort ();
11770               break;
11771             }
11772         }
11773       else 
11774         {
11775           vindex = 0;
11776           used_prefixes |= (prefixes & PREFIX_REPZ);
11777           if (prefixes & PREFIX_REPZ)
11778             {
11779               vindex = 1;
11780               all_prefixes[last_repz_prefix] = 0;
11781             }
11782           else
11783             {
11784               /* We should check PREFIX_REPNZ and PREFIX_REPZ before
11785                  PREFIX_DATA.  */
11786               used_prefixes |= (prefixes & PREFIX_REPNZ);
11787               if (prefixes & PREFIX_REPNZ)
11788                 {
11789                   vindex = 3;
11790                   all_prefixes[last_repnz_prefix] = 0;
11791                 }
11792               else
11793                 {
11794                   used_prefixes |= (prefixes & PREFIX_DATA);
11795                   if (prefixes & PREFIX_DATA)
11796                     {
11797                       vindex = 2;
11798                       all_prefixes[last_data_prefix] = 0;
11799                     }
11800                 }
11801             }
11802         }
11803       dp = &prefix_table[dp->op[1].bytemode][vindex];
11804       break;
11805
11806     case USE_X86_64_TABLE:
11807       vindex = address_mode == mode_64bit ? 1 : 0;
11808       dp = &x86_64_table[dp->op[1].bytemode][vindex];
11809       break;
11810
11811     case USE_3BYTE_TABLE:
11812       FETCH_DATA (info, codep + 2);
11813       vindex = *codep++;
11814       dp = &three_byte_table[dp->op[1].bytemode][vindex];
11815       modrm.mod = (*codep >> 6) & 3;
11816       modrm.reg = (*codep >> 3) & 7;
11817       modrm.rm = *codep & 7;
11818       break;
11819
11820     case USE_VEX_LEN_TABLE:
11821       if (!need_vex)
11822         abort ();
11823
11824       switch (vex.length)
11825         {
11826         case 128:
11827           vindex = 0;
11828           break;
11829         case 256:
11830           vindex = 1;
11831           break;
11832         default:
11833           abort ();
11834           break;
11835         }
11836
11837       dp = &vex_len_table[dp->op[1].bytemode][vindex];
11838       break;
11839
11840     case USE_XOP_8F_TABLE:
11841       FETCH_DATA (info, codep + 3);
11842       /* All bits in the REX prefix are ignored.  */
11843       rex_ignored = rex;
11844       rex = ~(*codep >> 5) & 0x7;
11845
11846       /* VEX_TABLE_INDEX is the mmmmm part of the XOP byte 1 "RCB.mmmmm".  */
11847       switch ((*codep & 0x1f))
11848         {
11849         default:
11850           BadOp ();
11851         case 0x8:
11852           vex_table_index = XOP_08;
11853           break;
11854         case 0x9:
11855           vex_table_index = XOP_09;
11856           break;
11857         case 0xa:
11858           vex_table_index = XOP_0A;
11859           break;
11860         }
11861       codep++;
11862       vex.w = *codep & 0x80;
11863       if (vex.w && address_mode == mode_64bit)
11864         rex |= REX_W;
11865
11866       vex.register_specifier = (~(*codep >> 3)) & 0xf;
11867       if (address_mode != mode_64bit
11868           && vex.register_specifier > 0x7)
11869         BadOp ();
11870
11871       vex.length = (*codep & 0x4) ? 256 : 128;
11872       switch ((*codep & 0x3))
11873         {
11874         case 0:
11875           vex.prefix = 0;
11876           break;
11877         case 1:
11878           vex.prefix = DATA_PREFIX_OPCODE;
11879           break;
11880         case 2:
11881           vex.prefix = REPE_PREFIX_OPCODE;
11882           break;
11883         case 3:
11884           vex.prefix = REPNE_PREFIX_OPCODE;
11885           break;
11886         }
11887       need_vex = 1;
11888       need_vex_reg = 1;
11889       codep++;
11890       vindex = *codep++;
11891       dp = &xop_table[vex_table_index][vindex];
11892
11893       FETCH_DATA (info, codep + 1);
11894       modrm.mod = (*codep >> 6) & 3;
11895       modrm.reg = (*codep >> 3) & 7;
11896       modrm.rm = *codep & 7;
11897       break;
11898
11899     case USE_VEX_C4_TABLE:
11900       FETCH_DATA (info, codep + 3);
11901       /* All bits in the REX prefix are ignored.  */
11902       rex_ignored = rex;
11903       rex = ~(*codep >> 5) & 0x7;
11904       switch ((*codep & 0x1f))
11905         {
11906         default:
11907           BadOp ();
11908         case 0x1:
11909           vex_table_index = VEX_0F;
11910           break;
11911         case 0x2:
11912           vex_table_index = VEX_0F38;
11913           break;
11914         case 0x3:
11915           vex_table_index = VEX_0F3A;
11916           break;
11917         }
11918       codep++;
11919       vex.w = *codep & 0x80;
11920       if (vex.w && address_mode == mode_64bit)
11921         rex |= REX_W;
11922
11923       vex.register_specifier = (~(*codep >> 3)) & 0xf;
11924       if (address_mode != mode_64bit
11925           && vex.register_specifier > 0x7)
11926         BadOp ();
11927
11928       vex.length = (*codep & 0x4) ? 256 : 128;
11929       switch ((*codep & 0x3))
11930         {
11931         case 0:
11932           vex.prefix = 0;
11933           break;
11934         case 1:
11935           vex.prefix = DATA_PREFIX_OPCODE;
11936           break;
11937         case 2:
11938           vex.prefix = REPE_PREFIX_OPCODE;
11939           break;
11940         case 3:
11941           vex.prefix = REPNE_PREFIX_OPCODE;
11942           break;
11943         }
11944       need_vex = 1;
11945       need_vex_reg = 1;
11946       codep++;
11947       vindex = *codep++;
11948       dp = &vex_table[vex_table_index][vindex];
11949       /* There is no MODRM byte for VEX [82|77].  */
11950       if (vindex != 0x77 && vindex != 0x82)
11951         {
11952           FETCH_DATA (info, codep + 1);
11953           modrm.mod = (*codep >> 6) & 3;
11954           modrm.reg = (*codep >> 3) & 7;
11955           modrm.rm = *codep & 7;
11956         }
11957       break;
11958
11959     case USE_VEX_C5_TABLE:
11960       FETCH_DATA (info, codep + 2);
11961       /* All bits in the REX prefix are ignored.  */
11962       rex_ignored = rex;
11963       rex = (*codep & 0x80) ? 0 : REX_R;
11964
11965       vex.register_specifier = (~(*codep >> 3)) & 0xf;
11966       if (address_mode != mode_64bit
11967           && vex.register_specifier > 0x7)
11968         BadOp ();
11969
11970       vex.w = 0;
11971
11972       vex.length = (*codep & 0x4) ? 256 : 128;
11973       switch ((*codep & 0x3))
11974         {
11975         case 0:
11976           vex.prefix = 0;
11977           break;
11978         case 1:
11979           vex.prefix = DATA_PREFIX_OPCODE;
11980           break;
11981         case 2:
11982           vex.prefix = REPE_PREFIX_OPCODE;
11983           break;
11984         case 3:
11985           vex.prefix = REPNE_PREFIX_OPCODE;
11986           break;
11987         }
11988       need_vex = 1;
11989       need_vex_reg = 1;
11990       codep++;
11991       vindex = *codep++;
11992       dp = &vex_table[dp->op[1].bytemode][vindex];
11993       /* There is no MODRM byte for VEX [82|77].  */
11994       if (vindex != 0x77 && vindex != 0x82)
11995         {
11996           FETCH_DATA (info, codep + 1);
11997           modrm.mod = (*codep >> 6) & 3;
11998           modrm.reg = (*codep >> 3) & 7;
11999           modrm.rm = *codep & 7;
12000         }
12001       break;
12002
12003     case USE_VEX_W_TABLE:
12004       if (!need_vex)
12005         abort ();
12006
12007       dp = &vex_w_table[dp->op[1].bytemode][vex.w ? 1 : 0];
12008       break;
12009
12010     default:
12011       abort ();
12012     }
12013
12014   if (dp->name != NULL)
12015     return dp;
12016   else
12017     return get_valid_dis386 (dp, info);
12018 }
12019
12020 static int
12021 print_insn (bfd_vma pc, disassemble_info *info)
12022 {
12023   const struct dis386 *dp;
12024   int i;
12025   char *op_txt[MAX_OPERANDS];
12026   int needcomma;
12027   int sizeflag;
12028   const char *p;
12029   struct dis_private priv;
12030   unsigned char op;
12031   int prefix_length;
12032   int default_prefixes;
12033
12034   if (info->mach == bfd_mach_x86_64_intel_syntax
12035       || info->mach == bfd_mach_x86_64
12036       || info->mach == bfd_mach_l1om
12037       || info->mach == bfd_mach_l1om_intel_syntax)
12038     address_mode = mode_64bit;
12039   else
12040     address_mode = mode_32bit;
12041
12042   if (intel_syntax == (char) -1)
12043     intel_syntax = (info->mach == bfd_mach_i386_i386_intel_syntax
12044                     || info->mach == bfd_mach_x86_64_intel_syntax
12045                     || info->mach == bfd_mach_l1om_intel_syntax);
12046
12047   if (info->mach == bfd_mach_i386_i386
12048       || info->mach == bfd_mach_x86_64
12049       || info->mach == bfd_mach_l1om
12050       || info->mach == bfd_mach_i386_i386_intel_syntax
12051       || info->mach == bfd_mach_x86_64_intel_syntax
12052       || info->mach == bfd_mach_l1om_intel_syntax)
12053     priv.orig_sizeflag = AFLAG | DFLAG;
12054   else if (info->mach == bfd_mach_i386_i8086)
12055     priv.orig_sizeflag = 0;
12056   else
12057     abort ();
12058
12059   for (p = info->disassembler_options; p != NULL; )
12060     {
12061       if (CONST_STRNEQ (p, "x86-64"))
12062         {
12063           address_mode = mode_64bit;
12064           priv.orig_sizeflag = AFLAG | DFLAG;
12065         }
12066       else if (CONST_STRNEQ (p, "i386"))
12067         {
12068           address_mode = mode_32bit;
12069           priv.orig_sizeflag = AFLAG | DFLAG;
12070         }
12071       else if (CONST_STRNEQ (p, "i8086"))
12072         {
12073           address_mode = mode_16bit;
12074           priv.orig_sizeflag = 0;
12075         }
12076       else if (CONST_STRNEQ (p, "intel"))
12077         {
12078           intel_syntax = 1;
12079           if (CONST_STRNEQ (p + 5, "-mnemonic"))
12080             intel_mnemonic = 1;
12081         }
12082       else if (CONST_STRNEQ (p, "att"))
12083         {
12084           intel_syntax = 0;
12085           if (CONST_STRNEQ (p + 3, "-mnemonic"))
12086             intel_mnemonic = 0;
12087         }
12088       else if (CONST_STRNEQ (p, "addr"))
12089         {
12090           if (address_mode == mode_64bit)
12091             {
12092               if (p[4] == '3' && p[5] == '2')
12093                 priv.orig_sizeflag &= ~AFLAG;
12094               else if (p[4] == '6' && p[5] == '4')
12095                 priv.orig_sizeflag |= AFLAG;
12096             }
12097           else
12098             {
12099               if (p[4] == '1' && p[5] == '6')
12100                 priv.orig_sizeflag &= ~AFLAG;
12101               else if (p[4] == '3' && p[5] == '2')
12102                 priv.orig_sizeflag |= AFLAG;
12103             }
12104         }
12105       else if (CONST_STRNEQ (p, "data"))
12106         {
12107           if (p[4] == '1' && p[5] == '6')
12108             priv.orig_sizeflag &= ~DFLAG;
12109           else if (p[4] == '3' && p[5] == '2')
12110             priv.orig_sizeflag |= DFLAG;
12111         }
12112       else if (CONST_STRNEQ (p, "suffix"))
12113         priv.orig_sizeflag |= SUFFIX_ALWAYS;
12114
12115       p = strchr (p, ',');
12116       if (p != NULL)
12117         p++;
12118     }
12119
12120   if (intel_syntax)
12121     {
12122       names64 = intel_names64;
12123       names32 = intel_names32;
12124       names16 = intel_names16;
12125       names8 = intel_names8;
12126       names8rex = intel_names8rex;
12127       names_seg = intel_names_seg;
12128       index64 = intel_index64;
12129       index32 = intel_index32;
12130       index16 = intel_index16;
12131       open_char = '[';
12132       close_char = ']';
12133       separator_char = '+';
12134       scale_char = '*';
12135     }
12136   else
12137     {
12138       names64 = att_names64;
12139       names32 = att_names32;
12140       names16 = att_names16;
12141       names8 = att_names8;
12142       names8rex = att_names8rex;
12143       names_seg = att_names_seg;
12144       index64 = att_index64;
12145       index32 = att_index32;
12146       index16 = att_index16;
12147       open_char = '(';
12148       close_char =  ')';
12149       separator_char = ',';
12150       scale_char = ',';
12151     }
12152
12153   /* The output looks better if we put 7 bytes on a line, since that
12154      puts most long word instructions on a single line.  Use 8 bytes
12155      for Intel L1OM.  */
12156   if (info->mach == bfd_mach_l1om
12157       || info->mach == bfd_mach_l1om_intel_syntax)
12158     info->bytes_per_line = 8;
12159   else
12160     info->bytes_per_line = 7;
12161
12162   info->private_data = &priv;
12163   priv.max_fetched = priv.the_buffer;
12164   priv.insn_start = pc;
12165
12166   obuf[0] = 0;
12167   for (i = 0; i < MAX_OPERANDS; ++i)
12168     {
12169       op_out[i][0] = 0;
12170       op_index[i] = -1;
12171     }
12172
12173   the_info = info;
12174   start_pc = pc;
12175   start_codep = priv.the_buffer;
12176   codep = priv.the_buffer;
12177
12178   if (setjmp (priv.bailout) != 0)
12179     {
12180       const char *name;
12181
12182       /* Getting here means we tried for data but didn't get it.  That
12183          means we have an incomplete instruction of some sort.  Just
12184          print the first byte as a prefix or a .byte pseudo-op.  */
12185       if (codep > priv.the_buffer)
12186         {
12187           name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
12188           if (name != NULL)
12189             (*info->fprintf_func) (info->stream, "%s", name);
12190           else
12191             {
12192               /* Just print the first byte as a .byte instruction.  */
12193               (*info->fprintf_func) (info->stream, ".byte 0x%x",
12194                                      (unsigned int) priv.the_buffer[0]);
12195             }
12196
12197           return 1;
12198         }
12199
12200       return -1;
12201     }
12202
12203   obufp = obuf;
12204   sizeflag = priv.orig_sizeflag;
12205
12206   if (!ckprefix () || rex_used)
12207     {
12208       /* Too many prefixes or unused REX prefixes.  */
12209       for (i = 0;
12210            all_prefixes[i] && i < (int) ARRAY_SIZE (all_prefixes);
12211            i++)
12212         (*info->fprintf_func) (info->stream, "%s",
12213                                prefix_name (all_prefixes[i], sizeflag));
12214       return 1;
12215     }
12216
12217   insn_codep = codep;
12218
12219   FETCH_DATA (info, codep + 1);
12220   two_source_ops = (*codep == 0x62) || (*codep == 0xc8);
12221
12222   if (((prefixes & PREFIX_FWAIT)
12223        && ((*codep < 0xd8) || (*codep > 0xdf))))
12224     {
12225       (*info->fprintf_func) (info->stream, "fwait");
12226       return 1;
12227     }
12228
12229   op = 0;
12230
12231   if (*codep == 0x0f)
12232     {
12233       unsigned char threebyte;
12234       FETCH_DATA (info, codep + 2);
12235       threebyte = *++codep;
12236       dp = &dis386_twobyte[threebyte];
12237       need_modrm = twobyte_has_modrm[*codep];
12238       codep++;
12239     }
12240   else
12241     {
12242       dp = &dis386[*codep];
12243       need_modrm = onebyte_has_modrm[*codep];
12244       codep++;
12245     }
12246
12247   if ((prefixes & PREFIX_REPZ))
12248     used_prefixes |= PREFIX_REPZ;
12249   if ((prefixes & PREFIX_REPNZ))
12250     used_prefixes |= PREFIX_REPNZ;
12251   if ((prefixes & PREFIX_LOCK))
12252     used_prefixes |= PREFIX_LOCK;
12253
12254   default_prefixes = 0;
12255   if (prefixes & PREFIX_ADDR)
12256     {
12257       sizeflag ^= AFLAG;
12258       if (dp->op[2].bytemode != loop_jcxz_mode || intel_syntax)
12259         {
12260           if ((sizeflag & AFLAG) || address_mode == mode_64bit)
12261             all_prefixes[last_addr_prefix] = ADDR32_PREFIX;
12262           else
12263             all_prefixes[last_addr_prefix] = ADDR16_PREFIX;
12264           default_prefixes |= PREFIX_ADDR;
12265         }
12266     }
12267
12268   if ((prefixes & PREFIX_DATA))
12269     {
12270       sizeflag ^= DFLAG;
12271       if (dp->op[2].bytemode == cond_jump_mode
12272           && dp->op[0].bytemode == v_mode
12273           && !intel_syntax)
12274         {
12275           if (sizeflag & DFLAG)
12276             all_prefixes[last_data_prefix] = DATA32_PREFIX;
12277           else
12278             all_prefixes[last_data_prefix] = DATA16_PREFIX;
12279           default_prefixes |= PREFIX_DATA;
12280         }
12281       else if (rex & REX_W)
12282         {
12283           /* REX_W will override PREFIX_DATA.  */
12284           default_prefixes |= PREFIX_DATA;
12285         }
12286     }
12287
12288   if (need_modrm)
12289     {
12290       FETCH_DATA (info, codep + 1);
12291       modrm.mod = (*codep >> 6) & 3;
12292       modrm.reg = (*codep >> 3) & 7;
12293       modrm.rm = *codep & 7;
12294     }
12295
12296    need_vex = 0;
12297    need_vex_reg = 0;
12298    vex_w_done = 0;
12299
12300   if (dp->name == NULL && dp->op[0].bytemode == FLOATCODE)
12301     {
12302       dofloat (sizeflag);
12303     }
12304   else
12305     {
12306       dp = get_valid_dis386 (dp, info);
12307       if (dp != NULL && putop (dp->name, sizeflag) == 0)
12308         {
12309           for (i = 0; i < MAX_OPERANDS; ++i)
12310             {
12311               obufp = op_out[i];
12312               op_ad = MAX_OPERANDS - 1 - i;
12313               if (dp->op[i].rtn)
12314                 (*dp->op[i].rtn) (dp->op[i].bytemode, sizeflag);
12315             }
12316         }
12317     }
12318
12319   /* See if any prefixes were not used.  If so, print the first one
12320      separately.  If we don't do this, we'll wind up printing an
12321      instruction stream which does not precisely correspond to the
12322      bytes we are disassembling.  */
12323   if ((prefixes & ~(used_prefixes | default_prefixes)) != 0)
12324     {
12325       for (i = 0; i < (int) ARRAY_SIZE (all_prefixes); i++)
12326         if (all_prefixes[i])
12327           {
12328             const char *name;
12329             name = prefix_name (all_prefixes[i], priv.orig_sizeflag);
12330             if (name == NULL)
12331               name = INTERNAL_DISASSEMBLER_ERROR;
12332             (*info->fprintf_func) (info->stream, "%s", name);
12333             return 1;
12334           }
12335     }
12336
12337   /* Check if the REX prefix used.  */
12338   if (rex_ignored == 0 && (rex ^ rex_used) == 0)
12339     all_prefixes[last_rex_prefix] = 0;
12340
12341   /* Check if the SEG prefix used.  */
12342   if ((prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS | PREFIX_ES
12343                    | PREFIX_FS | PREFIX_GS)) != 0
12344       && (used_prefixes
12345           & seg_prefix (all_prefixes[last_seg_prefix])) != 0)
12346     all_prefixes[last_seg_prefix] = 0;
12347
12348   /* Check if the ADDR prefix used.  */
12349   if ((prefixes & PREFIX_ADDR) != 0
12350       && (used_prefixes & PREFIX_ADDR) != 0)
12351     all_prefixes[last_addr_prefix] = 0;
12352
12353   /* Check if the DATA prefix used.  */
12354   if ((prefixes & PREFIX_DATA) != 0
12355       && (used_prefixes & PREFIX_DATA) != 0)
12356     all_prefixes[last_data_prefix] = 0;
12357
12358   prefix_length = 0;
12359   for (i = 0; i < (int) ARRAY_SIZE (all_prefixes); i++)
12360     if (all_prefixes[i])
12361       {
12362         const char *name;
12363         name = prefix_name (all_prefixes[i], sizeflag);
12364         if (name == NULL)
12365           abort ();
12366         prefix_length += strlen (name) + 1;
12367         (*info->fprintf_func) (info->stream, "%s ", name);
12368       }
12369
12370   /* Check maximum code length.  */
12371   if ((codep - start_codep) > MAX_CODE_LENGTH)
12372     {
12373       (*info->fprintf_func) (info->stream, "(bad)");
12374       return MAX_CODE_LENGTH;
12375     }
12376
12377   obufp = mnemonicendp;
12378   for (i = strlen (obuf) + prefix_length; i < 6; i++)
12379     oappend (" ");
12380   oappend (" ");
12381   (*info->fprintf_func) (info->stream, "%s", obuf);
12382
12383   /* The enter and bound instructions are printed with operands in the same
12384      order as the intel book; everything else is printed in reverse order.  */
12385   if (intel_syntax || two_source_ops)
12386     {
12387       bfd_vma riprel;
12388
12389       for (i = 0; i < MAX_OPERANDS; ++i)
12390         op_txt[i] = op_out[i];
12391
12392       for (i = 0; i < (MAX_OPERANDS >> 1); ++i)
12393         {
12394           op_ad = op_index[i];
12395           op_index[i] = op_index[MAX_OPERANDS - 1 - i];
12396           op_index[MAX_OPERANDS - 1 - i] = op_ad;
12397           riprel = op_riprel[i];
12398           op_riprel[i] = op_riprel [MAX_OPERANDS - 1 - i];
12399           op_riprel[MAX_OPERANDS - 1 - i] = riprel;
12400         }
12401     }
12402   else
12403     {
12404       for (i = 0; i < MAX_OPERANDS; ++i)
12405         op_txt[MAX_OPERANDS - 1 - i] = op_out[i];
12406     }
12407
12408   needcomma = 0;
12409   for (i = 0; i < MAX_OPERANDS; ++i)
12410     if (*op_txt[i])
12411       {
12412         if (needcomma)
12413           (*info->fprintf_func) (info->stream, ",");
12414         if (op_index[i] != -1 && !op_riprel[i])
12415           (*info->print_address_func) ((bfd_vma) op_address[op_index[i]], info);
12416         else
12417           (*info->fprintf_func) (info->stream, "%s", op_txt[i]);
12418         needcomma = 1;
12419       }
12420
12421   for (i = 0; i < MAX_OPERANDS; i++)
12422     if (op_index[i] != -1 && op_riprel[i])
12423       {
12424         (*info->fprintf_func) (info->stream, "        # ");
12425         (*info->print_address_func) ((bfd_vma) (start_pc + codep - start_codep
12426                                                 + op_address[op_index[i]]), info);
12427         break;
12428       }
12429   return codep - priv.the_buffer;
12430 }
12431
12432 static const char *float_mem[] = {
12433   /* d8 */
12434   "fadd{s|}",
12435   "fmul{s|}",
12436   "fcom{s|}",
12437   "fcomp{s|}",
12438   "fsub{s|}",
12439   "fsubr{s|}",
12440   "fdiv{s|}",
12441   "fdivr{s|}",
12442   /* d9 */
12443   "fld{s|}",
12444   "(bad)",
12445   "fst{s|}",
12446   "fstp{s|}",
12447   "fldenvIC",
12448   "fldcw",
12449   "fNstenvIC",
12450   "fNstcw",
12451   /* da */
12452   "fiadd{l|}",
12453   "fimul{l|}",
12454   "ficom{l|}",
12455   "ficomp{l|}",
12456   "fisub{l|}",
12457   "fisubr{l|}",
12458   "fidiv{l|}",
12459   "fidivr{l|}",
12460   /* db */
12461   "fild{l|}",
12462   "fisttp{l|}",
12463   "fist{l|}",
12464   "fistp{l|}",
12465   "(bad)",
12466   "fld{t||t|}",
12467   "(bad)",
12468   "fstp{t||t|}",
12469   /* dc */
12470   "fadd{l|}",
12471   "fmul{l|}",
12472   "fcom{l|}",
12473   "fcomp{l|}",
12474   "fsub{l|}",
12475   "fsubr{l|}",
12476   "fdiv{l|}",
12477   "fdivr{l|}",
12478   /* dd */
12479   "fld{l|}",
12480   "fisttp{ll|}",
12481   "fst{l||}",
12482   "fstp{l|}",
12483   "frstorIC",
12484   "(bad)",
12485   "fNsaveIC",
12486   "fNstsw",
12487   /* de */
12488   "fiadd",
12489   "fimul",
12490   "ficom",
12491   "ficomp",
12492   "fisub",
12493   "fisubr",
12494   "fidiv",
12495   "fidivr",
12496   /* df */
12497   "fild",
12498   "fisttp",
12499   "fist",
12500   "fistp",
12501   "fbld",
12502   "fild{ll|}",
12503   "fbstp",
12504   "fistp{ll|}",
12505 };
12506
12507 static const unsigned char float_mem_mode[] = {
12508   /* d8 */
12509   d_mode,
12510   d_mode,
12511   d_mode,
12512   d_mode,
12513   d_mode,
12514   d_mode,
12515   d_mode,
12516   d_mode,
12517   /* d9 */
12518   d_mode,
12519   0,
12520   d_mode,
12521   d_mode,
12522   0,
12523   w_mode,
12524   0,
12525   w_mode,
12526   /* da */
12527   d_mode,
12528   d_mode,
12529   d_mode,
12530   d_mode,
12531   d_mode,
12532   d_mode,
12533   d_mode,
12534   d_mode,
12535   /* db */
12536   d_mode,
12537   d_mode,
12538   d_mode,
12539   d_mode,
12540   0,
12541   t_mode,
12542   0,
12543   t_mode,
12544   /* dc */
12545   q_mode,
12546   q_mode,
12547   q_mode,
12548   q_mode,
12549   q_mode,
12550   q_mode,
12551   q_mode,
12552   q_mode,
12553   /* dd */
12554   q_mode,
12555   q_mode,
12556   q_mode,
12557   q_mode,
12558   0,
12559   0,
12560   0,
12561   w_mode,
12562   /* de */
12563   w_mode,
12564   w_mode,
12565   w_mode,
12566   w_mode,
12567   w_mode,
12568   w_mode,
12569   w_mode,
12570   w_mode,
12571   /* df */
12572   w_mode,
12573   w_mode,
12574   w_mode,
12575   w_mode,
12576   t_mode,
12577   q_mode,
12578   t_mode,
12579   q_mode
12580 };
12581
12582 #define ST { OP_ST, 0 }
12583 #define STi { OP_STi, 0 }
12584
12585 #define FGRPd9_2 NULL, { { NULL, 0 } }
12586 #define FGRPd9_4 NULL, { { NULL, 1 } }
12587 #define FGRPd9_5 NULL, { { NULL, 2 } }
12588 #define FGRPd9_6 NULL, { { NULL, 3 } }
12589 #define FGRPd9_7 NULL, { { NULL, 4 } }
12590 #define FGRPda_5 NULL, { { NULL, 5 } }
12591 #define FGRPdb_4 NULL, { { NULL, 6 } }
12592 #define FGRPde_3 NULL, { { NULL, 7 } }
12593 #define FGRPdf_4 NULL, { { NULL, 8 } }
12594
12595 static const struct dis386 float_reg[][8] = {
12596   /* d8 */
12597   {
12598     { "fadd",   { ST, STi } },
12599     { "fmul",   { ST, STi } },
12600     { "fcom",   { STi } },
12601     { "fcomp",  { STi } },
12602     { "fsub",   { ST, STi } },
12603     { "fsubr",  { ST, STi } },
12604     { "fdiv",   { ST, STi } },
12605     { "fdivr",  { ST, STi } },
12606   },
12607   /* d9 */
12608   {
12609     { "fld",    { STi } },
12610     { "fxch",   { STi } },
12611     { FGRPd9_2 },
12612     { "(bad)",  { XX } },
12613     { FGRPd9_4 },
12614     { FGRPd9_5 },
12615     { FGRPd9_6 },
12616     { FGRPd9_7 },
12617   },
12618   /* da */
12619   {
12620     { "fcmovb", { ST, STi } },
12621     { "fcmove", { ST, STi } },
12622     { "fcmovbe",{ ST, STi } },
12623     { "fcmovu", { ST, STi } },
12624     { "(bad)",  { XX } },
12625     { FGRPda_5 },
12626     { "(bad)",  { XX } },
12627     { "(bad)",  { XX } },
12628   },
12629   /* db */
12630   {
12631     { "fcmovnb",{ ST, STi } },
12632     { "fcmovne",{ ST, STi } },
12633     { "fcmovnbe",{ ST, STi } },
12634     { "fcmovnu",{ ST, STi } },
12635     { FGRPdb_4 },
12636     { "fucomi", { ST, STi } },
12637     { "fcomi",  { ST, STi } },
12638     { "(bad)",  { XX } },
12639   },
12640   /* dc */
12641   {
12642     { "fadd",   { STi, ST } },
12643     { "fmul",   { STi, ST } },
12644     { "(bad)",  { XX } },
12645     { "(bad)",  { XX } },
12646     { "fsub!M", { STi, ST } },
12647     { "fsubM",  { STi, ST } },
12648     { "fdiv!M", { STi, ST } },
12649     { "fdivM",  { STi, ST } },
12650   },
12651   /* dd */
12652   {
12653     { "ffree",  { STi } },
12654     { "(bad)",  { XX } },
12655     { "fst",    { STi } },
12656     { "fstp",   { STi } },
12657     { "fucom",  { STi } },
12658     { "fucomp", { STi } },
12659     { "(bad)",  { XX } },
12660     { "(bad)",  { XX } },
12661   },
12662   /* de */
12663   {
12664     { "faddp",  { STi, ST } },
12665     { "fmulp",  { STi, ST } },
12666     { "(bad)",  { XX } },
12667     { FGRPde_3 },
12668     { "fsub!Mp", { STi, ST } },
12669     { "fsubMp", { STi, ST } },
12670     { "fdiv!Mp", { STi, ST } },
12671     { "fdivMp", { STi, ST } },
12672   },
12673   /* df */
12674   {
12675     { "ffreep", { STi } },
12676     { "(bad)",  { XX } },
12677     { "(bad)",  { XX } },
12678     { "(bad)",  { XX } },
12679     { FGRPdf_4 },
12680     { "fucomip", { ST, STi } },
12681     { "fcomip", { ST, STi } },
12682     { "(bad)",  { XX } },
12683   },
12684 };
12685
12686 static char *fgrps[][8] = {
12687   /* d9_2  0 */
12688   {
12689     "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
12690   },
12691
12692   /* d9_4  1 */
12693   {
12694     "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)",
12695   },
12696
12697   /* d9_5  2 */
12698   {
12699     "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)",
12700   },
12701
12702   /* d9_6  3 */
12703   {
12704     "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp",
12705   },
12706
12707   /* d9_7  4 */
12708   {
12709     "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos",
12710   },
12711
12712   /* da_5  5 */
12713   {
12714     "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
12715   },
12716
12717   /* db_4  6 */
12718   {
12719     "fNeni(8087 only)","fNdisi(8087 only)","fNclex","fNinit",
12720     "fNsetpm(287 only)","frstpm(287 only)","(bad)","(bad)",
12721   },
12722
12723   /* de_3  7 */
12724   {
12725     "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
12726   },
12727
12728   /* df_4  8 */
12729   {
12730     "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
12731   },
12732 };
12733
12734 static void
12735 swap_operand (void)
12736 {
12737   mnemonicendp[0] = '.';
12738   mnemonicendp[1] = 's';
12739   mnemonicendp += 2;
12740 }
12741
12742 static void
12743 OP_Skip_MODRM (int bytemode ATTRIBUTE_UNUSED,
12744                int sizeflag ATTRIBUTE_UNUSED)
12745 {
12746   /* Skip mod/rm byte.  */
12747   MODRM_CHECK;
12748   codep++;
12749 }
12750
12751 static void
12752 dofloat (int sizeflag)
12753 {
12754   const struct dis386 *dp;
12755   unsigned char floatop;
12756
12757   floatop = codep[-1];
12758
12759   if (modrm.mod != 3)
12760     {
12761       int fp_indx = (floatop - 0xd8) * 8 + modrm.reg;
12762
12763       putop (float_mem[fp_indx], sizeflag);
12764       obufp = op_out[0];
12765       op_ad = 2;
12766       OP_E (float_mem_mode[fp_indx], sizeflag);
12767       return;
12768     }
12769   /* Skip mod/rm byte.  */
12770   MODRM_CHECK;
12771   codep++;
12772
12773   dp = &float_reg[floatop - 0xd8][modrm.reg];
12774   if (dp->name == NULL)
12775     {
12776       putop (fgrps[dp->op[0].bytemode][modrm.rm], sizeflag);
12777
12778       /* Instruction fnstsw is only one with strange arg.  */
12779       if (floatop == 0xdf && codep[-1] == 0xe0)
12780         strcpy (op_out[0], names16[0]);
12781     }
12782   else
12783     {
12784       putop (dp->name, sizeflag);
12785
12786       obufp = op_out[0];
12787       op_ad = 2;
12788       if (dp->op[0].rtn)
12789         (*dp->op[0].rtn) (dp->op[0].bytemode, sizeflag);
12790
12791       obufp = op_out[1];
12792       op_ad = 1;
12793       if (dp->op[1].rtn)
12794         (*dp->op[1].rtn) (dp->op[1].bytemode, sizeflag);
12795     }
12796 }
12797
12798 static void
12799 OP_ST (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
12800 {
12801   oappend ("%st" + intel_syntax);
12802 }
12803
12804 static void
12805 OP_STi (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
12806 {
12807   sprintf (scratchbuf, "%%st(%d)", modrm.rm);
12808   oappend (scratchbuf + intel_syntax);
12809 }
12810
12811 /* Capital letters in template are macros.  */
12812 static int
12813 putop (const char *in_template, int sizeflag)
12814 {
12815   const char *p;
12816   int alt = 0;
12817   int cond = 1;
12818   unsigned int l = 0, len = 1;
12819   char last[4];
12820
12821 #define SAVE_LAST(c)                    \
12822   if (l < len && l < sizeof (last))     \
12823     last[l++] = c;                      \
12824   else                                  \
12825     abort ();
12826
12827   for (p = in_template; *p; p++)
12828     {
12829       switch (*p)
12830         {
12831         default:
12832           *obufp++ = *p;
12833           break;
12834         case '%':
12835           len++;
12836           break;
12837         case '!':
12838           cond = 0;
12839           break;
12840         case '{':
12841           alt = 0;
12842           if (intel_syntax)
12843             {
12844               while (*++p != '|')
12845                 if (*p == '}' || *p == '\0')
12846                   abort ();
12847             }
12848           /* Fall through.  */
12849         case 'I':
12850           alt = 1;
12851           continue;
12852         case '|':
12853           while (*++p != '}')
12854             {
12855               if (*p == '\0')
12856                 abort ();
12857             }
12858           break;
12859         case '}':
12860           break;
12861         case 'A':
12862           if (intel_syntax)
12863             break;
12864           if (modrm.mod != 3 || (sizeflag & SUFFIX_ALWAYS))
12865             *obufp++ = 'b';
12866           break;
12867         case 'B':
12868           if (l == 0 && len == 1)
12869             {
12870 case_B:
12871               if (intel_syntax)
12872                 break;
12873               if (sizeflag & SUFFIX_ALWAYS)
12874                 *obufp++ = 'b';
12875             }
12876           else
12877             {
12878               if (l != 1
12879                   || len != 2
12880                   || last[0] != 'L')
12881                 {
12882                   SAVE_LAST (*p);
12883                   break;
12884                 }
12885
12886               if (address_mode == mode_64bit
12887                   && !(prefixes & PREFIX_ADDR))
12888                 {
12889                   *obufp++ = 'a';
12890                   *obufp++ = 'b';
12891                   *obufp++ = 's';
12892                 }
12893
12894               goto case_B;
12895             }
12896           break;
12897         case 'C':
12898           if (intel_syntax && !alt)
12899             break;
12900           if ((prefixes & PREFIX_DATA) || (sizeflag & SUFFIX_ALWAYS))
12901             {
12902               if (sizeflag & DFLAG)
12903                 *obufp++ = intel_syntax ? 'd' : 'l';
12904               else
12905                 *obufp++ = intel_syntax ? 'w' : 's';
12906               used_prefixes |= (prefixes & PREFIX_DATA);
12907             }
12908           break;
12909         case 'D':
12910           if (intel_syntax || !(sizeflag & SUFFIX_ALWAYS))
12911             break;
12912           USED_REX (REX_W);
12913           if (modrm.mod == 3)
12914             {
12915               if (rex & REX_W)
12916                 *obufp++ = 'q';
12917               else
12918                 {
12919                   if (sizeflag & DFLAG)
12920                     *obufp++ = intel_syntax ? 'd' : 'l';
12921                   else
12922                     *obufp++ = 'w';
12923                   used_prefixes |= (prefixes & PREFIX_DATA);
12924                 }
12925             }
12926           else
12927             *obufp++ = 'w';
12928           break;
12929         case 'E':               /* For jcxz/jecxz */
12930           if (address_mode == mode_64bit)
12931             {
12932               if (sizeflag & AFLAG)
12933                 *obufp++ = 'r';
12934               else
12935                 *obufp++ = 'e';
12936             }
12937           else
12938             if (sizeflag & AFLAG)
12939               *obufp++ = 'e';
12940           used_prefixes |= (prefixes & PREFIX_ADDR);
12941           break;
12942         case 'F':
12943           if (intel_syntax)
12944             break;
12945           if ((prefixes & PREFIX_ADDR) || (sizeflag & SUFFIX_ALWAYS))
12946             {
12947               if (sizeflag & AFLAG)
12948                 *obufp++ = address_mode == mode_64bit ? 'q' : 'l';
12949               else
12950                 *obufp++ = address_mode == mode_64bit ? 'l' : 'w';
12951               used_prefixes |= (prefixes & PREFIX_ADDR);
12952             }
12953           break;
12954         case 'G':
12955           if (intel_syntax || (obufp[-1] != 's' && !(sizeflag & SUFFIX_ALWAYS)))
12956             break;
12957           if ((rex & REX_W) || (sizeflag & DFLAG))
12958             *obufp++ = 'l';
12959           else
12960             *obufp++ = 'w';
12961           if (!(rex & REX_W))
12962             used_prefixes |= (prefixes & PREFIX_DATA);
12963           break;
12964         case 'H':
12965           if (intel_syntax)
12966             break;
12967           if ((prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_CS
12968               || (prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_DS)
12969             {
12970               used_prefixes |= prefixes & (PREFIX_CS | PREFIX_DS);
12971               *obufp++ = ',';
12972               *obufp++ = 'p';
12973               if (prefixes & PREFIX_DS)
12974                 *obufp++ = 't';
12975               else
12976                 *obufp++ = 'n';
12977             }
12978           break;
12979         case 'J':
12980           if (intel_syntax)
12981             break;
12982           *obufp++ = 'l';
12983           break;
12984         case 'K':
12985           USED_REX (REX_W);
12986           if (rex & REX_W)
12987             *obufp++ = 'q';
12988           else
12989             *obufp++ = 'd';
12990           break;
12991         case 'Z':
12992           if (intel_syntax)
12993             break;
12994           if (address_mode == mode_64bit && (sizeflag & SUFFIX_ALWAYS))
12995             {
12996               *obufp++ = 'q';
12997               break;
12998             }
12999           /* Fall through.  */
13000           goto case_L;
13001         case 'L':
13002           if (l != 0 || len != 1)
13003             {
13004               SAVE_LAST (*p);
13005               break;
13006             }
13007 case_L:
13008           if (intel_syntax)
13009             break;
13010           if (sizeflag & SUFFIX_ALWAYS)
13011             *obufp++ = 'l';
13012           break;
13013         case 'M':
13014           if (intel_mnemonic != cond)
13015             *obufp++ = 'r';
13016           break;
13017         case 'N':
13018           if ((prefixes & PREFIX_FWAIT) == 0)
13019             *obufp++ = 'n';
13020           else
13021             used_prefixes |= PREFIX_FWAIT;
13022           break;
13023         case 'O':
13024           USED_REX (REX_W);
13025           if (rex & REX_W)
13026             *obufp++ = 'o';
13027           else if (intel_syntax && (sizeflag & DFLAG))
13028             *obufp++ = 'q';
13029           else
13030             *obufp++ = 'd';
13031           if (!(rex & REX_W))
13032             used_prefixes |= (prefixes & PREFIX_DATA);
13033           break;
13034         case 'T':
13035           if (intel_syntax)
13036             break;
13037           if (address_mode == mode_64bit && (sizeflag & DFLAG))
13038             {
13039               *obufp++ = 'q';
13040               break;
13041             }
13042           /* Fall through.  */
13043         case 'P':
13044           if (intel_syntax)
13045             break;
13046           if ((prefixes & PREFIX_DATA)
13047               || (rex & REX_W)
13048               || (sizeflag & SUFFIX_ALWAYS))
13049             {
13050               USED_REX (REX_W);
13051               if (rex & REX_W)
13052                 *obufp++ = 'q';
13053               else
13054                 {
13055                    if (sizeflag & DFLAG)
13056                       *obufp++ = 'l';
13057                    else
13058                      *obufp++ = 'w';
13059                    used_prefixes |= (prefixes & PREFIX_DATA);
13060                 }
13061             }
13062           break;
13063         case 'U':
13064           if (intel_syntax)
13065             break;
13066           if (address_mode == mode_64bit && (sizeflag & DFLAG))
13067             {
13068               if (modrm.mod != 3 || (sizeflag & SUFFIX_ALWAYS))
13069                 *obufp++ = 'q';
13070               break;
13071             }
13072           /* Fall through.  */
13073           goto case_Q;
13074         case 'Q':
13075           if (l == 0 && len == 1)
13076             {
13077 case_Q:
13078               if (intel_syntax && !alt)
13079                 break;
13080               USED_REX (REX_W);
13081               if (modrm.mod != 3 || (sizeflag & SUFFIX_ALWAYS))
13082                 {
13083                   if (rex & REX_W)
13084                     *obufp++ = 'q';
13085                   else
13086                     {
13087                       if (sizeflag & DFLAG)
13088                         *obufp++ = intel_syntax ? 'd' : 'l';
13089                       else
13090                         *obufp++ = 'w';
13091                       used_prefixes |= (prefixes & PREFIX_DATA);
13092                     }
13093                 }
13094             }
13095           else
13096             {
13097               if (l != 1 || len != 2 || last[0] != 'L')
13098                 {
13099                   SAVE_LAST (*p);
13100                   break;
13101                 }
13102               if (intel_syntax
13103                   || (modrm.mod == 3 && !(sizeflag & SUFFIX_ALWAYS)))
13104                 break;
13105               if ((rex & REX_W))
13106                 {
13107                   USED_REX (REX_W);
13108                   *obufp++ = 'q';
13109                 }
13110               else
13111                 *obufp++ = 'l';
13112             }
13113           break;
13114         case 'R':
13115           USED_REX (REX_W);
13116           if (rex & REX_W)
13117             *obufp++ = 'q';
13118           else if (sizeflag & DFLAG)
13119             {
13120               if (intel_syntax)
13121                   *obufp++ = 'd';
13122               else
13123                   *obufp++ = 'l';
13124             }
13125           else
13126             *obufp++ = 'w';
13127           if (intel_syntax && !p[1]
13128               && ((rex & REX_W) || (sizeflag & DFLAG)))
13129             *obufp++ = 'e';
13130           if (!(rex & REX_W))
13131             used_prefixes |= (prefixes & PREFIX_DATA);
13132           break;
13133         case 'V':
13134           if (l == 0 && len == 1)
13135             {
13136               if (intel_syntax)
13137                 break;
13138               if (address_mode == mode_64bit && (sizeflag & DFLAG))
13139                 {
13140                   if (sizeflag & SUFFIX_ALWAYS)
13141                     *obufp++ = 'q';
13142                   break;
13143                 }
13144             }
13145           else
13146             {
13147               if (l != 1
13148                   || len != 2
13149                   || last[0] != 'L')
13150                 {
13151                   SAVE_LAST (*p);
13152                   break;
13153                 }
13154
13155               if (rex & REX_W)
13156                 {
13157                   *obufp++ = 'a';
13158                   *obufp++ = 'b';
13159                   *obufp++ = 's';
13160                 }
13161             }
13162           /* Fall through.  */
13163           goto case_S;
13164         case 'S':
13165           if (l == 0 && len == 1)
13166             {
13167 case_S:
13168               if (intel_syntax)
13169                 break;
13170               if (sizeflag & SUFFIX_ALWAYS)
13171                 {
13172                   if (rex & REX_W)
13173                     *obufp++ = 'q';
13174                   else
13175                     {
13176                       if (sizeflag & DFLAG)
13177                         *obufp++ = 'l';
13178                       else
13179                         *obufp++ = 'w';
13180                       used_prefixes |= (prefixes & PREFIX_DATA);
13181                     }
13182                 }
13183             }
13184           else
13185             {
13186               if (l != 1
13187                   || len != 2
13188                   || last[0] != 'L')
13189                 {
13190                   SAVE_LAST (*p);
13191                   break;
13192                 }
13193
13194               if (address_mode == mode_64bit
13195                   && !(prefixes & PREFIX_ADDR))
13196                 {
13197                   *obufp++ = 'a';
13198                   *obufp++ = 'b';
13199                   *obufp++ = 's';
13200                 }
13201
13202               goto case_S;
13203             }
13204           break;
13205         case 'X':
13206           if (l != 0 || len != 1)
13207             {
13208               SAVE_LAST (*p);
13209               break;
13210             }
13211           if (need_vex && vex.prefix)
13212             {
13213               if (vex.prefix == DATA_PREFIX_OPCODE)
13214                 *obufp++ = 'd';
13215               else
13216                 *obufp++ = 's';
13217             }
13218           else
13219             {
13220               if (prefixes & PREFIX_DATA)
13221                 *obufp++ = 'd';
13222               else
13223                 *obufp++ = 's';
13224               used_prefixes |= (prefixes & PREFIX_DATA);
13225             }
13226           break;
13227         case 'Y':
13228           if (l == 0 && len == 1)
13229             {
13230               if (intel_syntax || !(sizeflag & SUFFIX_ALWAYS))
13231                 break;
13232               if (rex & REX_W)
13233                 {
13234                   USED_REX (REX_W);
13235                   *obufp++ = 'q';
13236                 }
13237               break;
13238             }
13239           else
13240             {
13241               if (l != 1 || len != 2 || last[0] != 'X')
13242                 {
13243                   SAVE_LAST (*p);
13244                   break;
13245                 }
13246               if (!need_vex)
13247                 abort ();
13248               if (intel_syntax
13249                   || (modrm.mod == 3 && !(sizeflag & SUFFIX_ALWAYS)))
13250                 break;
13251               switch (vex.length)
13252                 {
13253                 case 128:
13254                   *obufp++ = 'x';
13255                   break;
13256                 case 256:
13257                   *obufp++ = 'y';
13258                   break;
13259                 default:
13260                   abort ();
13261                 }
13262             }
13263           break;
13264         case 'W':
13265           if (l == 0 && len == 1)
13266             {
13267               /* operand size flag for cwtl, cbtw */
13268               USED_REX (REX_W);
13269               if (rex & REX_W)
13270                 {
13271                   if (intel_syntax)
13272                     *obufp++ = 'd';
13273                   else
13274                     *obufp++ = 'l';
13275                 }
13276               else if (sizeflag & DFLAG)
13277                 *obufp++ = 'w';
13278               else
13279                 *obufp++ = 'b';
13280               if (!(rex & REX_W))
13281                 used_prefixes |= (prefixes & PREFIX_DATA);
13282             }
13283           else
13284             {
13285               if (l != 1 || len != 2 || last[0] != 'X')
13286                 {
13287                   SAVE_LAST (*p);
13288                   break;
13289                 }
13290               if (!need_vex)
13291                 abort ();
13292               *obufp++ = vex.w ? 'd': 's';
13293             }
13294           break;
13295         }
13296       alt = 0;
13297     }
13298   *obufp = 0;
13299   mnemonicendp = obufp;
13300   return 0;
13301 }
13302
13303 static void
13304 oappend (const char *s)
13305 {
13306   obufp = stpcpy (obufp, s);
13307 }
13308
13309 static void
13310 append_seg (void)
13311 {
13312   if (prefixes & PREFIX_CS)
13313     {
13314       used_prefixes |= PREFIX_CS;
13315       oappend ("%cs:" + intel_syntax);
13316     }
13317   if (prefixes & PREFIX_DS)
13318     {
13319       used_prefixes |= PREFIX_DS;
13320       oappend ("%ds:" + intel_syntax);
13321     }
13322   if (prefixes & PREFIX_SS)
13323     {
13324       used_prefixes |= PREFIX_SS;
13325       oappend ("%ss:" + intel_syntax);
13326     }
13327   if (prefixes & PREFIX_ES)
13328     {
13329       used_prefixes |= PREFIX_ES;
13330       oappend ("%es:" + intel_syntax);
13331     }
13332   if (prefixes & PREFIX_FS)
13333     {
13334       used_prefixes |= PREFIX_FS;
13335       oappend ("%fs:" + intel_syntax);
13336     }
13337   if (prefixes & PREFIX_GS)
13338     {
13339       used_prefixes |= PREFIX_GS;
13340       oappend ("%gs:" + intel_syntax);
13341     }
13342 }
13343
13344 static void
13345 OP_indirE (int bytemode, int sizeflag)
13346 {
13347   if (!intel_syntax)
13348     oappend ("*");
13349   OP_E (bytemode, sizeflag);
13350 }
13351
13352 static void
13353 print_operand_value (char *buf, int hex, bfd_vma disp)
13354 {
13355   if (address_mode == mode_64bit)
13356     {
13357       if (hex)
13358         {
13359           char tmp[30];
13360           int i;
13361           buf[0] = '0';
13362           buf[1] = 'x';
13363           sprintf_vma (tmp, disp);
13364           for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++);
13365           strcpy (buf + 2, tmp + i);
13366         }
13367       else
13368         {
13369           bfd_signed_vma v = disp;
13370           char tmp[30];
13371           int i;
13372           if (v < 0)
13373             {
13374               *(buf++) = '-';
13375               v = -disp;
13376               /* Check for possible overflow on 0x8000000000000000.  */
13377               if (v < 0)
13378                 {
13379                   strcpy (buf, "9223372036854775808");
13380                   return;
13381                 }
13382             }
13383           if (!v)
13384             {
13385               strcpy (buf, "0");
13386               return;
13387             }
13388
13389           i = 0;
13390           tmp[29] = 0;
13391           while (v)
13392             {
13393               tmp[28 - i] = (v % 10) + '0';
13394               v /= 10;
13395               i++;
13396             }
13397           strcpy (buf, tmp + 29 - i);
13398         }
13399     }
13400   else
13401     {
13402       if (hex)
13403         sprintf (buf, "0x%x", (unsigned int) disp);
13404       else
13405         sprintf (buf, "%d", (int) disp);
13406     }
13407 }
13408
13409 /* Put DISP in BUF as signed hex number.  */
13410
13411 static void
13412 print_displacement (char *buf, bfd_vma disp)
13413 {
13414   bfd_signed_vma val = disp;
13415   char tmp[30];
13416   int i, j = 0;
13417
13418   if (val < 0)
13419     {
13420       buf[j++] = '-';
13421       val = -disp;
13422
13423       /* Check for possible overflow.  */
13424       if (val < 0)
13425         {
13426           switch (address_mode)
13427             {
13428             case mode_64bit:
13429               strcpy (buf + j, "0x8000000000000000");
13430               break;
13431             case mode_32bit:
13432               strcpy (buf + j, "0x80000000");
13433               break;
13434             case mode_16bit:
13435               strcpy (buf + j, "0x8000");
13436               break;
13437             }
13438           return;
13439         }
13440     }
13441
13442   buf[j++] = '0';
13443   buf[j++] = 'x';
13444
13445   sprintf_vma (tmp, (bfd_vma) val);
13446   for (i = 0; tmp[i] == '0'; i++)
13447     continue;
13448   if (tmp[i] == '\0')
13449     i--;
13450   strcpy (buf + j, tmp + i);
13451 }
13452
13453 static void
13454 intel_operand_size (int bytemode, int sizeflag)
13455 {
13456   switch (bytemode)
13457     {
13458     case b_mode:
13459     case b_swap_mode:
13460     case dqb_mode:
13461       oappend ("BYTE PTR ");
13462       break;
13463     case w_mode:
13464     case dqw_mode:
13465       oappend ("WORD PTR ");
13466       break;
13467     case stack_v_mode:
13468       if (address_mode == mode_64bit && (sizeflag & DFLAG))
13469         {
13470           oappend ("QWORD PTR ");
13471           break;
13472         }
13473       /* FALLTHRU */
13474     case v_mode:
13475     case v_swap_mode:
13476     case dq_mode:
13477       USED_REX (REX_W);
13478       if (rex & REX_W)
13479         oappend ("QWORD PTR ");
13480       else
13481         {
13482           if ((sizeflag & DFLAG) || bytemode == dq_mode)
13483             oappend ("DWORD PTR ");
13484           else
13485             oappend ("WORD PTR ");
13486           used_prefixes |= (prefixes & PREFIX_DATA);
13487         }
13488       break;
13489     case z_mode:
13490       if ((rex & REX_W) || (sizeflag & DFLAG))
13491         *obufp++ = 'D';
13492       oappend ("WORD PTR ");
13493       if (!(rex & REX_W))
13494         used_prefixes |= (prefixes & PREFIX_DATA);
13495       break;
13496     case a_mode:
13497       if (sizeflag & DFLAG)
13498         oappend ("QWORD PTR ");
13499       else
13500         oappend ("DWORD PTR ");
13501       used_prefixes |= (prefixes & PREFIX_DATA);
13502       break;
13503     case d_mode:
13504     case d_swap_mode:
13505     case dqd_mode:
13506       oappend ("DWORD PTR ");
13507       break;
13508     case q_mode:
13509     case q_swap_mode:
13510       oappend ("QWORD PTR ");
13511       break;
13512     case m_mode:
13513       if (address_mode == mode_64bit)
13514         oappend ("QWORD PTR ");
13515       else
13516         oappend ("DWORD PTR ");
13517       break;
13518     case f_mode:
13519       if (sizeflag & DFLAG)
13520         oappend ("FWORD PTR ");
13521       else
13522         oappend ("DWORD PTR ");
13523       used_prefixes |= (prefixes & PREFIX_DATA);
13524       break;
13525     case t_mode:
13526       oappend ("TBYTE PTR ");
13527       break;
13528     case x_mode:
13529     case x_swap_mode:
13530       if (need_vex)
13531         {
13532           switch (vex.length)
13533             {
13534             case 128:
13535               oappend ("XMMWORD PTR ");
13536               break;
13537             case 256:
13538               oappend ("YMMWORD PTR ");
13539               break;
13540             default:
13541               abort ();
13542             }
13543         }
13544       else
13545         oappend ("XMMWORD PTR ");
13546       break;
13547     case xmm_mode:
13548       oappend ("XMMWORD PTR ");
13549       break;
13550     case xmmq_mode:
13551       if (!need_vex)
13552         abort ();
13553
13554       switch (vex.length)
13555         {
13556         case 128:
13557           oappend ("QWORD PTR ");
13558           break;
13559         case 256:
13560           oappend ("XMMWORD PTR ");
13561           break;
13562         default:
13563           abort ();
13564         }
13565       break;
13566     case ymmq_mode:
13567       if (!need_vex)
13568         abort ();
13569
13570       switch (vex.length)
13571         {
13572         case 128:
13573           oappend ("QWORD PTR ");
13574           break;
13575         case 256:
13576           oappend ("YMMWORD PTR ");
13577           break;
13578         default:
13579           abort ();
13580         }
13581       break;
13582     case o_mode:
13583       oappend ("OWORD PTR ");
13584       break;
13585     case vex_w_dq_mode:
13586       if (!need_vex)
13587         abort ();
13588
13589       if (vex.w)
13590         oappend ("QWORD PTR ");
13591       else
13592         oappend ("DWORD PTR ");
13593       break;
13594     default:
13595       break;
13596     }
13597 }
13598
13599 static void
13600 OP_E_register (int bytemode, int sizeflag)
13601 {
13602   int reg = modrm.rm;
13603   const char **names;
13604
13605   USED_REX (REX_B);
13606   if ((rex & REX_B))
13607     reg += 8;
13608
13609   if ((sizeflag & SUFFIX_ALWAYS)
13610       && (bytemode == b_swap_mode || bytemode == v_swap_mode))
13611     swap_operand ();
13612
13613   switch (bytemode)
13614     {
13615     case b_mode:
13616     case b_swap_mode:
13617       USED_REX (0);
13618       if (rex)
13619         names = names8rex;
13620       else
13621         names = names8;
13622       break;
13623     case w_mode:
13624       names = names16;
13625       break;
13626     case d_mode:
13627       names = names32;
13628       break;
13629     case q_mode:
13630       names = names64;
13631       break;
13632     case m_mode:
13633       names = address_mode == mode_64bit ? names64 : names32;
13634       break;
13635     case stack_v_mode:
13636       if (address_mode == mode_64bit && (sizeflag & DFLAG))
13637         {
13638           names = names64;
13639           break;
13640         }
13641       bytemode = v_mode;
13642       /* FALLTHRU */
13643     case v_mode:
13644     case v_swap_mode:
13645     case dq_mode:
13646     case dqb_mode:
13647     case dqd_mode:
13648     case dqw_mode:
13649       USED_REX (REX_W);
13650       if (rex & REX_W)
13651         names = names64;
13652       else
13653         {
13654           if ((sizeflag & DFLAG) 
13655               || (bytemode != v_mode
13656                   && bytemode != v_swap_mode))
13657             names = names32;
13658           else
13659             names = names16;
13660           used_prefixes |= (prefixes & PREFIX_DATA);
13661         }
13662       break;
13663     case 0:
13664       return;
13665     default:
13666       oappend (INTERNAL_DISASSEMBLER_ERROR);
13667       return;
13668     }
13669   oappend (names[reg]);
13670 }
13671
13672 static void
13673 OP_E_memory (int bytemode, int sizeflag)
13674 {
13675   bfd_vma disp = 0;
13676   int add = (rex & REX_B) ? 8 : 0;
13677   int riprel = 0;
13678
13679   USED_REX (REX_B);
13680   if (intel_syntax)
13681     intel_operand_size (bytemode, sizeflag);
13682   append_seg ();
13683
13684   if ((sizeflag & AFLAG) || address_mode == mode_64bit)
13685     {
13686       /* 32/64 bit address mode */
13687       int havedisp;
13688       int havesib;
13689       int havebase;
13690       int haveindex;
13691       int needindex;
13692       int base, rbase;
13693       int vindex = 0;
13694       int scale = 0;
13695
13696       havesib = 0;
13697       havebase = 1;
13698       haveindex = 0;
13699       base = modrm.rm;
13700
13701       if (base == 4)
13702         {
13703           havesib = 1;
13704           FETCH_DATA (the_info, codep + 1);
13705           vindex = (*codep >> 3) & 7;
13706           scale = (*codep >> 6) & 3;
13707           base = *codep & 7;
13708           USED_REX (REX_X);
13709           if (rex & REX_X)
13710             vindex += 8;
13711           haveindex = vindex != 4;
13712           codep++;
13713         }
13714       rbase = base + add;
13715
13716       switch (modrm.mod)
13717         {
13718         case 0:
13719           if (base == 5)
13720             {
13721               havebase = 0;
13722               if (address_mode == mode_64bit && !havesib)
13723                 riprel = 1;
13724               disp = get32s ();
13725             }
13726           break;
13727         case 1:
13728           FETCH_DATA (the_info, codep + 1);
13729           disp = *codep++;
13730           if ((disp & 0x80) != 0)
13731             disp -= 0x100;
13732           break;
13733         case 2:
13734           disp = get32s ();
13735           break;
13736         }
13737
13738       /* In 32bit mode, we need index register to tell [offset] from
13739          [eiz*1 + offset].  */
13740       needindex = (havesib
13741                    && !havebase
13742                    && !haveindex
13743                    && address_mode == mode_32bit);
13744       havedisp = (havebase
13745                   || needindex
13746                   || (havesib && (haveindex || scale != 0)));
13747
13748       if (!intel_syntax)
13749         if (modrm.mod != 0 || base == 5)
13750           {
13751             if (havedisp || riprel)
13752               print_displacement (scratchbuf, disp);
13753             else
13754               print_operand_value (scratchbuf, 1, disp);
13755             oappend (scratchbuf);
13756             if (riprel)
13757               {
13758                 set_op (disp, 1);
13759                 oappend (sizeflag & AFLAG ? "(%rip)" : "(%eip)");
13760               }
13761           }
13762
13763       if (havebase || haveindex || riprel)
13764         used_prefixes |= PREFIX_ADDR;
13765
13766       if (havedisp || (intel_syntax && riprel))
13767         {
13768           *obufp++ = open_char;
13769           if (intel_syntax && riprel)
13770             {
13771               set_op (disp, 1);
13772               oappend (sizeflag & AFLAG ? "rip" : "eip");
13773             }
13774           *obufp = '\0';
13775           if (havebase)
13776             oappend (address_mode == mode_64bit && (sizeflag & AFLAG)
13777                      ? names64[rbase] : names32[rbase]);
13778           if (havesib)
13779             {
13780               /* ESP/RSP won't allow index.  If base isn't ESP/RSP,
13781                  print index to tell base + index from base.  */
13782               if (scale != 0
13783                   || needindex
13784                   || haveindex
13785                   || (havebase && base != ESP_REG_NUM))
13786                 {
13787                   if (!intel_syntax || havebase)
13788                     {
13789                       *obufp++ = separator_char;
13790                       *obufp = '\0';
13791                     }
13792                   if (haveindex)
13793                     oappend (address_mode == mode_64bit 
13794                              && (sizeflag & AFLAG)
13795                              ? names64[vindex] : names32[vindex]);
13796                   else
13797                     oappend (address_mode == mode_64bit 
13798                              && (sizeflag & AFLAG)
13799                              ? index64 : index32);
13800
13801                   *obufp++ = scale_char;
13802                   *obufp = '\0';
13803                   sprintf (scratchbuf, "%d", 1 << scale);
13804                   oappend (scratchbuf);
13805                 }
13806             }
13807           if (intel_syntax
13808               && (disp || modrm.mod != 0 || base == 5))
13809             {
13810               if (!havedisp || (bfd_signed_vma) disp >= 0)
13811                 {
13812                   *obufp++ = '+';
13813                   *obufp = '\0';
13814                 }
13815               else if (modrm.mod != 1 && disp != -disp)
13816                 {
13817                   *obufp++ = '-';
13818                   *obufp = '\0';
13819                   disp = - (bfd_signed_vma) disp;
13820                 }
13821
13822               if (havedisp)
13823                 print_displacement (scratchbuf, disp);
13824               else
13825                 print_operand_value (scratchbuf, 1, disp);
13826               oappend (scratchbuf);
13827             }
13828
13829           *obufp++ = close_char;
13830           *obufp = '\0';
13831         }
13832       else if (intel_syntax)
13833         {
13834           if (modrm.mod != 0 || base == 5)
13835             {
13836               if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
13837                               | PREFIX_ES | PREFIX_FS | PREFIX_GS))
13838                 ;
13839               else
13840                 {
13841                   oappend (names_seg[ds_reg - es_reg]);
13842                   oappend (":");
13843                 }
13844               print_operand_value (scratchbuf, 1, disp);
13845               oappend (scratchbuf);
13846             }
13847         }
13848     }
13849   else
13850     {
13851       /* 16 bit address mode */
13852       used_prefixes |= prefixes & PREFIX_ADDR;
13853       switch (modrm.mod)
13854         {
13855         case 0:
13856           if (modrm.rm == 6)
13857             {
13858               disp = get16 ();
13859               if ((disp & 0x8000) != 0)
13860                 disp -= 0x10000;
13861             }
13862           break;
13863         case 1:
13864           FETCH_DATA (the_info, codep + 1);
13865           disp = *codep++;
13866           if ((disp & 0x80) != 0)
13867             disp -= 0x100;
13868           break;
13869         case 2:
13870           disp = get16 ();
13871           if ((disp & 0x8000) != 0)
13872             disp -= 0x10000;
13873           break;
13874         }
13875
13876       if (!intel_syntax)
13877         if (modrm.mod != 0 || modrm.rm == 6)
13878           {
13879             print_displacement (scratchbuf, disp);
13880             oappend (scratchbuf);
13881           }
13882
13883       if (modrm.mod != 0 || modrm.rm != 6)
13884         {
13885           *obufp++ = open_char;
13886           *obufp = '\0';
13887           oappend (index16[modrm.rm]);
13888           if (intel_syntax
13889               && (disp || modrm.mod != 0 || modrm.rm == 6))
13890             {
13891               if ((bfd_signed_vma) disp >= 0)
13892                 {
13893                   *obufp++ = '+';
13894                   *obufp = '\0';
13895                 }
13896               else if (modrm.mod != 1)
13897                 {
13898                   *obufp++ = '-';
13899                   *obufp = '\0';
13900                   disp = - (bfd_signed_vma) disp;
13901                 }
13902
13903               print_displacement (scratchbuf, disp);
13904               oappend (scratchbuf);
13905             }
13906
13907           *obufp++ = close_char;
13908           *obufp = '\0';
13909         }
13910       else if (intel_syntax)
13911         {
13912           if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
13913                           | PREFIX_ES | PREFIX_FS | PREFIX_GS))
13914             ;
13915           else
13916             {
13917               oappend (names_seg[ds_reg - es_reg]);
13918               oappend (":");
13919             }
13920           print_operand_value (scratchbuf, 1, disp & 0xffff);
13921           oappend (scratchbuf);
13922         }
13923     }
13924 }
13925
13926 static void
13927 OP_E (int bytemode, int sizeflag)
13928 {
13929   /* Skip mod/rm byte.  */
13930   MODRM_CHECK;
13931   codep++;
13932
13933   if (modrm.mod == 3)
13934     OP_E_register (bytemode, sizeflag);
13935   else
13936     OP_E_memory (bytemode, sizeflag);
13937 }
13938
13939 static void
13940 OP_G (int bytemode, int sizeflag)
13941 {
13942   int add = 0;
13943   USED_REX (REX_R);
13944   if (rex & REX_R)
13945     add += 8;
13946   switch (bytemode)
13947     {
13948     case b_mode:
13949       USED_REX (0);
13950       if (rex)
13951         oappend (names8rex[modrm.reg + add]);
13952       else
13953         oappend (names8[modrm.reg + add]);
13954       break;
13955     case w_mode:
13956       oappend (names16[modrm.reg + add]);
13957       break;
13958     case d_mode:
13959       oappend (names32[modrm.reg + add]);
13960       break;
13961     case q_mode:
13962       oappend (names64[modrm.reg + add]);
13963       break;
13964     case v_mode:
13965     case dq_mode:
13966     case dqb_mode:
13967     case dqd_mode:
13968     case dqw_mode:
13969       USED_REX (REX_W);
13970       if (rex & REX_W)
13971         oappend (names64[modrm.reg + add]);
13972       else
13973         {
13974           if ((sizeflag & DFLAG) || bytemode != v_mode)
13975             oappend (names32[modrm.reg + add]);
13976           else
13977             oappend (names16[modrm.reg + add]);
13978           used_prefixes |= (prefixes & PREFIX_DATA);
13979         }
13980       break;
13981     case m_mode:
13982       if (address_mode == mode_64bit)
13983         oappend (names64[modrm.reg + add]);
13984       else
13985         oappend (names32[modrm.reg + add]);
13986       break;
13987     default:
13988       oappend (INTERNAL_DISASSEMBLER_ERROR);
13989       break;
13990     }
13991 }
13992
13993 static bfd_vma
13994 get64 (void)
13995 {
13996   bfd_vma x;
13997 #ifdef BFD64
13998   unsigned int a;
13999   unsigned int b;
14000
14001   FETCH_DATA (the_info, codep + 8);
14002   a = *codep++ & 0xff;
14003   a |= (*codep++ & 0xff) << 8;
14004   a |= (*codep++ & 0xff) << 16;
14005   a |= (*codep++ & 0xff) << 24;
14006   b = *codep++ & 0xff;
14007   b |= (*codep++ & 0xff) << 8;
14008   b |= (*codep++ & 0xff) << 16;
14009   b |= (*codep++ & 0xff) << 24;
14010   x = a + ((bfd_vma) b << 32);
14011 #else
14012   abort ();
14013   x = 0;
14014 #endif
14015   return x;
14016 }
14017
14018 static bfd_signed_vma
14019 get32 (void)
14020 {
14021   bfd_signed_vma x = 0;
14022
14023   FETCH_DATA (the_info, codep + 4);
14024   x = *codep++ & (bfd_signed_vma) 0xff;
14025   x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
14026   x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
14027   x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
14028   return x;
14029 }
14030
14031 static bfd_signed_vma
14032 get32s (void)
14033 {
14034   bfd_signed_vma x = 0;
14035
14036   FETCH_DATA (the_info, codep + 4);
14037   x = *codep++ & (bfd_signed_vma) 0xff;
14038   x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
14039   x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
14040   x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
14041
14042   x = (x ^ ((bfd_signed_vma) 1 << 31)) - ((bfd_signed_vma) 1 << 31);
14043
14044   return x;
14045 }
14046
14047 static int
14048 get16 (void)
14049 {
14050   int x = 0;
14051
14052   FETCH_DATA (the_info, codep + 2);
14053   x = *codep++ & 0xff;
14054   x |= (*codep++ & 0xff) << 8;
14055   return x;
14056 }
14057
14058 static void
14059 set_op (bfd_vma op, int riprel)
14060 {
14061   op_index[op_ad] = op_ad;
14062   if (address_mode == mode_64bit)
14063     {
14064       op_address[op_ad] = op;
14065       op_riprel[op_ad] = riprel;
14066     }
14067   else
14068     {
14069       /* Mask to get a 32-bit address.  */
14070       op_address[op_ad] = op & 0xffffffff;
14071       op_riprel[op_ad] = riprel & 0xffffffff;
14072     }
14073 }
14074
14075 static void
14076 OP_REG (int code, int sizeflag)
14077 {
14078   const char *s;
14079   int add;
14080   USED_REX (REX_B);
14081   if (rex & REX_B)
14082     add = 8;
14083   else
14084     add = 0;
14085
14086   switch (code)
14087     {
14088     case ax_reg: case cx_reg: case dx_reg: case bx_reg:
14089     case sp_reg: case bp_reg: case si_reg: case di_reg:
14090       s = names16[code - ax_reg + add];
14091       break;
14092     case es_reg: case ss_reg: case cs_reg:
14093     case ds_reg: case fs_reg: case gs_reg:
14094       s = names_seg[code - es_reg + add];
14095       break;
14096     case al_reg: case ah_reg: case cl_reg: case ch_reg:
14097     case dl_reg: case dh_reg: case bl_reg: case bh_reg:
14098       USED_REX (0);
14099       if (rex)
14100         s = names8rex[code - al_reg + add];
14101       else
14102         s = names8[code - al_reg];
14103       break;
14104     case rAX_reg: case rCX_reg: case rDX_reg: case rBX_reg:
14105     case rSP_reg: case rBP_reg: case rSI_reg: case rDI_reg:
14106       if (address_mode == mode_64bit && (sizeflag & DFLAG))
14107         {
14108           s = names64[code - rAX_reg + add];
14109           break;
14110         }
14111       code += eAX_reg - rAX_reg;
14112       /* Fall through.  */
14113     case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
14114     case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
14115       USED_REX (REX_W);
14116       if (rex & REX_W)
14117         s = names64[code - eAX_reg + add];
14118       else
14119         {
14120           if (sizeflag & DFLAG)
14121             s = names32[code - eAX_reg + add];
14122           else
14123             s = names16[code - eAX_reg + add];
14124           used_prefixes |= (prefixes & PREFIX_DATA);
14125         }
14126       break;
14127     default:
14128       s = INTERNAL_DISASSEMBLER_ERROR;
14129       break;
14130     }
14131   oappend (s);
14132 }
14133
14134 static void
14135 OP_IMREG (int code, int sizeflag)
14136 {
14137   const char *s;
14138
14139   switch (code)
14140     {
14141     case indir_dx_reg:
14142       if (intel_syntax)
14143         s = "dx";
14144       else
14145         s = "(%dx)";
14146       break;
14147     case ax_reg: case cx_reg: case dx_reg: case bx_reg:
14148     case sp_reg: case bp_reg: case si_reg: case di_reg:
14149       s = names16[code - ax_reg];
14150       break;
14151     case es_reg: case ss_reg: case cs_reg:
14152     case ds_reg: case fs_reg: case gs_reg:
14153       s = names_seg[code - es_reg];
14154       break;
14155     case al_reg: case ah_reg: case cl_reg: case ch_reg:
14156     case dl_reg: case dh_reg: case bl_reg: case bh_reg:
14157       USED_REX (0);
14158       if (rex)
14159         s = names8rex[code - al_reg];
14160       else
14161         s = names8[code - al_reg];
14162       break;
14163     case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
14164     case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
14165       USED_REX (REX_W);
14166       if (rex & REX_W)
14167         s = names64[code - eAX_reg];
14168       else
14169         {
14170           if (sizeflag & DFLAG)
14171             s = names32[code - eAX_reg];
14172           else
14173             s = names16[code - eAX_reg];
14174           used_prefixes |= (prefixes & PREFIX_DATA);
14175         }
14176       break;
14177     case z_mode_ax_reg:
14178       if ((rex & REX_W) || (sizeflag & DFLAG))
14179         s = *names32;
14180       else
14181         s = *names16;
14182       if (!(rex & REX_W))
14183         used_prefixes |= (prefixes & PREFIX_DATA);
14184       break;
14185     default:
14186       s = INTERNAL_DISASSEMBLER_ERROR;
14187       break;
14188     }
14189   oappend (s);
14190 }
14191
14192 static void
14193 OP_I (int bytemode, int sizeflag)
14194 {
14195   bfd_signed_vma op;
14196   bfd_signed_vma mask = -1;
14197
14198   switch (bytemode)
14199     {
14200     case b_mode:
14201       FETCH_DATA (the_info, codep + 1);
14202       op = *codep++;
14203       mask = 0xff;
14204       break;
14205     case q_mode:
14206       if (address_mode == mode_64bit)
14207         {
14208           op = get32s ();
14209           break;
14210         }
14211       /* Fall through.  */
14212     case v_mode:
14213       USED_REX (REX_W);
14214       if (rex & REX_W)
14215         op = get32s ();
14216       else
14217         {
14218           if (sizeflag & DFLAG)
14219             {
14220               op = get32 ();
14221               mask = 0xffffffff;
14222             }
14223           else
14224             {
14225               op = get16 ();
14226               mask = 0xfffff;
14227             }
14228           used_prefixes |= (prefixes & PREFIX_DATA);
14229         }
14230       break;
14231     case w_mode:
14232       mask = 0xfffff;
14233       op = get16 ();
14234       break;
14235     case const_1_mode:
14236       if (intel_syntax)
14237         oappend ("1");
14238       return;
14239     default:
14240       oappend (INTERNAL_DISASSEMBLER_ERROR);
14241       return;
14242     }
14243
14244   op &= mask;
14245   scratchbuf[0] = '$';
14246   print_operand_value (scratchbuf + 1, 1, op);
14247   oappend (scratchbuf + intel_syntax);
14248   scratchbuf[0] = '\0';
14249 }
14250
14251 static void
14252 OP_I64 (int bytemode, int sizeflag)
14253 {
14254   bfd_signed_vma op;
14255   bfd_signed_vma mask = -1;
14256
14257   if (address_mode != mode_64bit)
14258     {
14259       OP_I (bytemode, sizeflag);
14260       return;
14261     }
14262
14263   switch (bytemode)
14264     {
14265     case b_mode:
14266       FETCH_DATA (the_info, codep + 1);
14267       op = *codep++;
14268       mask = 0xff;
14269       break;
14270     case v_mode:
14271       USED_REX (REX_W);
14272       if (rex & REX_W)
14273         op = get64 ();
14274       else
14275         {
14276           if (sizeflag & DFLAG)
14277             {
14278               op = get32 ();
14279               mask = 0xffffffff;
14280             }
14281           else
14282             {
14283               op = get16 ();
14284               mask = 0xfffff;
14285             }
14286           used_prefixes |= (prefixes & PREFIX_DATA);
14287         }
14288       break;
14289     case w_mode:
14290       mask = 0xfffff;
14291       op = get16 ();
14292       break;
14293     default:
14294       oappend (INTERNAL_DISASSEMBLER_ERROR);
14295       return;
14296     }
14297
14298   op &= mask;
14299   scratchbuf[0] = '$';
14300   print_operand_value (scratchbuf + 1, 1, op);
14301   oappend (scratchbuf + intel_syntax);
14302   scratchbuf[0] = '\0';
14303 }
14304
14305 static void
14306 OP_sI (int bytemode, int sizeflag)
14307 {
14308   bfd_signed_vma op;
14309   bfd_signed_vma mask = -1;
14310
14311   switch (bytemode)
14312     {
14313     case b_mode:
14314       FETCH_DATA (the_info, codep + 1);
14315       op = *codep++;
14316       if ((op & 0x80) != 0)
14317         op -= 0x100;
14318       mask = 0xffffffff;
14319       break;
14320     case v_mode:
14321       USED_REX (REX_W);
14322       if (rex & REX_W)
14323         op = get32s ();
14324       else
14325         {
14326           if (sizeflag & DFLAG)
14327             {
14328               op = get32s ();
14329               mask = 0xffffffff;
14330             }
14331           else
14332             {
14333               mask = 0xffffffff;
14334               op = get16 ();
14335               if ((op & 0x8000) != 0)
14336                 op -= 0x10000;
14337             }
14338           used_prefixes |= (prefixes & PREFIX_DATA);
14339         }
14340       break;
14341     case w_mode:
14342       op = get16 ();
14343       mask = 0xffffffff;
14344       if ((op & 0x8000) != 0)
14345         op -= 0x10000;
14346       break;
14347     default:
14348       oappend (INTERNAL_DISASSEMBLER_ERROR);
14349       return;
14350     }
14351
14352   scratchbuf[0] = '$';
14353   print_operand_value (scratchbuf + 1, 1, op);
14354   oappend (scratchbuf + intel_syntax);
14355 }
14356
14357 static void
14358 OP_J (int bytemode, int sizeflag)
14359 {
14360   bfd_vma disp;
14361   bfd_vma mask = -1;
14362   bfd_vma segment = 0;
14363
14364   switch (bytemode)
14365     {
14366     case b_mode:
14367       FETCH_DATA (the_info, codep + 1);
14368       disp = *codep++;
14369       if ((disp & 0x80) != 0)
14370         disp -= 0x100;
14371       break;
14372     case v_mode:
14373       USED_REX (REX_W);
14374       if ((sizeflag & DFLAG) || (rex & REX_W))
14375         disp = get32s ();
14376       else
14377         {
14378           disp = get16 ();
14379           if ((disp & 0x8000) != 0)
14380             disp -= 0x10000;
14381           /* In 16bit mode, address is wrapped around at 64k within
14382              the same segment.  Otherwise, a data16 prefix on a jump
14383              instruction means that the pc is masked to 16 bits after
14384              the displacement is added!  */
14385           mask = 0xffff;
14386           if ((prefixes & PREFIX_DATA) == 0)
14387             segment = ((start_pc + codep - start_codep)
14388                        & ~((bfd_vma) 0xffff));
14389         }
14390       if (!(rex & REX_W))
14391         used_prefixes |= (prefixes & PREFIX_DATA);
14392       break;
14393     default:
14394       oappend (INTERNAL_DISASSEMBLER_ERROR);
14395       return;
14396     }
14397   disp = ((start_pc + codep - start_codep + disp) & mask) | segment;
14398   set_op (disp, 0);
14399   print_operand_value (scratchbuf, 1, disp);
14400   oappend (scratchbuf);
14401 }
14402
14403 static void
14404 OP_SEG (int bytemode, int sizeflag)
14405 {
14406   if (bytemode == w_mode)
14407     oappend (names_seg[modrm.reg]);
14408   else
14409     OP_E (modrm.mod == 3 ? bytemode : w_mode, sizeflag);
14410 }
14411
14412 static void
14413 OP_DIR (int dummy ATTRIBUTE_UNUSED, int sizeflag)
14414 {
14415   int seg, offset;
14416
14417   if (sizeflag & DFLAG)
14418     {
14419       offset = get32 ();
14420       seg = get16 ();
14421     }
14422   else
14423     {
14424       offset = get16 ();
14425       seg = get16 ();
14426     }
14427   used_prefixes |= (prefixes & PREFIX_DATA);
14428   if (intel_syntax)
14429     sprintf (scratchbuf, "0x%x:0x%x", seg, offset);
14430   else
14431     sprintf (scratchbuf, "$0x%x,$0x%x", seg, offset);
14432   oappend (scratchbuf);
14433 }
14434
14435 static void
14436 OP_OFF (int bytemode, int sizeflag)
14437 {
14438   bfd_vma off;
14439
14440   if (intel_syntax && (sizeflag & SUFFIX_ALWAYS))
14441     intel_operand_size (bytemode, sizeflag);
14442   append_seg ();
14443
14444   if ((sizeflag & AFLAG) || address_mode == mode_64bit)
14445     off = get32 ();
14446   else
14447     off = get16 ();
14448
14449   if (intel_syntax)
14450     {
14451       if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
14452                         | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
14453         {
14454           oappend (names_seg[ds_reg - es_reg]);
14455           oappend (":");
14456         }
14457     }
14458   print_operand_value (scratchbuf, 1, off);
14459   oappend (scratchbuf);
14460 }
14461
14462 static void
14463 OP_OFF64 (int bytemode, int sizeflag)
14464 {
14465   bfd_vma off;
14466
14467   if (address_mode != mode_64bit
14468       || (prefixes & PREFIX_ADDR))
14469     {
14470       OP_OFF (bytemode, sizeflag);
14471       return;
14472     }
14473
14474   if (intel_syntax && (sizeflag & SUFFIX_ALWAYS))
14475     intel_operand_size (bytemode, sizeflag);
14476   append_seg ();
14477
14478   off = get64 ();
14479
14480   if (intel_syntax)
14481     {
14482       if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
14483                         | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
14484         {
14485           oappend (names_seg[ds_reg - es_reg]);
14486           oappend (":");
14487         }
14488     }
14489   print_operand_value (scratchbuf, 1, off);
14490   oappend (scratchbuf);
14491 }
14492
14493 static void
14494 ptr_reg (int code, int sizeflag)
14495 {
14496   const char *s;
14497
14498   *obufp++ = open_char;
14499   used_prefixes |= (prefixes & PREFIX_ADDR);
14500   if (address_mode == mode_64bit)
14501     {
14502       if (!(sizeflag & AFLAG))
14503         s = names32[code - eAX_reg];
14504       else
14505         s = names64[code - eAX_reg];
14506     }
14507   else if (sizeflag & AFLAG)
14508     s = names32[code - eAX_reg];
14509   else
14510     s = names16[code - eAX_reg];
14511   oappend (s);
14512   *obufp++ = close_char;
14513   *obufp = 0;
14514 }
14515
14516 static void
14517 OP_ESreg (int code, int sizeflag)
14518 {
14519   if (intel_syntax)
14520     {
14521       switch (codep[-1])
14522         {
14523         case 0x6d:      /* insw/insl */
14524           intel_operand_size (z_mode, sizeflag);
14525           break;
14526         case 0xa5:      /* movsw/movsl/movsq */
14527         case 0xa7:      /* cmpsw/cmpsl/cmpsq */
14528         case 0xab:      /* stosw/stosl */
14529         case 0xaf:      /* scasw/scasl */
14530           intel_operand_size (v_mode, sizeflag);
14531           break;
14532         default:
14533           intel_operand_size (b_mode, sizeflag);
14534         }
14535     }
14536   oappend ("%es:" + intel_syntax);
14537   ptr_reg (code, sizeflag);
14538 }
14539
14540 static void
14541 OP_DSreg (int code, int sizeflag)
14542 {
14543   if (intel_syntax)
14544     {
14545       switch (codep[-1])
14546         {
14547         case 0x6f:      /* outsw/outsl */
14548           intel_operand_size (z_mode, sizeflag);
14549           break;
14550         case 0xa5:      /* movsw/movsl/movsq */
14551         case 0xa7:      /* cmpsw/cmpsl/cmpsq */
14552         case 0xad:      /* lodsw/lodsl/lodsq */
14553           intel_operand_size (v_mode, sizeflag);
14554           break;
14555         default:
14556           intel_operand_size (b_mode, sizeflag);
14557         }
14558     }
14559   if ((prefixes
14560        & (PREFIX_CS
14561           | PREFIX_DS
14562           | PREFIX_SS
14563           | PREFIX_ES
14564           | PREFIX_FS
14565           | PREFIX_GS)) == 0)
14566     prefixes |= PREFIX_DS;
14567   append_seg ();
14568   ptr_reg (code, sizeflag);
14569 }
14570
14571 static void
14572 OP_C (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14573 {
14574   int add;
14575   if (rex & REX_R)
14576     {
14577       USED_REX (REX_R);
14578       add = 8;
14579     }
14580   else if (address_mode != mode_64bit && (prefixes & PREFIX_LOCK))
14581     {
14582       all_prefixes[last_lock_prefix] = 0;
14583       used_prefixes |= PREFIX_LOCK;
14584       add = 8;
14585     }
14586   else
14587     add = 0;
14588   sprintf (scratchbuf, "%%cr%d", modrm.reg + add);
14589   oappend (scratchbuf + intel_syntax);
14590 }
14591
14592 static void
14593 OP_D (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14594 {
14595   int add;
14596   USED_REX (REX_R);
14597   if (rex & REX_R)
14598     add = 8;
14599   else
14600     add = 0;
14601   if (intel_syntax)
14602     sprintf (scratchbuf, "db%d", modrm.reg + add);
14603   else
14604     sprintf (scratchbuf, "%%db%d", modrm.reg + add);
14605   oappend (scratchbuf);
14606 }
14607
14608 static void
14609 OP_T (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14610 {
14611   sprintf (scratchbuf, "%%tr%d", modrm.reg);
14612   oappend (scratchbuf + intel_syntax);
14613 }
14614
14615 static void
14616 OP_R (int bytemode, int sizeflag)
14617 {
14618   if (modrm.mod == 3)
14619     OP_E (bytemode, sizeflag);
14620   else
14621     BadOp ();
14622 }
14623
14624 static void
14625 OP_MMX (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14626 {
14627   used_prefixes |= (prefixes & PREFIX_DATA);
14628   if (prefixes & PREFIX_DATA)
14629     {
14630       int add;
14631       USED_REX (REX_R);
14632       if (rex & REX_R)
14633         add = 8;
14634       else
14635         add = 0;
14636       sprintf (scratchbuf, "%%xmm%d", modrm.reg + add);
14637     }
14638   else
14639     sprintf (scratchbuf, "%%mm%d", modrm.reg);
14640   oappend (scratchbuf + intel_syntax);
14641 }
14642
14643 static void
14644 OP_XMM (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
14645 {
14646   int add;
14647   USED_REX (REX_R);
14648   if (rex & REX_R)
14649     add = 8;
14650   else
14651     add = 0;
14652   if (need_vex && bytemode != xmm_mode)
14653     {
14654       switch (vex.length)
14655         {
14656         case 128:
14657           sprintf (scratchbuf, "%%xmm%d", modrm.reg + add);
14658           break;
14659         case 256:
14660           sprintf (scratchbuf, "%%ymm%d", modrm.reg + add);
14661           break;
14662         default:
14663           abort ();
14664         }
14665     }
14666   else
14667     sprintf (scratchbuf, "%%xmm%d", modrm.reg + add);
14668   oappend (scratchbuf + intel_syntax);
14669 }
14670
14671 static void
14672 OP_EM (int bytemode, int sizeflag)
14673 {
14674   if (modrm.mod != 3)
14675     {
14676       if (intel_syntax
14677           && (bytemode == v_mode || bytemode == v_swap_mode))
14678         {
14679           bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode;
14680           used_prefixes |= (prefixes & PREFIX_DATA);
14681         }
14682       OP_E (bytemode, sizeflag);
14683       return;
14684     }
14685
14686   if ((sizeflag & SUFFIX_ALWAYS) && bytemode == v_swap_mode)
14687     swap_operand ();
14688
14689   /* Skip mod/rm byte.  */
14690   MODRM_CHECK;
14691   codep++;
14692   used_prefixes |= (prefixes & PREFIX_DATA);
14693   if (prefixes & PREFIX_DATA)
14694     {
14695       int add;
14696
14697       USED_REX (REX_B);
14698       if (rex & REX_B)
14699         add = 8;
14700       else
14701         add = 0;
14702       sprintf (scratchbuf, "%%xmm%d", modrm.rm + add);
14703     }
14704   else
14705     sprintf (scratchbuf, "%%mm%d", modrm.rm);
14706   oappend (scratchbuf + intel_syntax);
14707 }
14708
14709 /* cvt* are the only instructions in sse2 which have
14710    both SSE and MMX operands and also have 0x66 prefix
14711    in their opcode. 0x66 was originally used to differentiate
14712    between SSE and MMX instruction(operands). So we have to handle the
14713    cvt* separately using OP_EMC and OP_MXC */
14714 static void
14715 OP_EMC (int bytemode, int sizeflag)
14716 {
14717   if (modrm.mod != 3)
14718     {
14719       if (intel_syntax && bytemode == v_mode)
14720         {
14721           bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode;
14722           used_prefixes |= (prefixes & PREFIX_DATA);
14723         }
14724       OP_E (bytemode, sizeflag);
14725       return;
14726     }
14727
14728   /* Skip mod/rm byte.  */
14729   MODRM_CHECK;
14730   codep++;
14731   used_prefixes |= (prefixes & PREFIX_DATA);
14732   sprintf (scratchbuf, "%%mm%d", modrm.rm);
14733   oappend (scratchbuf + intel_syntax);
14734 }
14735
14736 static void
14737 OP_MXC (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14738 {
14739   used_prefixes |= (prefixes & PREFIX_DATA);
14740   sprintf (scratchbuf, "%%mm%d", modrm.reg);
14741   oappend (scratchbuf + intel_syntax);
14742 }
14743
14744 static void
14745 OP_EX (int bytemode, int sizeflag)
14746 {
14747   int add;
14748
14749   /* Skip mod/rm byte.  */
14750   MODRM_CHECK;
14751   codep++;
14752
14753   if (modrm.mod != 3)
14754     {
14755       OP_E_memory (bytemode, sizeflag);
14756       return;
14757     }
14758
14759   USED_REX (REX_B);
14760   if (rex & REX_B)
14761     add = 8;
14762   else
14763     add = 0;
14764
14765   if ((sizeflag & SUFFIX_ALWAYS)
14766       && (bytemode == x_swap_mode
14767           || bytemode == d_swap_mode
14768           || bytemode == q_swap_mode))
14769     swap_operand ();
14770
14771   if (need_vex
14772       && bytemode != xmm_mode
14773       && bytemode != xmmq_mode)
14774     {
14775       switch (vex.length)
14776         {
14777         case 128:
14778           sprintf (scratchbuf, "%%xmm%d", modrm.rm + add);
14779           break;
14780         case 256:
14781           sprintf (scratchbuf, "%%ymm%d", modrm.rm + add);
14782           break;
14783         default:
14784           abort ();
14785         }
14786     }
14787   else
14788     sprintf (scratchbuf, "%%xmm%d", modrm.rm + add);
14789   oappend (scratchbuf + intel_syntax);
14790 }
14791
14792 static void
14793 OP_MS (int bytemode, int sizeflag)
14794 {
14795   if (modrm.mod == 3)
14796     OP_EM (bytemode, sizeflag);
14797   else
14798     BadOp ();
14799 }
14800
14801 static void
14802 OP_XS (int bytemode, int sizeflag)
14803 {
14804   if (modrm.mod == 3)
14805     OP_EX (bytemode, sizeflag);
14806   else
14807     BadOp ();
14808 }
14809
14810 static void
14811 OP_M (int bytemode, int sizeflag)
14812 {
14813   if (modrm.mod == 3)
14814     /* bad bound,lea,lds,les,lfs,lgs,lss,cmpxchg8b,vmptrst modrm */
14815     BadOp ();
14816   else
14817     OP_E (bytemode, sizeflag);
14818 }
14819
14820 static void
14821 OP_0f07 (int bytemode, int sizeflag)
14822 {
14823   if (modrm.mod != 3 || modrm.rm != 0)
14824     BadOp ();
14825   else
14826     OP_E (bytemode, sizeflag);
14827 }
14828
14829 /* NOP is an alias of "xchg %ax,%ax" in 16bit mode, "xchg %eax,%eax" in
14830    32bit mode and "xchg %rax,%rax" in 64bit mode.  */
14831
14832 static void
14833 NOP_Fixup1 (int bytemode, int sizeflag)
14834 {
14835   if ((prefixes & PREFIX_DATA) != 0
14836       || (rex != 0
14837           && rex != 0x48
14838           && address_mode == mode_64bit))
14839     OP_REG (bytemode, sizeflag);
14840   else
14841     strcpy (obuf, "nop");
14842 }
14843
14844 static void
14845 NOP_Fixup2 (int bytemode, int sizeflag)
14846 {
14847   if ((prefixes & PREFIX_DATA) != 0
14848       || (rex != 0
14849           && rex != 0x48
14850           && address_mode == mode_64bit))
14851     OP_IMREG (bytemode, sizeflag);
14852 }
14853
14854 static const char *const Suffix3DNow[] = {
14855 /* 00 */        NULL,           NULL,           NULL,           NULL,
14856 /* 04 */        NULL,           NULL,           NULL,           NULL,
14857 /* 08 */        NULL,           NULL,           NULL,           NULL,
14858 /* 0C */        "pi2fw",        "pi2fd",        NULL,           NULL,
14859 /* 10 */        NULL,           NULL,           NULL,           NULL,
14860 /* 14 */        NULL,           NULL,           NULL,           NULL,
14861 /* 18 */        NULL,           NULL,           NULL,           NULL,
14862 /* 1C */        "pf2iw",        "pf2id",        NULL,           NULL,
14863 /* 20 */        NULL,           NULL,           NULL,           NULL,
14864 /* 24 */        NULL,           NULL,           NULL,           NULL,
14865 /* 28 */        NULL,           NULL,           NULL,           NULL,
14866 /* 2C */        NULL,           NULL,           NULL,           NULL,
14867 /* 30 */        NULL,           NULL,           NULL,           NULL,
14868 /* 34 */        NULL,           NULL,           NULL,           NULL,
14869 /* 38 */        NULL,           NULL,           NULL,           NULL,
14870 /* 3C */        NULL,           NULL,           NULL,           NULL,
14871 /* 40 */        NULL,           NULL,           NULL,           NULL,
14872 /* 44 */        NULL,           NULL,           NULL,           NULL,
14873 /* 48 */        NULL,           NULL,           NULL,           NULL,
14874 /* 4C */        NULL,           NULL,           NULL,           NULL,
14875 /* 50 */        NULL,           NULL,           NULL,           NULL,
14876 /* 54 */        NULL,           NULL,           NULL,           NULL,
14877 /* 58 */        NULL,           NULL,           NULL,           NULL,
14878 /* 5C */        NULL,           NULL,           NULL,           NULL,
14879 /* 60 */        NULL,           NULL,           NULL,           NULL,
14880 /* 64 */        NULL,           NULL,           NULL,           NULL,
14881 /* 68 */        NULL,           NULL,           NULL,           NULL,
14882 /* 6C */        NULL,           NULL,           NULL,           NULL,
14883 /* 70 */        NULL,           NULL,           NULL,           NULL,
14884 /* 74 */        NULL,           NULL,           NULL,           NULL,
14885 /* 78 */        NULL,           NULL,           NULL,           NULL,
14886 /* 7C */        NULL,           NULL,           NULL,           NULL,
14887 /* 80 */        NULL,           NULL,           NULL,           NULL,
14888 /* 84 */        NULL,           NULL,           NULL,           NULL,
14889 /* 88 */        NULL,           NULL,           "pfnacc",       NULL,
14890 /* 8C */        NULL,           NULL,           "pfpnacc",      NULL,
14891 /* 90 */        "pfcmpge",      NULL,           NULL,           NULL,
14892 /* 94 */        "pfmin",        NULL,           "pfrcp",        "pfrsqrt",
14893 /* 98 */        NULL,           NULL,           "pfsub",        NULL,
14894 /* 9C */        NULL,           NULL,           "pfadd",        NULL,
14895 /* A0 */        "pfcmpgt",      NULL,           NULL,           NULL,
14896 /* A4 */        "pfmax",        NULL,           "pfrcpit1",     "pfrsqit1",
14897 /* A8 */        NULL,           NULL,           "pfsubr",       NULL,
14898 /* AC */        NULL,           NULL,           "pfacc",        NULL,
14899 /* B0 */        "pfcmpeq",      NULL,           NULL,           NULL,
14900 /* B4 */        "pfmul",        NULL,           "pfrcpit2",     "pmulhrw",
14901 /* B8 */        NULL,           NULL,           NULL,           "pswapd",
14902 /* BC */        NULL,           NULL,           NULL,           "pavgusb",
14903 /* C0 */        NULL,           NULL,           NULL,           NULL,
14904 /* C4 */        NULL,           NULL,           NULL,           NULL,
14905 /* C8 */        NULL,           NULL,           NULL,           NULL,
14906 /* CC */        NULL,           NULL,           NULL,           NULL,
14907 /* D0 */        NULL,           NULL,           NULL,           NULL,
14908 /* D4 */        NULL,           NULL,           NULL,           NULL,
14909 /* D8 */        NULL,           NULL,           NULL,           NULL,
14910 /* DC */        NULL,           NULL,           NULL,           NULL,
14911 /* E0 */        NULL,           NULL,           NULL,           NULL,
14912 /* E4 */        NULL,           NULL,           NULL,           NULL,
14913 /* E8 */        NULL,           NULL,           NULL,           NULL,
14914 /* EC */        NULL,           NULL,           NULL,           NULL,
14915 /* F0 */        NULL,           NULL,           NULL,           NULL,
14916 /* F4 */        NULL,           NULL,           NULL,           NULL,
14917 /* F8 */        NULL,           NULL,           NULL,           NULL,
14918 /* FC */        NULL,           NULL,           NULL,           NULL,
14919 };
14920
14921 static void
14922 OP_3DNowSuffix (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14923 {
14924   const char *mnemonic;
14925
14926   FETCH_DATA (the_info, codep + 1);
14927   /* AMD 3DNow! instructions are specified by an opcode suffix in the
14928      place where an 8-bit immediate would normally go.  ie. the last
14929      byte of the instruction.  */
14930   obufp = mnemonicendp;
14931   mnemonic = Suffix3DNow[*codep++ & 0xff];
14932   if (mnemonic)
14933     oappend (mnemonic);
14934   else
14935     {
14936       /* Since a variable sized modrm/sib chunk is between the start
14937          of the opcode (0x0f0f) and the opcode suffix, we need to do
14938          all the modrm processing first, and don't know until now that
14939          we have a bad opcode.  This necessitates some cleaning up.  */
14940       op_out[0][0] = '\0';
14941       op_out[1][0] = '\0';
14942       BadOp ();
14943     }
14944   mnemonicendp = obufp;
14945 }
14946
14947 static struct op simd_cmp_op[] =
14948 {
14949   { STRING_COMMA_LEN ("eq") },
14950   { STRING_COMMA_LEN ("lt") },
14951   { STRING_COMMA_LEN ("le") },
14952   { STRING_COMMA_LEN ("unord") },
14953   { STRING_COMMA_LEN ("neq") },
14954   { STRING_COMMA_LEN ("nlt") },
14955   { STRING_COMMA_LEN ("nle") },
14956   { STRING_COMMA_LEN ("ord") }
14957 };
14958
14959 static void
14960 CMP_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
14961 {
14962   unsigned int cmp_type;
14963
14964   FETCH_DATA (the_info, codep + 1);
14965   cmp_type = *codep++ & 0xff;
14966   if (cmp_type < ARRAY_SIZE (simd_cmp_op))
14967     {
14968       char suffix [3];
14969       char *p = mnemonicendp - 2;
14970       suffix[0] = p[0];
14971       suffix[1] = p[1];
14972       suffix[2] = '\0';
14973       sprintf (p, "%s%s", simd_cmp_op[cmp_type].name, suffix);
14974       mnemonicendp += simd_cmp_op[cmp_type].len;
14975     }
14976   else
14977     {
14978       /* We have a reserved extension byte.  Output it directly.  */
14979       scratchbuf[0] = '$';
14980       print_operand_value (scratchbuf + 1, 1, cmp_type);
14981       oappend (scratchbuf + intel_syntax);
14982       scratchbuf[0] = '\0';
14983     }
14984 }
14985
14986 static void
14987 OP_Mwait (int bytemode ATTRIBUTE_UNUSED,
14988           int sizeflag ATTRIBUTE_UNUSED)
14989 {
14990   /* mwait %eax,%ecx  */
14991   if (!intel_syntax)
14992     {
14993       const char **names = (address_mode == mode_64bit
14994                             ? names64 : names32);
14995       strcpy (op_out[0], names[0]);
14996       strcpy (op_out[1], names[1]);
14997       two_source_ops = 1;
14998     }
14999   /* Skip mod/rm byte.  */
15000   MODRM_CHECK;
15001   codep++;
15002 }
15003
15004 static void
15005 OP_Monitor (int bytemode ATTRIBUTE_UNUSED,
15006             int sizeflag ATTRIBUTE_UNUSED)
15007 {
15008   /* monitor %eax,%ecx,%edx"  */
15009   if (!intel_syntax)
15010     {
15011       const char **op1_names;
15012       const char **names = (address_mode == mode_64bit
15013                             ? names64 : names32);
15014
15015       if (!(prefixes & PREFIX_ADDR))
15016         op1_names = (address_mode == mode_16bit
15017                      ? names16 : names);
15018       else
15019         {
15020           /* Remove "addr16/addr32".  */
15021           all_prefixes[last_addr_prefix] = 0;
15022           op1_names = (address_mode != mode_32bit
15023                        ? names32 : names16);
15024           used_prefixes |= PREFIX_ADDR;
15025         }
15026       strcpy (op_out[0], op1_names[0]);
15027       strcpy (op_out[1], names[1]);
15028       strcpy (op_out[2], names[2]);
15029       two_source_ops = 1;
15030     }
15031   /* Skip mod/rm byte.  */
15032   MODRM_CHECK;
15033   codep++;
15034 }
15035
15036 static void
15037 BadOp (void)
15038 {
15039   /* Throw away prefixes and 1st. opcode byte.  */
15040   codep = insn_codep + 1;
15041   oappend ("(bad)");
15042 }
15043
15044 static void
15045 REP_Fixup (int bytemode, int sizeflag)
15046 {
15047   /* The 0xf3 prefix should be displayed as "rep" for ins, outs, movs,
15048      lods and stos.  */
15049   if (prefixes & PREFIX_REPZ)
15050     all_prefixes[last_repz_prefix] = REP_PREFIX;
15051
15052   switch (bytemode)
15053     {
15054     case al_reg:
15055     case eAX_reg:
15056     case indir_dx_reg:
15057       OP_IMREG (bytemode, sizeflag);
15058       break;
15059     case eDI_reg:
15060       OP_ESreg (bytemode, sizeflag);
15061       break;
15062     case eSI_reg:
15063       OP_DSreg (bytemode, sizeflag);
15064       break;
15065     default:
15066       abort ();
15067       break;
15068     }
15069 }
15070
15071 static void
15072 CMPXCHG8B_Fixup (int bytemode, int sizeflag)
15073 {
15074   USED_REX (REX_W);
15075   if (rex & REX_W)
15076     {
15077       /* Change cmpxchg8b to cmpxchg16b.  */
15078       char *p = mnemonicendp - 2;
15079       mnemonicendp = stpcpy (p, "16b");
15080       bytemode = o_mode;
15081     }
15082   OP_M (bytemode, sizeflag);
15083 }
15084
15085 static void
15086 XMM_Fixup (int reg, int sizeflag ATTRIBUTE_UNUSED)
15087 {
15088   if (need_vex)
15089     {
15090       switch (vex.length)
15091         {
15092         case 128:
15093           sprintf (scratchbuf, "%%xmm%d", reg);
15094           break;
15095         case 256:
15096           sprintf (scratchbuf, "%%ymm%d", reg);
15097           break;
15098         default:
15099           abort ();
15100         }
15101     }
15102   else
15103     sprintf (scratchbuf, "%%xmm%d", reg);
15104   oappend (scratchbuf + intel_syntax);
15105 }
15106
15107 static void
15108 CRC32_Fixup (int bytemode, int sizeflag)
15109 {
15110   /* Add proper suffix to "crc32".  */
15111   char *p = mnemonicendp;
15112
15113   switch (bytemode)
15114     {
15115     case b_mode:
15116       if (intel_syntax)
15117         goto skip;
15118
15119       *p++ = 'b';
15120       break;
15121     case v_mode:
15122       if (intel_syntax)
15123         goto skip;
15124
15125       USED_REX (REX_W);
15126       if (rex & REX_W)
15127         *p++ = 'q';
15128       else 
15129         {
15130           if (sizeflag & DFLAG)
15131             *p++ = 'l';
15132           else
15133             *p++ = 'w';
15134           used_prefixes |= (prefixes & PREFIX_DATA);
15135         }
15136       break;
15137     default:
15138       oappend (INTERNAL_DISASSEMBLER_ERROR);
15139       break;
15140     }
15141   mnemonicendp = p;
15142   *p = '\0';
15143
15144 skip:
15145   if (modrm.mod == 3)
15146     {
15147       int add;
15148
15149       /* Skip mod/rm byte.  */
15150       MODRM_CHECK;
15151       codep++;
15152
15153       USED_REX (REX_B);
15154       add = (rex & REX_B) ? 8 : 0;
15155       if (bytemode == b_mode)
15156         {
15157           USED_REX (0);
15158           if (rex)
15159             oappend (names8rex[modrm.rm + add]);
15160           else
15161             oappend (names8[modrm.rm + add]);
15162         }
15163       else
15164         {
15165           USED_REX (REX_W);
15166           if (rex & REX_W)
15167             oappend (names64[modrm.rm + add]);
15168           else if ((prefixes & PREFIX_DATA))
15169             oappend (names16[modrm.rm + add]);
15170           else
15171             oappend (names32[modrm.rm + add]);
15172         }
15173     }
15174   else
15175     OP_E (bytemode, sizeflag);
15176 }
15177
15178 static void
15179 FXSAVE_Fixup (int bytemode, int sizeflag)
15180 {
15181   /* Add proper suffix to "fxsave" and "fxrstor".  */
15182   USED_REX (REX_W);
15183   if (rex & REX_W)
15184     {
15185       char *p = mnemonicendp;
15186       *p++ = '6';
15187       *p++ = '4';
15188       *p = '\0';
15189       mnemonicendp = p;
15190     }
15191   OP_M (bytemode, sizeflag);
15192 }
15193
15194 /* Display the destination register operand for instructions with
15195    VEX. */
15196
15197 static void
15198 OP_VEX (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
15199 {
15200   if (!need_vex)
15201     abort ();
15202
15203   if (!need_vex_reg)
15204     return;
15205
15206   switch (vex.length)
15207     {
15208     case 128:
15209       switch (bytemode)
15210         {
15211         case vex_mode:
15212         case vex128_mode:
15213           break;
15214         default:
15215           abort ();
15216           return;
15217         }
15218
15219       sprintf (scratchbuf, "%%xmm%d", vex.register_specifier);
15220       break;
15221     case 256:
15222       switch (bytemode)
15223         {
15224         case vex_mode:
15225         case vex256_mode:
15226           break;
15227         default:
15228           abort ();
15229           return;
15230         }
15231
15232       sprintf (scratchbuf, "%%ymm%d", vex.register_specifier);
15233       break;
15234     default:
15235       abort ();
15236       break;
15237     }
15238   oappend (scratchbuf + intel_syntax);
15239 }
15240
15241 /* Get the VEX immediate byte without moving codep.  */
15242
15243 static unsigned char
15244 get_vex_imm8 (int sizeflag, int opnum)
15245 {
15246   int bytes_before_imm = 0;
15247
15248   if (modrm.mod != 3)
15249     {
15250       /* There are SIB/displacement bytes.  */
15251       if ((sizeflag & AFLAG) || address_mode == mode_64bit)
15252         {
15253           /* 32/64 bit address mode */
15254           int base = modrm.rm;
15255
15256           /* Check SIB byte.  */
15257           if (base == 4)
15258             {
15259               FETCH_DATA (the_info, codep + 1);
15260               base = *codep & 7;
15261               /* When decoding the third source, don't increase
15262                  bytes_before_imm as this has already been incremented
15263                  by one in OP_E_memory while decoding the second
15264                  source operand.  */
15265               if (opnum == 0)
15266                 bytes_before_imm++;
15267             }
15268
15269           /* Don't increase bytes_before_imm when decoding the third source,
15270              it has already been incremented by OP_E_memory while decoding
15271              the second source operand.  */
15272           if (opnum == 0)
15273             {
15274               switch (modrm.mod)
15275                 {
15276                   case 0:
15277                     /* When modrm.rm == 5 or modrm.rm == 4 and base in
15278                        SIB == 5, there is a 4 byte displacement.  */
15279                     if (base != 5)
15280                       /* No displacement. */
15281                       break;
15282                   case 2:
15283                     /* 4 byte displacement.  */
15284                     bytes_before_imm += 4;
15285                     break;
15286                   case 1:
15287                     /* 1 byte displacement.  */
15288                     bytes_before_imm++;
15289                     break;
15290                 }
15291             }
15292         }
15293       else
15294         {
15295           /* 16 bit address mode */
15296           /* Don't increase bytes_before_imm when decoding the third source,
15297              it has already been incremented by OP_E_memory while decoding
15298              the second source operand.  */
15299           if (opnum == 0)
15300             {
15301               switch (modrm.mod)
15302                 {
15303                 case 0:
15304                   /* When modrm.rm == 6, there is a 2 byte displacement.  */
15305                   if (modrm.rm != 6)
15306                     /* No displacement. */
15307                     break;
15308                 case 2:
15309                   /* 2 byte displacement.  */
15310                   bytes_before_imm += 2;
15311                   break;
15312                 case 1:
15313                   /* 1 byte displacement: when decoding the third source,
15314                      don't increase bytes_before_imm as this has already
15315                      been incremented by one in OP_E_memory while decoding
15316                      the second source operand.  */
15317                   if (opnum == 0)
15318                     bytes_before_imm++;
15319
15320                   break;
15321                 }
15322             }
15323         }
15324     }
15325
15326   FETCH_DATA (the_info, codep + bytes_before_imm + 1);
15327   return codep [bytes_before_imm];
15328 }
15329
15330 static void
15331 OP_EX_VexReg (int bytemode, int sizeflag, int reg)
15332 {
15333   if (reg == -1 && modrm.mod != 3)
15334     {
15335       OP_E_memory (bytemode, sizeflag);
15336       return;
15337     }
15338   else
15339     {
15340       if (reg == -1)
15341         {
15342           reg = modrm.rm;
15343           USED_REX (REX_B);
15344           if (rex & REX_B)
15345             reg += 8;
15346         }
15347       else if (reg > 7 && address_mode != mode_64bit)
15348         BadOp ();
15349     }
15350
15351   switch (vex.length)
15352     {
15353     case 128:
15354       sprintf (scratchbuf, "%%xmm%d", reg);
15355       break;
15356     case 256:
15357       sprintf (scratchbuf, "%%ymm%d", reg);
15358       break;
15359     default:
15360       abort ();
15361     }
15362   oappend (scratchbuf + intel_syntax);
15363 }
15364
15365 static void
15366 OP_Vex_2src (int bytemode, int sizeflag)
15367 {
15368   if (modrm.mod == 3)
15369     {
15370       USED_REX (REX_B);
15371       sprintf (scratchbuf, "%%xmm%d", rex & REX_B ? modrm.rm + 8 : modrm.rm);
15372       oappend (scratchbuf + intel_syntax);
15373     }
15374   else
15375     {
15376       if (intel_syntax
15377           && (bytemode == v_mode || bytemode == v_swap_mode))
15378         {
15379           bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode;
15380           used_prefixes |= (prefixes & PREFIX_DATA);
15381         }
15382       OP_E (bytemode, sizeflag);
15383     }
15384 }
15385
15386 static void
15387 OP_Vex_2src_1 (int bytemode, int sizeflag)
15388 {
15389   if (modrm.mod == 3)
15390     {
15391       /* Skip mod/rm byte.   */
15392       MODRM_CHECK;
15393       codep++;
15394     }
15395
15396   if (vex.w)
15397     {
15398       sprintf (scratchbuf, "%%xmm%d", vex.register_specifier);
15399       oappend (scratchbuf + intel_syntax);
15400     }
15401   else
15402     OP_Vex_2src (bytemode, sizeflag);
15403 }
15404
15405 static void
15406 OP_Vex_2src_2 (int bytemode, int sizeflag)
15407 {
15408   if (vex.w)
15409     OP_Vex_2src (bytemode, sizeflag);
15410   else
15411     {
15412       sprintf (scratchbuf, "%%xmm%d", vex.register_specifier);
15413       oappend (scratchbuf + intel_syntax);
15414     }
15415 }
15416
15417 static void
15418 OP_EX_VexW (int bytemode, int sizeflag)
15419 {
15420   int reg = -1;
15421
15422   if (!vex_w_done)
15423     {
15424       vex_w_done = 1;
15425
15426       /* Skip mod/rm byte.  */
15427       MODRM_CHECK;
15428       codep++;
15429
15430       if (vex.w)
15431         reg = get_vex_imm8 (sizeflag, 0) >> 4;
15432     }
15433   else
15434     {
15435       if (!vex.w)
15436         reg = get_vex_imm8 (sizeflag, 1) >> 4;
15437     }
15438
15439   OP_EX_VexReg (bytemode, sizeflag, reg);
15440 }
15441
15442 static void
15443 VEXI4_Fixup (int bytemode ATTRIBUTE_UNUSED,
15444              int sizeflag ATTRIBUTE_UNUSED)
15445 {
15446   /* Skip the immediate byte and check for invalid bits.  */
15447   FETCH_DATA (the_info, codep + 1);
15448   if (*codep++ & 0xf)
15449     BadOp ();
15450 }
15451
15452 static void
15453 OP_REG_VexI4 (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
15454 {
15455   int reg;
15456   FETCH_DATA (the_info, codep + 1);
15457   reg = *codep++;
15458
15459   if (bytemode != x_mode)
15460     abort ();
15461
15462   if (reg & 0xf)
15463       BadOp ();
15464
15465   reg >>= 4;
15466   if (reg > 7 && address_mode != mode_64bit)
15467     BadOp ();
15468
15469   switch (vex.length)
15470     {
15471     case 128:
15472       sprintf (scratchbuf, "%%xmm%d", reg);
15473       break;
15474     case 256:
15475       sprintf (scratchbuf, "%%ymm%d", reg);
15476       break;
15477     default:
15478       abort ();
15479     }
15480   oappend (scratchbuf + intel_syntax);
15481 }
15482
15483 static void
15484 OP_XMM_VexW (int bytemode, int sizeflag)
15485 {
15486   /* Turn off the REX.W bit since it is used for swapping operands
15487      now.  */
15488   rex &= ~REX_W;
15489   OP_XMM (bytemode, sizeflag);
15490 }
15491
15492 static void
15493 OP_EX_Vex (int bytemode, int sizeflag)
15494 {
15495   if (modrm.mod != 3)
15496     {
15497       if (vex.register_specifier != 0)
15498         BadOp ();
15499       need_vex_reg = 0;
15500     }
15501   OP_EX (bytemode, sizeflag);
15502 }
15503
15504 static void
15505 OP_XMM_Vex (int bytemode, int sizeflag)
15506 {
15507   if (modrm.mod != 3)
15508     {
15509       if (vex.register_specifier != 0)
15510         BadOp ();
15511       need_vex_reg = 0;
15512     }
15513   OP_XMM (bytemode, sizeflag);
15514 }
15515
15516 static void
15517 VZERO_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
15518 {
15519   switch (vex.length)
15520     {
15521     case 128:
15522       mnemonicendp = stpcpy (obuf, "vzeroupper");
15523       break;
15524     case 256:
15525       mnemonicendp = stpcpy (obuf, "vzeroall");
15526       break;
15527     default:
15528       abort ();
15529     }
15530 }
15531
15532 static struct op vex_cmp_op[] =
15533 {
15534   { STRING_COMMA_LEN ("eq") },
15535   { STRING_COMMA_LEN ("lt") },
15536   { STRING_COMMA_LEN ("le") },
15537   { STRING_COMMA_LEN ("unord") },
15538   { STRING_COMMA_LEN ("neq") },
15539   { STRING_COMMA_LEN ("nlt") },
15540   { STRING_COMMA_LEN ("nle") },
15541   { STRING_COMMA_LEN ("ord") },
15542   { STRING_COMMA_LEN ("eq_uq") },
15543   { STRING_COMMA_LEN ("nge") },
15544   { STRING_COMMA_LEN ("ngt") },
15545   { STRING_COMMA_LEN ("false") },
15546   { STRING_COMMA_LEN ("neq_oq") },
15547   { STRING_COMMA_LEN ("ge") },
15548   { STRING_COMMA_LEN ("gt") },
15549   { STRING_COMMA_LEN ("true") },
15550   { STRING_COMMA_LEN ("eq_os") },
15551   { STRING_COMMA_LEN ("lt_oq") },
15552   { STRING_COMMA_LEN ("le_oq") },
15553   { STRING_COMMA_LEN ("unord_s") },
15554   { STRING_COMMA_LEN ("neq_us") },
15555   { STRING_COMMA_LEN ("nlt_uq") },
15556   { STRING_COMMA_LEN ("nle_uq") },
15557   { STRING_COMMA_LEN ("ord_s") },
15558   { STRING_COMMA_LEN ("eq_us") },
15559   { STRING_COMMA_LEN ("nge_uq") },
15560   { STRING_COMMA_LEN ("ngt_uq") },
15561   { STRING_COMMA_LEN ("false_os") },
15562   { STRING_COMMA_LEN ("neq_os") },
15563   { STRING_COMMA_LEN ("ge_oq") },
15564   { STRING_COMMA_LEN ("gt_oq") },
15565   { STRING_COMMA_LEN ("true_us") },
15566 };
15567
15568 static void
15569 VCMP_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
15570 {
15571   unsigned int cmp_type;
15572
15573   FETCH_DATA (the_info, codep + 1);
15574   cmp_type = *codep++ & 0xff;
15575   if (cmp_type < ARRAY_SIZE (vex_cmp_op))
15576     {
15577       char suffix [3];
15578       char *p = mnemonicendp - 2;
15579       suffix[0] = p[0];
15580       suffix[1] = p[1];
15581       suffix[2] = '\0';
15582       sprintf (p, "%s%s", vex_cmp_op[cmp_type].name, suffix);
15583       mnemonicendp += vex_cmp_op[cmp_type].len;
15584     }
15585   else
15586     {
15587       /* We have a reserved extension byte.  Output it directly.  */
15588       scratchbuf[0] = '$';
15589       print_operand_value (scratchbuf + 1, 1, cmp_type);
15590       oappend (scratchbuf + intel_syntax);
15591       scratchbuf[0] = '\0';
15592     }
15593 }
15594
15595 static const struct op pclmul_op[] =
15596 {
15597   { STRING_COMMA_LEN ("lql") },
15598   { STRING_COMMA_LEN ("hql") },
15599   { STRING_COMMA_LEN ("lqh") },
15600   { STRING_COMMA_LEN ("hqh") }
15601 };
15602
15603 static void
15604 PCLMUL_Fixup (int bytemode ATTRIBUTE_UNUSED,
15605               int sizeflag ATTRIBUTE_UNUSED)
15606 {
15607   unsigned int pclmul_type;
15608
15609   FETCH_DATA (the_info, codep + 1);
15610   pclmul_type = *codep++ & 0xff;
15611   switch (pclmul_type)
15612     {
15613     case 0x10:
15614       pclmul_type = 2;
15615       break;
15616     case 0x11:
15617       pclmul_type = 3;
15618       break;
15619     default:
15620       break;
15621     } 
15622   if (pclmul_type < ARRAY_SIZE (pclmul_op))
15623     {
15624       char suffix [4];
15625       char *p = mnemonicendp - 3;
15626       suffix[0] = p[0];
15627       suffix[1] = p[1];
15628       suffix[2] = p[2];
15629       suffix[3] = '\0';
15630       sprintf (p, "%s%s", pclmul_op[pclmul_type].name, suffix);
15631       mnemonicendp += pclmul_op[pclmul_type].len;
15632     }
15633   else
15634     {
15635       /* We have a reserved extension byte.  Output it directly.  */
15636       scratchbuf[0] = '$';
15637       print_operand_value (scratchbuf + 1, 1, pclmul_type);
15638       oappend (scratchbuf + intel_syntax);
15639       scratchbuf[0] = '\0';
15640     }
15641 }
15642
15643 static void
15644 MOVBE_Fixup (int bytemode, int sizeflag)
15645 {
15646   /* Add proper suffix to "movbe".  */
15647   char *p = mnemonicendp;
15648
15649   switch (bytemode)
15650     {
15651     case v_mode:
15652       if (intel_syntax)
15653         goto skip;
15654
15655       USED_REX (REX_W);
15656       if (sizeflag & SUFFIX_ALWAYS)
15657         {
15658           if (rex & REX_W)
15659             *p++ = 'q';
15660           else
15661             {
15662               if (sizeflag & DFLAG)
15663                 *p++ = 'l';
15664               else
15665                 *p++ = 'w';
15666               used_prefixes |= (prefixes & PREFIX_DATA);
15667             }
15668         }
15669       break;
15670     default:
15671       oappend (INTERNAL_DISASSEMBLER_ERROR);
15672       break;
15673     }
15674   mnemonicendp = p;
15675   *p = '\0';
15676
15677 skip:
15678   OP_M (bytemode, sizeflag);
15679 }
15680
15681 static void
15682 OP_LWPCB_E (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
15683 {
15684   int reg;
15685   const char **names;
15686
15687   /* Skip mod/rm byte.  */
15688   MODRM_CHECK;
15689   codep++;
15690
15691   if (vex.w)
15692     names = names64;
15693   else if (vex.length == 256)
15694     names = names32;
15695   else
15696     names = names16;
15697
15698   reg = modrm.rm;
15699   USED_REX (REX_B);
15700   if (rex & REX_B)
15701     reg += 8;
15702
15703   oappend (names[reg]);
15704 }
15705
15706 static void
15707 OP_LWP_E (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
15708 {
15709   const char **names;
15710
15711   if (vex.w)
15712     names = names64;
15713   else if (vex.length == 256)
15714     names = names32;
15715   else
15716     names = names16;
15717
15718   oappend (names[vex.register_specifier]);
15719 }
15720
15721 static void
15722 OP_LWP_I (int bytemode ATTRIBUTE_UNUSED, int sizeflag)
15723 {
15724   if (vex.w || vex.length == 256)
15725     OP_I (q_mode, sizeflag);
15726   else
15727     OP_I (w_mode, sizeflag);
15728 }
15729