two_byte_opcodes.isa revision 10959
17087Snate@binkert.org// Copyright (c) 2007-2008 The Hewlett-Packard Development Company
210959Sdavid.hashe@amd.com// Copyright (c) 2012-2013 AMD
37087Snate@binkert.org// All rights reserved.
47087Snate@binkert.org//
57087Snate@binkert.org// The license below extends only to copyright in the software and shall
67087Snate@binkert.org// not be construed as granting a license to any other intellectual
77087Snate@binkert.org// property including but not limited to intellectual property relating
87087Snate@binkert.org// to a hardware implementation of the functionality of the software
97087Snate@binkert.org// licensed hereunder.  You may use the software subject to the license
107087Snate@binkert.org// terms below provided that you ensure that this notice is replicated
117087Snate@binkert.org// unmodified and in its entirety in all distributions of the software,
127087Snate@binkert.org// modified or unmodified, in source code or in binary form.
137087Snate@binkert.org//
145331Sgblack@eecs.umich.edu// Copyright (c) 2008 The Regents of The University of Michigan
155331Sgblack@eecs.umich.edu// All rights reserved.
165331Sgblack@eecs.umich.edu//
175331Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without
185331Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are
195331Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright
205331Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer;
215331Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright
225331Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the
235331Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution;
245331Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its
255331Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from
265331Sgblack@eecs.umich.edu// this software without specific prior written permission.
275331Sgblack@eecs.umich.edu//
285331Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
295331Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
305331Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
315331Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
325331Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
335331Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
345331Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
355331Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
365331Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
375331Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
385331Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
395331Sgblack@eecs.umich.edu//
405331Sgblack@eecs.umich.edu// Authors: Gabe Black
415331Sgblack@eecs.umich.edu
424276Sgblack@eecs.umich.edu////////////////////////////////////////////////////////////////////
434276Sgblack@eecs.umich.edu//
444276Sgblack@eecs.umich.edu// Decode the two byte opcodes
454276Sgblack@eecs.umich.edu//
4610593Sgabeblack@google.com'X86ISA::TwoByteOpcode': decode OPCODE_OP_TOP5 {
4710593Sgabeblack@google.com    format WarnUnimpl {
4810593Sgabeblack@google.com        0x00: decode OPCODE_OP_BOTTOM3 {
4910593Sgabeblack@google.com            //0x00: group6();
5010593Sgabeblack@google.com            0x00: decode MODRM_REG {
5110593Sgabeblack@google.com                0x0: sldt_Mw_or_Rv();
5210593Sgabeblack@google.com                0x1: str_Mw_or_Rv();
5310593Sgabeblack@google.com                0x2: Inst::LLDT(Ew);
5410593Sgabeblack@google.com                0x3: Inst::LTR(Ew);
5510593Sgabeblack@google.com                0x4: verr_Mw_or_Rv();
5610593Sgabeblack@google.com                0x5: verw_Mw_or_Rv();
5710593Sgabeblack@google.com                //0x6: jmpe_Ev(); // IA-64
5810593Sgabeblack@google.com                default: Inst::UD2();
5910593Sgabeblack@google.com            }
6010593Sgabeblack@google.com            //0x01: group7(); // Ugly, ugly, ugly...
6110593Sgabeblack@google.com            0x01: decode MODRM_REG {
6210593Sgabeblack@google.com                0x0: decode MODRM_MOD {
6310593Sgabeblack@google.com                    0x3: decode MODRM_RM {
6410593Sgabeblack@google.com                        0x1: vmcall();
6510593Sgabeblack@google.com                        0x2: vmlaunch();
6610593Sgabeblack@google.com                        0x3: vmresume();
6710593Sgabeblack@google.com                        0x4: vmxoff();
6810593Sgabeblack@google.com                        default: Inst::UD2();
6910593Sgabeblack@google.com                    }
7010593Sgabeblack@google.com                    default: sgdt_Ms();
715238Sgblack@eecs.umich.edu                }
7210593Sgabeblack@google.com                0x1: decode MODRM_MOD {
7310593Sgabeblack@google.com                    0x3: decode MODRM_RM {
7410593Sgabeblack@google.com                        0x0: MonitorInst::monitor({{
7510593Sgabeblack@google.com                           xc->armMonitor(Rax);
7610593Sgabeblack@google.com                        }});
7710593Sgabeblack@google.com                        0x1: MwaitInst::mwait({{
7810593Sgabeblack@google.com                           uint64_t m = 0;          //mem
7910593Sgabeblack@google.com                           unsigned s = 0x8;        //size
8010593Sgabeblack@google.com                           unsigned f = 0;          //flags
8110593Sgabeblack@google.com                           readMemAtomic(xc, traceData,
8210593Sgabeblack@google.com                                         xc->getAddrMonitor()->vAddr,
8310593Sgabeblack@google.com                                         m, s, f);
8410593Sgabeblack@google.com                           xc->mwaitAtomic(xc->tcBase());
8510593Sgabeblack@google.com                           MicroHalt hltObj(machInst, mnemonic, 0x0);
8610593Sgabeblack@google.com                           hltObj.execute(xc, traceData);
8710593Sgabeblack@google.com                        }});
8810593Sgabeblack@google.com                        default: Inst::UD2();
896611Sgblack@eecs.umich.edu                    }
9010593Sgabeblack@google.com                    default: sidt_Ms();
9110593Sgabeblack@google.com                }
9210593Sgabeblack@google.com                0x2: decode MODRM_MOD {
9310593Sgabeblack@google.com                    0x3: decode MODRM_RM {
9410593Sgabeblack@google.com                        0x0: xgetbv();
9510593Sgabeblack@google.com                        0x1: xsetbv();
966611Sgblack@eecs.umich.edu                    }
9710593Sgabeblack@google.com                    default: decode MODE_SUBMODE {
9810593Sgabeblack@google.com                        0x0: Inst::LGDT(M);
9910593Sgabeblack@google.com                        default: decode OPSIZE {
10010593Sgabeblack@google.com                            // 16 bit operand sizes are special, but only
10110593Sgabeblack@google.com                            // in legacy and compatability modes.
10210593Sgabeblack@google.com                            0x2: Inst::LGDT_16(M);
10310593Sgabeblack@google.com                            default: Inst::LGDT(M);
1046611Sgblack@eecs.umich.edu                        }
1056611Sgblack@eecs.umich.edu                    }
10610593Sgabeblack@google.com                }
10710593Sgabeblack@google.com                0x3: decode MODRM_MOD {
10810593Sgabeblack@google.com                    0x3: decode MODRM_RM {
10910593Sgabeblack@google.com                        0x0: vmrun();
11010593Sgabeblack@google.com                        0x1: vmmcall();
11110593Sgabeblack@google.com                        0x2: vmload();
11210593Sgabeblack@google.com                        0x3: vmsave();
11310593Sgabeblack@google.com                        0x4: stgi();
11410593Sgabeblack@google.com                        0x5: clgi();
11510593Sgabeblack@google.com                        0x6: skinit();
11610593Sgabeblack@google.com                        0x7: invlpga();
11710593Sgabeblack@google.com                    }
11810593Sgabeblack@google.com                    default: decode MODE_SUBMODE {
11910593Sgabeblack@google.com                        0x0: Inst::LIDT(M);
12010593Sgabeblack@google.com                        default: decode OPSIZE {
12110593Sgabeblack@google.com                            // 16 bit operand sizes are special, but only
12210593Sgabeblack@google.com                            // in legacy and compatability modes.
12310593Sgabeblack@google.com                            0x2: Inst::LIDT_16(M);
12410593Sgabeblack@google.com                            default: Inst::LIDT(M);
1255292Sgblack@eecs.umich.edu                        }
1266611Sgblack@eecs.umich.edu                    }
1275238Sgblack@eecs.umich.edu                }
12810593Sgabeblack@google.com                0x4: decode MODRM_MOD {
12910593Sgabeblack@google.com                    0x3: Inst::SMSW(Rv);
13010593Sgabeblack@google.com                    default: Inst::SMSW(Mw);
13110593Sgabeblack@google.com                }
13210593Sgabeblack@google.com                0x6: Inst::LMSW(Ew);
13310593Sgabeblack@google.com                0x7: decode MODRM_MOD {
13410593Sgabeblack@google.com                    0x3: decode MODRM_RM {
13510593Sgabeblack@google.com                        0x0: Inst::SWAPGS();
13610593Sgabeblack@google.com                        0x1: rdtscp();
1375789Sgblack@eecs.umich.edu                        default: Inst::UD2();
1385789Sgblack@eecs.umich.edu                    }
13910593Sgabeblack@google.com                    default: Inst::INVLPG(M);
1405908Sgblack@eecs.umich.edu                }
1414276Sgblack@eecs.umich.edu            }
14210593Sgabeblack@google.com            0x02: lar_Gv_Ew();
14310593Sgabeblack@google.com            0x03: lsl_Gv_Ew();
14410593Sgabeblack@google.com            // sandpile.org doesn't seem to know what this is...? We'll
14510593Sgabeblack@google.com            // use it for pseudo instructions. We've got 16 bits of space
14610593Sgabeblack@google.com            // to play with so there can be quite a few pseudo
14710593Sgabeblack@google.com            // instructions.
14810593Sgabeblack@google.com            //0x04: loadall_or_reset_or_hang();
14910593Sgabeblack@google.com            0x4: decode IMMEDIATE {
15010593Sgabeblack@google.com                format BasicOperate {
15110593Sgabeblack@google.com                    0x00: m5arm({{
15210593Sgabeblack@google.com                        PseudoInst::arm(xc->tcBase());
15310593Sgabeblack@google.com                    }}, IsNonSpeculative);
15410593Sgabeblack@google.com                    0x01: m5quiesce({{
15510593Sgabeblack@google.com                        PseudoInst::quiesce(xc->tcBase());
15610593Sgabeblack@google.com                    }}, IsNonSpeculative, IsQuiesce);
15710593Sgabeblack@google.com                    0x02: m5quiesceNs({{
15810593Sgabeblack@google.com                        PseudoInst::quiesceNs(xc->tcBase(), Rdi);
15910593Sgabeblack@google.com                    }}, IsNonSpeculative, IsQuiesce);
16010593Sgabeblack@google.com                    0x03: m5quiesceCycle({{
16110593Sgabeblack@google.com                        PseudoInst::quiesceCycles(xc->tcBase(), Rdi);
16210593Sgabeblack@google.com                    }}, IsNonSpeculative, IsQuiesce);
16310593Sgabeblack@google.com                    0x04: m5quiesceTime({{
16410593Sgabeblack@google.com                        Rax = PseudoInst::quiesceTime(xc->tcBase());
16510593Sgabeblack@google.com                    }}, IsNonSpeculative);
16610593Sgabeblack@google.com                    0x07: m5rpns({{
16710593Sgabeblack@google.com                        Rax = PseudoInst::rpns(xc->tcBase());
16810593Sgabeblack@google.com                    }}, IsNonSpeculative);
16910593Sgabeblack@google.com                    0x21: m5exit({{
17010593Sgabeblack@google.com                        PseudoInst::m5exit(xc->tcBase(), Rdi);
17110593Sgabeblack@google.com                    }}, IsNonSpeculative);
17210593Sgabeblack@google.com                    0x22: m5fail({{
17310593Sgabeblack@google.com                        PseudoInst::m5fail(xc->tcBase(), Rdi, Rsi);
17410593Sgabeblack@google.com                    }}, IsNonSpeculative);
17510593Sgabeblack@google.com                    0x30: m5initparam({{
17610593Sgabeblack@google.com                        Rax = PseudoInst::initParam(xc->tcBase());
17710593Sgabeblack@google.com                    }}, IsNonSpeculative);
17810593Sgabeblack@google.com                    0x31: m5loadsymbol({{
17910593Sgabeblack@google.com                        PseudoInst::loadsymbol(xc->tcBase());
18010593Sgabeblack@google.com                    }}, IsNonSpeculative);
18110593Sgabeblack@google.com                    0x40: m5resetstats({{
18210593Sgabeblack@google.com                        PseudoInst::resetstats(xc->tcBase(), Rdi, Rsi);
18310593Sgabeblack@google.com                    }}, IsNonSpeculative);
18410593Sgabeblack@google.com                    0x41: m5dumpstats({{
18510593Sgabeblack@google.com                        PseudoInst::dumpstats(xc->tcBase(), Rdi, Rsi);
18610593Sgabeblack@google.com                    }}, IsNonSpeculative);
18710593Sgabeblack@google.com                    0x42: m5dumpresetstats({{
18810593Sgabeblack@google.com                        PseudoInst::dumpresetstats(xc->tcBase(), Rdi, Rsi);
18910593Sgabeblack@google.com                    }}, IsNonSpeculative);
19010593Sgabeblack@google.com                    0x43: m5checkpoint({{
19110593Sgabeblack@google.com                        PseudoInst::m5checkpoint(xc->tcBase(), Rdi, Rsi);
19210593Sgabeblack@google.com                    }}, IsNonSpeculative);
19310593Sgabeblack@google.com                    0x50: m5readfile({{
19410593Sgabeblack@google.com                        Rax = PseudoInst::readfile(
19510593Sgabeblack@google.com                            xc->tcBase(), Rdi, Rsi, Rdx);
19610593Sgabeblack@google.com                    }}, IsNonSpeculative);
19710593Sgabeblack@google.com                    0x51: m5debugbreak({{
19810593Sgabeblack@google.com                        PseudoInst::debugbreak(xc->tcBase());
19910593Sgabeblack@google.com                    }}, IsNonSpeculative);
20010593Sgabeblack@google.com                    0x52: m5switchcpu({{
20110593Sgabeblack@google.com                        PseudoInst::switchcpu(xc->tcBase());
20210593Sgabeblack@google.com                    }}, IsNonSpeculative);
20310593Sgabeblack@google.com                    0x53: m5addsymbol({{
20410593Sgabeblack@google.com                        PseudoInst::addsymbol(xc->tcBase(), Rdi, Rsi);
20510593Sgabeblack@google.com                    }}, IsNonSpeculative);
20610593Sgabeblack@google.com                    0x54: m5panic({{
20710593Sgabeblack@google.com                        panic("M5 panic instruction called at pc = %#x.\n",
20810593Sgabeblack@google.com                              RIP);
20910593Sgabeblack@google.com                    }}, IsNonSpeculative);
21010593Sgabeblack@google.com                    0x55: m5reserved1({{
21110593Sgabeblack@google.com                        warn("M5 reserved opcode 1 ignored.\n");
21210593Sgabeblack@google.com                    }}, IsNonSpeculative);
21310593Sgabeblack@google.com                    0x56: m5reserved2({{
21410593Sgabeblack@google.com                        warn("M5 reserved opcode 2 ignored.\n");
21510593Sgabeblack@google.com                    }}, IsNonSpeculative);
21610593Sgabeblack@google.com                    0x57: m5reserved3({{
21710593Sgabeblack@google.com                        warn("M5 reserved opcode 3 ignored.\n");
21810593Sgabeblack@google.com                    }}, IsNonSpeculative);
21910593Sgabeblack@google.com                    0x58: m5reserved4({{
22010593Sgabeblack@google.com                        warn("M5 reserved opcode 4 ignored.\n");
22110593Sgabeblack@google.com                    }}, IsNonSpeculative);
22210593Sgabeblack@google.com                    0x59: m5reserved5({{
22310593Sgabeblack@google.com                        warn("M5 reserved opcode 5 ignored.\n");
22410593Sgabeblack@google.com                    }}, IsNonSpeculative);
22510593Sgabeblack@google.com                    0x5a: m5_work_begin({{
22610593Sgabeblack@google.com                        PseudoInst::workbegin(xc->tcBase(), Rdi, Rsi);
22710593Sgabeblack@google.com                    }}, IsNonSpeculative);
22810593Sgabeblack@google.com                    0x5b: m5_work_end({{
22910593Sgabeblack@google.com                        PseudoInst::workend(xc->tcBase(), Rdi, Rsi);
23010593Sgabeblack@google.com                    }}, IsNonSpeculative);
2316616Sgblack@eecs.umich.edu                    default: Inst::UD2();
2326616Sgblack@eecs.umich.edu                }
2334276Sgblack@eecs.umich.edu            }
23410593Sgabeblack@google.com            0x05: decode FullSystemInt {
23510593Sgabeblack@google.com                0: SyscallInst::syscall('xc->syscall(Rax)',
23610593Sgabeblack@google.com                        IsSyscall, IsNonSpeculative, IsSerializeAfter);
23710593Sgabeblack@google.com                default: decode MODE_MODE {
23810593Sgabeblack@google.com                    0x0: decode MODE_SUBMODE {
23910593Sgabeblack@google.com                        0x0: Inst::SYSCALL_64();
24010593Sgabeblack@google.com                        0x1: Inst::SYSCALL_COMPAT();
24110593Sgabeblack@google.com                    }
24210593Sgabeblack@google.com                    0x1: Inst::SYSCALL_LEGACY();
24310593Sgabeblack@google.com                }
24410593Sgabeblack@google.com            }
24510593Sgabeblack@google.com            0x06: Inst::CLTS();
24610593Sgabeblack@google.com            0x07: decode MODE_SUBMODE {
24710593Sgabeblack@google.com                0x0: decode OPSIZE {
24810593Sgabeblack@google.com                    // Return to 64 bit mode.
24910593Sgabeblack@google.com                    0x8: Inst::SYSRET_TO_64();
25010593Sgabeblack@google.com                    // Return to compatibility mode.
25110593Sgabeblack@google.com                    default: Inst::SYSRET_TO_COMPAT();
25210593Sgabeblack@google.com                }
25310593Sgabeblack@google.com                default: Inst::SYSRET_NON_64();
25410593Sgabeblack@google.com            }
25510593Sgabeblack@google.com        }
25610593Sgabeblack@google.com        0x01: decode OPCODE_OP_BOTTOM3 {
25710593Sgabeblack@google.com            0x0: invd();
25810593Sgabeblack@google.com            0x1: wbinvd();
25910593Sgabeblack@google.com            0x2: Inst::UD2();
26010593Sgabeblack@google.com            0x3: Inst::UD2();
26110593Sgabeblack@google.com            0x4: Inst::UD2();
26210593Sgabeblack@google.com            0x5: Inst::PREFETCH(Mb);
26310593Sgabeblack@google.com            0x6: FailUnimpl::femms();
26410593Sgabeblack@google.com            0x7: decode IMMEDIATE {
26510593Sgabeblack@google.com                0x0C: pi2fw_Pq_Qq();
26610593Sgabeblack@google.com                0x0D: pi2fd_Pq_Qq();
26710593Sgabeblack@google.com                0x1C: pf2iw_Pq_Qq();
26810593Sgabeblack@google.com                0x1D: pf2id_Pq_Qq();
26910593Sgabeblack@google.com                0x8A: pfnacc_Pq_Qq();
27010593Sgabeblack@google.com                0x8E: pfpnacc_Pq_Qq();
27110593Sgabeblack@google.com                0x90: pfcmpge_Pq_Qq();
27210593Sgabeblack@google.com                0x94: pfmin_Pq_Qq();
27310593Sgabeblack@google.com                0x96: pfrcp_Pq_Qq();
27410593Sgabeblack@google.com                0x97: pfrsqrt_Pq_Qq();
27510593Sgabeblack@google.com                0x9A: Inst::PFSUB(Pq,Qq);
27610593Sgabeblack@google.com                0x9E: pfadd_Pq_Qq();
27710593Sgabeblack@google.com                0xA0: pfcmpgt_Pq_Qq();
27810593Sgabeblack@google.com                0xA4: pfmax_Pq_Qq();
27910593Sgabeblack@google.com                0xA6: pfrcpit1_Pq_Qq();
28010593Sgabeblack@google.com                0xA7: pfrsqit1_Pq_Qq();
28110593Sgabeblack@google.com                0xAA: Inst::PFSUBR(Pq,Qq);
28210593Sgabeblack@google.com                0xAE: pfacc_Pq_Qq();
28310593Sgabeblack@google.com                0xB0: pfcmpeq_Pq_Qq();
28410593Sgabeblack@google.com                0xB4: Inst::PFMUL(Pq,Qq);
28510593Sgabeblack@google.com                0xB6: pfrcpit2_Pq_Qq();
28610593Sgabeblack@google.com                0xB7: Inst::PMULHRW(Pq,Qq);
28710593Sgabeblack@google.com                0xBB: pswapd_Pq_Qq();
28810593Sgabeblack@google.com                0xBF: pavgusb_Pq_Qq();
28910593Sgabeblack@google.com                default: Inst::UD2();
29010593Sgabeblack@google.com            }
29110593Sgabeblack@google.com        }
29210593Sgabeblack@google.com        format Inst{
29310593Sgabeblack@google.com            0x02: decode LEGACY_DECODEVAL {
29410593Sgabeblack@google.com                // no prefix
29510593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
29610593Sgabeblack@google.com                    0x0: MOVUPS(Vo,Wo);
29710593Sgabeblack@google.com                    0x1: MOVUPS(Wo,Vo);
29810593Sgabeblack@google.com                    0x2: decode MODRM_MOD {
29910593Sgabeblack@google.com                        0x3: MOVHLPS(Vps,VRq);
30010593Sgabeblack@google.com                        default: MOVLPS(Vps,Mq);
30110593Sgabeblack@google.com                    }
30210593Sgabeblack@google.com                    0x3: MOVLPS(Mq,Vps);
30310593Sgabeblack@google.com                    0x4: UNPCKLPS(Vps,Wq);
30410593Sgabeblack@google.com                    0x5: UNPCKHPS(Vps,Wq);
30510593Sgabeblack@google.com                    0x6: decode MODRM_MOD {
30610593Sgabeblack@google.com                        0x3: MOVLHPS(Vps,VRq);
30710593Sgabeblack@google.com                        default: MOVHPS(Vps,Mq);
30810593Sgabeblack@google.com                    }
30910593Sgabeblack@google.com                    0x7: MOVHPS(Mq,Vq);
31010593Sgabeblack@google.com                }
31110593Sgabeblack@google.com                // repe (0xF3)
31210593Sgabeblack@google.com                0x4: decode OPCODE_OP_BOTTOM3 {
31310593Sgabeblack@google.com                    0x0: MOVSS(Vd,Wd);
31410593Sgabeblack@google.com                    0x1: MOVSS(Wd,Vd);
31510593Sgabeblack@google.com                    0x2: WarnUnimpl::movsldup_Vo_Wo();
31610593Sgabeblack@google.com                    0x6: WarnUnimpl::movshdup_Vo_Wo();
31710593Sgabeblack@google.com                    default: UD2();
31810593Sgabeblack@google.com                }
31910593Sgabeblack@google.com                // operand size (0x66)
32010593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
32110593Sgabeblack@google.com                    0x0: MOVUPD(Vo,Wo);
32210593Sgabeblack@google.com                    0x1: MOVUPD(Wo,Vo);
32310593Sgabeblack@google.com                    0x2: MOVLPD(Vq,Mq);
32410593Sgabeblack@google.com                    0x3: MOVLPD(Mq,Vq);
32510593Sgabeblack@google.com                    0x4: UNPCKLPD(Vo,Wq);
32610593Sgabeblack@google.com                    0x5: UNPCKHPD(Vo,Wo);
32710593Sgabeblack@google.com                    0x6: MOVHPD(Vq,Mq);
32810593Sgabeblack@google.com                    0x7: MOVHPD(Mq,Vq);
32910593Sgabeblack@google.com            }
33010593Sgabeblack@google.com                // repne (0xF2)
33110593Sgabeblack@google.com                0x8: decode OPCODE_OP_BOTTOM3 {
33210593Sgabeblack@google.com                    0x0: MOVSD(Vq,Wq);
33310593Sgabeblack@google.com                    0x1: MOVSD(Wq,Vq);
33410593Sgabeblack@google.com                    0x2: MOVDDUP(Vo,Wq);
33510593Sgabeblack@google.com                    default: UD2();
33610593Sgabeblack@google.com                }
33710593Sgabeblack@google.com                default: UD2();
33810593Sgabeblack@google.com            }
33910593Sgabeblack@google.com            0x03: decode OPCODE_OP_BOTTOM3 {
34010593Sgabeblack@google.com                //group16();
34110593Sgabeblack@google.com                0x0: decode MODRM_REG {
34210593Sgabeblack@google.com                    0x0: WarnUnimpl::prefetch_nta();
34310593Sgabeblack@google.com                    0x1: PREFETCH_T0(Mb);
34410593Sgabeblack@google.com                    0x2: WarnUnimpl::prefetch_t1();
34510593Sgabeblack@google.com                    0x3: WarnUnimpl::prefetch_t2();
34610593Sgabeblack@google.com                    default: HINT_NOP();
34710593Sgabeblack@google.com                }
34810593Sgabeblack@google.com                0x1: HINT_NOP();
34910593Sgabeblack@google.com                0x2: HINT_NOP();
35010593Sgabeblack@google.com                0x3: HINT_NOP();
35110593Sgabeblack@google.com                0x4: HINT_NOP();
35210593Sgabeblack@google.com                0x5: HINT_NOP();
35310593Sgabeblack@google.com                0x6: HINT_NOP();
35410593Sgabeblack@google.com                0x7: HINT_NOP();
35510593Sgabeblack@google.com            }
35610593Sgabeblack@google.com            0x04: decode LEGACY_DECODEVAL {
35710593Sgabeblack@google.com                // no prefix
35810593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
35910593Sgabeblack@google.com                    0x0: MOV(Rd,Cd);
36010593Sgabeblack@google.com                    0x1: MOV(Rd,Dd);
36110593Sgabeblack@google.com                    0x2: MOV(Cd,Rd);
36210593Sgabeblack@google.com                    0x3: MOV(Dd,Rd);
36310593Sgabeblack@google.com                    default: UD2();
36410593Sgabeblack@google.com                }
36510959Sdavid.hashe@amd.com                // operand size (0x66)
36610959Sdavid.hashe@amd.com                0x1: decode OPCODE_OP_BOTTOM3 {
36710959Sdavid.hashe@amd.com                    0x0: MOV(Rd,Cd);
36810959Sdavid.hashe@amd.com                    0x2: MOV(Cd,Rd);
36910959Sdavid.hashe@amd.com                }
37010593Sgabeblack@google.com                default: UD2();
37110593Sgabeblack@google.com            }
37210593Sgabeblack@google.com            0x05: decode LEGACY_DECODEVAL {
37310593Sgabeblack@google.com                // no prefix
37410593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
37510593Sgabeblack@google.com                    //These moves should really use size o (octword), but
37610593Sgabeblack@google.com                    //because they are split in two, they use q (quadword).
37710593Sgabeblack@google.com                    0x0: MOVAPS(Vq,Wq);
37810593Sgabeblack@google.com                    0x1: MOVAPS(Wq,Vq);
37910593Sgabeblack@google.com                    0x2: CVTPI2PS(Vq,Qq);
38010593Sgabeblack@google.com                    0x3: WarnUnimpl::movntps_Mo_Vo();
38110593Sgabeblack@google.com                    0x4: CVTTPS2PI(Pq,Wq);
38210593Sgabeblack@google.com                    0x5: CVTPS2PI(Pq,Wq);
38310593Sgabeblack@google.com                    0x6: UCOMISS(Vd,Wd);
38410593Sgabeblack@google.com                    0x7: COMISS(Vd,Wd);
38510593Sgabeblack@google.com                }
38610593Sgabeblack@google.com                // repe (0xF3)
38710593Sgabeblack@google.com                0x4: decode OPCODE_OP_BOTTOM3 {
38810593Sgabeblack@google.com                    0x2: CVTSI2SS(Vd,Ed);
38910593Sgabeblack@google.com                    0x4: CVTTSS2SI(Gd,Wd);
39010593Sgabeblack@google.com                    0x5: CVTSS2SI(Gd,Wd);
39110593Sgabeblack@google.com                    default: UD2();
39210593Sgabeblack@google.com                }
39310593Sgabeblack@google.com                // operand size (0x66)
39410593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
39510593Sgabeblack@google.com                    0x0: MOVAPD(Vo,Wo);
39610593Sgabeblack@google.com                    0x1: MOVAPD(Wo,Vo);
39710593Sgabeblack@google.com                    0x2: CVTPI2PD(Vo,Qq);
39810593Sgabeblack@google.com                    0x3: WarnUnimpl::movntpd_Mo_Vo();
39910593Sgabeblack@google.com                    0x4: CVTTPD2PI(Pq,Wo);
40010593Sgabeblack@google.com                    0x5: CVTPD2PI(Pq,Wo);
40110593Sgabeblack@google.com                    0x6: UCOMISD(Vq,Wq);
40210593Sgabeblack@google.com                    0x7: COMISD(Vq,Wq);
40310593Sgabeblack@google.com                }
40410593Sgabeblack@google.com                // repne (0xF2)
40510593Sgabeblack@google.com                0x8: decode OPCODE_OP_BOTTOM3 {
40610593Sgabeblack@google.com                    // The size of the V operand should be q, not dp
40710593Sgabeblack@google.com                    0x2: CVTSI2SD(Vdp,Edp);
40810593Sgabeblack@google.com                    // The size of the W operand should be q, not dp
40910593Sgabeblack@google.com                    0x4: CVTTSD2SI(Gdp,Wdp);
41010593Sgabeblack@google.com                    0x5: CVTSD2SI(Gd,Wq);
41110593Sgabeblack@google.com                    default: UD2();
41210593Sgabeblack@google.com                }
41310593Sgabeblack@google.com                default: UD2();
41410593Sgabeblack@google.com            }
41510593Sgabeblack@google.com        }
41610593Sgabeblack@google.com        0x06: decode OPCODE_OP_BOTTOM3 {
41710593Sgabeblack@google.com            0x0: Inst::WRMSR();
41810593Sgabeblack@google.com            0x1: Inst::RDTSC();
41910593Sgabeblack@google.com            0x2: Inst::RDMSR();
42010593Sgabeblack@google.com            0x3: rdpmc();
42110593Sgabeblack@google.com            0x4: decode FullSystemInt {
42210593Sgabeblack@google.com                0: SyscallInst::sysenter('xc->syscall(Rax)',
42310593Sgabeblack@google.com                        IsSyscall, IsNonSpeculative, IsSerializeAfter);
42410593Sgabeblack@google.com                default: sysenter();
42510593Sgabeblack@google.com            }
42610593Sgabeblack@google.com            0x5: sysexit();
42710593Sgabeblack@google.com            0x6: Inst::UD2();
42810593Sgabeblack@google.com            0x7: getsec();
42910593Sgabeblack@google.com        }
43010593Sgabeblack@google.com        0x07: decode OPCODE_OP_BOTTOM3 {
43110593Sgabeblack@google.com            0x0: M5InternalError::error(
43210593Sgabeblack@google.com                {{"Three byte opcode shouldn't be handled by "
43310593Sgabeblack@google.com                  "two_byte_opcodes.isa!"}});
43410593Sgabeblack@google.com            0x2: M5InternalError::error(
43510593Sgabeblack@google.com                {{"Three byte opcode shouldn't be handled by "
43610593Sgabeblack@google.com                  "two_byte_opcodes.isa!"}});
43710593Sgabeblack@google.com            default: UD2();
43810593Sgabeblack@google.com        }
43910593Sgabeblack@google.com        format Inst {
44010593Sgabeblack@google.com            0x08: decode OPCODE_OP_BOTTOM3 {
44110593Sgabeblack@google.com                0x0: CMOVO(Gv,Ev);
44210593Sgabeblack@google.com                0x1: CMOVNO(Gv,Ev);
44310593Sgabeblack@google.com                0x2: CMOVB(Gv,Ev);
44410593Sgabeblack@google.com                0x3: CMOVNB(Gv,Ev);
44510593Sgabeblack@google.com                0x4: CMOVZ(Gv,Ev);
44610593Sgabeblack@google.com                0x5: CMOVNZ(Gv,Ev);
44710593Sgabeblack@google.com                0x6: CMOVBE(Gv,Ev);
44810593Sgabeblack@google.com                0x7: CMOVNBE(Gv,Ev);
44910593Sgabeblack@google.com            }
45010593Sgabeblack@google.com            0x09: decode OPCODE_OP_BOTTOM3 {
45110593Sgabeblack@google.com                0x0: CMOVS(Gv,Ev);
45210593Sgabeblack@google.com                0x1: CMOVNS(Gv,Ev);
45310593Sgabeblack@google.com                0x2: CMOVP(Gv,Ev);
45410593Sgabeblack@google.com                0x3: CMOVNP(Gv,Ev);
45510593Sgabeblack@google.com                0x4: CMOVL(Gv,Ev);
45610593Sgabeblack@google.com                0x5: CMOVNL(Gv,Ev);
45710593Sgabeblack@google.com                0x6: CMOVLE(Gv,Ev);
45810593Sgabeblack@google.com                0x7: CMOVNLE(Gv,Ev);
45910593Sgabeblack@google.com            }
46010593Sgabeblack@google.com            0x0A: decode LEGACY_DECODEVAL {
46110593Sgabeblack@google.com                // no prefix
46210593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
46310593Sgabeblack@google.com                    0x0: MOVMSKPS(Gd,VRo);
46410593Sgabeblack@google.com                    0x1: SQRTPS(Vo,Wo);
46510593Sgabeblack@google.com                    0x2: WarnUnimpl::rqsrtps_Vo_Wo();
46610593Sgabeblack@google.com                    0x3: WarnUnimpl::rcpps_Vo_Wo();
46710593Sgabeblack@google.com                    0x4: ANDPS(Vo,Wo);
46810593Sgabeblack@google.com                    0x5: ANDNPS(Vo,Wo);
46910593Sgabeblack@google.com                    0x6: ORPS(Vo,Wo);
47010593Sgabeblack@google.com                    0x7: XORPS(Vo,Wo);
47110593Sgabeblack@google.com                }
47210593Sgabeblack@google.com                // repe (0xF3)
47310593Sgabeblack@google.com                0x4: decode OPCODE_OP_BOTTOM3 {
47410593Sgabeblack@google.com                    0x1: SQRTSS(Vd,Wd);
47510593Sgabeblack@google.com                    0x2: WarnUnimpl::rsqrtss_Vd_Wd();
47610593Sgabeblack@google.com                    0x3: WarnUnimpl::rcpss_Vd_Wd();
47710593Sgabeblack@google.com                    default: UD2();
47810593Sgabeblack@google.com                }
47910593Sgabeblack@google.com                // operand size (0x66)
48010593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
48110593Sgabeblack@google.com                    0x0: MOVMSKPD(Gd,VRo);
48210593Sgabeblack@google.com                    0x1: SQRTPD(Vo,Wo);
48310593Sgabeblack@google.com                    0x4: ANDPD(Vo,Wo);
48410593Sgabeblack@google.com                    0x5: ANDNPD(Vo,Wo);
48510593Sgabeblack@google.com                    0x6: ORPD(Vo,Wo);
48610593Sgabeblack@google.com                    0x7: XORPD(Vo,Wo);
48710593Sgabeblack@google.com                    default: UD2();
48810593Sgabeblack@google.com                }
48910593Sgabeblack@google.com                // repne (0xF2)
49010593Sgabeblack@google.com                0x8: decode OPCODE_OP_BOTTOM3 {
49110593Sgabeblack@google.com                    0x1: SQRTSD(Vq,Wq);
49210593Sgabeblack@google.com                    default: UD2();
49310593Sgabeblack@google.com                }
49410593Sgabeblack@google.com                default: UD2();
49510593Sgabeblack@google.com            }
49610593Sgabeblack@google.com            0x0B: decode LEGACY_DECODEVAL {
49710593Sgabeblack@google.com                // no prefix
49810593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
49910593Sgabeblack@google.com                    0x0: ADDPS(Vo,Wo);
50010593Sgabeblack@google.com                    0x1: MULPS(Vo,Wo);
50110593Sgabeblack@google.com                    0x2: CVTPS2PD(Vo,Wq);
50210593Sgabeblack@google.com                    0x3: CVTDQ2PS(Vo,Wo);
50310593Sgabeblack@google.com                    0x4: SUBPS(Vo,Wo);
50410593Sgabeblack@google.com                    0x5: MINPS(Vo,Wo);
50510593Sgabeblack@google.com                    0x6: DIVPS(Vo,Wo);
50610593Sgabeblack@google.com                    0x7: MAXPS(Vo,Wo);
50710593Sgabeblack@google.com                }
50810593Sgabeblack@google.com                // repe (0xF3)
50910593Sgabeblack@google.com                0x4: decode OPCODE_OP_BOTTOM3 {
51010593Sgabeblack@google.com                    0x0: ADDSS(Vd,Wd);
51110593Sgabeblack@google.com                    0x1: MULSS(Vd,Wd);
51210593Sgabeblack@google.com                    0x2: CVTSS2SD(Vq,Wd);
51310593Sgabeblack@google.com                    0x3: CVTTPS2DQ(Vo,Wo);
51410593Sgabeblack@google.com                    0x4: SUBSS(Vd,Wd);
51510593Sgabeblack@google.com                    0x5: MINSS(Vd,Wd);
51610593Sgabeblack@google.com                    0x6: DIVSS(Vd,Wd);
51710593Sgabeblack@google.com                    0x7: MAXSS(Vd,Wd);
51810593Sgabeblack@google.com                }
51910593Sgabeblack@google.com                // operand size (0x66)
52010593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
52110593Sgabeblack@google.com                    0x0: ADDPD(Vo,Wo);
52210593Sgabeblack@google.com                    0x1: MULPD(Vo,Wo);
52310593Sgabeblack@google.com                    0x2: CVTPD2PS(Vo,Wo);
52410593Sgabeblack@google.com                    0x3: CVTPS2DQ(Vo,Wo);
52510593Sgabeblack@google.com                    0x4: SUBPD(Vo,Wo);
52610593Sgabeblack@google.com                    0x5: MINPD(Vo,Wo);
52710593Sgabeblack@google.com                    0x6: DIVPD(Vo,Wo);
52810593Sgabeblack@google.com                    0x7: MAXPD(Vo,Wo);
52910593Sgabeblack@google.com                }
53010593Sgabeblack@google.com                // repne (0xF2)
53110593Sgabeblack@google.com                0x8: decode OPCODE_OP_BOTTOM3 {
53210593Sgabeblack@google.com                    0x0: ADDSD(Vq,Wq);
53310593Sgabeblack@google.com                    0x1: MULSD(Vq,Wq);
53410593Sgabeblack@google.com                    0x2: CVTSD2SS(Vd,Wq);
53510593Sgabeblack@google.com                    0x4: SUBSD(Vq,Wq);
53610593Sgabeblack@google.com                    0x5: MINSD(Vq,Wq);
53710593Sgabeblack@google.com                    0x6: DIVSD(Vq,Wq);
53810593Sgabeblack@google.com                    0x7: MAXSD(Vq,Wq);
53910593Sgabeblack@google.com                    default: UD2();
54010593Sgabeblack@google.com                }
54110593Sgabeblack@google.com                default: UD2();
54210593Sgabeblack@google.com            }
54310593Sgabeblack@google.com            0x0C: decode LEGACY_DECODEVAL {
54410593Sgabeblack@google.com                // no prefix
54510593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
54610593Sgabeblack@google.com                    0x0: PUNPCKLBW(Pq,Qd);
54710593Sgabeblack@google.com                    0x1: PUNPCKLWD(Pq,Qd);
54810593Sgabeblack@google.com                    0x2: PUNPCKLDQ(Pq,Qd);
54910593Sgabeblack@google.com                    0x3: PACKSSWB(Pq,Qq);
55010593Sgabeblack@google.com                    0x4: PCMPGTB(Pq,Qq);
55110593Sgabeblack@google.com                    0x5: PCMPGTW(Pq,Qq);
55210593Sgabeblack@google.com                    0x6: PCMPGTD(Pq,Qq);
55310593Sgabeblack@google.com                    0x7: PACKUSWB(Pq,Qq);
55410593Sgabeblack@google.com                }
55510593Sgabeblack@google.com                // operand size (0x66)
55610593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
55710593Sgabeblack@google.com                    0x0: PUNPCKLBW(Vo,Wq);
55810593Sgabeblack@google.com                    0x1: PUNPCKLWD(Vo,Wq);
55910593Sgabeblack@google.com                    0x2: PUNPCKLDQ(Vo,Wq);
56010593Sgabeblack@google.com                    0x3: PACKSSWB(Vo,Wo);
56110593Sgabeblack@google.com                    0x4: PCMPGTB(Vo,Wo);
56210593Sgabeblack@google.com                    0x5: PCMPGTW(Vo,Wo);
56310593Sgabeblack@google.com                    0x6: PCMPGTD(Vo,Wo);
56410593Sgabeblack@google.com                    0x7: PACKUSWB(Vo,Wo);
56510593Sgabeblack@google.com                }
56610593Sgabeblack@google.com                default: UD2();
56710593Sgabeblack@google.com            }
56810593Sgabeblack@google.com            0x0D: decode LEGACY_DECODEVAL {
56910593Sgabeblack@google.com                // no prefix
57010593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
57110593Sgabeblack@google.com                    0x0: PUNPCKHBW(Pq,Qq);
57210593Sgabeblack@google.com                    0x1: PUNPCKHWD(Pq,Qq);
57310593Sgabeblack@google.com                    0x2: PUNPCKHDQ(Pq,Qq);
57410593Sgabeblack@google.com                    0x3: PACKSSDW(Pq,Qq);
57510593Sgabeblack@google.com                    0x6: MOVD(Pq,Edp);
57610593Sgabeblack@google.com                    0x7: MOVQ(Pq,Qq);
57710593Sgabeblack@google.com                    default: UD2();
57810593Sgabeblack@google.com                }
57910593Sgabeblack@google.com                // repe (0xF3)
58010593Sgabeblack@google.com                0x4: decode OPCODE_OP_BOTTOM3 {
58110593Sgabeblack@google.com                    0x7: MOVDQU(Vo,Wo);
58210593Sgabeblack@google.com                    default: UD2();
58310593Sgabeblack@google.com                }
58410593Sgabeblack@google.com                // operand size (0x66)
58510593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
58610593Sgabeblack@google.com                    0x0: PUNPCKHBW(Vo,Wo);
58710593Sgabeblack@google.com                    0x1: PUNPCKHWD(Vo,Wo);
58810593Sgabeblack@google.com                    0x2: PUNPCKHDQ(Vo,Wo);
58910593Sgabeblack@google.com                    0x3: PACKSSDW(Vo,Wo);
59010593Sgabeblack@google.com                    0x4: PUNPCKLQDQ(Vo,Wq);
59110593Sgabeblack@google.com                    0x5: PUNPCKHQDQ(Vo,Wq);
59210593Sgabeblack@google.com                    0x6: MOVD(Vo,Edp);
59310593Sgabeblack@google.com                    0x7: MOVDQA(Vo,Wo);
59410593Sgabeblack@google.com                }
59510593Sgabeblack@google.com                default: UD2();
59610593Sgabeblack@google.com            }
59710593Sgabeblack@google.com            0x0E: decode LEGACY_DECODEVAL {
59810593Sgabeblack@google.com                // no prefix
59910593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
60010593Sgabeblack@google.com                    0x0: PSHUFW(Pq,Qq,Ib);
60110593Sgabeblack@google.com                    //0x1: group12_pshimw();
60210593Sgabeblack@google.com                    0x1: decode MODRM_REG {
60310593Sgabeblack@google.com                        0x2: PSRLW(PRq,Ib);
60410593Sgabeblack@google.com                        0x4: PSRAW(PRq,Ib);
60510593Sgabeblack@google.com                        0x6: PSLLW(PRq,Ib);
60610593Sgabeblack@google.com                        default: UD2();
60710593Sgabeblack@google.com                    }
60810593Sgabeblack@google.com                    //0x2: group13_pshimd();
60910593Sgabeblack@google.com                    0x2: decode MODRM_REG {
61010593Sgabeblack@google.com                        0x2: PSRLD(PRq,Ib);
61110593Sgabeblack@google.com                        0x4: PSRAD(PRq,Ib);
61210593Sgabeblack@google.com                        0x6: PSLLD(PRq,Ib);
61310593Sgabeblack@google.com                        default: UD2();
61410593Sgabeblack@google.com                    }
61510593Sgabeblack@google.com                    //0x3: group14_pshimq();
61610593Sgabeblack@google.com                    0x3: decode MODRM_REG {
61710593Sgabeblack@google.com                        0x2: PSRLQ(PRq,Ib);
61810593Sgabeblack@google.com                        0x6: PSLLQ(PRq,Ib);
61910593Sgabeblack@google.com                        default: Inst::UD2();
62010593Sgabeblack@google.com                    }
62110593Sgabeblack@google.com                    0x4: Inst::PCMPEQB(Pq,Qq);
62210593Sgabeblack@google.com                    0x5: Inst::PCMPEQW(Pq,Qq);
62310593Sgabeblack@google.com                    0x6: Inst::PCMPEQD(Pq,Qq);
62410593Sgabeblack@google.com                    0x7: Inst::EMMS();
62510593Sgabeblack@google.com                }
62610593Sgabeblack@google.com                // repe (0xF3)
62710593Sgabeblack@google.com                0x4: decode OPCODE_OP_BOTTOM3 {
62810593Sgabeblack@google.com                    0x0: PSHUFHW(Vo,Wo,Ib);
62910593Sgabeblack@google.com                    default: UD2();
63010593Sgabeblack@google.com                }
63110593Sgabeblack@google.com                // operand size (0x66)
63210593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
63310593Sgabeblack@google.com                    0x0: PSHUFD(Vo,Wo,Ib);
63410593Sgabeblack@google.com                    //0x1: group12_pshimw();
63510593Sgabeblack@google.com                    0x1: decode MODRM_REG {
63610593Sgabeblack@google.com                        0x2: PSRLW(VRo,Ib);
63710593Sgabeblack@google.com                        0x4: PSRAW(VRo,Ib);
63810593Sgabeblack@google.com                        0x6: PSLLW(VRo,Ib);
63910593Sgabeblack@google.com                    }
64010593Sgabeblack@google.com                    //0x2: group13_pshimd();
64110593Sgabeblack@google.com                    0x2: decode MODRM_REG {
64210593Sgabeblack@google.com                        0x2: PSRLD(VRo,Ib);
64310593Sgabeblack@google.com                        0x4: PSRAD(VRo,Ib);
64410593Sgabeblack@google.com                        0x6: PSLLD(VRo,Ib);
64510593Sgabeblack@google.com                        default: UD2();
64610593Sgabeblack@google.com                    }
64710593Sgabeblack@google.com                    //0x3: group14_pshimq();
64810593Sgabeblack@google.com                    0x3: decode MODRM_REG {
64910593Sgabeblack@google.com                        0x2: PSRLQ(VRo,Ib);
65010593Sgabeblack@google.com                        0x3: PSRLDQ(VRo,Ib);
65110593Sgabeblack@google.com                        0x6: PSLLQ(VRo,Ib);
65210593Sgabeblack@google.com                        0x7: PSLLDQ(VRo,Ib);
65310593Sgabeblack@google.com                        default: UD2();
65410593Sgabeblack@google.com                    }
65510593Sgabeblack@google.com                    0x4: PCMPEQB(Vo,Wo);
65610593Sgabeblack@google.com                    0x5: PCMPEQW(Vo,Wo);
65710593Sgabeblack@google.com                    0x6: PCMPEQD(Vo,Wo);
65810593Sgabeblack@google.com                    default: UD2();
65910593Sgabeblack@google.com                }
66010593Sgabeblack@google.com                // repne (0xF2)
66110593Sgabeblack@google.com                0x8: decode OPCODE_OP_BOTTOM3 {
66210593Sgabeblack@google.com                    0x0: PSHUFLW(Vo,Wo,Ib);
66310593Sgabeblack@google.com                    default: UD2();
66410593Sgabeblack@google.com                }
66510593Sgabeblack@google.com                default: UD2();
66610593Sgabeblack@google.com            }
66710593Sgabeblack@google.com            0x0F: decode LEGACY_DECODEVAL {
66810593Sgabeblack@google.com                // no prefix
66910593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
67010593Sgabeblack@google.com                    0x0: WarnUnimpl::vmread_Edp_Gdp();
67110593Sgabeblack@google.com                    0x1: WarnUnimpl::vmwrite_Gdp_Edp();
67210593Sgabeblack@google.com                    0x6: MOVD(Edp,Pdp);
67310593Sgabeblack@google.com                    0x7: MOVQ(Qq,Pq);
67410593Sgabeblack@google.com                    default: UD2();
67510593Sgabeblack@google.com                }
67610593Sgabeblack@google.com                // repe (0xF3)
67710593Sgabeblack@google.com                0x4: decode OPCODE_OP_BOTTOM3 {
67810593Sgabeblack@google.com                    0x6: MOVQ(Vq,Wq);
67910593Sgabeblack@google.com                    0x7: MOVDQU(Wo,Vo);
68010593Sgabeblack@google.com                    default: UD2();
68110593Sgabeblack@google.com                }
68210593Sgabeblack@google.com                // operand size (0x66)
68310593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
68410593Sgabeblack@google.com                    0x4: HADDPD(Vo,Wo);
68510593Sgabeblack@google.com                    0x5: WarnUnimpl::hsubpd_Vo_Wo();
68610593Sgabeblack@google.com                    0x6: MOVD(Edp,Vd);
68710593Sgabeblack@google.com                    0x7: MOVDQA(Wo,Vo);
68810593Sgabeblack@google.com                    default: UD2();
68910593Sgabeblack@google.com                }
69010593Sgabeblack@google.com                // repne (0xF2)
69110593Sgabeblack@google.com                0x8: decode OPCODE_OP_BOTTOM3 {
69210593Sgabeblack@google.com                    0x4: HADDPS(Vo,Wo);
69310593Sgabeblack@google.com                    0x5: WarnUnimpl::hsubps_Vo_Wo();
69410593Sgabeblack@google.com                    default: UD2();
69510593Sgabeblack@google.com                }
69610593Sgabeblack@google.com                default: UD2();
69710593Sgabeblack@google.com            }
69810593Sgabeblack@google.com            0x10: decode OPCODE_OP_BOTTOM3 {
69910593Sgabeblack@google.com                0x0: JO(Jz);
70010593Sgabeblack@google.com                0x1: JNO(Jz);
70110593Sgabeblack@google.com                0x2: JB(Jz);
70210593Sgabeblack@google.com                0x3: JNB(Jz);
70310593Sgabeblack@google.com                0x4: JZ(Jz);
70410593Sgabeblack@google.com                0x5: JNZ(Jz);
70510593Sgabeblack@google.com                0x6: JBE(Jz);
70610593Sgabeblack@google.com                0x7: JNBE(Jz);
70710593Sgabeblack@google.com            }
70810593Sgabeblack@google.com            0x11: decode OPCODE_OP_BOTTOM3 {
70910593Sgabeblack@google.com                0x0: JS(Jz);
71010593Sgabeblack@google.com                0x1: JNS(Jz);
71110593Sgabeblack@google.com                0x2: JP(Jz);
71210593Sgabeblack@google.com                0x3: JNP(Jz);
71310593Sgabeblack@google.com                0x4: JL(Jz);
71410593Sgabeblack@google.com                0x5: JNL(Jz);
71510593Sgabeblack@google.com                0x6: JLE(Jz);
71610593Sgabeblack@google.com                0x7: JNLE(Jz);
71710593Sgabeblack@google.com            }
71810593Sgabeblack@google.com            0x12: decode OPCODE_OP_BOTTOM3 {
71910593Sgabeblack@google.com                0x0: SETO(Eb);
72010593Sgabeblack@google.com                0x1: SETNO(Eb);
72110593Sgabeblack@google.com                0x2: SETB(Eb);
72210593Sgabeblack@google.com                0x3: SETNB(Eb);
72310593Sgabeblack@google.com                0x4: SETZ(Eb);
72410593Sgabeblack@google.com                0x5: SETNZ(Eb);
72510593Sgabeblack@google.com                0x6: SETBE(Eb);
72610593Sgabeblack@google.com                0x7: SETNBE(Eb);
72710593Sgabeblack@google.com            }
72810593Sgabeblack@google.com            0x13: decode OPCODE_OP_BOTTOM3 {
72910593Sgabeblack@google.com                0x0: SETS(Eb);
73010593Sgabeblack@google.com                0x1: SETNS(Eb);
73110593Sgabeblack@google.com                0x2: SETP(Eb);
73210593Sgabeblack@google.com                0x3: SETNP(Eb);
73310593Sgabeblack@google.com                0x4: SETL(Eb);
73410593Sgabeblack@google.com                0x5: SETNL(Eb);
73510593Sgabeblack@google.com                0x6: SETLE(Eb);
73610593Sgabeblack@google.com                0x7: SETNLE(Eb);
73710593Sgabeblack@google.com            }
73810593Sgabeblack@google.com        }
73910593Sgabeblack@google.com        0x14: decode OPCODE_OP_BOTTOM3 {
74010593Sgabeblack@google.com            0x0: push_fs();
74110593Sgabeblack@google.com            0x1: pop_fs();
74210593Sgabeblack@google.com            0x2: CPUIDInst::CPUID({{
74310593Sgabeblack@google.com                CpuidResult result;
74410593Sgabeblack@google.com                bool success = doCpuid(xc->tcBase(), bits(Rax, 31, 0),
74510593Sgabeblack@google.com                    bits(Rcx, 31, 0), result);
74610593Sgabeblack@google.com                if (success) {
74710593Sgabeblack@google.com                    Rax = result.rax;
74810593Sgabeblack@google.com                    Rbx = result.rbx;
74910593Sgabeblack@google.com                    Rcx = result.rcx;
75010593Sgabeblack@google.com                    Rdx = result.rdx;
75110593Sgabeblack@google.com                } else {
75210593Sgabeblack@google.com                    Rax = Rax;
75310593Sgabeblack@google.com                    Rbx = Rbx;
75410593Sgabeblack@google.com                    Rcx = Rcx;
75510593Sgabeblack@google.com                    Rdx = Rdx;
75610593Sgabeblack@google.com                }
75710593Sgabeblack@google.com                }});
75810593Sgabeblack@google.com            0x3: Inst::BT(Ev,Gv);
75910593Sgabeblack@google.com            0x4: Inst::SHLD(Ev,Gv,Ib);
76010593Sgabeblack@google.com            0x5: Inst::SHLD(Ev,Gv);
76110593Sgabeblack@google.com            default: Inst::UD2();
76210593Sgabeblack@google.com        }
76310593Sgabeblack@google.com        0x15: decode OPCODE_OP_BOTTOM3 {
76410593Sgabeblack@google.com            0x0: push_gs();
76510593Sgabeblack@google.com            0x1: pop_gs();
76610593Sgabeblack@google.com            0x2: rsm_smm();
76710593Sgabeblack@google.com            0x3: Inst::BTS(Ev,Gv);
76810593Sgabeblack@google.com            0x4: Inst::SHRD(Ev,Gv,Ib);
76910593Sgabeblack@google.com            0x5: Inst::SHRD(Ev,Gv);
77010593Sgabeblack@google.com            //0x6: group15();
77110593Sgabeblack@google.com            0x6: decode MODRM_MOD {
77210593Sgabeblack@google.com                0x3: decode MODRM_REG {
77310593Sgabeblack@google.com                    0x5: BasicOperate::LFENCE(
77410593Sgabeblack@google.com                                 {{/*Nothing*/}}, IsReadBarrier);
77510593Sgabeblack@google.com                    0x6: BasicOperate::MFENCE(
77610593Sgabeblack@google.com                                 {{/*Nothing*/}}, IsMemBarrier);
77710593Sgabeblack@google.com                    0x7: BasicOperate::SFENCE(
77810593Sgabeblack@google.com                                 {{/*Nothing*/}}, IsWriteBarrier);
77910593Sgabeblack@google.com                    default: Inst::UD2();
78010593Sgabeblack@google.com                }
78110593Sgabeblack@google.com                default: decode MODRM_REG {
78210593Sgabeblack@google.com                    0x0: decode OPSIZE {
78310593Sgabeblack@google.com                        4: Inst::FXSAVE(M);
78410593Sgabeblack@google.com                        8: Inst::FXSAVE64(M);
78510593Sgabeblack@google.com                        default: fxsave();
78610593Sgabeblack@google.com                    }
78710593Sgabeblack@google.com                    0x1: decode OPSIZE {
78810593Sgabeblack@google.com                        4: Inst::FXRSTOR(M);
78910593Sgabeblack@google.com                        8: Inst::FXRSTOR64(M);
79010593Sgabeblack@google.com                        default: fxrstor();
79110593Sgabeblack@google.com                    }
79210593Sgabeblack@google.com                    0x2: Inst::LDMXCSR(Md);
79310593Sgabeblack@google.com                    0x3: Inst::STMXCSR(Md);
79410593Sgabeblack@google.com                    0x4: xsave();
79510593Sgabeblack@google.com                    0x5: xrstor();
79610593Sgabeblack@google.com                    0x6: Inst::UD2();
79710593Sgabeblack@google.com                    0x7: clflush();
79810593Sgabeblack@google.com                }
79910593Sgabeblack@google.com            }
80010593Sgabeblack@google.com            0x7: Inst::IMUL(Gv,Ev);
80110593Sgabeblack@google.com        }
80210593Sgabeblack@google.com        format Inst {
80310593Sgabeblack@google.com            0x16: decode OPCODE_OP_BOTTOM3 {
80410593Sgabeblack@google.com                0x0: CMPXCHG(Eb,Gb);
80510593Sgabeblack@google.com                0x1: CMPXCHG(Ev,Gv);
80610593Sgabeblack@google.com                0x2: WarnUnimpl::lss_Gz_Mp();
80710593Sgabeblack@google.com                0x3: BTR(Ev,Gv);
80810593Sgabeblack@google.com                0x4: WarnUnimpl::lfs_Gz_Mp();
80910593Sgabeblack@google.com                0x5: WarnUnimpl::lgs_Gz_Mp();
81010593Sgabeblack@google.com                //The size of the second operand in these instructions
81110593Sgabeblack@google.com                //should really be "b" or "w", but it's set to v in order
81210593Sgabeblack@google.com                //to have a consistent register size. This shouldn't
81310593Sgabeblack@google.com                //affect behavior.
81410593Sgabeblack@google.com                0x6: MOVZX_B(Gv,Ev);
81510593Sgabeblack@google.com                0x7: MOVZX_W(Gv,Ev);
81610593Sgabeblack@google.com            }
81710593Sgabeblack@google.com            0x17: decode OPCODE_OP_BOTTOM3 {
81810593Sgabeblack@google.com                0x0: decode LEGACY_REP {
81910593Sgabeblack@google.com                    0x0: WarnUnimpl::jmpe_Jz();
82010593Sgabeblack@google.com                    0x1: WarnUnimpl::popcnt_Gv_Ev();
82110593Sgabeblack@google.com                }
82210593Sgabeblack@google.com                //0x1: group10_UD2();
82310593Sgabeblack@google.com                0x1: UD2();
82410593Sgabeblack@google.com                //0x2: group8_Ev_Ib();
82510593Sgabeblack@google.com                0x2: decode MODRM_REG {
82610593Sgabeblack@google.com                    0x4: BT(Ev,Ib);
82710593Sgabeblack@google.com                    0x5: BTS(Ev,Ib);
82810593Sgabeblack@google.com                    0x6: BTR(Ev,Ib);
82910593Sgabeblack@google.com                    0x7: BTC(Ev,Ib);
83010593Sgabeblack@google.com                    default: UD2();
83110593Sgabeblack@google.com                }
83210593Sgabeblack@google.com                0x3: BTC(Ev,Gv);
83310593Sgabeblack@google.com                0x4: BSF(Gv,Ev);
83410593Sgabeblack@google.com                0x5: BSR(Gv,Ev);
83510593Sgabeblack@google.com                //The size of the second operand in these instructions
83610593Sgabeblack@google.com                //should really be "b" or "w", but it's set to v in order
83710593Sgabeblack@google.com                //to have a consistent register size. This shouldn't
83810593Sgabeblack@google.com                //affect behavior.
83910593Sgabeblack@google.com                0x6: MOVSX_B(Gv,Ev);
84010593Sgabeblack@google.com                0x7: MOVSX_W(Gv,Ev);
84110593Sgabeblack@google.com            }
84210593Sgabeblack@google.com            0x18: decode OPCODE_OP_BOTTOM3 {
84310593Sgabeblack@google.com                0x0: XADD(Eb,Gb);
84410593Sgabeblack@google.com                0x1: XADD(Ev,Gv);
84510593Sgabeblack@google.com                //0x7: group9();
84610593Sgabeblack@google.com                0x7: decode MODRM_REG {
84710593Sgabeblack@google.com                    //Also CMPXCHG16B
84810593Sgabeblack@google.com                    0x1: CMPXCHG8B(Mdp);
84910593Sgabeblack@google.com                    0x6: decode LEGACY_OP {
85010593Sgabeblack@google.com                        0x1: WarnUnimpl::vmclear_Mq();
85110593Sgabeblack@google.com                        default: decode LEGACY_REP {
85210593Sgabeblack@google.com                            0x1: WarnUnimpl::vmxon_Mq();
85310593Sgabeblack@google.com                            0x0: WarnUnimpl::vmptrld_Mq();
85410593Sgabeblack@google.com                        }
85510593Sgabeblack@google.com                    }
85610593Sgabeblack@google.com                    0x7: WarnUnimpl::vmptrst_Mq();
85710593Sgabeblack@google.com                    default: UD2();
85810593Sgabeblack@google.com                }
85910593Sgabeblack@google.com                default: decode LEGACY_DECODEVAL {
8606576Sgblack@eecs.umich.edu                    // no prefix
8616576Sgblack@eecs.umich.edu                    0x0: decode OPCODE_OP_BOTTOM3 {
86210593Sgabeblack@google.com                        0x2: CMPPS(Vo,Wo,Ib);
86310593Sgabeblack@google.com                        0x3: MOVNTI(Mdp,Gdp);
86410593Sgabeblack@google.com                        0x4: PINSRW(Pq,Ew,Ib);
86510593Sgabeblack@google.com                        0x5: PEXTRW(Gd,PRq,Ib);
86610593Sgabeblack@google.com                        0x6: SHUFPS(Vps,Wps,Ib);
8675020Sgblack@eecs.umich.edu                    }
8686576Sgblack@eecs.umich.edu                    // repe (0xF3)
8696576Sgblack@eecs.umich.edu                    0x4: decode OPCODE_OP_BOTTOM3 {
87010593Sgabeblack@google.com                        0x2: CMPSS(Vd,Wd,Ib);
8716576Sgblack@eecs.umich.edu                        default: UD2();
8725020Sgblack@eecs.umich.edu                    }
8736576Sgblack@eecs.umich.edu                    // operand size (0x66)
8746576Sgblack@eecs.umich.edu                    0x1: decode OPCODE_OP_BOTTOM3 {
87510593Sgabeblack@google.com                        0x2: CMPPD(Vo,Wo,Ib);
87610593Sgabeblack@google.com                        0x4: PINSRW(Vdw,Ew,Ib);
87710593Sgabeblack@google.com                        0x5: PEXTRW(Gd,VRdq,Ib);
87810593Sgabeblack@google.com                        0x6: SHUFPD(Vpd,Wpd,Ib);
87910593Sgabeblack@google.com                        default: UD2();
8806576Sgblack@eecs.umich.edu                    }
8816576Sgblack@eecs.umich.edu                    // repne (0xF2)
8826576Sgblack@eecs.umich.edu                    0x8: decode OPCODE_OP_BOTTOM3 {
88310593Sgabeblack@google.com                        0x2: CMPSD(Vq,Wq,Ib);
8846611Sgblack@eecs.umich.edu                        default: UD2();
8856611Sgblack@eecs.umich.edu                    }
8866611Sgblack@eecs.umich.edu                    default: UD2();
8875020Sgblack@eecs.umich.edu                }
8884276Sgblack@eecs.umich.edu            }
88910593Sgabeblack@google.com            0x19: decode OPSIZE {
89010593Sgabeblack@google.com                4: BSWAP_D(Bd);
89110593Sgabeblack@google.com                8: BSWAP_Q(Bq);
8926611Sgblack@eecs.umich.edu                default: UD2();
8934276Sgblack@eecs.umich.edu            }
89410593Sgabeblack@google.com            0x1A: decode LEGACY_DECODEVAL {
89510593Sgabeblack@google.com                // no prefix
89610593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
89710593Sgabeblack@google.com                    0x1: PSRLW(Pq,Qq);
89810593Sgabeblack@google.com                    0x2: PSRLD(Pq,Qq);
89910593Sgabeblack@google.com                    0x3: PSRLQ(Pq,Qq);
90010593Sgabeblack@google.com                    0x4: PADDQ(Pq,Qq);
90110593Sgabeblack@google.com                    0x5: PMULLW(Pq,Qq);
90210593Sgabeblack@google.com                    0x7: PMOVMSKB(Gd,PRq);
9035059Sgblack@eecs.umich.edu                    default: UD2();
9045020Sgblack@eecs.umich.edu                }
90510593Sgabeblack@google.com                // repe (0xF3)
90610593Sgabeblack@google.com                0x4: decode OPCODE_OP_BOTTOM3 {
90710593Sgabeblack@google.com                    0x6: MOVQ2DQ(Vo,PRq);
9086576Sgblack@eecs.umich.edu                    default: UD2();
9095020Sgblack@eecs.umich.edu                }
91010593Sgabeblack@google.com                // operand size (0x66)
91110593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
91210632Smaxime.cscs@gmail.com                    0x0: ADDSUBPD(Vo,Wo);
91310593Sgabeblack@google.com                    0x1: PSRLW(Vo,Wo);
91410593Sgabeblack@google.com                    0x2: PSRLD(Vo,Wo);
91510593Sgabeblack@google.com                    0x3: PSRLQ(Vo,Wo);
91610593Sgabeblack@google.com                    0x4: PADDQ(Vo,Wo);
91710593Sgabeblack@google.com                    0x5: PMULLW(Vo,Wo);
91810593Sgabeblack@google.com                    0x6: MOVQ(Wq,Vq);
91910593Sgabeblack@google.com                    0x7: PMOVMSKB(Gd,VRo);
92010593Sgabeblack@google.com                }
92110593Sgabeblack@google.com                // repne (0xF2)
92210593Sgabeblack@google.com                0x8: decode OPCODE_OP_BOTTOM3 {
92310593Sgabeblack@google.com                    0x0: WarnUnimpl::addsubps_Vo_Wo();
92410593Sgabeblack@google.com                    0x6: MOVDQ2Q(Pq,VRq);
9256576Sgblack@eecs.umich.edu                    default: UD2();
9265020Sgblack@eecs.umich.edu                }
92710593Sgabeblack@google.com                default: UD2();
92810593Sgabeblack@google.com            }
92910593Sgabeblack@google.com            0x1B: decode LEGACY_DECODEVAL {
93010593Sgabeblack@google.com                // no prefix
93110593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
93210593Sgabeblack@google.com                    0x0: PSUBUSB(Pq,Qq);
93310593Sgabeblack@google.com                    0x1: PSUBUSW(Pq,Qq);
93410593Sgabeblack@google.com                    0x2: PMINUB(Pq,Qq);
93510593Sgabeblack@google.com                    0x3: PAND(Pq,Qq);
93610593Sgabeblack@google.com                    0x4: PADDUSB(Pq,Qq);
93710593Sgabeblack@google.com                    0x5: PADDUSW(Pq,Qq);
93810593Sgabeblack@google.com                    0x6: PMAXUB(Pq,Qq);
93910593Sgabeblack@google.com                    0x7: PANDN(Pq,Qq);
94010593Sgabeblack@google.com                }
94110593Sgabeblack@google.com                // operand size (0x66)
94210593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
94310593Sgabeblack@google.com                    0x0: PSUBUSB(Vo,Wo);
94410593Sgabeblack@google.com                    0x1: PSUBUSW(Vo,Wo);
94510593Sgabeblack@google.com                    0x2: PMINUB(Vo,Wo);
94610593Sgabeblack@google.com                    0x3: PAND(Vo,Wo);
94710593Sgabeblack@google.com                    0x4: PADDUSB(Vo,Wo);
94810593Sgabeblack@google.com                    0x5: PADDUSW(Vo,Wo);
94910593Sgabeblack@google.com                    0x6: PMAXUB(Vo,Wo);
95010593Sgabeblack@google.com                    0x7: PANDN(Vo,Wo);
95110593Sgabeblack@google.com                }
95210593Sgabeblack@google.com                default: UD2();
95310593Sgabeblack@google.com            }
95410593Sgabeblack@google.com            0x1C: decode LEGACY_DECODEVAL {
95510593Sgabeblack@google.com                // no prefix
95610593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
95710593Sgabeblack@google.com                    0x0: PAVGB(Pq,Qq);
95810593Sgabeblack@google.com                    0x1: PSRAW(Pq,Qq);
95910593Sgabeblack@google.com                    0x2: PSRAD(Pq,Qq);
96010593Sgabeblack@google.com                    0x3: PAVGW(Pq,Qq);
96110593Sgabeblack@google.com                    0x4: PMULHUW(Pq,Qq);
96210593Sgabeblack@google.com                    0x5: PMULHW(Pq,Qq);
96310593Sgabeblack@google.com                    0x7: WarnUnimpl::movntq_Mq_Pq();
9646576Sgblack@eecs.umich.edu                    default: UD2();
9655020Sgblack@eecs.umich.edu                }
96610593Sgabeblack@google.com                // repe (0xF3)
96710593Sgabeblack@google.com                0x4: decode OPCODE_OP_BOTTOM3 {
96810593Sgabeblack@google.com                    0x6: CVTDQ2PD(Vo,Wq);
9696584Sgblack@eecs.umich.edu                    default: UD2();
9705020Sgblack@eecs.umich.edu                }
97110593Sgabeblack@google.com                // operand size (0x66)
97210593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
97310593Sgabeblack@google.com                    0x0: PAVGB(Vo,Wo);
97410593Sgabeblack@google.com                    0x1: PSRAW(Vo,Wo);
97510593Sgabeblack@google.com                    0x2: PSRAD(Vo,Wo);
97610593Sgabeblack@google.com                    0x3: PAVGW(Vo,Wo);
97710593Sgabeblack@google.com                    0x4: PMULHUW(Vo,Wo);
97810593Sgabeblack@google.com                    0x5: PMULHW(Vo,Wo);
97910593Sgabeblack@google.com                    0x6: CVTTPD2DQ(Vo,Wo);
98010593Sgabeblack@google.com                    0x7: WarnUnimpl::movntdq_Mo_Vo();
98110593Sgabeblack@google.com                }
98210593Sgabeblack@google.com                // repne (0xF2)
98310593Sgabeblack@google.com                0x8: decode OPCODE_OP_BOTTOM3 {
98410593Sgabeblack@google.com                    0x6: CVTPD2DQ(Vo,Wo);
9856584Sgblack@eecs.umich.edu                    default: UD2();
9865020Sgblack@eecs.umich.edu                }
98710593Sgabeblack@google.com                default: UD2();
98810593Sgabeblack@google.com            }
98910593Sgabeblack@google.com            0x1D: decode LEGACY_DECODEVAL {
99010593Sgabeblack@google.com                // no prefix
99110593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
99210593Sgabeblack@google.com                    0x0: PSUBSB(Pq,Qq);
99310593Sgabeblack@google.com                    0x1: PSUBSW(Pq,Qq);
99410593Sgabeblack@google.com                    0x2: PMINSW(Pq,Qq);
99510593Sgabeblack@google.com                    0x3: POR(Pq,Qq);
99610593Sgabeblack@google.com                    0x4: PADDSB(Pq,Qq);
99710593Sgabeblack@google.com                    0x5: PADDSW(Pq,Qq);
99810593Sgabeblack@google.com                    0x6: PMAXSW(Pq,Qq);
99910593Sgabeblack@google.com                    0x7: PXOR(Pq,Qq);
10004727Sgblack@eecs.umich.edu                }
100110593Sgabeblack@google.com                // operand size (0x66)
100210593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
100310593Sgabeblack@google.com                    0x0: PSUBSB(Vo,Wo);
100410593Sgabeblack@google.com                    0x1: PSUBSW(Vo,Wo);
100510593Sgabeblack@google.com                    0x2: PMINSW(Vo,Wo);
100610593Sgabeblack@google.com                    0x3: POR(Vo,Wo);
100710593Sgabeblack@google.com                    0x4: PADDSB(Vo,Wo);
100810593Sgabeblack@google.com                    0x5: PADDSW(Vo,Wo);
100910593Sgabeblack@google.com                    0x6: PMAXSW(Vo,Wo);
101010593Sgabeblack@google.com                    0x7: PXOR(Vo,Wo);
10114727Sgblack@eecs.umich.edu                }
101210593Sgabeblack@google.com                default: UD2();
10134276Sgblack@eecs.umich.edu            }
101410593Sgabeblack@google.com            0x1E: decode LEGACY_DECODEVAL {
101510593Sgabeblack@google.com                // no prefix
101610593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
101710593Sgabeblack@google.com                    0x1: PSLLW(Pq,Qq);
101810593Sgabeblack@google.com                    0x2: PSLLD(Pq,Qq);
101910593Sgabeblack@google.com                    0x3: PSLLQ(Pq,Qq);
102010593Sgabeblack@google.com                    0x4: PMULUDQ(Pq,Qq);
102110593Sgabeblack@google.com                    0x5: PMADDWD(Pq,Qq);
102210593Sgabeblack@google.com                    0x6: PSADBW(Pq,Qq);
102310593Sgabeblack@google.com                    0x7: MASKMOVQ(Pq,PRq);
10246576Sgblack@eecs.umich.edu                    default: UD2();
10255020Sgblack@eecs.umich.edu                }
102610593Sgabeblack@google.com                // operand size (0x66)
102710593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
102810593Sgabeblack@google.com                    0x1: PSLLW(Vo,Wo);
102910593Sgabeblack@google.com                    0x2: PSLLD(Vo,Wo);
103010593Sgabeblack@google.com                    0x3: PSLLQ(Vo,Wo);
103110593Sgabeblack@google.com                    0x4: PMULUDQ(Vo,Wo);
103210593Sgabeblack@google.com                    0x5: PMADDWD(Vo,Wo);
103310593Sgabeblack@google.com                    0x6: PSADBW(Vo,Wo);
103410593Sgabeblack@google.com                    0x7: MASKMOVDQU(Vo,VRo);
10356593Sgblack@eecs.umich.edu                    default: UD2();
10365020Sgblack@eecs.umich.edu                }
103710593Sgabeblack@google.com                // repne (0xF2)
103810593Sgabeblack@google.com                0x8: decode OPCODE_OP_BOTTOM3 {
103910593Sgabeblack@google.com                    0x0: WarnUnimpl::lddqu_Vo_Mo();
10406576Sgblack@eecs.umich.edu                    default: UD2();
10415020Sgblack@eecs.umich.edu                }
104210593Sgabeblack@google.com                default: UD2();
104310593Sgabeblack@google.com            }
104410593Sgabeblack@google.com            0x1F: decode LEGACY_DECODEVAL {
104510593Sgabeblack@google.com                // no prefix
104610593Sgabeblack@google.com                0x0: decode OPCODE_OP_BOTTOM3 {
104710593Sgabeblack@google.com                    0x0: PSUBB(Pq,Qq);
104810593Sgabeblack@google.com                    0x1: PSUBW(Pq,Qq);
104910593Sgabeblack@google.com                    0x2: PSUBD(Pq,Qq);
105010593Sgabeblack@google.com                    0x3: PSUBQ(Pq,Qq);
105110593Sgabeblack@google.com                    0x4: PADDB(Pq,Qq);
105210593Sgabeblack@google.com                    0x5: PADDW(Pq,Qq);
105310593Sgabeblack@google.com                    0x6: PADDD(Pq,Qq);
105410593Sgabeblack@google.com                    0x7: UD2();
10555022Sgblack@eecs.umich.edu                }
105610593Sgabeblack@google.com                // operand size (0x66)
105710593Sgabeblack@google.com                0x1: decode OPCODE_OP_BOTTOM3 {
105810593Sgabeblack@google.com                    0x0: PSUBB(Vo,Wo);
105910593Sgabeblack@google.com                    0x1: PSUBW(Vo,Wo);
106010593Sgabeblack@google.com                    0x2: PSUBD(Vo,Wo);
106110593Sgabeblack@google.com                    0x3: PSUBQ(Vo,Wo);
106210593Sgabeblack@google.com                    0x4: PADDB(Vo,Wo);
106310593Sgabeblack@google.com                    0x5: PADDW(Vo,Wo);
106410593Sgabeblack@google.com                    0x6: PADDD(Vo,Wo);
106510593Sgabeblack@google.com                    0x7: UD2();
10665020Sgblack@eecs.umich.edu                }
106710593Sgabeblack@google.com                default: UD2();
10684276Sgblack@eecs.umich.edu            }
10694276Sgblack@eecs.umich.edu        }
107010593Sgabeblack@google.com        default: FailUnimpl::twoByteOps();
10714276Sgblack@eecs.umich.edu    }
10724276Sgblack@eecs.umich.edu}
1073