two_byte_opcodes.isa revision 5238:95f494fd38bd
12068SN/A// Copyright (c) 2007 The Hewlett-Packard Development Company
22068SN/A// All rights reserved.
32068SN/A//
42068SN/A// Redistribution and use of this software in source and binary forms,
52068SN/A// with or without modification, are permitted provided that the
62068SN/A// following conditions are met:
72068SN/A//
82068SN/A// The software must be used only for Non-Commercial Use which means any
92068SN/A// use which is NOT directed to receiving any direct monetary
102068SN/A// compensation for, or commercial advantage from such use.  Illustrative
112068SN/A// examples of non-commercial use are academic research, personal study,
122068SN/A// teaching, education and corporate research & development.
132068SN/A// Illustrative examples of commercial use are distributing products for
142068SN/A// commercial advantage and providing services using the software for
152068SN/A// commercial advantage.
162068SN/A//
172068SN/A// If you wish to use this software or functionality therein that may be
182068SN/A// covered by patents for commercial use, please contact:
192068SN/A//     Director of Intellectual Property Licensing
202068SN/A//     Office of Strategy and Technology
212068SN/A//     Hewlett-Packard Company
222068SN/A//     1501 Page Mill Road
232068SN/A//     Palo Alto, California  94304
242068SN/A//
252068SN/A// Redistributions of source code must retain the above copyright notice,
262068SN/A// this list of conditions and the following disclaimer.  Redistributions
272068SN/A// in binary form must reproduce the above copyright notice, this list of
282665Ssaidi@eecs.umich.edu// conditions and the following disclaimer in the documentation and/or
292665Ssaidi@eecs.umich.edu// other materials provided with the distribution.  Neither the name of
302665Ssaidi@eecs.umich.edu// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
312068SN/A// contributors may be used to endorse or promote products derived from
322649Ssaidi@eecs.umich.edu// this software without specific prior written permission.  No right of
332649Ssaidi@eecs.umich.edu// sublicense is granted herewith.  Derivatives of the software and
342649Ssaidi@eecs.umich.edu// output created using the software may be prepared, but only for
352649Ssaidi@eecs.umich.edu// Non-Commercial Uses.  Derivatives of the software may be shared with
362649Ssaidi@eecs.umich.edu// others provided: (i) the others agree to abide by the list of
372068SN/A// conditions herein which includes the Non-Commercial Use restrictions;
382068SN/A// and (ii) such Derivatives of the software include the above copyright
392068SN/A// notice to acknowledge the contribution from this software where
402068SN/A// applicable, this list of conditions and the disclaimer below.
412068SN/A//
422068SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
432068SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
442068SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
452068SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
462068SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
472068SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
482107SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
492068SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
502107SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
512068SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
522068SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
532227SN/A//
542107SN/A// Authors: Gabe Black
552107SN/A
562068SN/A////////////////////////////////////////////////////////////////////
572068SN/A//
582068SN/A// Decode the two byte opcodes
592068SN/A//
602068SN/A0x2: decode OPCODE_PREFIXA {
612068SN/A    0x0F: decode OPCODE_OP_TOP5 {
622068SN/A        format WarnUnimpl {
632068SN/A            0x00: decode OPCODE_OP_BOTTOM3 {
642068SN/A                //0x00: group6();
652068SN/A                0x00: decode MODRM_REG {
662107SN/A                    0x0: sldt_Mw_or_Rv();
672107SN/A                    0x1: str_Mw_or_Rv();
682068SN/A                    0x2: lldt_Mw_or_Rv();
692068SN/A                    0x3: ltr_Mw_or_Rv();
702068SN/A                    0x4: verr_Mw_or_Rv();
712068SN/A                    0x5: verw_Mw_or_Rv();
722068SN/A                    //0x6: jmpe_Ev(); // IA-64
732068SN/A                    default: Inst::UD2();
742068SN/A                }
752068SN/A                //0x01: group7(); // Ugly, ugly, ugly...
762068SN/A                0x01: decode MODRM_MOD {
772068SN/A                    0x3: decode MODRM_REG {
782068SN/A                        0x0: decode MODRM_RM {
792068SN/A                            0x1: vmcall();
802068SN/A                            0x2: vmlaunch();
812227SN/A                            0x3: vmresume();
822107SN/A                            0x4: vmxoff();
832107SN/A                            default: Inst::UD2();
842068SN/A                        }
852068SN/A                        0x1: decode MODRM_RM {
862068SN/A                            0x0: monitor();
872068SN/A                            0x1: mwait();
882068SN/A                            default: Inst::UD2();
892068SN/A                        }
902068SN/A                        0x3: decode MODRM_RM {
912068SN/A                            0x0: vmrun();
922068SN/A                            0x1: vmmcall();
932068SN/A                            0x2: vmload();
942068SN/A                            0x3: vmsave();
952068SN/A                            0x4: stgi();
962068SN/A                            0x5: clgi();
972068SN/A                            0x6: skinit();
982068SN/A                            0x7: invlpga();
992068SN/A                        }
1002227SN/A                        0x4: smsw_Rv();
1012107SN/A                        0x6: lmsw_Rv();
1022107SN/A                        0x7: decode MODRM_RM {
1032068SN/A                            0x0: swapgs();
1042068SN/A                            0x1: rdtscp();
1052068SN/A                            default: Inst::UD2();
1062068SN/A                        }
1072068SN/A                        default: Inst::UD2();
1082068SN/A                    }
1092068SN/A                    default: decode MODRM_REG {
1102068SN/A                        0x0: sgdt_Ms();
1112068SN/A                        0x1: sidt_Ms();
1122068SN/A                        0x2: lgdt_Ms();
1132068SN/A                        0x3: lidt_Ms();
1142068SN/A                        0x4: smsw_Mw();
1152068SN/A                        0x6: lmsw_Mw();
1162068SN/A                        0x7: invlpg_M();
1172068SN/A                        default: Inst::UD2();
1182068SN/A                    }
1192068SN/A                }
1202068SN/A                0x02: lar_Gv_Ew();
1212068SN/A                0x03: lsl_Gv_Ew();
1222068SN/A                //sandpile.org doesn't seem to know what this is... ?
1232068SN/A                0x04: loadall_or_reset_or_hang();
1242068SN/A#if FULL_SYSTEM
1252068SN/A                0x05: syscall();
1262068SN/A#else
1272068SN/A                0x05: SyscallInst::syscall('xc->syscall(rax)', IsSyscall);
1282068SN/A#endif
1293953Sstever@eecs.umich.edu                0x06: clts();
1302068SN/A                //sandpile.org says (AMD) after sysret, so I might want to check
1312068SN/A                //if that means amd64 or AMD machines
1322068SN/A                0x07: loadall_or_sysret();
1332068SN/A            }
1342068SN/A            0x01: decode OPCODE_OP_BOTTOM3 {
1352068SN/A                0x0: invd();
1362068SN/A                0x1: wbinvd();
1372068SN/A                0x2: Inst::UD2();
1382068SN/A                0x3: Inst::UD2();
1392068SN/A                0x4: Inst::UD2();
1402068SN/A                0x5: threednow();
1412068SN/A                0x6: threednow();
1422068SN/A                0x7: threednow();
1432068SN/A            }
1442068SN/A            0x02: decode LEGACY_DECODEVAL {
1452068SN/A                // no prefix
1462068SN/A                0x0: decode OPCODE_OP_BOTTOM3 {
1472068SN/A                    0x0: movups_Vo_Wo();
1482068SN/A                    0x1: movups_Wo_Vo();
1492068SN/A                    0x2: decode MODRM_MOD {
1502068SN/A                        0x3: movhlps_Vq_VRq();
1512068SN/A                        default: movlps_Vq_Mq();
1522227SN/A                    }
1532068SN/A                    0x3: movlps_Mq_Vq();
1542068SN/A                    0x4: unpcklps();
1552068SN/A                    0x5: unpckhps();
1562068SN/A                    0x6: decode MODRM_MOD {
1572068SN/A                        0x3: movlhps_Vq_VRq();
1582068SN/A                        default: movhps_Vq_Mq();
1592068SN/A                    }
1602068SN/A                    0x7: movhps_Mq_Vq();
1612068SN/A                }
1622068SN/A                // repe (0xF3)
1632068SN/A                0x4: decode OPCODE_OP_BOTTOM3 {
1642227SN/A                    0x0: movss_Vd_Wd();
1652068SN/A                    0x1: movss_Wd_Vd();
1662068SN/A                    0x2: movsldup_Vo_Wo();
1672068SN/A                    0x6: movshdup_Vo_Wo();
1682068SN/A                    default: Inst::UD2();
1692068SN/A                }
1702068SN/A                // operand size (0x66)
1712068SN/A                0x1: decode OPCODE_OP_BOTTOM3 {
1722227SN/A                    0x0: movupd_Vo_Wo();
1732068SN/A                    0x1: movupd_Wo_Vo();
1742068SN/A                    0x2: Inst::MOVLPD(Vq,Mq);
1752095SN/A                    0x3: Inst::MOVLPD(Mq,Vq);
1762095SN/A                    0x4: unpcklpd_Vo_Wq();
1772095SN/A                    0x5: unpckhpd_Vo_Wo();
1782095SN/A                    0x6: movhpd_Vq_Mq();
1792068SN/A                    0x7: movhpd_Mq_Vq();
1802068SN/A                }
1812068SN/A                // repne (0xF2)
1822095SN/A                0x8: decode OPCODE_OP_BOTTOM3 {
1832095SN/A                    0x0: Inst::MOVSD(Vq,Wq);
1842132SN/A                    0x1: Inst::MOVSD(Wq,Vq);
1852095SN/A                    0x2: movddup_Vo_Wq();
1862095SN/A                    default: Inst::UD2();
1872095SN/A                }
1882095SN/A                default: Inst::UD2();
1893349Sbinkertn@umich.edu            }
1902623SN/A            0x03: decode OPCODE_OP_BOTTOM3 {
1912095SN/A                0x0: group17();
1922095SN/A                0x1: group17();
1932095SN/A                0x2: group17();
1943953Sstever@eecs.umich.edu                0x3: group17();
1952068SN/A                0x4: group17();
1962068SN/A                0x5: group17();
1972068SN/A                0x6: group17();
1982227SN/A                0x7: group17();
1992068SN/A            }
2002068SN/A            0x04: decode LEGACY_DECODEVAL {
2013953Sstever@eecs.umich.edu                // no prefix
2022068SN/A                0x0: decode OPCODE_OP_BOTTOM3 {
2033953Sstever@eecs.umich.edu                    0x0: mov_Rd_Cd();
2042068SN/A                    0x1: mov_Rd_Dd();
2053953Sstever@eecs.umich.edu                    0x2: mov_Cd_Rd();
2063953Sstever@eecs.umich.edu                    0x3: mov_Dd_Rd();
2072227SN/A                    0x4: mov_Rd_Td();
2082068SN/A                    0x6: mov_Td_Rd();
2092068SN/A                    default: Inst::UD2();
2103953Sstever@eecs.umich.edu                }
2112068SN/A                // lock prefix (0xF0)
2123953Sstever@eecs.umich.edu                0x2: decode OPCODE_OP_BOTTOM3 {
2132068SN/A                    0x0: mov_Rd_CR8D();
2143953Sstever@eecs.umich.edu                    0x2: mov_CR8D_Rd();
2153953Sstever@eecs.umich.edu                }
2162227SN/A                default: Inst::UD2();
2172068SN/A            }
2182068SN/A            0x05: decode LEGACY_DECODEVAL {
2192068SN/A                // no prefix
2202068SN/A                0x0: decode OPCODE_OP_BOTTOM3 {
2212068SN/A                    //These moves should really use size o (octword), but
2222068SN/A                    //because they are split in two, they use q (quadword).
2232068SN/A                    0x0: Inst::MOVAPS(Vq,Wq);
2242068SN/A                    0x1: Inst::MOVAPS(Wq,Vq);
2252068SN/A                    0x2: decode MODRM_MOD {
2262132SN/A                        0x3: cvtpi2pS_Vq_Pq();
2272068SN/A                        default: cvtpi2ps_Vq_Mq();
2282068SN/A                    }
2292068SN/A                    0x3: movntps_Mo_Vo();
2302068SN/A                    0x4: cvttps2pi_Pq_Wq();
2312132SN/A                    0x5: cvtpS2pi_Pq_Wq();
2322068SN/A                    0x6: ucomiss_Vd_Wd();
2332068SN/A                    0x7: comiss_Vd_Wd();
2342068SN/A                }
2352068SN/A                // repe (0xF3)
2363953Sstever@eecs.umich.edu                0x4: decode OPCODE_OP_BOTTOM3 {
2372068SN/A                    0x2: cvtsi2ss_Vd_Ed();
2382090SN/A                    0x4: cvttss2si_Gd_Wd();
2392068SN/A                    0x5: cvtss2si_Gd_Wd();
2402068SN/A                    default: Inst::UD2();
2412068SN/A                }
2422068SN/A                // operand size (0x66)
2432068SN/A                0x1: decode OPCODE_OP_BOTTOM3 {
2442068SN/A                    0x0: movapd_Vo_Wo();
2452068SN/A                    0x1: movapd_Wo_Vo();
2462068SN/A                    0x2: decode MODRM_MOD {
2472069SN/A                        0x3: cvtpi2pd_Vo_Pq();
2482132SN/A                        default: cvtpi2pd_Vo_Mq();
2492068SN/A                    }
2502068SN/A                    0x3: movntpd_Mo_Vo();
2512068SN/A                    0x4: cvttpd2pi_Pq_Wo();
2522068SN/A                    0x5: cvtpd2pi_Pq_Wo();
2532132SN/A                    0x6: Inst::UCOMISD(Vq,Wq);
2542068SN/A                    0x7: comisd_Vq_Wq();
2552068SN/A                }
2562068SN/A                // repne (0xF2)
2572069SN/A                0x8: decode OPCODE_OP_BOTTOM3 {
2582068SN/A                    // The size of the V operand should be q, not dp
2592068SN/A                    0x2: Inst::CVTSI2SD(Vdp,Edp);
2602090SN/A                    // The size of the W operand should be q, not dp
2612069SN/A                    0x4: Inst::CVTTSD2SI(Gdp,Wdp);
2623953Sstever@eecs.umich.edu                    0x5: cvtsd2si_Gd_Wq();
2632068SN/A                    default: Inst::UD2();
2642068SN/A                }
2652090SN/A                default: Inst::UD2();
2662069SN/A            }
2672068SN/A            0x06: decode OPCODE_OP_BOTTOM3 {
2682068SN/A                0x0: Inst::WRMSR();
2692068SN/A                0x1: rdtsc();
2702068SN/A                0x2: Inst::RDMSR();
2712068SN/A                0x3: rdpmc();
2722068SN/A                0x4: sysenter();
2732068SN/A                0x5: sysexit();
2742069SN/A                0x6: Inst::UD2();
2752132SN/A                0x7: getsec();
2762068SN/A            }
2772068SN/A            0x07: decode OPCODE_OP_BOTTOM3 {
2782068SN/A                0x0: three_byte_opcode();
2792132SN/A                0x1: three_byte_opcode();
2802068SN/A                0x2: three_byte_opcode();
2812068SN/A                0x3: three_byte_opcode();
2822068SN/A                0x4: three_byte_opcode();
2832069SN/A                0x5: three_byte_opcode();
2842068SN/A                0x6: three_byte_opcode();
2852068SN/A                0x7: three_byte_opcode();
2862090SN/A            }
2872069SN/A            format Inst {
2882068SN/A                0x08: decode OPCODE_OP_BOTTOM3 {
2892068SN/A                    0x0: CMOVO(Gv,Ev);
2902068SN/A                    0x1: CMOVNO(Gv,Ev);
2912090SN/A                    0x2: CMOVB(Gv,Ev);
2922069SN/A                    0x3: CMOVNB(Gv,Ev);
2932069SN/A                    0x4: CMOVZ(Gv,Ev);
2942069SN/A                    0x5: CMOVNZ(Gv,Ev);
2952069SN/A                    0x6: CMOVBE(Gv,Ev);
2962069SN/A                    0x7: CMOVNBE(Gv,Ev);
2972069SN/A                }
2982069SN/A                0x09: decode OPCODE_OP_BOTTOM3 {
2992069SN/A                    0x0: CMOVS(Gv,Ev);
3002095SN/A                    0x1: CMOVNS(Gv,Ev);
3012132SN/A                    0x2: CMOVP(Gv,Ev);
3022095SN/A                    0x3: CMOVNP(Gv,Ev);
3032095SN/A                    0x4: CMOVL(Gv,Ev);
3042095SN/A                    0x5: CMOVNL(Gv,Ev);
3052132SN/A                    0x6: CMOVLE(Gv,Ev);
3062095SN/A                    0x7: CMOVNLE(Gv,Ev);
3072095SN/A                }
3082095SN/A            }
3092095SN/A            0x0A: decode LEGACY_DECODEVAL {
3102095SN/A                // no prefix
3112095SN/A                0x0: decode OPCODE_OP_BOTTOM3 {
3122098SN/A                    0x0: movmskps_Gd_VRo();
3132095SN/A                    0x1: sqrtps_Vo_Wo();
3142095SN/A                    0x2: rqsrtps_Vo_Wo();
3152095SN/A                    0x3: rcpps_Vo_Wo();
3162095SN/A                    0x4: andps_Vo_Wo();
3172095SN/A                    0x5: andnps_Vo_Wo();
3182095SN/A                    0x6: orps_Vo_Wo();
3192095SN/A                    0x7: xorps_Vo_Wo();
3202095SN/A                }
3212095SN/A                // repe (0xF3)
3223349Sbinkertn@umich.edu                0x4: decode OPCODE_OP_BOTTOM3 {
3232095SN/A                    0x1: sqrtss_Vd_Wd();
3242095SN/A                    0x2: rsqrtss_Vd_Wd();
3252095SN/A                    0x3: rcpss_Vd_Wd();
3262132SN/A                    default: Inst::UD2();
3272095SN/A                }
3282095SN/A                // operand size (0x66)
3292506SN/A                0x1: decode OPCODE_OP_BOTTOM3 {
3302095SN/A                    0x0: movmskpd_Gd_VRo();
3312623SN/A                    0x1: sqrtpd_Vo_Wo();
3322095SN/A                    0x4: andpd_Vo_Wo();
3332098SN/A                    0x5: andnpd_Vo_Wo();
3342095SN/A                    0x6: orpd_Vo_Wo();
3352095SN/A                    //This really should be type o, but it works on q sized
3362095SN/A                    //chunks at a time.
3372098SN/A                    0x7: Inst::XORPD(Vq,Wq);
3382095SN/A                    default: Inst::UD2();
3392095SN/A                }
3402095SN/A                format Inst {
3412095SN/A                    // repne (0xF2)
3422095SN/A                    0x8: decode OPCODE_OP_BOTTOM3 {
3432095SN/A                        0x1: SQRTSD(Vq,Wq);
3442095SN/A                        default: UD2();
3452095SN/A                    }
3462069SN/A                    default: UD2();
3472132SN/A                }
3482069SN/A            }
3492069SN/A            0x0B: decode LEGACY_DECODEVAL {
3502069SN/A                // no prefix
3512069SN/A                0x0: decode OPCODE_OP_BOTTOM3 {
3522132SN/A                    0x0: addps_Vo_Wo();
3534027Sstever@eecs.umich.edu                    0x1: mulps_Vo_Wo();
3544027Sstever@eecs.umich.edu                    0x2: cvtps2pd_Vo_Wq();
3554027Sstever@eecs.umich.edu                    0x3: cvtdq2ps_Vo_Wo();
3564027Sstever@eecs.umich.edu                    0x4: subps_Vo_Wo();
3574027Sstever@eecs.umich.edu                    0x5: minps_Vo_Wo();
3584027Sstever@eecs.umich.edu                    0x6: divps_Vo_Wo();
3594027Sstever@eecs.umich.edu                    0x7: maxps_Vo_Wo();
3604027Sstever@eecs.umich.edu                }
3614027Sstever@eecs.umich.edu                // repe (0xF3)
3624027Sstever@eecs.umich.edu                0x4: decode OPCODE_OP_BOTTOM3 {
3634027Sstever@eecs.umich.edu                    0x0: addss_Vd_Wd();
3644027Sstever@eecs.umich.edu                    0x1: mulss_Vd_Wd();
3654027Sstever@eecs.umich.edu                    0x2: cvtss2sd_Vq_Wd();
3664027Sstever@eecs.umich.edu                    0x3: cvttps2dq_Vo_Wo();
3674027Sstever@eecs.umich.edu                    0x4: subss_Vd_Wd();
3684027Sstever@eecs.umich.edu                    0x5: minss_Vd_Wd();
3694027Sstever@eecs.umich.edu                    0x6: divss_Vd_Wd();
3704027Sstever@eecs.umich.edu                    0x7: maxss_Vd_Wd();
3714027Sstever@eecs.umich.edu                }
3724027Sstever@eecs.umich.edu                // operand size (0x66)
3734027Sstever@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
3744027Sstever@eecs.umich.edu                    0x0: addpd_Vo_Wo();
3754027Sstever@eecs.umich.edu                    0x1: mulpd_Vo_Wo();
3764027Sstever@eecs.umich.edu                    0x2: cvtpd2ps_Vo_Wo();
3774027Sstever@eecs.umich.edu                    0x3: cvtps2dq_Vo_Wo();
3784027Sstever@eecs.umich.edu                    0x4: subpd_Vo_Wo();
3794027Sstever@eecs.umich.edu                    0x5: minpd_Vo_Wo();
3804027Sstever@eecs.umich.edu                    0x6: divpd_Vo_Wo();
3814027Sstever@eecs.umich.edu                    0x7: maxpd_Vo_Wo();
3824027Sstever@eecs.umich.edu                }
3834027Sstever@eecs.umich.edu                // repne (0xF2)
3844027Sstever@eecs.umich.edu                0x8: decode OPCODE_OP_BOTTOM3 {
3854027Sstever@eecs.umich.edu                    0x0: Inst::ADDSD(Vq,Wq);
3864027Sstever@eecs.umich.edu                    0x1: Inst::MULSD(Vq,Wq);
3874027Sstever@eecs.umich.edu                    0x2: cvtsd2ss_Vd_Wq();
3882069SN/A                    0x4: Inst::SUBSD(Vq,Wq);
3892069SN/A                    0x5: minsd_Vq_Wq();
3902069SN/A                    0x6: Inst::DIVSD(Vq,Wq);
3912069SN/A                    0x7: maxsd_Vq_Wq();
3922069SN/A                    default: Inst::UD2();
3932069SN/A                }
3942069SN/A                default: Inst::UD2();
3952090SN/A            }
3963953Sstever@eecs.umich.edu            0x0C: decode LEGACY_DECODEVAL {
3972069SN/A                // no prefix
3982069SN/A                0x0: decode OPCODE_OP_BOTTOM3 {
3992090SN/A                    0x0: punpcklbw_Pq_Qd();
4002069SN/A                    0x1: punpcklwd_Pq_Qd();
4012069SN/A                    0x2: punpckldq_Pq_Qd();
4022069SN/A                    0x3: packsswb_Pq_Qq();
4032068SN/A                    0x4: pcmpgtb_Pq_Qq();
4042068SN/A                    0x5: pcmpgtw_Pq_Qq();
4052090SN/A                    0x6: pcmpgtd_Pq_Qq();
4062068SN/A                    0x7: packuswb_Pq_Qq();
4072068SN/A                }
4082068SN/A                // operand size (0x66)
4092090SN/A                0x1: decode OPCODE_OP_BOTTOM3 {
4102069SN/A                    0x0: punpcklbw_Vo_Wq();
4112068SN/A                    0x1: punpcklwd_Vo_Wq();
4122068SN/A                    0x2: punpckldq_Vo_Wq();
4132068SN/A                    0x3: packsswb_Vo_Wo();
4142068SN/A                    0x4: pcmpgtb_Vo_Wo();
4152068SN/A                    0x5: pcmpgtw_Vo_Wo();
4162068SN/A                    0x6: pcmpgtd_Vo_Wo();
4172068SN/A                    0x7: packuswb_Vo_Wo();
4182069SN/A                }
4192132SN/A                default: Inst::UD2();
4202069SN/A            }
4212069SN/A            0x0D: decode LEGACY_DECODEVAL {
4222069SN/A                // no prefix
4232132SN/A                0x0: decode OPCODE_OP_BOTTOM3 {
4244027Sstever@eecs.umich.edu                    0x0: punpckhbw_Pq_Qq();
4254027Sstever@eecs.umich.edu                    0x1: punpckhwd_Pq_Qq();
4264027Sstever@eecs.umich.edu                    0x2: punpckhdq_Pq_Qq();
4274027Sstever@eecs.umich.edu                    0x3: packssdw_Pq_Qq();
4284027Sstever@eecs.umich.edu                    0x6: movd_Pq_Ed();
4294027Sstever@eecs.umich.edu                    0x7: movq_Pq_Qq();
4304027Sstever@eecs.umich.edu                    default: Inst::UD2();
4314027Sstever@eecs.umich.edu                }
4324027Sstever@eecs.umich.edu                // repe (0xF3)
4334027Sstever@eecs.umich.edu                0x4: decode OPCODE_OP_BOTTOM3 {
4344027Sstever@eecs.umich.edu                    0x7: movdqu_Vo_Wo();
4354027Sstever@eecs.umich.edu                    default: Inst::UD2();
4364027Sstever@eecs.umich.edu                }
4374027Sstever@eecs.umich.edu                // operand size (0x66)
4384027Sstever@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
4394027Sstever@eecs.umich.edu                    0x0: punpckhbw_Vo_Wo();
4404027Sstever@eecs.umich.edu                    0x1: punpckhwd_Vo_Wo();
4414027Sstever@eecs.umich.edu                    0x2: punpckhdq_Vo_Wo();
4424027Sstever@eecs.umich.edu                    0x3: packssdw_Vo_Wo();
4434027Sstever@eecs.umich.edu                    0x4: punpcklqdq_Vo_Wq();
4444027Sstever@eecs.umich.edu                    0x5: punpcklqdq_Vo_Wq();
4454027Sstever@eecs.umich.edu                    0x6: movd_Vo_Ed();
4464027Sstever@eecs.umich.edu                    0x7: movdqa_Vo_Wo();
4474027Sstever@eecs.umich.edu                }
4484027Sstever@eecs.umich.edu                default: Inst::UD2();
4494027Sstever@eecs.umich.edu            }
4504027Sstever@eecs.umich.edu            0x0E: decode LEGACY_DECODEVAL {
4514027Sstever@eecs.umich.edu                // no prefix
4524027Sstever@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
4534027Sstever@eecs.umich.edu                    0x0: pshufw_Pq_Qq_Ib();
4544027Sstever@eecs.umich.edu                    //0x1: group13_pshimw();
4554027Sstever@eecs.umich.edu                    0x1: decode MODRM_REG {
4564027Sstever@eecs.umich.edu                        0x2: decode LEGACY_OP {
4574027Sstever@eecs.umich.edu                            0x0: psrlw_PRq_Ib();
4582069SN/A                            0x1: psrlw_VRo_Ib();
4592069SN/A                        }
4602069SN/A                        0x4: decode LEGACY_OP {
4612069SN/A                            0x0: psraw_PRq_Ib();
4622069SN/A                            0x1: psraw_VRo_Ib();
4632069SN/A                        }
4642069SN/A                        0x6: decode LEGACY_OP {
4652090SN/A                            0x0: psllw_PRq_Ib();
4662069SN/A                            0x1: psllw_VRo_Ib();
4672069SN/A                        }
4682069SN/A                        default: Inst::UD2();
4692090SN/A                    }
4702069SN/A                    //0x2: group14_pshimd();
4712069SN/A                    0x2: decode MODRM_REG {
4722069SN/A                        0x2: decode LEGACY_OP {
4732069SN/A                            0x0: psrld_PRq_Ib();
4742069SN/A                            0x1: psrld_VRo_Ib();
4752090SN/A                        }
4762069SN/A                        0x4: decode LEGACY_OP {
4772069SN/A                            0x0: psrad_PRq_Ib();
4782069SN/A                            0x1: psrad_VRo_Ib();
4792090SN/A                        }
4802069SN/A                        0x6: decode LEGACY_OP {
4812069SN/A                            0x0: pslld_PRq_Ib();
4822069SN/A                            0x1: pslld_VRo_Ib();
4832069SN/A                        }
4842069SN/A                        default: Inst::UD2();
4852069SN/A                    }
4862069SN/A                    //0x3: group15_pshimq();
4872095SN/A                    0x3: decode MODRM_REG {
4882132SN/A                        0x2: decode LEGACY_OP {
4892095SN/A                            0x0: psrlq_PRq_Ib();
4902095SN/A                            0x1: psrlq_VRo_Ib();
4912095SN/A                        }
4922132SN/A                        0x3: decode LEGACY_OP {
4932095SN/A                            0x0: Inst::UD2();
4942095SN/A                            0x1: psrldq_VRo_Ib();
4952506SN/A                        }
4962095SN/A                        0x6: decode LEGACY_OP {
4972095SN/A                            0x0: psllq_PRq_Ib();
4982095SN/A                            0x1: psllq_VRo_Ib();
4992098SN/A                        }
5002095SN/A                        0x7: decode LEGACY_OP {
5012095SN/A                            0x0: Inst::UD2();
5022095SN/A                            0x1: pslldq_VRo_Ib();
5032098SN/A                        }
5042095SN/A                        default: Inst::UD2();
5052623SN/A                    }
5062095SN/A                    0x4: pcmpeqb_Pq_Qq();
5072095SN/A                    0x5: pcmpeqw_Pq_Qq();
5082095SN/A                    0x6: pcmpeqd_Pq_Qq();
5092095SN/A                    0x7: emms();
5102095SN/A                }
5112095SN/A                // repe (0xF3)
5122095SN/A                0x4: decode OPCODE_OP_BOTTOM3 {
5132095SN/A                    0x0: pshufhw_Vo_Wo_Ib();
5142095SN/A                    default: Inst::UD2();
5153349Sbinkertn@umich.edu                }
5162095SN/A                // operand size (0x66)
5172095SN/A                0x1: decode OPCODE_OP_BOTTOM3 {
5182095SN/A                    0x0: pshufd_Vo_Wo_Ib();
5192132SN/A                    //0x1: group13_pshimw();
5202095SN/A                    0x1: decode MODRM_REG {
5212095SN/A                        0x2: decode LEGACY_OP {
5222095SN/A                            0x0: psrlw_PRq_Ib();
5232095SN/A                            0x1: psrlw_VRo_Ib();
5242623SN/A                        }
5252623SN/A                        0x4: decode LEGACY_OP {
5262623SN/A                            0x0: psraw_PRq_Ib();
5272623SN/A                            0x1: psraw_VRo_Ib();
5282623SN/A                        }
5292623SN/A                        0x6: decode LEGACY_OP {
5302623SN/A                            0x0: psllw_PRq_Ib();
5312623SN/A                            0x1: psllw_VRo_Ib();
5322623SN/A                        }
5332623SN/A                        default: Inst::UD2();
5342623SN/A                    }
5352623SN/A                    //0x2: group14_pshimd();
5362623SN/A                    0x2: decode MODRM_REG {
5372623SN/A                        0x2: decode LEGACY_OP {
5383349Sbinkertn@umich.edu                            0x0: psrld_PRq_Ib();
5392623SN/A                            0x1: psrld_VRo_Ib();
5402623SN/A                        }
5412623SN/A                        0x4: decode LEGACY_OP {
5422623SN/A                            0x0: psrad_PRq_Ib();
5432623SN/A                            0x1: psrad_VRo_Ib();
5442623SN/A                        }
5452623SN/A                        0x6: decode LEGACY_OP {
5462623SN/A                            0x0: pslld_PRq_Ib();
5474040Ssaidi@eecs.umich.edu                            0x1: pslld_VRo_Ib();
5482095SN/A                        }
5492098SN/A                        default: Inst::UD2();
5502095SN/A                    }
5512095SN/A                    //0x3: group15_pshimq();
5522095SN/A                    0x3: decode MODRM_REG {
5532098SN/A                        0x2: decode LEGACY_OP {
5542095SN/A                            0x0: psrlq_PRq_Ib();
5552095SN/A                            0x1: psrlq_VRo_Ib();
5562095SN/A                        }
5572095SN/A                        0x3: decode LEGACY_OP {
5582095SN/A                            0x0: Inst::UD2();
5592095SN/A                            0x1: psrldq_VRo_Ib();
5602095SN/A                        }
5612069SN/A                        0x6: decode LEGACY_OP {
5622069SN/A                            0x0: psllq_PRq_Ib();
5632132SN/A                            0x1: psllq_VRo_Ib();
5642069SN/A                        }
5652069SN/A                        0x7: decode LEGACY_OP {
5662069SN/A                            0x0: Inst::UD2();
5672132SN/A                            0x1: pslldq_VRo_Ib();
5682069SN/A                        }
5692069SN/A                        default: Inst::UD2();
5702069SN/A                    }
5712069SN/A                    0x4: pcmpeqb_Vo_Wo();
5722069SN/A                    0x5: pcmpeqw_Vo_Wo();
5732069SN/A                    0x6: pcmpeqd_Vo_Wo();
5742090SN/A                    default: Inst::UD2();
5753953Sstever@eecs.umich.edu                }
5762069SN/A                // repne (0xF2)
5772069SN/A                0x8: decode OPCODE_OP_BOTTOM3 {
5782090SN/A                    0x0: pshuflw_Vo_Wo_Ib();
5792069SN/A                    default: Inst::UD2();
5802069SN/A                }
5812069SN/A                default: Inst::UD2();
5822069SN/A            }
5832132SN/A            0x0F: decode LEGACY_DECODEVAL {
5842068SN/A                // no prefix
5852068SN/A                0x0: decode OPCODE_OP_BOTTOM3 {
5862068SN/A                    0x0: vmread_Ed_or_Eq_Gd_or_Gq();
5872132SN/A                    0x1: vmwrite_Gd_or_Gq_Ed_or_Eq();
5882068SN/A                    0x6: mov_Ed_Pd();
5892068SN/A                    0x7: mov_Qq_Pq();
5902068SN/A                    default: Inst::UD2();
5912069SN/A                }
5922068SN/A                // repe (0xF3)
5932068SN/A                0x4: decode OPCODE_OP_BOTTOM3 {
5942090SN/A                    0x6: movq_Vo_Mq_or_Vq_Vq();
5952069SN/A                    0x7: movdqu_Wo_Vo();
5962068SN/A                    default: Inst::UD2();
5972068SN/A                }
5982090SN/A                // operand size (0x66)
5992068SN/A                0x1: decode OPCODE_OP_BOTTOM3 {
6002068SN/A                    0x4: haddpd_Vo_Wo();
6012068SN/A                    0x5: hsubpd_Vo_Wo();
6022095SN/A                    0x6: movd_Ed_Vd();
6032132SN/A                    0x7: movdqa_Wo_Vo();
6042095SN/A                    default: Inst::UD2();
6052095SN/A                }
6062355SN/A                // repne (0xF2)
6072098SN/A                0x8: decode OPCODE_OP_BOTTOM3 {
6082095SN/A                    0x4: haddps_Vo_Wo();
6092095SN/A                    0x5: hsubps_Vo_Wo();
6102095SN/A                    default: Inst::UD2();
6112095SN/A                }
6122095SN/A                default: Inst::UD2();
6133349Sbinkertn@umich.edu            }
6142095SN/A            format Inst {
6152095SN/A                0x10: decode OPCODE_OP_BOTTOM3 {
6162095SN/A                    0x0: JO(Jz);
6172355SN/A                    0x1: JNO(Jz);
6182110SN/A                    0x2: JB(Jz);
6192098SN/A                    0x3: JNB(Jz);
6202095SN/A                    0x4: JZ(Jz);
6212095SN/A                    0x5: JNZ(Jz);
6222095SN/A                    0x6: JBE(Jz);
6232068SN/A                    0x7: JNBE(Jz);
6242068SN/A                }
6252068SN/A                0x11: decode OPCODE_OP_BOTTOM3 {
6262068SN/A                    0x0: JS(Jz);
6272068SN/A                    0x1: JNS(Jz);
6282068SN/A                    0x2: JP(Jz);
6292068SN/A                    0x3: JNP(Jz);
6302068SN/A                    0x4: JL(Jz);
6312068SN/A                    0x5: JNL(Jz);
6322068SN/A                    0x6: JLE(Jz);
6332068SN/A                    0x7: JNLE(Jz);
6342068SN/A                }
6352068SN/A                0x12: decode OPCODE_OP_BOTTOM3 {
6362068SN/A                    0x0: SETO(Eb);
6372068SN/A                    0x1: SETNO(Eb);
6382068SN/A                    0x2: SETB(Eb);
6392068SN/A                    0x3: SETNB(Eb);
6402068SN/A                    0x4: SETZ(Eb);
6412068SN/A                    0x5: SETNZ(Eb);
6422068SN/A                    0x6: SETBE(Eb);
6432068SN/A                    0x7: SETNBE(Eb);
6442068SN/A                }
6452068SN/A                0x13: decode OPCODE_OP_BOTTOM3 {
6462068SN/A                    0x0: SETS(Eb);
6472068SN/A                    0x1: SETNS(Eb);
6482068SN/A                    0x2: SETP(Eb);
6492068SN/A                    0x3: SETNP(Eb);
6502075SN/A                    0x4: SETL(Eb);
6512075SN/A                    0x5: SETNL(Eb);
6522069SN/A                    0x6: SETLE(Eb);
6532075SN/A                    0x7: SETNLE(Eb);
6542075SN/A                }
6552075SN/A            }
6562068SN/A            0x14: decode OPCODE_OP_BOTTOM3 {
6572068SN/A                0x0: push_fs();
6582068SN/A                0x1: pop_fs();
6592068SN/A                0x2: Inst::CPUID(rAd);
6602068SN/A                0x3: bt_Ev_Gv();
6612068SN/A                0x4: shld_Ev_Gv_Ib();
6622068SN/A                0x5: shld_Ev_Gv_rCl();
6632068SN/A                0x6: xbts_and_cmpxchg();
6642068SN/A                0x7: ibts_and_cmpxchg();
6652068SN/A            }
6663953Sstever@eecs.umich.edu            0x15: decode OPCODE_OP_BOTTOM3 {
6673953Sstever@eecs.umich.edu                0x0: push_gs();
6683953Sstever@eecs.umich.edu                0x1: pop_gs();
6693953Sstever@eecs.umich.edu                0x2: rsm_smm();
6703953Sstever@eecs.umich.edu                0x3: bts_Ev_Gv();
6713953Sstever@eecs.umich.edu                0x4: shrd_Ev_Gv_Ib();
6723953Sstever@eecs.umich.edu                0x5: shrd_Ev_Gv_rCl();
6733953Sstever@eecs.umich.edu                //0x6: group16();
6743953Sstever@eecs.umich.edu                0x6: decode MODRM_MOD {
6753953Sstever@eecs.umich.edu                    0x3: decode MODRM_REG {
6763953Sstever@eecs.umich.edu                        0x5: lfence();
6773953Sstever@eecs.umich.edu                        0x6: mfence();
6782068SN/A                        0x7: sfence();
6792068SN/A                        default: Inst::UD2();
6802068SN/A                    }
6812068SN/A                    default: decode MODRM_REG {
6822068SN/A                        0x0: fxsave();
6832068SN/A                        0x1: fxrstor();
6842069SN/A                        0x7: clflush();
6852623SN/A                        default: Inst::UD2();
6864027Sstever@eecs.umich.edu                    }
6874027Sstever@eecs.umich.edu                }
6882623SN/A                0x7: Inst::IMUL(Gv,Ev);
6892623SN/A            }
6902069SN/A            0x16: decode OPCODE_OP_BOTTOM3 {
6912069SN/A                0x0: Inst::CMPXCHG(Eb,Gb);
6922095SN/A                0x1: Inst::CMPXCHG(Ev,Gv);
6932095SN/A                0x2: lss_Gz_Mp();
6942069SN/A                0x3: btr_Ev_Gv();
6952068SN/A                0x4: lfs_Gz_Mp();
6963953Sstever@eecs.umich.edu                0x5: lgs_Gz_Mp();
6973953Sstever@eecs.umich.edu                //The size of the second operand in these instructions should
6983953Sstever@eecs.umich.edu                //really be "b" or "w", but it's set to v in order to have a
6993953Sstever@eecs.umich.edu                //consistent register size. This shouldn't affect behavior.
7002068SN/A                0x6: Inst::MOVZX_B(Gv,Ev);
7012068SN/A                0x7: Inst::MOVZX_W(Gv,Ev);
7022069SN/A            }
7032095SN/A            0x17: decode OPCODE_OP_BOTTOM3 {
7043953Sstever@eecs.umich.edu                0x0: jmpe_Jz(); // IA-64?
7053953Sstever@eecs.umich.edu                //0x1: group11_UD2();
7062068SN/A                0x1: Inst::UD2();
7072068SN/A                //0x2: group8_Ev_Ib();
7082075SN/A                0x2: decode MODRM_REG {
7092075SN/A                    0x4: bt_Ev_Ib();
7102068SN/A                    0x5: bts_Ev_Ib();
7112075SN/A                    0x6: btr_Ev_Ib();
7122069SN/A                    0x7: btc_Ev_Ib();
7132069SN/A                    default: Inst::UD2();
7142068SN/A                }
7152068SN/A                0x3: btc_Ev_Gv();
7162068SN/A                0x4: bsf_Gv_Ev();
7172068SN/A                0x5: bsr_Gv_Ev();
7182075SN/A                //The size of the second operand in these instructions should
7192075SN/A                //really be "b" or "w", but it's set to v in order to have a
7202068SN/A                //consistent register size. This shouldn't affect behavior.
7212068SN/A                0x6: Inst::MOVSX_B(Gv,Ev);
7222075SN/A                0x7: Inst::MOVSX_W(Gv,Ev);
7232069SN/A            }
7242069SN/A            0x18: decode OPCODE_OP_BOTTOM3 {
7252068SN/A                0x0: xadd_Eb_Gb();
7262068SN/A                0x1: xadd_Ev_Gv();
7272068SN/A                //0x7: group9();
7282075SN/A                0x7: decode MODRM_REG {
7292075SN/A                    0x1: cmpxchg_Mq();
7302075SN/A                    0x6: decode LEGACY_OP {
7312075SN/A                        0x1: vmclear_Mq();
7322075SN/A                        default: decode LEGACY_REP {
7332075SN/A                            0x1: vmxon_Mq();
7342075SN/A                            0x0: vmptrld_Mq();
7352075SN/A                        }
7362068SN/A                    }
7372068SN/A                    0x7: vmptrst_Mq();
7382069SN/A                    default: Inst::UD2();
7392069SN/A                }
7402075SN/A                default: decode LEGACY_DECODEVAL {
7412068SN/A                    // no prefix
7422068SN/A                    0x0: decode OPCODE_OP_BOTTOM3 {
7432068SN/A                        0x2: cmpccps_Vo_Wo_Ib();
7442068SN/A                        0x3: cvtdq2ps_Vo_Wo();
7452068SN/A                        0x4: subps_Vo_Wo();
7462068SN/A                        0x5: minps_Vo_Wo();
7472068SN/A                        0x6: divps_Vo_Wo();
7482075SN/A                    }
7492075SN/A                    // repe (0xF3)
7502068SN/A                    0x4: decode OPCODE_OP_BOTTOM3 {
7512075SN/A                        0x2: cmpccss_Vd_Wd_Ib();
7522069SN/A                        default: Inst::UD2();
7532068SN/A                    }
7542068SN/A                    // operand size (0x66)
7552068SN/A                    0x1: decode OPCODE_OP_BOTTOM3 {
7562075SN/A                        0x2: cmpccpd_Vo_Wo_Ib();
7572075SN/A                        0x4: subpd_Vo_Wo();
7582075SN/A                        0x5: minpd_Vo_Wo();
7592068SN/A                        0x6: divpd_Vo_Wo();
7602075SN/A                        default: Inst::UD2();
7612623SN/A                    }
7622068SN/A                    // repne (0xF2)
7632068SN/A                    0x8: decode OPCODE_OP_BOTTOM3 {
7642068SN/A                        0x2: cmpccsd_Vq_Wq_Ib();
7652068SN/A                        default: Inst::UD2();
7662075SN/A                    }
7672075SN/A                    default: Inst::UD2();
7682068SN/A                }
7692075SN/A            }
7702069SN/A            0x19: bswap_B();
7712068SN/A            0x1A: decode LEGACY_DECODEVAL {
7722068SN/A                // no prefix
7732068SN/A                0x0: decode OPCODE_OP_BOTTOM3 {
774                    0x1: psrlw_Pq_Qq();
775                    0x2: psrld_Pq_Qq();
776                    0x3: psrlq_Pq_Qq();
777                    0x4: paddq_Pq_Qq();
778                    0x5: pmullw_Pq_Qq();
779                    0x7: pmovmskb_Gd_PRq();
780                    default: Inst::UD2();
781                }
782                // repe (0xF3)
783                0x4: decode OPCODE_OP_BOTTOM3 {
784                    0x6: movq2dq_Vo_PRq();
785                    default: Inst::UD2();
786                }
787                // operand size (0x66)
788                0x1: decode OPCODE_OP_BOTTOM3 {
789                    0x0: addsubpd_Vo_Wo();
790                    0x1: psrlw_Vo_Wo();
791                    0x2: psrld_Vo_Wo();
792                    0x3: psrlq_Vo_Wo();
793                    0x4: paddq_Vo_Wo();
794                    0x5: pmullw_Vo_Wo();
795                    0x6: decode MODRM_MOD {
796                        0x3: movq_Vq_Vq();
797                        default: movq_Mq_Vq();
798                    }
799                    0x7: pmovmskb_Gd_VRo();
800                }
801                // repne (0xF2)
802                0x8: decode OPCODE_OP_BOTTOM3 {
803                    0x0: addsubps_Vo_Wo();
804                    0x6: movdq2q_Pq_VRq();
805                    default: Inst::UD2();
806                }
807                default: Inst::UD2();
808            }
809            0x1B: decode LEGACY_DECODEVAL {
810                // no prefix
811                0x0: decode OPCODE_OP_BOTTOM3 {
812                    0x0: psubusb_Pq_Qq();
813                    0x1: psubusw_Pq_Qq();
814                    0x2: pminub_Pq_Qq();
815                    0x3: pand_Pq_Qq();
816                    0x4: paddusb_Pq_Qq();
817                    0x5: paddusw_Pq_Qq();
818                    0x6: pmaxub_Pq_Qq();
819                    0x7: pandn_Pq_Qq();
820                }
821                // operand size (0x66)
822                0x1: decode OPCODE_OP_BOTTOM3 {
823                    0x0: psubusb_Vo_Wo();
824                    0x1: psubusw_Vo_Wo();
825                    0x2: pminub_Vo_Wo();
826                    0x3: pand_Vo_Wo();
827                    0x4: paddusb_Vo_Wo();
828                    0x5: paddusw_Vo_Wo();
829                    0x6: pmaxub_Vo_Wo();
830                    0x7: pandn_Vo_Wo();
831                }
832                default: Inst::UD2();
833            }
834            0x1C: decode LEGACY_DECODEVAL {
835                // no prefix
836                0x0: decode OPCODE_OP_BOTTOM3 {
837                    0x0: pavgb_Pq_Qq();
838                    0x1: psraw_Pq_Qq();
839                    0x2: psrad_Pq_Qq();
840                    0x3: pavgw_Pq_Qq();
841                    0x4: pmulhuw_Pq_Qq();
842                    0x5: pmulhw_Pq_Qq();
843                    0x7: movntq_Mq_Pq();
844                    default: Inst::UD2();
845                }
846                // repe (0xF3)
847                0x4: decode OPCODE_OP_BOTTOM3 {
848                    0x6: cvtdq2pd_Vo_Wq();
849                    default: Inst::UD2();
850                }
851                // operand size (0x66)
852                0x1: decode OPCODE_OP_BOTTOM3 {
853                    0x0: pavgb_Vo_Wo();
854                    0x1: psraw_Vo_Wo();
855                    0x2: psrad_Vo_Wo();
856                    0x3: pavgw_Vo_Wo();
857                    0x4: pmulhuw_Vo_Wo();
858                    0x5: pmulhw_Vo_Wo();
859                    0x6: cvttpd2dq_Vo_Wo();
860                    0x7: movntdq_Mo_Vo();
861                }
862                // repne (0xF2)
863                0x8: decode OPCODE_OP_BOTTOM3 {
864                    0x6: cvtpd2dq_Vo_Wo();
865                    default: Inst::UD2();
866                }
867                default: Inst::UD2();
868            }
869            0x1D: decode LEGACY_DECODEVAL {
870                // no prefix
871                0x0: decode OPCODE_OP_BOTTOM3 {
872                    0x0: psubsb_Pq_Qq();
873                    0x1: psubsw_Pq_Qq();
874                    0x2: pminsw_Pq_Qq();
875                    0x3: por_Pq_Qq();
876                    0x4: paddsb_Pq_Qq();
877                    0x5: paddsw_Pq_Qq();
878                    0x6: pmaxsw_Pq_Qq();
879                    0x7: pxor_Pq_Qq();
880                }
881                // operand size (0x66)
882                0x1: decode OPCODE_OP_BOTTOM3 {
883                    0x0: psubsb_Vo_Wo();
884                    0x1: psubsw_Vo_Wo();
885                    0x2: pminsw_Vo_Wo();
886                    0x3: por_Vo_Wo();
887                    0x4: paddsb_Vo_Wo();
888                    0x5: paddsw_Vo_Wo();
889                    0x6: pmaxsw_Vo_Wo();
890                    0x7: pxor_Vo_Wo();
891                }
892                default: Inst::UD2();
893            }
894            0x1E: decode OPCODE_OP_BOTTOM3 {
895                // no prefix
896                0x0: decode OPCODE_OP_BOTTOM3 {
897                    0x1: psllw_Pq_Qq();
898                    0x2: pslld_Pq_Qq();
899                    0x3: psllq_Pq_Qq();
900                    0x4: pmuludq_Pq_Qq();
901                    0x5: pmaddwd_Pq_Qq();
902                    0x6: psadbw_Pq_Qq();
903                    0x7: maskmovq_Pq_PRq();
904                    default: Inst::UD2();
905                }
906                // operand size (0x66)
907                0x1: decode OPCODE_OP_BOTTOM3 {
908                    0x1: psllw_Vo_Wo();
909                    0x2: pslld_Vo_Wo();
910                    0x3: psllq_Vo_Wo();
911                    0x4: pmuludq_Vo_Wo();
912                    0x5: pmaddwd_Vo_Wo();
913                    0x6: psadbw_Vo_Wo();
914                    0x7: maskmovdqu_Vo_VRo();
915                    default: Inst::UD2();
916                }
917                // repne (0xF2)
918                0x8: decode OPCODE_OP_BOTTOM3 {
919                    0x0: lddqu_Vo_Mo();
920                    default: Inst::UD2();
921                }
922                default: Inst::UD2();
923            }
924            0x1F: decode LEGACY_DECODEVAL {
925                // no prefix
926                0x0: decode OPCODE_OP_BOTTOM3 {
927                    0x0: psubb_Pq_Qq();
928                    0x1: psubw_Pq_Qq();
929                    0x2: psubd_Pq_Qq();
930                    0x3: psubq_Pq_Qq();
931                    0x4: paddb_Pq_Qq();
932                    0x5: paddw_Pq_Qq();
933                    0x6: paddd_Pq_Qq();
934                    0x7: Inst::UD2();
935                }
936                // operand size (0x66)
937                0x1: decode OPCODE_OP_BOTTOM3 {
938                    0x0: psubb_Vo_Wo();
939                    0x1: psubw_Vo_Wo();
940                    0x2: psubd_Vo_Wo();
941                    0x3: psubq_Vo_Wo();
942                    0x4: paddb_Vo_Wo();
943                    0x5: paddw_Vo_Wo();
944                    0x6: paddd_Vo_Wo();
945                    0x7: Inst::UD2();
946                }
947                default: Inst::UD2();
948            }
949            default: FailUnimpl::twoByteOps();
950        }
951    }
952    default: M5InternalError::error(
953        {{"Unexpected first opcode byte in two byte opcode!"}});
954}
955