two_byte_opcodes.isa revision 6480
15331Sgblack@eecs.umich.edu// Copyright (c) 2008 The Regents of The University of Michigan
25331Sgblack@eecs.umich.edu// All rights reserved.
35331Sgblack@eecs.umich.edu//
45331Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without
55331Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are
65331Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright
75331Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer;
85331Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright
95331Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the
105331Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution;
115331Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its
125331Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from
135331Sgblack@eecs.umich.edu// this software without specific prior written permission.
145331Sgblack@eecs.umich.edu//
155331Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
165331Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
175331Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
185331Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
195331Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
205331Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
215331Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
225331Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
235331Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
245331Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
255331Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
265331Sgblack@eecs.umich.edu//
275331Sgblack@eecs.umich.edu// Authors: Gabe Black
285331Sgblack@eecs.umich.edu
295331Sgblack@eecs.umich.edu// Copyright (c) 2007-2008 The Hewlett-Packard Development Company
304276Sgblack@eecs.umich.edu// All rights reserved.
314276Sgblack@eecs.umich.edu//
324276Sgblack@eecs.umich.edu// Redistribution and use of this software in source and binary forms,
334276Sgblack@eecs.umich.edu// with or without modification, are permitted provided that the
344276Sgblack@eecs.umich.edu// following conditions are met:
354276Sgblack@eecs.umich.edu//
364276Sgblack@eecs.umich.edu// The software must be used only for Non-Commercial Use which means any
374276Sgblack@eecs.umich.edu// use which is NOT directed to receiving any direct monetary
384276Sgblack@eecs.umich.edu// compensation for, or commercial advantage from such use.  Illustrative
394276Sgblack@eecs.umich.edu// examples of non-commercial use are academic research, personal study,
404276Sgblack@eecs.umich.edu// teaching, education and corporate research & development.
414276Sgblack@eecs.umich.edu// Illustrative examples of commercial use are distributing products for
424276Sgblack@eecs.umich.edu// commercial advantage and providing services using the software for
434276Sgblack@eecs.umich.edu// commercial advantage.
444276Sgblack@eecs.umich.edu//
454276Sgblack@eecs.umich.edu// If you wish to use this software or functionality therein that may be
464276Sgblack@eecs.umich.edu// covered by patents for commercial use, please contact:
474276Sgblack@eecs.umich.edu//     Director of Intellectual Property Licensing
484276Sgblack@eecs.umich.edu//     Office of Strategy and Technology
494276Sgblack@eecs.umich.edu//     Hewlett-Packard Company
504276Sgblack@eecs.umich.edu//     1501 Page Mill Road
514276Sgblack@eecs.umich.edu//     Palo Alto, California  94304
524276Sgblack@eecs.umich.edu//
534276Sgblack@eecs.umich.edu// Redistributions of source code must retain the above copyright notice,
544276Sgblack@eecs.umich.edu// this list of conditions and the following disclaimer.  Redistributions
554276Sgblack@eecs.umich.edu// in binary form must reproduce the above copyright notice, this list of
564276Sgblack@eecs.umich.edu// conditions and the following disclaimer in the documentation and/or
574276Sgblack@eecs.umich.edu// other materials provided with the distribution.  Neither the name of
584276Sgblack@eecs.umich.edu// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
594276Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from
604276Sgblack@eecs.umich.edu// this software without specific prior written permission.  No right of
614276Sgblack@eecs.umich.edu// sublicense is granted herewith.  Derivatives of the software and
624276Sgblack@eecs.umich.edu// output created using the software may be prepared, but only for
634276Sgblack@eecs.umich.edu// Non-Commercial Uses.  Derivatives of the software may be shared with
644276Sgblack@eecs.umich.edu// others provided: (i) the others agree to abide by the list of
654276Sgblack@eecs.umich.edu// conditions herein which includes the Non-Commercial Use restrictions;
664276Sgblack@eecs.umich.edu// and (ii) such Derivatives of the software include the above copyright
674276Sgblack@eecs.umich.edu// notice to acknowledge the contribution from this software where
684276Sgblack@eecs.umich.edu// applicable, this list of conditions and the disclaimer below.
694276Sgblack@eecs.umich.edu//
704276Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
714276Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
724276Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
734276Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
744276Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
754276Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
764276Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
774276Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
784276Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
794276Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
804276Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
814276Sgblack@eecs.umich.edu//
824276Sgblack@eecs.umich.edu// Authors: Gabe Black
834276Sgblack@eecs.umich.edu
844276Sgblack@eecs.umich.edu////////////////////////////////////////////////////////////////////
854276Sgblack@eecs.umich.edu//
864276Sgblack@eecs.umich.edu// Decode the two byte opcodes
874276Sgblack@eecs.umich.edu//
884276Sgblack@eecs.umich.edu0x2: decode OPCODE_PREFIXA {
894711Sgblack@eecs.umich.edu    0x0F: decode OPCODE_OP_TOP5 {
904276Sgblack@eecs.umich.edu        format WarnUnimpl {
914276Sgblack@eecs.umich.edu            0x00: decode OPCODE_OP_BOTTOM3 {
925238Sgblack@eecs.umich.edu                //0x00: group6();
935238Sgblack@eecs.umich.edu                0x00: decode MODRM_REG {
945238Sgblack@eecs.umich.edu                    0x0: sldt_Mw_or_Rv();
955238Sgblack@eecs.umich.edu                    0x1: str_Mw_or_Rv();
965937Sgblack@eecs.umich.edu                    0x2: Inst::LLDT(Ew);
975902Sgblack@eecs.umich.edu                    0x3: Inst::LTR(Ew);
985238Sgblack@eecs.umich.edu                    0x4: verr_Mw_or_Rv();
995238Sgblack@eecs.umich.edu                    0x5: verw_Mw_or_Rv();
1005238Sgblack@eecs.umich.edu                    //0x6: jmpe_Ev(); // IA-64
1015238Sgblack@eecs.umich.edu                    default: Inst::UD2();
1025238Sgblack@eecs.umich.edu                }
1035238Sgblack@eecs.umich.edu                //0x01: group7(); // Ugly, ugly, ugly...
1045238Sgblack@eecs.umich.edu                0x01: decode MODRM_MOD {
1055238Sgblack@eecs.umich.edu                    0x3: decode MODRM_REG {
1065238Sgblack@eecs.umich.edu                        0x0: decode MODRM_RM {
1075238Sgblack@eecs.umich.edu                            0x1: vmcall();
1085238Sgblack@eecs.umich.edu                            0x2: vmlaunch();
1095238Sgblack@eecs.umich.edu                            0x3: vmresume();
1105238Sgblack@eecs.umich.edu                            0x4: vmxoff();
1115238Sgblack@eecs.umich.edu                            default: Inst::UD2();
1125238Sgblack@eecs.umich.edu                        }
1135238Sgblack@eecs.umich.edu                        0x1: decode MODRM_RM {
1145238Sgblack@eecs.umich.edu                            0x0: monitor();
1155238Sgblack@eecs.umich.edu                            0x1: mwait();
1165238Sgblack@eecs.umich.edu                            default: Inst::UD2();
1175238Sgblack@eecs.umich.edu                        }
1185238Sgblack@eecs.umich.edu                        0x3: decode MODRM_RM {
1195238Sgblack@eecs.umich.edu                            0x0: vmrun();
1205238Sgblack@eecs.umich.edu                            0x1: vmmcall();
1215238Sgblack@eecs.umich.edu                            0x2: vmload();
1225238Sgblack@eecs.umich.edu                            0x3: vmsave();
1235238Sgblack@eecs.umich.edu                            0x4: stgi();
1245238Sgblack@eecs.umich.edu                            0x5: clgi();
1255238Sgblack@eecs.umich.edu                            0x6: skinit();
1265238Sgblack@eecs.umich.edu                            0x7: invlpga();
1275238Sgblack@eecs.umich.edu                        }
1286055Sgblack@eecs.umich.edu                        0x4: Inst::SMSW(Rv);
1296054Sgblack@eecs.umich.edu                        0x6: Inst::LMSW(Rv);
1305238Sgblack@eecs.umich.edu                        0x7: decode MODRM_RM {
1315683Sgblack@eecs.umich.edu                            0x0: Inst::SWAPGS();
1325238Sgblack@eecs.umich.edu                            0x1: rdtscp();
1335238Sgblack@eecs.umich.edu                            default: Inst::UD2();
1345238Sgblack@eecs.umich.edu                        }
1355238Sgblack@eecs.umich.edu                        default: Inst::UD2();
1365238Sgblack@eecs.umich.edu                    }
1375238Sgblack@eecs.umich.edu                    default: decode MODRM_REG {
1385238Sgblack@eecs.umich.edu                        0x0: sgdt_Ms();
1395238Sgblack@eecs.umich.edu                        0x1: sidt_Ms();
1405291Sgblack@eecs.umich.edu                        0x2: decode MODE_SUBMODE {
1415291Sgblack@eecs.umich.edu                            0x0: Inst::LGDT(M);
1425291Sgblack@eecs.umich.edu                            default: decode OPSIZE {
1435291Sgblack@eecs.umich.edu                                // 16 bit operand sizes are special, but only
1445291Sgblack@eecs.umich.edu                                // in legacy and compatability modes.
1455291Sgblack@eecs.umich.edu                                0x2: Inst::LGDT_16(M);
1465291Sgblack@eecs.umich.edu                                default: Inst::LGDT(M);
1475291Sgblack@eecs.umich.edu                            }
1485291Sgblack@eecs.umich.edu                        }
1495292Sgblack@eecs.umich.edu                        0x3: decode MODE_SUBMODE {
1505292Sgblack@eecs.umich.edu                            0x0: Inst::LIDT(M);
1515292Sgblack@eecs.umich.edu                            default: decode OPSIZE {
1525292Sgblack@eecs.umich.edu                                // 16 bit operand sizes are special, but only
1535292Sgblack@eecs.umich.edu                                // in legacy and compatability modes.
1545292Sgblack@eecs.umich.edu                                0x2: Inst::LIDT_16(M);
1555292Sgblack@eecs.umich.edu                                default: Inst::LIDT(M);
1565292Sgblack@eecs.umich.edu                            }
1575292Sgblack@eecs.umich.edu                        }
1586055Sgblack@eecs.umich.edu                        0x4: Inst::SMSW(Mw);
1596054Sgblack@eecs.umich.edu                        0x6: Inst::LMSW(Mw);
1605359Sgblack@eecs.umich.edu                        0x7: Inst::INVLPG(M);
1615238Sgblack@eecs.umich.edu                        default: Inst::UD2();
1625238Sgblack@eecs.umich.edu                    }
1635238Sgblack@eecs.umich.edu                }
1644276Sgblack@eecs.umich.edu                0x02: lar_Gv_Ew();
1654276Sgblack@eecs.umich.edu                0x03: lsl_Gv_Ew();
1665789Sgblack@eecs.umich.edu                // sandpile.org doesn't seem to know what this is...? We'll
1675789Sgblack@eecs.umich.edu                // use it for pseudo instructions. We've got 16 bits of space
1685789Sgblack@eecs.umich.edu                // to play with so there can be quite a few pseudo
1695789Sgblack@eecs.umich.edu                // instructions.
1705789Sgblack@eecs.umich.edu                //0x04: loadall_or_reset_or_hang();
1715789Sgblack@eecs.umich.edu                0x4: decode IMMEDIATE {
1725789Sgblack@eecs.umich.edu                    format BasicOperate {
1735789Sgblack@eecs.umich.edu#if FULL_SYSTEM
1745789Sgblack@eecs.umich.edu                        0x00: m5arm({{
1755789Sgblack@eecs.umich.edu                            PseudoInst::arm(xc->tcBase());
1765789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
1775789Sgblack@eecs.umich.edu                        0x01: m5quiesce({{
1785789Sgblack@eecs.umich.edu                            PseudoInst::quiesce(xc->tcBase());
1795789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
1805789Sgblack@eecs.umich.edu                        0x02: m5quiesceNs({{
1815789Sgblack@eecs.umich.edu                            PseudoInst::quiesceNs(xc->tcBase(), Rdi);
1825789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
1835789Sgblack@eecs.umich.edu                        0x03: m5quiesceCycle({{
1845789Sgblack@eecs.umich.edu                            PseudoInst::quiesceCycles(xc->tcBase(), Rdi);
1855789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
1865789Sgblack@eecs.umich.edu                        0x04: m5quiesceTime({{
1875789Sgblack@eecs.umich.edu                            Rax = PseudoInst::quiesceTime(xc->tcBase());
1885789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
1895789Sgblack@eecs.umich.edu#endif
1905789Sgblack@eecs.umich.edu                        0x07: m5rpns({{
1915789Sgblack@eecs.umich.edu                            Rax = PseudoInst::rpns(xc->tcBase());
1925789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
1935789Sgblack@eecs.umich.edu                        0x21: m5exit({{
1945789Sgblack@eecs.umich.edu                            PseudoInst::m5exit(xc->tcBase(), Rdi);
1955789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
1965789Sgblack@eecs.umich.edu#if FULL_SYSTEM
1975789Sgblack@eecs.umich.edu                        0x30: m5initparam({{
1985789Sgblack@eecs.umich.edu                            Rax = xc->tcBase()->getCpuPtr()->
1995789Sgblack@eecs.umich.edu                                      system->init_param;
2005789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2015789Sgblack@eecs.umich.edu                        0x31: m5loadsymbol({{
2025789Sgblack@eecs.umich.edu                            PseudoInst::loadsymbol(xc->tcBase());
2035789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2045789Sgblack@eecs.umich.edu#endif
2055789Sgblack@eecs.umich.edu                        0x40: m5resetstats({{
2065789Sgblack@eecs.umich.edu                            PseudoInst::resetstats(xc->tcBase(), Rdi, Rsi);
2075789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2085789Sgblack@eecs.umich.edu                        0x41: m5dumpstats({{
2095789Sgblack@eecs.umich.edu                            PseudoInst::dumpstats(xc->tcBase(), Rdi, Rsi);
2105789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2115789Sgblack@eecs.umich.edu                        0x42: m5dumpresetstats({{
2125789Sgblack@eecs.umich.edu                            PseudoInst::dumpresetstats(xc->tcBase(), Rdi, Rsi);
2135789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2145789Sgblack@eecs.umich.edu                        0x43: m5checkpoint({{
2155789Sgblack@eecs.umich.edu                            PseudoInst::m5checkpoint(xc->tcBase(), Rdi, Rsi);
2165789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2175789Sgblack@eecs.umich.edu#if FULL_SYSTEM
2185789Sgblack@eecs.umich.edu                        0x50: m5readfile({{
2195789Sgblack@eecs.umich.edu                            Rax = PseudoInst::readfile(
2205789Sgblack@eecs.umich.edu                                xc->tcBase(), Rdi, Rsi, Rdx);
2215789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2225789Sgblack@eecs.umich.edu#endif
2235789Sgblack@eecs.umich.edu                        0x51: m5debugbreak({{
2245789Sgblack@eecs.umich.edu                            PseudoInst::debugbreak(xc->tcBase());
2255789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2265789Sgblack@eecs.umich.edu                        0x52: m5switchcpu({{
2275789Sgblack@eecs.umich.edu                            PseudoInst::switchcpu(xc->tcBase());
2285789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2295789Sgblack@eecs.umich.edu#if FULL_SYSTEM
2305789Sgblack@eecs.umich.edu                        0x53: m5addsymbol({{
2315789Sgblack@eecs.umich.edu                            PseudoInst::addsymbol(xc->tcBase(), Rdi, Rsi);
2325789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2335789Sgblack@eecs.umich.edu#endif
2345789Sgblack@eecs.umich.edu                        0x54: m5panic({{
2355789Sgblack@eecs.umich.edu                            panic("M5 panic instruction called at pc=%#x.\n",
2365789Sgblack@eecs.umich.edu                                xc->readPC());
2375789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2385789Sgblack@eecs.umich.edu                        0x55: m5reserved1({{
2395789Sgblack@eecs.umich.edu                            warn("M5 reserved opcode 1 ignored.\n");
2405789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2415789Sgblack@eecs.umich.edu                        0x56: m5reserved2({{
2425789Sgblack@eecs.umich.edu                            warn("M5 reserved opcode 2 ignored.\n");
2435789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2445789Sgblack@eecs.umich.edu                        0x57: m5reserved3({{
2455789Sgblack@eecs.umich.edu                            warn("M5 reserved opcode 3 ignored.\n");
2465789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2475789Sgblack@eecs.umich.edu                        0x58: m5reserved4({{
2485789Sgblack@eecs.umich.edu                            warn("M5 reserved opcode 4 ignored.\n");
2495789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2505789Sgblack@eecs.umich.edu                        0x59: m5reserved5({{
2515789Sgblack@eecs.umich.edu                            warn("M5 reserved opcode 5 ignored.\n");
2525789Sgblack@eecs.umich.edu                        }}, IsNonSpeculative);
2535789Sgblack@eecs.umich.edu                        default: Inst::UD2();
2545789Sgblack@eecs.umich.edu                    }
2555789Sgblack@eecs.umich.edu                }
2564712Sgblack@eecs.umich.edu#if FULL_SYSTEM
2575907Sgblack@eecs.umich.edu                0x05: decode MODE_MODE {
2585907Sgblack@eecs.umich.edu                    0x0: decode MODE_SUBMODE {
2595907Sgblack@eecs.umich.edu                        0x0: Inst::SYSCALL_64();
2605907Sgblack@eecs.umich.edu                        0x1: Inst::SYSCALL_COMPAT();
2615907Sgblack@eecs.umich.edu                    }
2625907Sgblack@eecs.umich.edu                    0x1: Inst::SYSCALL_LEGACY();
2635907Sgblack@eecs.umich.edu                }
2644712Sgblack@eecs.umich.edu#else
2655659Sgblack@eecs.umich.edu                0x05: SyscallInst::syscall('xc->syscall(Rax)', IsSyscall);
2664712Sgblack@eecs.umich.edu#endif
2675933Sgblack@eecs.umich.edu                0x06: Inst::CLTS();
2685908Sgblack@eecs.umich.edu                0x07: decode MODE_SUBMODE {
2695908Sgblack@eecs.umich.edu                    0x0: decode OPSIZE {
2705908Sgblack@eecs.umich.edu                        // Return to 64 bit mode.
2715908Sgblack@eecs.umich.edu                        0x8: Inst::SYSRET_TO_64();
2725908Sgblack@eecs.umich.edu                        // Return to compatibility mode.
2735908Sgblack@eecs.umich.edu                        default: Inst::SYSRET_TO_COMPAT();
2745908Sgblack@eecs.umich.edu                    }
2755908Sgblack@eecs.umich.edu                    default: Inst::SYSRET_NON_64();
2765908Sgblack@eecs.umich.edu                }
2774276Sgblack@eecs.umich.edu            }
2784276Sgblack@eecs.umich.edu            0x01: decode OPCODE_OP_BOTTOM3 {
2794712Sgblack@eecs.umich.edu                0x0: invd();
2804712Sgblack@eecs.umich.edu                0x1: wbinvd();
2814730Sgblack@eecs.umich.edu                0x2: Inst::UD2();
2824760Sgblack@eecs.umich.edu                0x3: Inst::UD2();
2834730Sgblack@eecs.umich.edu                0x4: Inst::UD2();
2845920Sgblack@eecs.umich.edu                0x5: Inst::PREFETCH(Mb);
2855422Sgblack@eecs.umich.edu                0x6: FailUnimpl::femms();
2865422Sgblack@eecs.umich.edu                0x7: FailUnimpl::threednow();
2874276Sgblack@eecs.umich.edu            }
2884760Sgblack@eecs.umich.edu            0x02: decode LEGACY_DECODEVAL {
2894760Sgblack@eecs.umich.edu                // no prefix
2904760Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
2915020Sgblack@eecs.umich.edu                    0x0: movups_Vo_Wo();
2925020Sgblack@eecs.umich.edu                    0x1: movups_Wo_Vo();
2935020Sgblack@eecs.umich.edu                    0x2: decode MODRM_MOD {
2945020Sgblack@eecs.umich.edu                        0x3: movhlps_Vq_VRq();
2955020Sgblack@eecs.umich.edu                        default: movlps_Vq_Mq();
2965020Sgblack@eecs.umich.edu                    }
2975020Sgblack@eecs.umich.edu                    0x3: movlps_Mq_Vq();
2985020Sgblack@eecs.umich.edu                    0x4: unpcklps();
2995020Sgblack@eecs.umich.edu                    0x5: unpckhps();
3005020Sgblack@eecs.umich.edu                    0x6: decode MODRM_MOD {
3015020Sgblack@eecs.umich.edu                        0x3: movlhps_Vq_VRq();
3025020Sgblack@eecs.umich.edu                        default: movhps_Vq_Mq();
3035020Sgblack@eecs.umich.edu                    }
3045020Sgblack@eecs.umich.edu                    0x7: movhps_Mq_Vq();
3054760Sgblack@eecs.umich.edu                }
3064760Sgblack@eecs.umich.edu                // repe (0xF3)
3074760Sgblack@eecs.umich.edu                0x4: decode OPCODE_OP_BOTTOM3 {
3085020Sgblack@eecs.umich.edu                    0x0: movss_Vd_Wd();
3095020Sgblack@eecs.umich.edu                    0x1: movss_Wd_Vd();
3105020Sgblack@eecs.umich.edu                    0x2: movsldup_Vo_Wo();
3115020Sgblack@eecs.umich.edu                    0x6: movshdup_Vo_Wo();
3125020Sgblack@eecs.umich.edu                    default: Inst::UD2();
3134760Sgblack@eecs.umich.edu                }
3144760Sgblack@eecs.umich.edu                // operand size (0x66)
3154760Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
3165020Sgblack@eecs.umich.edu                    0x0: movupd_Vo_Wo();
3175020Sgblack@eecs.umich.edu                    0x1: movupd_Wo_Vo();
3185029Sgblack@eecs.umich.edu                    0x2: Inst::MOVLPD(Vq,Mq);
3195029Sgblack@eecs.umich.edu                    0x3: Inst::MOVLPD(Mq,Vq);
3205020Sgblack@eecs.umich.edu                    0x4: unpcklpd_Vo_Wq();
3215020Sgblack@eecs.umich.edu                    0x5: unpckhpd_Vo_Wo();
3225020Sgblack@eecs.umich.edu                    0x6: movhpd_Vq_Mq();
3235020Sgblack@eecs.umich.edu                    0x7: movhpd_Mq_Vq();
3244760Sgblack@eecs.umich.edu                }
3254760Sgblack@eecs.umich.edu                // repne (0xF2)
3264760Sgblack@eecs.umich.edu                0x8: decode OPCODE_OP_BOTTOM3 {
3275030Sgblack@eecs.umich.edu                    0x0: Inst::MOVSD(Vq,Wq);
3285030Sgblack@eecs.umich.edu                    0x1: Inst::MOVSD(Wq,Vq);
3295020Sgblack@eecs.umich.edu                    0x2: movddup_Vo_Wq();
3305020Sgblack@eecs.umich.edu                    default: Inst::UD2();
3314760Sgblack@eecs.umich.edu                }
3324760Sgblack@eecs.umich.edu                default: Inst::UD2();
3334276Sgblack@eecs.umich.edu            }
3344276Sgblack@eecs.umich.edu            0x03: decode OPCODE_OP_BOTTOM3 {
3355331Sgblack@eecs.umich.edu                //group17();
3365331Sgblack@eecs.umich.edu                0x0: decode MODRM_REG {
3375331Sgblack@eecs.umich.edu                    0x0: prefetch_nta();
3385920Sgblack@eecs.umich.edu                    0x1: Inst::PREFETCH_T0(Mb);
3395331Sgblack@eecs.umich.edu                    0x2: prefetch_t1();
3405331Sgblack@eecs.umich.edu                    0x3: prefetch_t2();
3415331Sgblack@eecs.umich.edu                    default: Inst::HINT_NOP();
3425331Sgblack@eecs.umich.edu                }
3435331Sgblack@eecs.umich.edu                0x1: Inst::HINT_NOP();
3445331Sgblack@eecs.umich.edu                0x2: Inst::HINT_NOP();
3455331Sgblack@eecs.umich.edu                0x3: Inst::HINT_NOP();
3465331Sgblack@eecs.umich.edu                0x4: Inst::HINT_NOP();
3475331Sgblack@eecs.umich.edu                0x5: Inst::HINT_NOP();
3485331Sgblack@eecs.umich.edu                0x6: Inst::HINT_NOP();
3495331Sgblack@eecs.umich.edu                0x7: Inst::HINT_NOP();
3504276Sgblack@eecs.umich.edu            }
3515020Sgblack@eecs.umich.edu            0x04: decode LEGACY_DECODEVAL {
3525020Sgblack@eecs.umich.edu                // no prefix
3535020Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
3545296Sgblack@eecs.umich.edu                    0x0: Inst::MOV(Rd,Cd);
3555931Sgblack@eecs.umich.edu                    0x1: Inst::MOV(Rd,Dd);
3565241Sgblack@eecs.umich.edu                    0x2: Inst::MOV(Cd,Rd);
3575931Sgblack@eecs.umich.edu                    0x3: Inst::MOV(Dd,Rd);
3585020Sgblack@eecs.umich.edu                    0x4: mov_Rd_Td();
3595020Sgblack@eecs.umich.edu                    0x6: mov_Td_Rd();
3605020Sgblack@eecs.umich.edu                    default: Inst::UD2();
3615020Sgblack@eecs.umich.edu                }
3625020Sgblack@eecs.umich.edu                // lock prefix (0xF0)
3635020Sgblack@eecs.umich.edu                0x2: decode OPCODE_OP_BOTTOM3 {
3645020Sgblack@eecs.umich.edu                    0x0: mov_Rd_CR8D();
3655020Sgblack@eecs.umich.edu                    0x2: mov_CR8D_Rd();
3665020Sgblack@eecs.umich.edu                }
3675020Sgblack@eecs.umich.edu                default: Inst::UD2();
3684276Sgblack@eecs.umich.edu            }
3695020Sgblack@eecs.umich.edu            0x05: decode LEGACY_DECODEVAL {
3705020Sgblack@eecs.umich.edu                // no prefix
3715020Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
3725031Sgblack@eecs.umich.edu                    //These moves should really use size o (octword), but
3735031Sgblack@eecs.umich.edu                    //because they are split in two, they use q (quadword).
3745031Sgblack@eecs.umich.edu                    0x0: Inst::MOVAPS(Vq,Wq);
3755031Sgblack@eecs.umich.edu                    0x1: Inst::MOVAPS(Wq,Vq);
3765020Sgblack@eecs.umich.edu                    0x2: decode MODRM_MOD {
3775020Sgblack@eecs.umich.edu                        0x3: cvtpi2pS_Vq_Pq();
3785020Sgblack@eecs.umich.edu                        default: cvtpi2ps_Vq_Mq();
3795020Sgblack@eecs.umich.edu                    }
3805020Sgblack@eecs.umich.edu                    0x3: movntps_Mo_Vo();
3815020Sgblack@eecs.umich.edu                    0x4: cvttps2pi_Pq_Wq();
3825020Sgblack@eecs.umich.edu                    0x5: cvtpS2pi_Pq_Wq();
3835020Sgblack@eecs.umich.edu                    0x6: ucomiss_Vd_Wd();
3845020Sgblack@eecs.umich.edu                    0x7: comiss_Vd_Wd();
3855020Sgblack@eecs.umich.edu                }
3865020Sgblack@eecs.umich.edu                // repe (0xF3)
3875020Sgblack@eecs.umich.edu                0x4: decode OPCODE_OP_BOTTOM3 {
3885020Sgblack@eecs.umich.edu                    0x2: cvtsi2ss_Vd_Ed();
3895020Sgblack@eecs.umich.edu                    0x4: cvttss2si_Gd_Wd();
3905020Sgblack@eecs.umich.edu                    0x5: cvtss2si_Gd_Wd();
3915020Sgblack@eecs.umich.edu                    default: Inst::UD2();
3925020Sgblack@eecs.umich.edu                }
3935020Sgblack@eecs.umich.edu                // operand size (0x66)
3945020Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
3955020Sgblack@eecs.umich.edu                    0x0: movapd_Vo_Wo();
3965020Sgblack@eecs.umich.edu                    0x1: movapd_Wo_Vo();
3975020Sgblack@eecs.umich.edu                    0x2: decode MODRM_MOD {
3985020Sgblack@eecs.umich.edu                        0x3: cvtpi2pd_Vo_Pq();
3995020Sgblack@eecs.umich.edu                        default: cvtpi2pd_Vo_Mq();
4005020Sgblack@eecs.umich.edu                    }
4015020Sgblack@eecs.umich.edu                    0x3: movntpd_Mo_Vo();
4025020Sgblack@eecs.umich.edu                    0x4: cvttpd2pi_Pq_Wo();
4035020Sgblack@eecs.umich.edu                    0x5: cvtpd2pi_Pq_Wo();
4045058Sgblack@eecs.umich.edu                    0x6: Inst::UCOMISD(Vq,Wq);
4055020Sgblack@eecs.umich.edu                    0x7: comisd_Vq_Wq();
4065020Sgblack@eecs.umich.edu                }
4075020Sgblack@eecs.umich.edu                // repne (0xF2)
4085020Sgblack@eecs.umich.edu                0x8: decode OPCODE_OP_BOTTOM3 {
4095046Sgblack@eecs.umich.edu                    // The size of the V operand should be q, not dp
4105046Sgblack@eecs.umich.edu                    0x2: Inst::CVTSI2SD(Vdp,Edp);
4115046Sgblack@eecs.umich.edu                    // The size of the W operand should be q, not dp
4125046Sgblack@eecs.umich.edu                    0x4: Inst::CVTTSD2SI(Gdp,Wdp);
4135020Sgblack@eecs.umich.edu                    0x5: cvtsd2si_Gd_Wq();
4145020Sgblack@eecs.umich.edu                    default: Inst::UD2();
4155020Sgblack@eecs.umich.edu                }
4165020Sgblack@eecs.umich.edu                default: Inst::UD2();
4174276Sgblack@eecs.umich.edu            }
4184276Sgblack@eecs.umich.edu            0x06: decode OPCODE_OP_BOTTOM3 {
4195149Sgblack@eecs.umich.edu                0x0: Inst::WRMSR();
4205409Sgblack@eecs.umich.edu                0x1: Inst::RDTSC();
4215149Sgblack@eecs.umich.edu                0x2: Inst::RDMSR();
4224712Sgblack@eecs.umich.edu                0x3: rdpmc();
4235972Sgblack@eecs.umich.edu#if FULL_SYSTEM
4244712Sgblack@eecs.umich.edu                0x4: sysenter();
4255972Sgblack@eecs.umich.edu#else
4265972Sgblack@eecs.umich.edu                0x4: SyscallInst::sysenter('xc->syscall(Rax)', IsSyscall);
4275972Sgblack@eecs.umich.edu#endif
4284712Sgblack@eecs.umich.edu                0x5: sysexit();
4294730Sgblack@eecs.umich.edu                0x6: Inst::UD2();
4304712Sgblack@eecs.umich.edu                0x7: getsec();
4314276Sgblack@eecs.umich.edu            }
4324276Sgblack@eecs.umich.edu            0x07: decode OPCODE_OP_BOTTOM3 {
4334712Sgblack@eecs.umich.edu                0x0: three_byte_opcode();
4344712Sgblack@eecs.umich.edu                0x1: three_byte_opcode();
4354712Sgblack@eecs.umich.edu                0x2: three_byte_opcode();
4364712Sgblack@eecs.umich.edu                0x3: three_byte_opcode();
4374712Sgblack@eecs.umich.edu                0x4: three_byte_opcode();
4384712Sgblack@eecs.umich.edu                0x5: three_byte_opcode();
4394712Sgblack@eecs.umich.edu                0x6: three_byte_opcode();
4404712Sgblack@eecs.umich.edu                0x7: three_byte_opcode();
4414276Sgblack@eecs.umich.edu            }
4424760Sgblack@eecs.umich.edu            format Inst {
4434760Sgblack@eecs.umich.edu                0x08: decode OPCODE_OP_BOTTOM3 {
4444760Sgblack@eecs.umich.edu                    0x0: CMOVO(Gv,Ev);
4454760Sgblack@eecs.umich.edu                    0x1: CMOVNO(Gv,Ev);
4464760Sgblack@eecs.umich.edu                    0x2: CMOVB(Gv,Ev);
4474760Sgblack@eecs.umich.edu                    0x3: CMOVNB(Gv,Ev);
4484760Sgblack@eecs.umich.edu                    0x4: CMOVZ(Gv,Ev);
4494760Sgblack@eecs.umich.edu                    0x5: CMOVNZ(Gv,Ev);
4504760Sgblack@eecs.umich.edu                    0x6: CMOVBE(Gv,Ev);
4514760Sgblack@eecs.umich.edu                    0x7: CMOVNBE(Gv,Ev);
4524760Sgblack@eecs.umich.edu                }
4534760Sgblack@eecs.umich.edu                0x09: decode OPCODE_OP_BOTTOM3 {
4544760Sgblack@eecs.umich.edu                    0x0: CMOVS(Gv,Ev);
4554760Sgblack@eecs.umich.edu                    0x1: CMOVNS(Gv,Ev);
4564760Sgblack@eecs.umich.edu                    0x2: CMOVP(Gv,Ev);
4574760Sgblack@eecs.umich.edu                    0x3: CMOVNP(Gv,Ev);
4584760Sgblack@eecs.umich.edu                    0x4: CMOVL(Gv,Ev);
4594760Sgblack@eecs.umich.edu                    0x5: CMOVNL(Gv,Ev);
4604760Sgblack@eecs.umich.edu                    0x6: CMOVLE(Gv,Ev);
4614760Sgblack@eecs.umich.edu                    0x7: CMOVNLE(Gv,Ev);
4624760Sgblack@eecs.umich.edu                }
4634276Sgblack@eecs.umich.edu            }
4645020Sgblack@eecs.umich.edu            0x0A: decode LEGACY_DECODEVAL {
4655020Sgblack@eecs.umich.edu                // no prefix
4665020Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
4675020Sgblack@eecs.umich.edu                    0x0: movmskps_Gd_VRo();
4685020Sgblack@eecs.umich.edu                    0x1: sqrtps_Vo_Wo();
4695020Sgblack@eecs.umich.edu                    0x2: rqsrtps_Vo_Wo();
4705020Sgblack@eecs.umich.edu                    0x3: rcpps_Vo_Wo();
4715020Sgblack@eecs.umich.edu                    0x4: andps_Vo_Wo();
4725020Sgblack@eecs.umich.edu                    0x5: andnps_Vo_Wo();
4735020Sgblack@eecs.umich.edu                    0x6: orps_Vo_Wo();
4745020Sgblack@eecs.umich.edu                    0x7: xorps_Vo_Wo();
4755020Sgblack@eecs.umich.edu                }
4765020Sgblack@eecs.umich.edu                // repe (0xF3)
4775020Sgblack@eecs.umich.edu                0x4: decode OPCODE_OP_BOTTOM3 {
4785020Sgblack@eecs.umich.edu                    0x1: sqrtss_Vd_Wd();
4795020Sgblack@eecs.umich.edu                    0x2: rsqrtss_Vd_Wd();
4805020Sgblack@eecs.umich.edu                    0x3: rcpss_Vd_Wd();
4815020Sgblack@eecs.umich.edu                    default: Inst::UD2();
4825020Sgblack@eecs.umich.edu                }
4835020Sgblack@eecs.umich.edu                // operand size (0x66)
4845020Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
4855020Sgblack@eecs.umich.edu                    0x0: movmskpd_Gd_VRo();
4865020Sgblack@eecs.umich.edu                    0x1: sqrtpd_Vo_Wo();
4875020Sgblack@eecs.umich.edu                    0x4: andpd_Vo_Wo();
4885020Sgblack@eecs.umich.edu                    0x5: andnpd_Vo_Wo();
4895020Sgblack@eecs.umich.edu                    0x6: orpd_Vo_Wo();
4905052Sgblack@eecs.umich.edu                    //This really should be type o, but it works on q sized
4915052Sgblack@eecs.umich.edu                    //chunks at a time.
4925052Sgblack@eecs.umich.edu                    0x7: Inst::XORPD(Vq,Wq);
4935020Sgblack@eecs.umich.edu                    default: Inst::UD2();
4945020Sgblack@eecs.umich.edu                }
4955059Sgblack@eecs.umich.edu                format Inst {
4965059Sgblack@eecs.umich.edu                    // repne (0xF2)
4975059Sgblack@eecs.umich.edu                    0x8: decode OPCODE_OP_BOTTOM3 {
4985059Sgblack@eecs.umich.edu                        0x1: SQRTSD(Vq,Wq);
4995059Sgblack@eecs.umich.edu                        default: UD2();
5005059Sgblack@eecs.umich.edu                    }
5015059Sgblack@eecs.umich.edu                    default: UD2();
5025020Sgblack@eecs.umich.edu                }
5034276Sgblack@eecs.umich.edu            }
5045020Sgblack@eecs.umich.edu            0x0B: decode LEGACY_DECODEVAL {
5055020Sgblack@eecs.umich.edu                // no prefix
5065020Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
5075020Sgblack@eecs.umich.edu                    0x0: addps_Vo_Wo();
5085020Sgblack@eecs.umich.edu                    0x1: mulps_Vo_Wo();
5095020Sgblack@eecs.umich.edu                    0x2: cvtps2pd_Vo_Wq();
5105020Sgblack@eecs.umich.edu                    0x3: cvtdq2ps_Vo_Wo();
5115020Sgblack@eecs.umich.edu                    0x4: subps_Vo_Wo();
5125020Sgblack@eecs.umich.edu                    0x5: minps_Vo_Wo();
5135020Sgblack@eecs.umich.edu                    0x6: divps_Vo_Wo();
5145020Sgblack@eecs.umich.edu                    0x7: maxps_Vo_Wo();
5155020Sgblack@eecs.umich.edu                }
5165020Sgblack@eecs.umich.edu                // repe (0xF3)
5175020Sgblack@eecs.umich.edu                0x4: decode OPCODE_OP_BOTTOM3 {
5185020Sgblack@eecs.umich.edu                    0x0: addss_Vd_Wd();
5195020Sgblack@eecs.umich.edu                    0x1: mulss_Vd_Wd();
5205020Sgblack@eecs.umich.edu                    0x2: cvtss2sd_Vq_Wd();
5215020Sgblack@eecs.umich.edu                    0x3: cvttps2dq_Vo_Wo();
5225020Sgblack@eecs.umich.edu                    0x4: subss_Vd_Wd();
5235020Sgblack@eecs.umich.edu                    0x5: minss_Vd_Wd();
5245020Sgblack@eecs.umich.edu                    0x6: divss_Vd_Wd();
5255020Sgblack@eecs.umich.edu                    0x7: maxss_Vd_Wd();
5265020Sgblack@eecs.umich.edu                }
5275020Sgblack@eecs.umich.edu                // operand size (0x66)
5285020Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
5295020Sgblack@eecs.umich.edu                    0x0: addpd_Vo_Wo();
5305020Sgblack@eecs.umich.edu                    0x1: mulpd_Vo_Wo();
5315020Sgblack@eecs.umich.edu                    0x2: cvtpd2ps_Vo_Wo();
5325020Sgblack@eecs.umich.edu                    0x3: cvtps2dq_Vo_Wo();
5335020Sgblack@eecs.umich.edu                    0x4: subpd_Vo_Wo();
5345020Sgblack@eecs.umich.edu                    0x5: minpd_Vo_Wo();
5355020Sgblack@eecs.umich.edu                    0x6: divpd_Vo_Wo();
5365020Sgblack@eecs.umich.edu                    0x7: maxpd_Vo_Wo();
5375020Sgblack@eecs.umich.edu                }
5385020Sgblack@eecs.umich.edu                // repne (0xF2)
5395020Sgblack@eecs.umich.edu                0x8: decode OPCODE_OP_BOTTOM3 {
5405047Sgblack@eecs.umich.edu                    0x0: Inst::ADDSD(Vq,Wq);
5415047Sgblack@eecs.umich.edu                    0x1: Inst::MULSD(Vq,Wq);
5425020Sgblack@eecs.umich.edu                    0x2: cvtsd2ss_Vd_Wq();
5435047Sgblack@eecs.umich.edu                    0x4: Inst::SUBSD(Vq,Wq);
5445020Sgblack@eecs.umich.edu                    0x5: minsd_Vq_Wq();
5455047Sgblack@eecs.umich.edu                    0x6: Inst::DIVSD(Vq,Wq);
5465020Sgblack@eecs.umich.edu                    0x7: maxsd_Vq_Wq();
5475020Sgblack@eecs.umich.edu                    default: Inst::UD2();
5485020Sgblack@eecs.umich.edu                }
5495020Sgblack@eecs.umich.edu                default: Inst::UD2();
5504276Sgblack@eecs.umich.edu            }
5515020Sgblack@eecs.umich.edu            0x0C: decode LEGACY_DECODEVAL {
5525020Sgblack@eecs.umich.edu                // no prefix
5535020Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
5545020Sgblack@eecs.umich.edu                    0x0: punpcklbw_Pq_Qd();
5555020Sgblack@eecs.umich.edu                    0x1: punpcklwd_Pq_Qd();
5565020Sgblack@eecs.umich.edu                    0x2: punpckldq_Pq_Qd();
5575020Sgblack@eecs.umich.edu                    0x3: packsswb_Pq_Qq();
5585020Sgblack@eecs.umich.edu                    0x4: pcmpgtb_Pq_Qq();
5595020Sgblack@eecs.umich.edu                    0x5: pcmpgtw_Pq_Qq();
5605020Sgblack@eecs.umich.edu                    0x6: pcmpgtd_Pq_Qq();
5615020Sgblack@eecs.umich.edu                    0x7: packuswb_Pq_Qq();
5625020Sgblack@eecs.umich.edu                }
5635020Sgblack@eecs.umich.edu                // operand size (0x66)
5645020Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
5655020Sgblack@eecs.umich.edu                    0x0: punpcklbw_Vo_Wq();
5665020Sgblack@eecs.umich.edu                    0x1: punpcklwd_Vo_Wq();
5675020Sgblack@eecs.umich.edu                    0x2: punpckldq_Vo_Wq();
5685020Sgblack@eecs.umich.edu                    0x3: packsswb_Vo_Wo();
5695020Sgblack@eecs.umich.edu                    0x4: pcmpgtb_Vo_Wo();
5705020Sgblack@eecs.umich.edu                    0x5: pcmpgtw_Vo_Wo();
5715020Sgblack@eecs.umich.edu                    0x6: pcmpgtd_Vo_Wo();
5725020Sgblack@eecs.umich.edu                    0x7: packuswb_Vo_Wo();
5735020Sgblack@eecs.umich.edu                }
5745020Sgblack@eecs.umich.edu                default: Inst::UD2();
5754276Sgblack@eecs.umich.edu            }
5765020Sgblack@eecs.umich.edu            0x0D: decode LEGACY_DECODEVAL {
5775020Sgblack@eecs.umich.edu                // no prefix
5785020Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
5795020Sgblack@eecs.umich.edu                    0x0: punpckhbw_Pq_Qq();
5805020Sgblack@eecs.umich.edu                    0x1: punpckhwd_Pq_Qq();
5815020Sgblack@eecs.umich.edu                    0x2: punpckhdq_Pq_Qq();
5825020Sgblack@eecs.umich.edu                    0x3: packssdw_Pq_Qq();
5835020Sgblack@eecs.umich.edu                    0x6: movd_Pq_Ed();
5845020Sgblack@eecs.umich.edu                    0x7: movq_Pq_Qq();
5855020Sgblack@eecs.umich.edu                    default: Inst::UD2();
5865020Sgblack@eecs.umich.edu                }
5875020Sgblack@eecs.umich.edu                // repe (0xF3)
5885020Sgblack@eecs.umich.edu                0x4: decode OPCODE_OP_BOTTOM3 {
5895020Sgblack@eecs.umich.edu                    0x7: movdqu_Vo_Wo();
5905020Sgblack@eecs.umich.edu                    default: Inst::UD2();
5915020Sgblack@eecs.umich.edu                }
5925020Sgblack@eecs.umich.edu                // operand size (0x66)
5935020Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
5945020Sgblack@eecs.umich.edu                    0x0: punpckhbw_Vo_Wo();
5955020Sgblack@eecs.umich.edu                    0x1: punpckhwd_Vo_Wo();
5965020Sgblack@eecs.umich.edu                    0x2: punpckhdq_Vo_Wo();
5975020Sgblack@eecs.umich.edu                    0x3: packssdw_Vo_Wo();
5985020Sgblack@eecs.umich.edu                    0x4: punpcklqdq_Vo_Wq();
5995020Sgblack@eecs.umich.edu                    0x5: punpcklqdq_Vo_Wq();
6005020Sgblack@eecs.umich.edu                    0x6: movd_Vo_Ed();
6015020Sgblack@eecs.umich.edu                    0x7: movdqa_Vo_Wo();
6025020Sgblack@eecs.umich.edu                }
6035020Sgblack@eecs.umich.edu                default: Inst::UD2();
6044276Sgblack@eecs.umich.edu            }
6055020Sgblack@eecs.umich.edu            0x0E: decode LEGACY_DECODEVAL {
6065020Sgblack@eecs.umich.edu                // no prefix
6075020Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
6085020Sgblack@eecs.umich.edu                    0x0: pshufw_Pq_Qq_Ib();
6095238Sgblack@eecs.umich.edu                    //0x1: group13_pshimw();
6105238Sgblack@eecs.umich.edu                    0x1: decode MODRM_REG {
6115238Sgblack@eecs.umich.edu                        0x2: decode LEGACY_OP {
6125238Sgblack@eecs.umich.edu                            0x0: psrlw_PRq_Ib();
6135238Sgblack@eecs.umich.edu                            0x1: psrlw_VRo_Ib();
6145238Sgblack@eecs.umich.edu                        }
6155238Sgblack@eecs.umich.edu                        0x4: decode LEGACY_OP {
6165238Sgblack@eecs.umich.edu                            0x0: psraw_PRq_Ib();
6175238Sgblack@eecs.umich.edu                            0x1: psraw_VRo_Ib();
6185238Sgblack@eecs.umich.edu                        }
6195238Sgblack@eecs.umich.edu                        0x6: decode LEGACY_OP {
6205238Sgblack@eecs.umich.edu                            0x0: psllw_PRq_Ib();
6215238Sgblack@eecs.umich.edu                            0x1: psllw_VRo_Ib();
6225238Sgblack@eecs.umich.edu                        }
6235238Sgblack@eecs.umich.edu                        default: Inst::UD2();
6245238Sgblack@eecs.umich.edu                    }
6255238Sgblack@eecs.umich.edu                    //0x2: group14_pshimd();
6265238Sgblack@eecs.umich.edu                    0x2: decode MODRM_REG {
6275238Sgblack@eecs.umich.edu                        0x2: decode LEGACY_OP {
6285238Sgblack@eecs.umich.edu                            0x0: psrld_PRq_Ib();
6295238Sgblack@eecs.umich.edu                            0x1: psrld_VRo_Ib();
6305238Sgblack@eecs.umich.edu                        }
6315238Sgblack@eecs.umich.edu                        0x4: decode LEGACY_OP {
6325238Sgblack@eecs.umich.edu                            0x0: psrad_PRq_Ib();
6335238Sgblack@eecs.umich.edu                            0x1: psrad_VRo_Ib();
6345238Sgblack@eecs.umich.edu                        }
6355238Sgblack@eecs.umich.edu                        0x6: decode LEGACY_OP {
6365238Sgblack@eecs.umich.edu                            0x0: pslld_PRq_Ib();
6375238Sgblack@eecs.umich.edu                            0x1: pslld_VRo_Ib();
6385238Sgblack@eecs.umich.edu                        }
6395238Sgblack@eecs.umich.edu                        default: Inst::UD2();
6405238Sgblack@eecs.umich.edu                    }
6415238Sgblack@eecs.umich.edu                    //0x3: group15_pshimq();
6425238Sgblack@eecs.umich.edu                    0x3: decode MODRM_REG {
6435238Sgblack@eecs.umich.edu                        0x2: decode LEGACY_OP {
6445238Sgblack@eecs.umich.edu                            0x0: psrlq_PRq_Ib();
6455238Sgblack@eecs.umich.edu                            0x1: psrlq_VRo_Ib();
6465238Sgblack@eecs.umich.edu                        }
6475238Sgblack@eecs.umich.edu                        0x3: decode LEGACY_OP {
6485238Sgblack@eecs.umich.edu                            0x0: Inst::UD2();
6495238Sgblack@eecs.umich.edu                            0x1: psrldq_VRo_Ib();
6505238Sgblack@eecs.umich.edu                        }
6515238Sgblack@eecs.umich.edu                        0x6: decode LEGACY_OP {
6525238Sgblack@eecs.umich.edu                            0x0: psllq_PRq_Ib();
6535238Sgblack@eecs.umich.edu                            0x1: psllq_VRo_Ib();
6545238Sgblack@eecs.umich.edu                        }
6555238Sgblack@eecs.umich.edu                        0x7: decode LEGACY_OP {
6565238Sgblack@eecs.umich.edu                            0x0: Inst::UD2();
6575238Sgblack@eecs.umich.edu                            0x1: pslldq_VRo_Ib();
6585238Sgblack@eecs.umich.edu                        }
6595238Sgblack@eecs.umich.edu                        default: Inst::UD2();
6605238Sgblack@eecs.umich.edu                    }
6615020Sgblack@eecs.umich.edu                    0x4: pcmpeqb_Pq_Qq();
6625020Sgblack@eecs.umich.edu                    0x5: pcmpeqw_Pq_Qq();
6635020Sgblack@eecs.umich.edu                    0x6: pcmpeqd_Pq_Qq();
6645020Sgblack@eecs.umich.edu                    0x7: emms();
6655020Sgblack@eecs.umich.edu                }
6665020Sgblack@eecs.umich.edu                // repe (0xF3)
6675020Sgblack@eecs.umich.edu                0x4: decode OPCODE_OP_BOTTOM3 {
6685020Sgblack@eecs.umich.edu                    0x0: pshufhw_Vo_Wo_Ib();
6695020Sgblack@eecs.umich.edu                    default: Inst::UD2();
6705020Sgblack@eecs.umich.edu                }
6715020Sgblack@eecs.umich.edu                // operand size (0x66)
6725020Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
6735020Sgblack@eecs.umich.edu                    0x0: pshufd_Vo_Wo_Ib();
6745238Sgblack@eecs.umich.edu                    //0x1: group13_pshimw();
6755238Sgblack@eecs.umich.edu                    0x1: decode MODRM_REG {
6765238Sgblack@eecs.umich.edu                        0x2: decode LEGACY_OP {
6775238Sgblack@eecs.umich.edu                            0x0: psrlw_PRq_Ib();
6785238Sgblack@eecs.umich.edu                            0x1: psrlw_VRo_Ib();
6795238Sgblack@eecs.umich.edu                        }
6805238Sgblack@eecs.umich.edu                        0x4: decode LEGACY_OP {
6815238Sgblack@eecs.umich.edu                            0x0: psraw_PRq_Ib();
6825238Sgblack@eecs.umich.edu                            0x1: psraw_VRo_Ib();
6835238Sgblack@eecs.umich.edu                        }
6845238Sgblack@eecs.umich.edu                        0x6: decode LEGACY_OP {
6855238Sgblack@eecs.umich.edu                            0x0: psllw_PRq_Ib();
6865238Sgblack@eecs.umich.edu                            0x1: psllw_VRo_Ib();
6875238Sgblack@eecs.umich.edu                        }
6885238Sgblack@eecs.umich.edu                        default: Inst::UD2();
6895238Sgblack@eecs.umich.edu                    }
6905238Sgblack@eecs.umich.edu                    //0x2: group14_pshimd();
6915238Sgblack@eecs.umich.edu                    0x2: decode MODRM_REG {
6925238Sgblack@eecs.umich.edu                        0x2: decode LEGACY_OP {
6935238Sgblack@eecs.umich.edu                            0x0: psrld_PRq_Ib();
6945238Sgblack@eecs.umich.edu                            0x1: psrld_VRo_Ib();
6955238Sgblack@eecs.umich.edu                        }
6965238Sgblack@eecs.umich.edu                        0x4: decode LEGACY_OP {
6975238Sgblack@eecs.umich.edu                            0x0: psrad_PRq_Ib();
6985238Sgblack@eecs.umich.edu                            0x1: psrad_VRo_Ib();
6995238Sgblack@eecs.umich.edu                        }
7005238Sgblack@eecs.umich.edu                        0x6: decode LEGACY_OP {
7015238Sgblack@eecs.umich.edu                            0x0: pslld_PRq_Ib();
7025238Sgblack@eecs.umich.edu                            0x1: pslld_VRo_Ib();
7035238Sgblack@eecs.umich.edu                        }
7045238Sgblack@eecs.umich.edu                        default: Inst::UD2();
7055238Sgblack@eecs.umich.edu                    }
7065238Sgblack@eecs.umich.edu                    //0x3: group15_pshimq();
7075238Sgblack@eecs.umich.edu                    0x3: decode MODRM_REG {
7085238Sgblack@eecs.umich.edu                        0x2: decode LEGACY_OP {
7095238Sgblack@eecs.umich.edu                            0x0: psrlq_PRq_Ib();
7105238Sgblack@eecs.umich.edu                            0x1: psrlq_VRo_Ib();
7115238Sgblack@eecs.umich.edu                        }
7125238Sgblack@eecs.umich.edu                        0x3: decode LEGACY_OP {
7135238Sgblack@eecs.umich.edu                            0x0: Inst::UD2();
7145238Sgblack@eecs.umich.edu                            0x1: psrldq_VRo_Ib();
7155238Sgblack@eecs.umich.edu                        }
7165238Sgblack@eecs.umich.edu                        0x6: decode LEGACY_OP {
7175238Sgblack@eecs.umich.edu                            0x0: psllq_PRq_Ib();
7185238Sgblack@eecs.umich.edu                            0x1: psllq_VRo_Ib();
7195238Sgblack@eecs.umich.edu                        }
7205238Sgblack@eecs.umich.edu                        0x7: decode LEGACY_OP {
7215238Sgblack@eecs.umich.edu                            0x0: Inst::UD2();
7225238Sgblack@eecs.umich.edu                            0x1: pslldq_VRo_Ib();
7235238Sgblack@eecs.umich.edu                        }
7245238Sgblack@eecs.umich.edu                        default: Inst::UD2();
7255238Sgblack@eecs.umich.edu                    }
7265020Sgblack@eecs.umich.edu                    0x4: pcmpeqb_Vo_Wo();
7275020Sgblack@eecs.umich.edu                    0x5: pcmpeqw_Vo_Wo();
7285020Sgblack@eecs.umich.edu                    0x6: pcmpeqd_Vo_Wo();
7295020Sgblack@eecs.umich.edu                    default: Inst::UD2();
7305020Sgblack@eecs.umich.edu                }
7315020Sgblack@eecs.umich.edu                // repne (0xF2)
7325020Sgblack@eecs.umich.edu                0x8: decode OPCODE_OP_BOTTOM3 {
7335020Sgblack@eecs.umich.edu                    0x0: pshuflw_Vo_Wo_Ib();
7345020Sgblack@eecs.umich.edu                    default: Inst::UD2();
7355020Sgblack@eecs.umich.edu                }
7365020Sgblack@eecs.umich.edu                default: Inst::UD2();
7374276Sgblack@eecs.umich.edu            }
7385020Sgblack@eecs.umich.edu            0x0F: decode LEGACY_DECODEVAL {
7395020Sgblack@eecs.umich.edu                // no prefix
7405020Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
7415020Sgblack@eecs.umich.edu                    0x0: vmread_Ed_or_Eq_Gd_or_Gq();
7425020Sgblack@eecs.umich.edu                    0x1: vmwrite_Gd_or_Gq_Ed_or_Eq();
7435020Sgblack@eecs.umich.edu                    0x6: mov_Ed_Pd();
7445020Sgblack@eecs.umich.edu                    0x7: mov_Qq_Pq();
7455020Sgblack@eecs.umich.edu                    default: Inst::UD2();
7465020Sgblack@eecs.umich.edu                }
7475020Sgblack@eecs.umich.edu                // repe (0xF3)
7485020Sgblack@eecs.umich.edu                0x4: decode OPCODE_OP_BOTTOM3 {
7495020Sgblack@eecs.umich.edu                    0x6: movq_Vo_Mq_or_Vq_Vq();
7505020Sgblack@eecs.umich.edu                    0x7: movdqu_Wo_Vo();
7515020Sgblack@eecs.umich.edu                    default: Inst::UD2();
7525020Sgblack@eecs.umich.edu                }
7535020Sgblack@eecs.umich.edu                // operand size (0x66)
7545020Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
7555020Sgblack@eecs.umich.edu                    0x4: haddpd_Vo_Wo();
7565020Sgblack@eecs.umich.edu                    0x5: hsubpd_Vo_Wo();
7575020Sgblack@eecs.umich.edu                    0x6: movd_Ed_Vd();
7585020Sgblack@eecs.umich.edu                    0x7: movdqa_Wo_Vo();
7595020Sgblack@eecs.umich.edu                    default: Inst::UD2();
7605020Sgblack@eecs.umich.edu                }
7615020Sgblack@eecs.umich.edu                // repne (0xF2)
7625020Sgblack@eecs.umich.edu                0x8: decode OPCODE_OP_BOTTOM3 {
7635020Sgblack@eecs.umich.edu                    0x4: haddps_Vo_Wo();
7645020Sgblack@eecs.umich.edu                    0x5: hsubps_Vo_Wo();
7655020Sgblack@eecs.umich.edu                    default: Inst::UD2();
7665020Sgblack@eecs.umich.edu                }
7675020Sgblack@eecs.umich.edu                default: Inst::UD2();
7684276Sgblack@eecs.umich.edu            }
7694727Sgblack@eecs.umich.edu            format Inst {
7704727Sgblack@eecs.umich.edu                0x10: decode OPCODE_OP_BOTTOM3 {
7714727Sgblack@eecs.umich.edu                    0x0: JO(Jz);
7724727Sgblack@eecs.umich.edu                    0x1: JNO(Jz);
7734727Sgblack@eecs.umich.edu                    0x2: JB(Jz);
7744727Sgblack@eecs.umich.edu                    0x3: JNB(Jz);
7754727Sgblack@eecs.umich.edu                    0x4: JZ(Jz);
7764727Sgblack@eecs.umich.edu                    0x5: JNZ(Jz);
7774727Sgblack@eecs.umich.edu                    0x6: JBE(Jz);
7784727Sgblack@eecs.umich.edu                    0x7: JNBE(Jz);
7794727Sgblack@eecs.umich.edu                }
7804727Sgblack@eecs.umich.edu                0x11: decode OPCODE_OP_BOTTOM3 {
7814727Sgblack@eecs.umich.edu                    0x0: JS(Jz);
7824727Sgblack@eecs.umich.edu                    0x1: JNS(Jz);
7834727Sgblack@eecs.umich.edu                    0x2: JP(Jz);
7844727Sgblack@eecs.umich.edu                    0x3: JNP(Jz);
7854727Sgblack@eecs.umich.edu                    0x4: JL(Jz);
7864727Sgblack@eecs.umich.edu                    0x5: JNL(Jz);
7874727Sgblack@eecs.umich.edu                    0x6: JLE(Jz);
7884727Sgblack@eecs.umich.edu                    0x7: JNLE(Jz);
7894727Sgblack@eecs.umich.edu                }
7904760Sgblack@eecs.umich.edu                0x12: decode OPCODE_OP_BOTTOM3 {
7914760Sgblack@eecs.umich.edu                    0x0: SETO(Eb);
7924760Sgblack@eecs.umich.edu                    0x1: SETNO(Eb);
7934760Sgblack@eecs.umich.edu                    0x2: SETB(Eb);
7944760Sgblack@eecs.umich.edu                    0x3: SETNB(Eb);
7954760Sgblack@eecs.umich.edu                    0x4: SETZ(Eb);
7964760Sgblack@eecs.umich.edu                    0x5: SETNZ(Eb);
7974760Sgblack@eecs.umich.edu                    0x6: SETBE(Eb);
7984760Sgblack@eecs.umich.edu                    0x7: SETNBE(Eb);
7994760Sgblack@eecs.umich.edu                }
8004760Sgblack@eecs.umich.edu                0x13: decode OPCODE_OP_BOTTOM3 {
8014760Sgblack@eecs.umich.edu                    0x0: SETS(Eb);
8024760Sgblack@eecs.umich.edu                    0x1: SETNS(Eb);
8034760Sgblack@eecs.umich.edu                    0x2: SETP(Eb);
8044760Sgblack@eecs.umich.edu                    0x3: SETNP(Eb);
8054760Sgblack@eecs.umich.edu                    0x4: SETL(Eb);
8064760Sgblack@eecs.umich.edu                    0x5: SETNL(Eb);
8074760Sgblack@eecs.umich.edu                    0x6: SETLE(Eb);
8084760Sgblack@eecs.umich.edu                    0x7: SETNLE(Eb);
8094760Sgblack@eecs.umich.edu                }
8104276Sgblack@eecs.umich.edu            }
8114276Sgblack@eecs.umich.edu            0x14: decode OPCODE_OP_BOTTOM3 {
8124712Sgblack@eecs.umich.edu                0x0: push_fs();
8134712Sgblack@eecs.umich.edu                0x1: pop_fs();
8145659Sgblack@eecs.umich.edu                0x2: CPUIDInst::CPUID({{
8155659Sgblack@eecs.umich.edu                    CpuidResult result;
8166052Sgblack@eecs.umich.edu                    success = doCpuid(xc->tcBase(), bits(Rax, 31, 0), result);
8175659Sgblack@eecs.umich.edu                    Rax = result.rax;
8185659Sgblack@eecs.umich.edu                    Rbx = result.rbx;
8195659Sgblack@eecs.umich.edu                    Rcx = result.rcx;
8205659Sgblack@eecs.umich.edu                    Rdx = result.rdx;
8215659Sgblack@eecs.umich.edu                    }});
8225240Sgblack@eecs.umich.edu                0x3: Inst::BT(Ev,Gv);
8236480Sgblack@eecs.umich.edu                0x4: Inst::SHLD(Ev,Gv,Ib);
8246480Sgblack@eecs.umich.edu                0x5: Inst::SHLD(Ev,Gv);
8254712Sgblack@eecs.umich.edu                0x6: xbts_and_cmpxchg();
8264712Sgblack@eecs.umich.edu                0x7: ibts_and_cmpxchg();
8274276Sgblack@eecs.umich.edu            }
8284276Sgblack@eecs.umich.edu            0x15: decode OPCODE_OP_BOTTOM3 {
8294712Sgblack@eecs.umich.edu                0x0: push_gs();
8304712Sgblack@eecs.umich.edu                0x1: pop_gs();
8314712Sgblack@eecs.umich.edu                0x2: rsm_smm();
8325240Sgblack@eecs.umich.edu                0x3: Inst::BTS(Ev,Gv);
8335977Sgblack@eecs.umich.edu                0x4: Inst::SHRD(Ev,Gv,Ib);
8344712Sgblack@eecs.umich.edu                0x5: shrd_Ev_Gv_rCl();
8355238Sgblack@eecs.umich.edu                //0x6: group16();
8365967Sgblack@eecs.umich.edu                0x6: decode MODRM_REG {
8375967Sgblack@eecs.umich.edu                    0x0: fxsave();
8385967Sgblack@eecs.umich.edu                    0x1: fxrstor();
8395967Sgblack@eecs.umich.edu                    0x2: ldmxcsr();
8405967Sgblack@eecs.umich.edu                    0x3: stmxcsr();
8415967Sgblack@eecs.umich.edu                    0x4: Inst::UD2();
8425967Sgblack@eecs.umich.edu                    0x5: decode MODRM_MOD {
8435967Sgblack@eecs.umich.edu                        0x3: BasicOperate::LFENCE(
8445923Sgblack@eecs.umich.edu                                     {{/*Nothing*/}}, IsReadBarrier);
8455238Sgblack@eecs.umich.edu                        default: Inst::UD2();
8465238Sgblack@eecs.umich.edu                    }
8475967Sgblack@eecs.umich.edu                    0x6: decode MODRM_MOD {
8485967Sgblack@eecs.umich.edu                        0x3: BasicOperate::MFENCE(
8495967Sgblack@eecs.umich.edu                                     {{/*Nothing*/}}, IsMemBarrier);
8505967Sgblack@eecs.umich.edu                        default: Inst::UD2();
8515967Sgblack@eecs.umich.edu                    }
8525967Sgblack@eecs.umich.edu                    0x7: decode MODRM_MOD {
8535967Sgblack@eecs.umich.edu                        0x3: BasicOperate::SFENCE(
8545967Sgblack@eecs.umich.edu                                     {{/*Nothing*/}}, IsWriteBarrier);
8555238Sgblack@eecs.umich.edu                        default: Inst::UD2();
8565238Sgblack@eecs.umich.edu                    }
8575238Sgblack@eecs.umich.edu                }
8584724Sgblack@eecs.umich.edu                0x7: Inst::IMUL(Gv,Ev);
8594276Sgblack@eecs.umich.edu            }
8604276Sgblack@eecs.umich.edu            0x16: decode OPCODE_OP_BOTTOM3 {
8614864Sgblack@eecs.umich.edu                0x0: Inst::CMPXCHG(Eb,Gb);
8624864Sgblack@eecs.umich.edu                0x1: Inst::CMPXCHG(Ev,Gv);
8634712Sgblack@eecs.umich.edu                0x2: lss_Gz_Mp();
8645240Sgblack@eecs.umich.edu                0x3: Inst::BTR(Ev,Gv);
8654712Sgblack@eecs.umich.edu                0x4: lfs_Gz_Mp();
8664712Sgblack@eecs.umich.edu                0x5: lgs_Gz_Mp();
8674746Sgblack@eecs.umich.edu                //The size of the second operand in these instructions should
8684746Sgblack@eecs.umich.edu                //really be "b" or "w", but it's set to v in order to have a
8694746Sgblack@eecs.umich.edu                //consistent register size. This shouldn't affect behavior.
8704746Sgblack@eecs.umich.edu                0x6: Inst::MOVZX_B(Gv,Ev);
8714746Sgblack@eecs.umich.edu                0x7: Inst::MOVZX_W(Gv,Ev);
8724276Sgblack@eecs.umich.edu            }
8734276Sgblack@eecs.umich.edu            0x17: decode OPCODE_OP_BOTTOM3 {
8744712Sgblack@eecs.umich.edu                0x0: jmpe_Jz(); // IA-64?
8755240Sgblack@eecs.umich.edu                format Inst {
8765240Sgblack@eecs.umich.edu                    //0x1: group11_UD2();
8775240Sgblack@eecs.umich.edu                    0x1: UD2();
8785240Sgblack@eecs.umich.edu                    //0x2: group8_Ev_Ib();
8795240Sgblack@eecs.umich.edu                    0x2: decode MODRM_REG {
8805240Sgblack@eecs.umich.edu                        0x4: BT(Ev,Ib);
8815240Sgblack@eecs.umich.edu                        0x5: BTS(Ev,Ib);
8825240Sgblack@eecs.umich.edu                        0x6: BTR(Ev,Ib);
8835240Sgblack@eecs.umich.edu                        0x7: BTC(Ev,Ib);
8845240Sgblack@eecs.umich.edu                        default: UD2();
8855240Sgblack@eecs.umich.edu                    }
8865240Sgblack@eecs.umich.edu                    0x3: BTC(Ev,Gv);
8875238Sgblack@eecs.umich.edu                }
8885332Sgblack@eecs.umich.edu                0x4: Inst::BSF(Gv,Ev);
8895332Sgblack@eecs.umich.edu                0x5: Inst::BSR(Gv,Ev);
8904746Sgblack@eecs.umich.edu                //The size of the second operand in these instructions should
8914746Sgblack@eecs.umich.edu                //really be "b" or "w", but it's set to v in order to have a
8924746Sgblack@eecs.umich.edu                //consistent register size. This shouldn't affect behavior.
8934746Sgblack@eecs.umich.edu                0x6: Inst::MOVSX_B(Gv,Ev);
8944746Sgblack@eecs.umich.edu                0x7: Inst::MOVSX_W(Gv,Ev);
8954276Sgblack@eecs.umich.edu            }
8964276Sgblack@eecs.umich.edu            0x18: decode OPCODE_OP_BOTTOM3 {
8975815Sgblack@eecs.umich.edu                0x0: Inst::XADD(Eb,Gb);
8985815Sgblack@eecs.umich.edu                0x1: Inst::XADD(Ev,Gv);
8995238Sgblack@eecs.umich.edu                //0x7: group9();
9005238Sgblack@eecs.umich.edu                0x7: decode MODRM_REG {
9015238Sgblack@eecs.umich.edu                    0x1: cmpxchg_Mq();
9025238Sgblack@eecs.umich.edu                    0x6: decode LEGACY_OP {
9035238Sgblack@eecs.umich.edu                        0x1: vmclear_Mq();
9045238Sgblack@eecs.umich.edu                        default: decode LEGACY_REP {
9055238Sgblack@eecs.umich.edu                            0x1: vmxon_Mq();
9065238Sgblack@eecs.umich.edu                            0x0: vmptrld_Mq();
9075238Sgblack@eecs.umich.edu                        }
9085238Sgblack@eecs.umich.edu                    }
9095238Sgblack@eecs.umich.edu                    0x7: vmptrst_Mq();
9105238Sgblack@eecs.umich.edu                    default: Inst::UD2();
9115238Sgblack@eecs.umich.edu                }
9125020Sgblack@eecs.umich.edu                default: decode LEGACY_DECODEVAL {
9135020Sgblack@eecs.umich.edu                    // no prefix
9145020Sgblack@eecs.umich.edu                    0x0: decode OPCODE_OP_BOTTOM3 {
9155020Sgblack@eecs.umich.edu                        0x2: cmpccps_Vo_Wo_Ib();
9165020Sgblack@eecs.umich.edu                        0x3: cvtdq2ps_Vo_Wo();
9175020Sgblack@eecs.umich.edu                        0x4: subps_Vo_Wo();
9185020Sgblack@eecs.umich.edu                        0x5: minps_Vo_Wo();
9195020Sgblack@eecs.umich.edu                        0x6: divps_Vo_Wo();
9205020Sgblack@eecs.umich.edu                    }
9215020Sgblack@eecs.umich.edu                    // repe (0xF3)
9225020Sgblack@eecs.umich.edu                    0x4: decode OPCODE_OP_BOTTOM3 {
9235020Sgblack@eecs.umich.edu                        0x2: cmpccss_Vd_Wd_Ib();
9245020Sgblack@eecs.umich.edu                        default: Inst::UD2();
9255020Sgblack@eecs.umich.edu                    }
9265020Sgblack@eecs.umich.edu                    // operand size (0x66)
9275020Sgblack@eecs.umich.edu                    0x1: decode OPCODE_OP_BOTTOM3 {
9285020Sgblack@eecs.umich.edu                        0x2: cmpccpd_Vo_Wo_Ib();
9295020Sgblack@eecs.umich.edu                        0x4: subpd_Vo_Wo();
9305020Sgblack@eecs.umich.edu                        0x5: minpd_Vo_Wo();
9315020Sgblack@eecs.umich.edu                        0x6: divpd_Vo_Wo();
9325020Sgblack@eecs.umich.edu                        default: Inst::UD2();
9335020Sgblack@eecs.umich.edu                    }
9345020Sgblack@eecs.umich.edu                    // repne (0xF2)
9355020Sgblack@eecs.umich.edu                    0x8: decode OPCODE_OP_BOTTOM3 {
9365020Sgblack@eecs.umich.edu                        0x2: cmpccsd_Vq_Wq_Ib();
9375020Sgblack@eecs.umich.edu                        default: Inst::UD2();
9385020Sgblack@eecs.umich.edu                    }
9395020Sgblack@eecs.umich.edu                    default: Inst::UD2();
9405020Sgblack@eecs.umich.edu                }
9414276Sgblack@eecs.umich.edu            }
9425814Sgblack@eecs.umich.edu            0x19: decode OPSIZE {
9435814Sgblack@eecs.umich.edu                4: Inst::BSWAP_D(Bd);
9445814Sgblack@eecs.umich.edu                8: Inst::BSWAP_Q(Bq);
9455814Sgblack@eecs.umich.edu                default: Inst::UD2();
9465814Sgblack@eecs.umich.edu            }
9475020Sgblack@eecs.umich.edu            0x1A: decode LEGACY_DECODEVAL {
9485020Sgblack@eecs.umich.edu                // no prefix
9495020Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
9505020Sgblack@eecs.umich.edu                    0x1: psrlw_Pq_Qq();
9515020Sgblack@eecs.umich.edu                    0x2: psrld_Pq_Qq();
9525020Sgblack@eecs.umich.edu                    0x3: psrlq_Pq_Qq();
9535020Sgblack@eecs.umich.edu                    0x4: paddq_Pq_Qq();
9545020Sgblack@eecs.umich.edu                    0x5: pmullw_Pq_Qq();
9555020Sgblack@eecs.umich.edu                    0x7: pmovmskb_Gd_PRq();
9565020Sgblack@eecs.umich.edu                    default: Inst::UD2();
9575020Sgblack@eecs.umich.edu                }
9585020Sgblack@eecs.umich.edu                // repe (0xF3)
9595020Sgblack@eecs.umich.edu                0x4: decode OPCODE_OP_BOTTOM3 {
9605020Sgblack@eecs.umich.edu                    0x6: movq2dq_Vo_PRq();
9615020Sgblack@eecs.umich.edu                    default: Inst::UD2();
9625020Sgblack@eecs.umich.edu                }
9635020Sgblack@eecs.umich.edu                // operand size (0x66)
9645020Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
9655020Sgblack@eecs.umich.edu                    0x0: addsubpd_Vo_Wo();
9665020Sgblack@eecs.umich.edu                    0x1: psrlw_Vo_Wo();
9675020Sgblack@eecs.umich.edu                    0x2: psrld_Vo_Wo();
9685020Sgblack@eecs.umich.edu                    0x3: psrlq_Vo_Wo();
9695020Sgblack@eecs.umich.edu                    0x4: paddq_Vo_Wo();
9705020Sgblack@eecs.umich.edu                    0x5: pmullw_Vo_Wo();
9715020Sgblack@eecs.umich.edu                    0x6: decode MODRM_MOD {
9725020Sgblack@eecs.umich.edu                        0x3: movq_Vq_Vq();
9735020Sgblack@eecs.umich.edu                        default: movq_Mq_Vq();
9745020Sgblack@eecs.umich.edu                    }
9755020Sgblack@eecs.umich.edu                    0x7: pmovmskb_Gd_VRo();
9765020Sgblack@eecs.umich.edu                }
9775020Sgblack@eecs.umich.edu                // repne (0xF2)
9785020Sgblack@eecs.umich.edu                0x8: decode OPCODE_OP_BOTTOM3 {
9795020Sgblack@eecs.umich.edu                    0x0: addsubps_Vo_Wo();
9805020Sgblack@eecs.umich.edu                    0x6: movdq2q_Pq_VRq();
9815020Sgblack@eecs.umich.edu                    default: Inst::UD2();
9825020Sgblack@eecs.umich.edu                }
9835020Sgblack@eecs.umich.edu                default: Inst::UD2();
9844276Sgblack@eecs.umich.edu            }
9855020Sgblack@eecs.umich.edu            0x1B: decode LEGACY_DECODEVAL {
9865020Sgblack@eecs.umich.edu                // no prefix
9875020Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
9885020Sgblack@eecs.umich.edu                    0x0: psubusb_Pq_Qq();
9895020Sgblack@eecs.umich.edu                    0x1: psubusw_Pq_Qq();
9905020Sgblack@eecs.umich.edu                    0x2: pminub_Pq_Qq();
9915020Sgblack@eecs.umich.edu                    0x3: pand_Pq_Qq();
9925020Sgblack@eecs.umich.edu                    0x4: paddusb_Pq_Qq();
9935020Sgblack@eecs.umich.edu                    0x5: paddusw_Pq_Qq();
9945020Sgblack@eecs.umich.edu                    0x6: pmaxub_Pq_Qq();
9955020Sgblack@eecs.umich.edu                    0x7: pandn_Pq_Qq();
9965020Sgblack@eecs.umich.edu                }
9975020Sgblack@eecs.umich.edu                // operand size (0x66)
9985020Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
9995020Sgblack@eecs.umich.edu                    0x0: psubusb_Vo_Wo();
10005020Sgblack@eecs.umich.edu                    0x1: psubusw_Vo_Wo();
10015020Sgblack@eecs.umich.edu                    0x2: pminub_Vo_Wo();
10025020Sgblack@eecs.umich.edu                    0x3: pand_Vo_Wo();
10035020Sgblack@eecs.umich.edu                    0x4: paddusb_Vo_Wo();
10045020Sgblack@eecs.umich.edu                    0x5: paddusw_Vo_Wo();
10055020Sgblack@eecs.umich.edu                    0x6: pmaxub_Vo_Wo();
10065020Sgblack@eecs.umich.edu                    0x7: pandn_Vo_Wo();
10075020Sgblack@eecs.umich.edu                }
10085020Sgblack@eecs.umich.edu                default: Inst::UD2();
10094276Sgblack@eecs.umich.edu            }
10105022Sgblack@eecs.umich.edu            0x1C: decode LEGACY_DECODEVAL {
10115022Sgblack@eecs.umich.edu                // no prefix
10125022Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
10135022Sgblack@eecs.umich.edu                    0x0: pavgb_Pq_Qq();
10145022Sgblack@eecs.umich.edu                    0x1: psraw_Pq_Qq();
10155022Sgblack@eecs.umich.edu                    0x2: psrad_Pq_Qq();
10165022Sgblack@eecs.umich.edu                    0x3: pavgw_Pq_Qq();
10175022Sgblack@eecs.umich.edu                    0x4: pmulhuw_Pq_Qq();
10185022Sgblack@eecs.umich.edu                    0x5: pmulhw_Pq_Qq();
10195022Sgblack@eecs.umich.edu                    0x7: movntq_Mq_Pq();
10205022Sgblack@eecs.umich.edu                    default: Inst::UD2();
10215022Sgblack@eecs.umich.edu                }
10225022Sgblack@eecs.umich.edu                // repe (0xF3)
10235022Sgblack@eecs.umich.edu                0x4: decode OPCODE_OP_BOTTOM3 {
10245022Sgblack@eecs.umich.edu                    0x6: cvtdq2pd_Vo_Wq();
10255022Sgblack@eecs.umich.edu                    default: Inst::UD2();
10265022Sgblack@eecs.umich.edu                }
10275022Sgblack@eecs.umich.edu                // operand size (0x66)
10285022Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
10295022Sgblack@eecs.umich.edu                    0x0: pavgb_Vo_Wo();
10305022Sgblack@eecs.umich.edu                    0x1: psraw_Vo_Wo();
10315022Sgblack@eecs.umich.edu                    0x2: psrad_Vo_Wo();
10325022Sgblack@eecs.umich.edu                    0x3: pavgw_Vo_Wo();
10335022Sgblack@eecs.umich.edu                    0x4: pmulhuw_Vo_Wo();
10345022Sgblack@eecs.umich.edu                    0x5: pmulhw_Vo_Wo();
10355022Sgblack@eecs.umich.edu                    0x6: cvttpd2dq_Vo_Wo();
10365022Sgblack@eecs.umich.edu                    0x7: movntdq_Mo_Vo();
10375022Sgblack@eecs.umich.edu                }
10385022Sgblack@eecs.umich.edu                // repne (0xF2)
10395022Sgblack@eecs.umich.edu                0x8: decode OPCODE_OP_BOTTOM3 {
10405022Sgblack@eecs.umich.edu                    0x6: cvtpd2dq_Vo_Wo();
10415022Sgblack@eecs.umich.edu                    default: Inst::UD2();
10425022Sgblack@eecs.umich.edu                }
10435022Sgblack@eecs.umich.edu                default: Inst::UD2();
10444276Sgblack@eecs.umich.edu            }
10455020Sgblack@eecs.umich.edu            0x1D: decode LEGACY_DECODEVAL {
10465020Sgblack@eecs.umich.edu                // no prefix
10475020Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
10485020Sgblack@eecs.umich.edu                    0x0: psubsb_Pq_Qq();
10495020Sgblack@eecs.umich.edu                    0x1: psubsw_Pq_Qq();
10505020Sgblack@eecs.umich.edu                    0x2: pminsw_Pq_Qq();
10515020Sgblack@eecs.umich.edu                    0x3: por_Pq_Qq();
10525020Sgblack@eecs.umich.edu                    0x4: paddsb_Pq_Qq();
10535020Sgblack@eecs.umich.edu                    0x5: paddsw_Pq_Qq();
10545020Sgblack@eecs.umich.edu                    0x6: pmaxsw_Pq_Qq();
10555020Sgblack@eecs.umich.edu                    0x7: pxor_Pq_Qq();
10565020Sgblack@eecs.umich.edu                }
10575020Sgblack@eecs.umich.edu                // operand size (0x66)
10585020Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
10595020Sgblack@eecs.umich.edu                    0x0: psubsb_Vo_Wo();
10605020Sgblack@eecs.umich.edu                    0x1: psubsw_Vo_Wo();
10615020Sgblack@eecs.umich.edu                    0x2: pminsw_Vo_Wo();
10625020Sgblack@eecs.umich.edu                    0x3: por_Vo_Wo();
10635020Sgblack@eecs.umich.edu                    0x4: paddsb_Vo_Wo();
10645020Sgblack@eecs.umich.edu                    0x5: paddsw_Vo_Wo();
10655020Sgblack@eecs.umich.edu                    0x6: pmaxsw_Vo_Wo();
10665020Sgblack@eecs.umich.edu                    0x7: pxor_Vo_Wo();
10675020Sgblack@eecs.umich.edu                }
10685020Sgblack@eecs.umich.edu                default: Inst::UD2();
10694276Sgblack@eecs.umich.edu            }
10706477Sgblack@eecs.umich.edu            0x1E: decode LEGACY_DECODEVAL {
10715022Sgblack@eecs.umich.edu                // no prefix
10725022Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
10735022Sgblack@eecs.umich.edu                    0x1: psllw_Pq_Qq();
10745022Sgblack@eecs.umich.edu                    0x2: pslld_Pq_Qq();
10755022Sgblack@eecs.umich.edu                    0x3: psllq_Pq_Qq();
10765022Sgblack@eecs.umich.edu                    0x4: pmuludq_Pq_Qq();
10775022Sgblack@eecs.umich.edu                    0x5: pmaddwd_Pq_Qq();
10785022Sgblack@eecs.umich.edu                    0x6: psadbw_Pq_Qq();
10795022Sgblack@eecs.umich.edu                    0x7: maskmovq_Pq_PRq();
10805022Sgblack@eecs.umich.edu                    default: Inst::UD2();
10815022Sgblack@eecs.umich.edu                }
10825022Sgblack@eecs.umich.edu                // operand size (0x66)
10835022Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
10845022Sgblack@eecs.umich.edu                    0x1: psllw_Vo_Wo();
10855022Sgblack@eecs.umich.edu                    0x2: pslld_Vo_Wo();
10865022Sgblack@eecs.umich.edu                    0x3: psllq_Vo_Wo();
10875022Sgblack@eecs.umich.edu                    0x4: pmuludq_Vo_Wo();
10885022Sgblack@eecs.umich.edu                    0x5: pmaddwd_Vo_Wo();
10895022Sgblack@eecs.umich.edu                    0x6: psadbw_Vo_Wo();
10905022Sgblack@eecs.umich.edu                    0x7: maskmovdqu_Vo_VRo();
10915022Sgblack@eecs.umich.edu                    default: Inst::UD2();
10925022Sgblack@eecs.umich.edu                }
10935022Sgblack@eecs.umich.edu                // repne (0xF2)
10945022Sgblack@eecs.umich.edu                0x8: decode OPCODE_OP_BOTTOM3 {
10955022Sgblack@eecs.umich.edu                    0x0: lddqu_Vo_Mo();
10965022Sgblack@eecs.umich.edu                    default: Inst::UD2();
10975022Sgblack@eecs.umich.edu                }
10985022Sgblack@eecs.umich.edu                default: Inst::UD2();
10994276Sgblack@eecs.umich.edu            }
11005020Sgblack@eecs.umich.edu            0x1F: decode LEGACY_DECODEVAL {
11015020Sgblack@eecs.umich.edu                // no prefix
11025020Sgblack@eecs.umich.edu                0x0: decode OPCODE_OP_BOTTOM3 {
11035020Sgblack@eecs.umich.edu                    0x0: psubb_Pq_Qq();
11045020Sgblack@eecs.umich.edu                    0x1: psubw_Pq_Qq();
11055020Sgblack@eecs.umich.edu                    0x2: psubd_Pq_Qq();
11065020Sgblack@eecs.umich.edu                    0x3: psubq_Pq_Qq();
11075020Sgblack@eecs.umich.edu                    0x4: paddb_Pq_Qq();
11085020Sgblack@eecs.umich.edu                    0x5: paddw_Pq_Qq();
11095020Sgblack@eecs.umich.edu                    0x6: paddd_Pq_Qq();
11105020Sgblack@eecs.umich.edu                    0x7: Inst::UD2();
11115020Sgblack@eecs.umich.edu                }
11125020Sgblack@eecs.umich.edu                // operand size (0x66)
11135020Sgblack@eecs.umich.edu                0x1: decode OPCODE_OP_BOTTOM3 {
11145020Sgblack@eecs.umich.edu                    0x0: psubb_Vo_Wo();
11155020Sgblack@eecs.umich.edu                    0x1: psubw_Vo_Wo();
11165020Sgblack@eecs.umich.edu                    0x2: psubd_Vo_Wo();
11175020Sgblack@eecs.umich.edu                    0x3: psubq_Vo_Wo();
11185020Sgblack@eecs.umich.edu                    0x4: paddb_Vo_Wo();
11195020Sgblack@eecs.umich.edu                    0x5: paddw_Vo_Wo();
11205020Sgblack@eecs.umich.edu                    0x6: paddd_Vo_Wo();
11215020Sgblack@eecs.umich.edu                    0x7: Inst::UD2();
11225020Sgblack@eecs.umich.edu                }
11235020Sgblack@eecs.umich.edu                default: Inst::UD2();
11244276Sgblack@eecs.umich.edu            }
11254276Sgblack@eecs.umich.edu            default: FailUnimpl::twoByteOps();
11264276Sgblack@eecs.umich.edu        }
11274276Sgblack@eecs.umich.edu    }
11284276Sgblack@eecs.umich.edu    default: M5InternalError::error(
11294276Sgblack@eecs.umich.edu        {{"Unexpected first opcode byte in two byte opcode!"}});
11304276Sgblack@eecs.umich.edu}
1131