two_byte_opcodes.isa revision 5059
1// Copyright (c) 2007 The Hewlett-Packard Development Company
2// All rights reserved.
3//
4// Redistribution and use of this software in source and binary forms,
5// with or without modification, are permitted provided that the
6// following conditions are met:
7//
8// The software must be used only for Non-Commercial Use which means any
9// use which is NOT directed to receiving any direct monetary
10// compensation for, or commercial advantage from such use.  Illustrative
11// examples of non-commercial use are academic research, personal study,
12// teaching, education and corporate research & development.
13// Illustrative examples of commercial use are distributing products for
14// commercial advantage and providing services using the software for
15// commercial advantage.
16//
17// If you wish to use this software or functionality therein that may be
18// covered by patents for commercial use, please contact:
19//     Director of Intellectual Property Licensing
20//     Office of Strategy and Technology
21//     Hewlett-Packard Company
22//     1501 Page Mill Road
23//     Palo Alto, California  94304
24//
25// Redistributions of source code must retain the above copyright notice,
26// this list of conditions and the following disclaimer.  Redistributions
27// in binary form must reproduce the above copyright notice, this list of
28// conditions and the following disclaimer in the documentation and/or
29// other materials provided with the distribution.  Neither the name of
30// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
31// contributors may be used to endorse or promote products derived from
32// this software without specific prior written permission.  No right of
33// sublicense is granted herewith.  Derivatives of the software and
34// output created using the software may be prepared, but only for
35// Non-Commercial Uses.  Derivatives of the software may be shared with
36// others provided: (i) the others agree to abide by the list of
37// conditions herein which includes the Non-Commercial Use restrictions;
38// and (ii) such Derivatives of the software include the above copyright
39// notice to acknowledge the contribution from this software where
40// applicable, this list of conditions and the disclaimer below.
41//
42// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53//
54// Authors: Gabe Black
55
56////////////////////////////////////////////////////////////////////
57//
58// Decode the two byte opcodes
59//
600x2: decode OPCODE_PREFIXA {
61    0x0F: decode OPCODE_OP_TOP5 {
62        format WarnUnimpl {
63            0x00: decode OPCODE_OP_BOTTOM3 {
64                0x00: group6();
65                0x01: group7();
66                0x02: lar_Gv_Ew();
67                0x03: lsl_Gv_Ew();
68                //sandpile.org doesn't seem to know what this is... ?
69                0x04: loadall_or_reset_or_hang();
70#if FULL_SYSTEM
71                0x05: syscall();
72#else
73                0x05: SyscallInst::syscall('xc->syscall(rax)', IsSyscall);
74#endif
75                0x06: clts();
76                //sandpile.org says (AMD) after sysret, so I might want to check
77                //if that means amd64 or AMD machines
78                0x07: loadall_or_sysret();
79            }
80            0x01: decode OPCODE_OP_BOTTOM3 {
81                0x0: invd();
82                0x1: wbinvd();
83                0x2: Inst::UD2();
84                0x3: Inst::UD2();
85                0x4: Inst::UD2();
86                0x5: threednow();
87                0x6: threednow();
88                0x7: threednow();
89            }
90            0x02: decode LEGACY_DECODEVAL {
91                // no prefix
92                0x0: decode OPCODE_OP_BOTTOM3 {
93                    0x0: movups_Vo_Wo();
94                    0x1: movups_Wo_Vo();
95                    0x2: decode MODRM_MOD {
96                        0x3: movhlps_Vq_VRq();
97                        default: movlps_Vq_Mq();
98                    }
99                    0x3: movlps_Mq_Vq();
100                    0x4: unpcklps();
101                    0x5: unpckhps();
102                    0x6: decode MODRM_MOD {
103                        0x3: movlhps_Vq_VRq();
104                        default: movhps_Vq_Mq();
105                    }
106                    0x7: movhps_Mq_Vq();
107                }
108                // repe (0xF3)
109                0x4: decode OPCODE_OP_BOTTOM3 {
110                    0x0: movss_Vd_Wd();
111                    0x1: movss_Wd_Vd();
112                    0x2: movsldup_Vo_Wo();
113                    0x6: movshdup_Vo_Wo();
114                    default: Inst::UD2();
115                }
116                // operand size (0x66)
117                0x1: decode OPCODE_OP_BOTTOM3 {
118                    0x0: movupd_Vo_Wo();
119                    0x1: movupd_Wo_Vo();
120                    0x2: Inst::MOVLPD(Vq,Mq);
121                    0x3: Inst::MOVLPD(Mq,Vq);
122                    0x4: unpcklpd_Vo_Wq();
123                    0x5: unpckhpd_Vo_Wo();
124                    0x6: movhpd_Vq_Mq();
125                    0x7: movhpd_Mq_Vq();
126                }
127                // repne (0xF2)
128                0x8: decode OPCODE_OP_BOTTOM3 {
129                    0x0: Inst::MOVSD(Vq,Wq);
130                    0x1: Inst::MOVSD(Wq,Vq);
131                    0x2: movddup_Vo_Wq();
132                    default: Inst::UD2();
133                }
134                default: Inst::UD2();
135            }
136            0x03: decode OPCODE_OP_BOTTOM3 {
137                0x0: group17();
138                0x1: group17();
139                0x2: group17();
140                0x3: group17();
141                0x4: group17();
142                0x5: group17();
143                0x6: group17();
144                0x7: group17();
145            }
146            0x04: decode LEGACY_DECODEVAL {
147                // no prefix
148                0x0: decode OPCODE_OP_BOTTOM3 {
149                    0x0: mov_Rd_Cd();
150                    0x1: mov_Rd_Dd();
151                    0x2: mov_Cd_Rd();
152                    0x3: mov_Dd_Rd();
153                    0x4: mov_Rd_Td();
154                    0x6: mov_Td_Rd();
155                    default: Inst::UD2();
156                }
157                // lock prefix (0xF0)
158                0x2: decode OPCODE_OP_BOTTOM3 {
159                    0x0: mov_Rd_CR8D();
160                    0x2: mov_CR8D_Rd();
161                }
162                default: Inst::UD2();
163            }
164            0x05: decode LEGACY_DECODEVAL {
165                // no prefix
166                0x0: decode OPCODE_OP_BOTTOM3 {
167                    //These moves should really use size o (octword), but
168                    //because they are split in two, they use q (quadword).
169                    0x0: Inst::MOVAPS(Vq,Wq);
170                    0x1: Inst::MOVAPS(Wq,Vq);
171                    0x2: decode MODRM_MOD {
172                        0x3: cvtpi2pS_Vq_Pq();
173                        default: cvtpi2ps_Vq_Mq();
174                    }
175                    0x3: movntps_Mo_Vo();
176                    0x4: cvttps2pi_Pq_Wq();
177                    0x5: cvtpS2pi_Pq_Wq();
178                    0x6: ucomiss_Vd_Wd();
179                    0x7: comiss_Vd_Wd();
180                }
181                // repe (0xF3)
182                0x4: decode OPCODE_OP_BOTTOM3 {
183                    0x2: cvtsi2ss_Vd_Ed();
184                    0x4: cvttss2si_Gd_Wd();
185                    0x5: cvtss2si_Gd_Wd();
186                    default: Inst::UD2();
187                }
188                // operand size (0x66)
189                0x1: decode OPCODE_OP_BOTTOM3 {
190                    0x0: movapd_Vo_Wo();
191                    0x1: movapd_Wo_Vo();
192                    0x2: decode MODRM_MOD {
193                        0x3: cvtpi2pd_Vo_Pq();
194                        default: cvtpi2pd_Vo_Mq();
195                    }
196                    0x3: movntpd_Mo_Vo();
197                    0x4: cvttpd2pi_Pq_Wo();
198                    0x5: cvtpd2pi_Pq_Wo();
199                    0x6: Inst::UCOMISD(Vq,Wq);
200                    0x7: comisd_Vq_Wq();
201                }
202                // repne (0xF2)
203                0x8: decode OPCODE_OP_BOTTOM3 {
204                    // The size of the V operand should be q, not dp
205                    0x2: Inst::CVTSI2SD(Vdp,Edp);
206                    // The size of the W operand should be q, not dp
207                    0x4: Inst::CVTTSD2SI(Gdp,Wdp);
208                    0x5: cvtsd2si_Gd_Wq();
209                    default: Inst::UD2();
210                }
211                default: Inst::UD2();
212            }
213            0x06: decode OPCODE_OP_BOTTOM3 {
214                0x0: wrmsr();
215                0x1: rdtsc();
216                0x2: rdmsr();
217                0x3: rdpmc();
218                0x4: sysenter();
219                0x5: sysexit();
220                0x6: Inst::UD2();
221                0x7: getsec();
222            }
223            0x07: decode OPCODE_OP_BOTTOM3 {
224                0x0: three_byte_opcode();
225                0x1: three_byte_opcode();
226                0x2: three_byte_opcode();
227                0x3: three_byte_opcode();
228                0x4: three_byte_opcode();
229                0x5: three_byte_opcode();
230                0x6: three_byte_opcode();
231                0x7: three_byte_opcode();
232            }
233            format Inst {
234                0x08: decode OPCODE_OP_BOTTOM3 {
235                    0x0: CMOVO(Gv,Ev);
236                    0x1: CMOVNO(Gv,Ev);
237                    0x2: CMOVB(Gv,Ev);
238                    0x3: CMOVNB(Gv,Ev);
239                    0x4: CMOVZ(Gv,Ev);
240                    0x5: CMOVNZ(Gv,Ev);
241                    0x6: CMOVBE(Gv,Ev);
242                    0x7: CMOVNBE(Gv,Ev);
243                }
244                0x09: decode OPCODE_OP_BOTTOM3 {
245                    0x0: CMOVS(Gv,Ev);
246                    0x1: CMOVNS(Gv,Ev);
247                    0x2: CMOVP(Gv,Ev);
248                    0x3: CMOVNP(Gv,Ev);
249                    0x4: CMOVL(Gv,Ev);
250                    0x5: CMOVNL(Gv,Ev);
251                    0x6: CMOVLE(Gv,Ev);
252                    0x7: CMOVNLE(Gv,Ev);
253                }
254            }
255            0x0A: decode LEGACY_DECODEVAL {
256                // no prefix
257                0x0: decode OPCODE_OP_BOTTOM3 {
258                    0x0: movmskps_Gd_VRo();
259                    0x1: sqrtps_Vo_Wo();
260                    0x2: rqsrtps_Vo_Wo();
261                    0x3: rcpps_Vo_Wo();
262                    0x4: andps_Vo_Wo();
263                    0x5: andnps_Vo_Wo();
264                    0x6: orps_Vo_Wo();
265                    0x7: xorps_Vo_Wo();
266                }
267                // repe (0xF3)
268                0x4: decode OPCODE_OP_BOTTOM3 {
269                    0x1: sqrtss_Vd_Wd();
270                    0x2: rsqrtss_Vd_Wd();
271                    0x3: rcpss_Vd_Wd();
272                    default: Inst::UD2();
273                }
274                // operand size (0x66)
275                0x1: decode OPCODE_OP_BOTTOM3 {
276                    0x0: movmskpd_Gd_VRo();
277                    0x1: sqrtpd_Vo_Wo();
278                    0x4: andpd_Vo_Wo();
279                    0x5: andnpd_Vo_Wo();
280                    0x6: orpd_Vo_Wo();
281                    //This really should be type o, but it works on q sized
282                    //chunks at a time.
283                    0x7: Inst::XORPD(Vq,Wq);
284                    default: Inst::UD2();
285                }
286                format Inst {
287                    // repne (0xF2)
288                    0x8: decode OPCODE_OP_BOTTOM3 {
289                        0x1: SQRTSD(Vq,Wq);
290                        default: UD2();
291                    }
292                    default: UD2();
293                }
294            }
295            0x0B: decode LEGACY_DECODEVAL {
296                // no prefix
297                0x0: decode OPCODE_OP_BOTTOM3 {
298                    0x0: addps_Vo_Wo();
299                    0x1: mulps_Vo_Wo();
300                    0x2: cvtps2pd_Vo_Wq();
301                    0x3: cvtdq2ps_Vo_Wo();
302                    0x4: subps_Vo_Wo();
303                    0x5: minps_Vo_Wo();
304                    0x6: divps_Vo_Wo();
305                    0x7: maxps_Vo_Wo();
306                }
307                // repe (0xF3)
308                0x4: decode OPCODE_OP_BOTTOM3 {
309                    0x0: addss_Vd_Wd();
310                    0x1: mulss_Vd_Wd();
311                    0x2: cvtss2sd_Vq_Wd();
312                    0x3: cvttps2dq_Vo_Wo();
313                    0x4: subss_Vd_Wd();
314                    0x5: minss_Vd_Wd();
315                    0x6: divss_Vd_Wd();
316                    0x7: maxss_Vd_Wd();
317                }
318                // operand size (0x66)
319                0x1: decode OPCODE_OP_BOTTOM3 {
320                    0x0: addpd_Vo_Wo();
321                    0x1: mulpd_Vo_Wo();
322                    0x2: cvtpd2ps_Vo_Wo();
323                    0x3: cvtps2dq_Vo_Wo();
324                    0x4: subpd_Vo_Wo();
325                    0x5: minpd_Vo_Wo();
326                    0x6: divpd_Vo_Wo();
327                    0x7: maxpd_Vo_Wo();
328                }
329                // repne (0xF2)
330                0x8: decode OPCODE_OP_BOTTOM3 {
331                    0x0: Inst::ADDSD(Vq,Wq);
332                    0x1: Inst::MULSD(Vq,Wq);
333                    0x2: cvtsd2ss_Vd_Wq();
334                    0x4: Inst::SUBSD(Vq,Wq);
335                    0x5: minsd_Vq_Wq();
336                    0x6: Inst::DIVSD(Vq,Wq);
337                    0x7: maxsd_Vq_Wq();
338                    default: Inst::UD2();
339                }
340                default: Inst::UD2();
341            }
342            0x0C: decode LEGACY_DECODEVAL {
343                // no prefix
344                0x0: decode OPCODE_OP_BOTTOM3 {
345                    0x0: punpcklbw_Pq_Qd();
346                    0x1: punpcklwd_Pq_Qd();
347                    0x2: punpckldq_Pq_Qd();
348                    0x3: packsswb_Pq_Qq();
349                    0x4: pcmpgtb_Pq_Qq();
350                    0x5: pcmpgtw_Pq_Qq();
351                    0x6: pcmpgtd_Pq_Qq();
352                    0x7: packuswb_Pq_Qq();
353                }
354                // operand size (0x66)
355                0x1: decode OPCODE_OP_BOTTOM3 {
356                    0x0: punpcklbw_Vo_Wq();
357                    0x1: punpcklwd_Vo_Wq();
358                    0x2: punpckldq_Vo_Wq();
359                    0x3: packsswb_Vo_Wo();
360                    0x4: pcmpgtb_Vo_Wo();
361                    0x5: pcmpgtw_Vo_Wo();
362                    0x6: pcmpgtd_Vo_Wo();
363                    0x7: packuswb_Vo_Wo();
364                }
365                default: Inst::UD2();
366            }
367            0x0D: decode LEGACY_DECODEVAL {
368                // no prefix
369                0x0: decode OPCODE_OP_BOTTOM3 {
370                    0x0: punpckhbw_Pq_Qq();
371                    0x1: punpckhwd_Pq_Qq();
372                    0x2: punpckhdq_Pq_Qq();
373                    0x3: packssdw_Pq_Qq();
374                    0x6: movd_Pq_Ed();
375                    0x7: movq_Pq_Qq();
376                    default: Inst::UD2();
377                }
378                // repe (0xF3)
379                0x4: decode OPCODE_OP_BOTTOM3 {
380                    0x7: movdqu_Vo_Wo();
381                    default: Inst::UD2();
382                }
383                // operand size (0x66)
384                0x1: decode OPCODE_OP_BOTTOM3 {
385                    0x0: punpckhbw_Vo_Wo();
386                    0x1: punpckhwd_Vo_Wo();
387                    0x2: punpckhdq_Vo_Wo();
388                    0x3: packssdw_Vo_Wo();
389                    0x4: punpcklqdq_Vo_Wq();
390                    0x5: punpcklqdq_Vo_Wq();
391                    0x6: movd_Vo_Ed();
392                    0x7: movdqa_Vo_Wo();
393                }
394                default: Inst::UD2();
395            }
396            0x0E: decode LEGACY_DECODEVAL {
397                // no prefix
398                0x0: decode OPCODE_OP_BOTTOM3 {
399                    0x0: pshufw_Pq_Qq_Ib();
400                    0x1: group13_pshimw();
401                    0x2: group14_pshimd();
402                    0x3: group15_pshimq();
403                    0x4: pcmpeqb_Pq_Qq();
404                    0x5: pcmpeqw_Pq_Qq();
405                    0x6: pcmpeqd_Pq_Qq();
406                    0x7: emms();
407                }
408                // repe (0xF3)
409                0x4: decode OPCODE_OP_BOTTOM3 {
410                    0x0: pshufhw_Vo_Wo_Ib();
411                    default: Inst::UD2();
412                }
413                // operand size (0x66)
414                0x1: decode OPCODE_OP_BOTTOM3 {
415                    0x0: pshufd_Vo_Wo_Ib();
416                    0x1: group13_pshimw();
417                    0x2: group14_pshimd();
418                    0x3: group15_pshimq_dq();
419                    0x4: pcmpeqb_Vo_Wo();
420                    0x5: pcmpeqw_Vo_Wo();
421                    0x6: pcmpeqd_Vo_Wo();
422                    default: Inst::UD2();
423                }
424                // repne (0xF2)
425                0x8: decode OPCODE_OP_BOTTOM3 {
426                    0x0: pshuflw_Vo_Wo_Ib();
427                    default: Inst::UD2();
428                }
429                default: Inst::UD2();
430            }
431            0x0F: decode LEGACY_DECODEVAL {
432                // no prefix
433                0x0: decode OPCODE_OP_BOTTOM3 {
434                    0x0: vmread_Ed_or_Eq_Gd_or_Gq();
435                    0x1: vmwrite_Gd_or_Gq_Ed_or_Eq();
436                    0x6: mov_Ed_Pd();
437                    0x7: mov_Qq_Pq();
438                    default: Inst::UD2();
439                }
440                // repe (0xF3)
441                0x4: decode OPCODE_OP_BOTTOM3 {
442                    0x6: movq_Vo_Mq_or_Vq_Vq();
443                    0x7: movdqu_Wo_Vo();
444                    default: Inst::UD2();
445                }
446                // operand size (0x66)
447                0x1: decode OPCODE_OP_BOTTOM3 {
448                    0x4: haddpd_Vo_Wo();
449                    0x5: hsubpd_Vo_Wo();
450                    0x6: movd_Ed_Vd();
451                    0x7: movdqa_Wo_Vo();
452                    default: Inst::UD2();
453                }
454                // repne (0xF2)
455                0x8: decode OPCODE_OP_BOTTOM3 {
456                    0x4: haddps_Vo_Wo();
457                    0x5: hsubps_Vo_Wo();
458                    default: Inst::UD2();
459                }
460                default: Inst::UD2();
461            }
462            format Inst {
463                0x10: decode OPCODE_OP_BOTTOM3 {
464                    0x0: JO(Jz);
465                    0x1: JNO(Jz);
466                    0x2: JB(Jz);
467                    0x3: JNB(Jz);
468                    0x4: JZ(Jz);
469                    0x5: JNZ(Jz);
470                    0x6: JBE(Jz);
471                    0x7: JNBE(Jz);
472                }
473                0x11: decode OPCODE_OP_BOTTOM3 {
474                    0x0: JS(Jz);
475                    0x1: JNS(Jz);
476                    0x2: JP(Jz);
477                    0x3: JNP(Jz);
478                    0x4: JL(Jz);
479                    0x5: JNL(Jz);
480                    0x6: JLE(Jz);
481                    0x7: JNLE(Jz);
482                }
483                0x12: decode OPCODE_OP_BOTTOM3 {
484                    0x0: SETO(Eb);
485                    0x1: SETNO(Eb);
486                    0x2: SETB(Eb);
487                    0x3: SETNB(Eb);
488                    0x4: SETZ(Eb);
489                    0x5: SETNZ(Eb);
490                    0x6: SETBE(Eb);
491                    0x7: SETNBE(Eb);
492                }
493                0x13: decode OPCODE_OP_BOTTOM3 {
494                    0x0: SETS(Eb);
495                    0x1: SETNS(Eb);
496                    0x2: SETP(Eb);
497                    0x3: SETNP(Eb);
498                    0x4: SETL(Eb);
499                    0x5: SETNL(Eb);
500                    0x6: SETLE(Eb);
501                    0x7: SETNLE(Eb);
502                }
503            }
504            0x14: decode OPCODE_OP_BOTTOM3 {
505                0x0: push_fs();
506                0x1: pop_fs();
507                0x2: Inst::CPUID(rAd);
508                0x3: bt_Ev_Gv();
509                0x4: shld_Ev_Gv_Ib();
510                0x5: shld_Ev_Gv_rCl();
511                0x6: xbts_and_cmpxchg();
512                0x7: ibts_and_cmpxchg();
513            }
514            0x15: decode OPCODE_OP_BOTTOM3 {
515                0x0: push_gs();
516                0x1: pop_gs();
517                0x2: rsm_smm();
518                0x3: bts_Ev_Gv();
519                0x4: shrd_Ev_Gv_Ib();
520                0x5: shrd_Ev_Gv_rCl();
521                0x6: group16();
522                0x7: Inst::IMUL(Gv,Ev);
523            }
524            0x16: decode OPCODE_OP_BOTTOM3 {
525                0x0: Inst::CMPXCHG(Eb,Gb);
526                0x1: Inst::CMPXCHG(Ev,Gv);
527                0x2: lss_Gz_Mp();
528                0x3: btr_Ev_Gv();
529                0x4: lfs_Gz_Mp();
530                0x5: lgs_Gz_Mp();
531                //The size of the second operand in these instructions should
532                //really be "b" or "w", but it's set to v in order to have a
533                //consistent register size. This shouldn't affect behavior.
534                0x6: Inst::MOVZX_B(Gv,Ev);
535                0x7: Inst::MOVZX_W(Gv,Ev);
536            }
537            0x17: decode OPCODE_OP_BOTTOM3 {
538                0x0: jmpe_Jz(); // IA-64?
539                0x1: group11_UD2();
540                0x2: group8_Ev_Ib();
541                0x3: btc_Ev_Gv();
542                0x4: bsf_Gv_Ev();
543                0x5: bsr_Gv_Ev();
544                //The size of the second operand in these instructions should
545                //really be "b" or "w", but it's set to v in order to have a
546                //consistent register size. This shouldn't affect behavior.
547                0x6: Inst::MOVSX_B(Gv,Ev);
548                0x7: Inst::MOVSX_W(Gv,Ev);
549            }
550            0x18: decode OPCODE_OP_BOTTOM3 {
551                0x0: xadd_Eb_Gb();
552                0x1: xadd_Ev_Gv();
553                0x7: group9();
554                default: decode LEGACY_DECODEVAL {
555                    // no prefix
556                    0x0: decode OPCODE_OP_BOTTOM3 {
557                        0x2: cmpccps_Vo_Wo_Ib();
558                        0x3: cvtdq2ps_Vo_Wo();
559                        0x4: subps_Vo_Wo();
560                        0x5: minps_Vo_Wo();
561                        0x6: divps_Vo_Wo();
562                    }
563                    // repe (0xF3)
564                    0x4: decode OPCODE_OP_BOTTOM3 {
565                        0x2: cmpccss_Vd_Wd_Ib();
566                        default: Inst::UD2();
567                    }
568                    // operand size (0x66)
569                    0x1: decode OPCODE_OP_BOTTOM3 {
570                        0x2: cmpccpd_Vo_Wo_Ib();
571                        0x4: subpd_Vo_Wo();
572                        0x5: minpd_Vo_Wo();
573                        0x6: divpd_Vo_Wo();
574                        default: Inst::UD2();
575                    }
576                    // repne (0xF2)
577                    0x8: decode OPCODE_OP_BOTTOM3 {
578                        0x2: cmpccsd_Vq_Wq_Ib();
579                        default: Inst::UD2();
580                    }
581                    default: Inst::UD2();
582                }
583            }
584            0x19: bswap_B();
585            0x1A: decode LEGACY_DECODEVAL {
586                // no prefix
587                0x0: decode OPCODE_OP_BOTTOM3 {
588                    0x1: psrlw_Pq_Qq();
589                    0x2: psrld_Pq_Qq();
590                    0x3: psrlq_Pq_Qq();
591                    0x4: paddq_Pq_Qq();
592                    0x5: pmullw_Pq_Qq();
593                    0x7: pmovmskb_Gd_PRq();
594                    default: Inst::UD2();
595                }
596                // repe (0xF3)
597                0x4: decode OPCODE_OP_BOTTOM3 {
598                    0x6: movq2dq_Vo_PRq();
599                    default: Inst::UD2();
600                }
601                // operand size (0x66)
602                0x1: decode OPCODE_OP_BOTTOM3 {
603                    0x0: addsubpd_Vo_Wo();
604                    0x1: psrlw_Vo_Wo();
605                    0x2: psrld_Vo_Wo();
606                    0x3: psrlq_Vo_Wo();
607                    0x4: paddq_Vo_Wo();
608                    0x5: pmullw_Vo_Wo();
609                    0x6: decode MODRM_MOD {
610                        0x3: movq_Vq_Vq();
611                        default: movq_Mq_Vq();
612                    }
613                    0x7: pmovmskb_Gd_VRo();
614                }
615                // repne (0xF2)
616                0x8: decode OPCODE_OP_BOTTOM3 {
617                    0x0: addsubps_Vo_Wo();
618                    0x6: movdq2q_Pq_VRq();
619                    default: Inst::UD2();
620                }
621                default: Inst::UD2();
622            }
623            0x1B: decode LEGACY_DECODEVAL {
624                // no prefix
625                0x0: decode OPCODE_OP_BOTTOM3 {
626                    0x0: psubusb_Pq_Qq();
627                    0x1: psubusw_Pq_Qq();
628                    0x2: pminub_Pq_Qq();
629                    0x3: pand_Pq_Qq();
630                    0x4: paddusb_Pq_Qq();
631                    0x5: paddusw_Pq_Qq();
632                    0x6: pmaxub_Pq_Qq();
633                    0x7: pandn_Pq_Qq();
634                }
635                // operand size (0x66)
636                0x1: decode OPCODE_OP_BOTTOM3 {
637                    0x0: psubusb_Vo_Wo();
638                    0x1: psubusw_Vo_Wo();
639                    0x2: pminub_Vo_Wo();
640                    0x3: pand_Vo_Wo();
641                    0x4: paddusb_Vo_Wo();
642                    0x5: paddusw_Vo_Wo();
643                    0x6: pmaxub_Vo_Wo();
644                    0x7: pandn_Vo_Wo();
645                }
646                default: Inst::UD2();
647            }
648            0x1C: decode LEGACY_DECODEVAL {
649                // no prefix
650                0x0: decode OPCODE_OP_BOTTOM3 {
651                    0x0: pavgb_Pq_Qq();
652                    0x1: psraw_Pq_Qq();
653                    0x2: psrad_Pq_Qq();
654                    0x3: pavgw_Pq_Qq();
655                    0x4: pmulhuw_Pq_Qq();
656                    0x5: pmulhw_Pq_Qq();
657                    0x7: movntq_Mq_Pq();
658                    default: Inst::UD2();
659                }
660                // repe (0xF3)
661                0x4: decode OPCODE_OP_BOTTOM3 {
662                    0x6: cvtdq2pd_Vo_Wq();
663                    default: Inst::UD2();
664                }
665                // operand size (0x66)
666                0x1: decode OPCODE_OP_BOTTOM3 {
667                    0x0: pavgb_Vo_Wo();
668                    0x1: psraw_Vo_Wo();
669                    0x2: psrad_Vo_Wo();
670                    0x3: pavgw_Vo_Wo();
671                    0x4: pmulhuw_Vo_Wo();
672                    0x5: pmulhw_Vo_Wo();
673                    0x6: cvttpd2dq_Vo_Wo();
674                    0x7: movntdq_Mo_Vo();
675                }
676                // repne (0xF2)
677                0x8: decode OPCODE_OP_BOTTOM3 {
678                    0x6: cvtpd2dq_Vo_Wo();
679                    default: Inst::UD2();
680                }
681                default: Inst::UD2();
682            }
683            0x1D: decode LEGACY_DECODEVAL {
684                // no prefix
685                0x0: decode OPCODE_OP_BOTTOM3 {
686                    0x0: psubsb_Pq_Qq();
687                    0x1: psubsw_Pq_Qq();
688                    0x2: pminsw_Pq_Qq();
689                    0x3: por_Pq_Qq();
690                    0x4: paddsb_Pq_Qq();
691                    0x5: paddsw_Pq_Qq();
692                    0x6: pmaxsw_Pq_Qq();
693                    0x7: pxor_Pq_Qq();
694                }
695                // operand size (0x66)
696                0x1: decode OPCODE_OP_BOTTOM3 {
697                    0x0: psubsb_Vo_Wo();
698                    0x1: psubsw_Vo_Wo();
699                    0x2: pminsw_Vo_Wo();
700                    0x3: por_Vo_Wo();
701                    0x4: paddsb_Vo_Wo();
702                    0x5: paddsw_Vo_Wo();
703                    0x6: pmaxsw_Vo_Wo();
704                    0x7: pxor_Vo_Wo();
705                }
706                default: Inst::UD2();
707            }
708            0x1E: decode OPCODE_OP_BOTTOM3 {
709                // no prefix
710                0x0: decode OPCODE_OP_BOTTOM3 {
711                    0x1: psllw_Pq_Qq();
712                    0x2: pslld_Pq_Qq();
713                    0x3: psllq_Pq_Qq();
714                    0x4: pmuludq_Pq_Qq();
715                    0x5: pmaddwd_Pq_Qq();
716                    0x6: psadbw_Pq_Qq();
717                    0x7: maskmovq_Pq_PRq();
718                    default: Inst::UD2();
719                }
720                // operand size (0x66)
721                0x1: decode OPCODE_OP_BOTTOM3 {
722                    0x1: psllw_Vo_Wo();
723                    0x2: pslld_Vo_Wo();
724                    0x3: psllq_Vo_Wo();
725                    0x4: pmuludq_Vo_Wo();
726                    0x5: pmaddwd_Vo_Wo();
727                    0x6: psadbw_Vo_Wo();
728                    0x7: maskmovdqu_Vo_VRo();
729                    default: Inst::UD2();
730                }
731                // repne (0xF2)
732                0x8: decode OPCODE_OP_BOTTOM3 {
733                    0x0: lddqu_Vo_Mo();
734                    default: Inst::UD2();
735                }
736                default: Inst::UD2();
737            }
738            0x1F: decode LEGACY_DECODEVAL {
739                // no prefix
740                0x0: decode OPCODE_OP_BOTTOM3 {
741                    0x0: psubb_Pq_Qq();
742                    0x1: psubw_Pq_Qq();
743                    0x2: psubd_Pq_Qq();
744                    0x3: psubq_Pq_Qq();
745                    0x4: paddb_Pq_Qq();
746                    0x5: paddw_Pq_Qq();
747                    0x6: paddd_Pq_Qq();
748                    0x7: Inst::UD2();
749                }
750                // operand size (0x66)
751                0x1: decode OPCODE_OP_BOTTOM3 {
752                    0x0: psubb_Vo_Wo();
753                    0x1: psubw_Vo_Wo();
754                    0x2: psubd_Vo_Wo();
755                    0x3: psubq_Vo_Wo();
756                    0x4: paddb_Vo_Wo();
757                    0x5: paddw_Vo_Wo();
758                    0x6: paddd_Vo_Wo();
759                    0x7: Inst::UD2();
760                }
761                default: Inst::UD2();
762            }
763            default: FailUnimpl::twoByteOps();
764        }
765    }
766    default: M5InternalError::error(
767        {{"Unexpected first opcode byte in two byte opcode!"}});
768}
769