1 // Copyright (c) 2008 The Regents of The University of Michigan
2 // All rights reserved.
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met: redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer;
8 // redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution;
11 // neither the name of the copyright holders nor the names of its
12 // contributors may be used to endorse or promote products derived from
13 // this software without specific prior written permission.
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 // Authors: Gabe Black
29 // Copyright (c) 2007-2008 The Hewlett-Packard Development Company
30 // All rights reserved.
32 // Redistribution and use of this software in source and binary forms,
33 // with or without modification, are permitted provided that the
34 // following conditions are met:
36 // The software must be used only for Non-Commercial Use which means any
37 // use which is NOT directed to receiving any direct monetary
38 // compensation for, or commercial advantage from such use. Illustrative
39 // examples of non-commercial use are academic research, personal study,
40 // teaching, education and corporate research & development.
41 // Illustrative examples of commercial use are distributing products for
42 // commercial advantage and providing services using the software for
43 // commercial advantage.
45 // If you wish to use this software or functionality therein that may be
46 // covered by patents for commercial use, please contact:
47 // Director of Intellectual Property Licensing
48 // Office of Strategy and Technology
49 // Hewlett-Packard Company
50 // 1501 Page Mill Road
51 // Palo Alto, California 94304
53 // Redistributions of source code must retain the above copyright notice,
54 // this list of conditions and the following disclaimer. Redistributions
55 // in binary form must reproduce the above copyright notice, this list of
56 // conditions and the following disclaimer in the documentation and/or
57 // other materials provided with the distribution. Neither the name of
58 // the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
59 // contributors may be used to endorse or promote products derived from
60 // this software without specific prior written permission. No right of
61 // sublicense is granted herewith. Derivatives of the software and
62 // output created using the software may be prepared, but only for
63 // Non-Commercial Uses. Derivatives of the software may be shared with
64 // others provided: (i) the others agree to abide by the list of
65 // conditions herein which includes the Non-Commercial Use restrictions;
66 // and (ii) such Derivatives of the software include the above copyright
67 // notice to acknowledge the contribution from this software where
68 // applicable, this list of conditions and the disclaimer below.
70 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
71 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
72 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
73 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
74 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
75 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
76 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
77 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
78 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
79 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
80 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
82 // Authors: Gabe Black
84 ////////////////////////////////////////////////////////////////////
86 // Decode the two byte opcodes
88 0x2: decode OPCODE_PREFIXA {
89 0x0F: decode OPCODE_OP_TOP5 {
91 0x00: decode OPCODE_OP_BOTTOM3 {
93 0x00: decode MODRM_REG {
100 //0x6: jmpe_Ev(); // IA-64
101 default: Inst::UD2();
103 //0x01: group7(); // Ugly, ugly, ugly...
104 0x01: decode MODRM_MOD {
105 0x3: decode MODRM_REG {
106 0x0: decode MODRM_RM {
111 default: Inst::UD2();
113 0x1: decode MODRM_RM {
116 default: Inst::UD2();
118 0x3: decode MODRM_RM {
130 0x7: decode MODRM_RM {
133 default: Inst::UD2();
135 default: Inst::UD2();
137 default: decode MODRM_REG {
140 0x2: decode MODE_SUBMODE {
142 default: decode OPSIZE {
143 // 16 bit operand sizes are special, but only
144 // in legacy and compatability modes.
145 0x2: Inst::LGDT_16(M);
146 default: Inst::LGDT(M);
149 0x3: decode MODE_SUBMODE {
151 default: decode OPSIZE {
152 // 16 bit operand sizes are special, but only
153 // in legacy and compatability modes.
154 0x2: Inst::LIDT_16(M);
155 default: Inst::LIDT(M);
160 0x7: Inst::INVLPG(M);
161 default: Inst::UD2();
166 // sandpile.org doesn't seem to know what this is...? We'll
167 // use it for pseudo instructions. We've got 16 bits of space
168 // to play with so there can be quite a few pseudo
170 //0x04: loadall_or_reset_or_hang();
171 0x4: decode IMMEDIATE {
172 format BasicOperate {
175 PseudoInst::arm(xc->tcBase());
176 }}, IsNonSpeculative);
178 PseudoInst::quiesce(xc->tcBase());
179 }}, IsNonSpeculative);
181 PseudoInst::quiesceNs(xc->tcBase(), Rdi);
182 }}, IsNonSpeculative);
183 0x03: m5quiesceCycle({{
184 PseudoInst::quiesceCycles(xc->tcBase(), Rdi);
185 }}, IsNonSpeculative);
186 0x04: m5quiesceTime({{
187 Rax = PseudoInst::quiesceTime(xc->tcBase());
188 }}, IsNonSpeculative);
191 Rax = PseudoInst::rpns(xc->tcBase());
192 }}, IsNonSpeculative);
194 PseudoInst::m5exit(xc->tcBase(), Rdi);
195 }}, IsNonSpeculative);
198 Rax = xc->tcBase()->getCpuPtr()->
200 }}, IsNonSpeculative);
201 0x31: m5loadsymbol({{
202 PseudoInst::loadsymbol(xc->tcBase());
203 }}, IsNonSpeculative);
205 0x40: m5resetstats({{
206 PseudoInst::resetstats(xc->tcBase(), Rdi, Rsi);
207 }}, IsNonSpeculative);
209 PseudoInst::dumpstats(xc->tcBase(), Rdi, Rsi);
210 }}, IsNonSpeculative);
211 0x42: m5dumpresetstats({{
212 PseudoInst::dumpresetstats(xc->tcBase(), Rdi, Rsi);
213 }}, IsNonSpeculative);
214 0x43: m5checkpoint({{
215 PseudoInst::m5checkpoint(xc->tcBase(), Rdi, Rsi);
216 }}, IsNonSpeculative);
219 Rax = PseudoInst::readfile(
220 xc->tcBase(), Rdi, Rsi, Rdx);
221 }}, IsNonSpeculative);
223 0x51: m5debugbreak({{
224 PseudoInst::debugbreak(xc->tcBase());
225 }}, IsNonSpeculative);
227 PseudoInst::switchcpu(xc->tcBase());
228 }}, IsNonSpeculative);
231 PseudoInst::addsymbol(xc->tcBase(), Rdi, Rsi);
232 }}, IsNonSpeculative);
235 panic("M5 panic instruction called at pc=%#x.\n",
237 }}, IsNonSpeculative);
239 warn("M5 reserved opcode 1 ignored.\n");
240 }}, IsNonSpeculative);
242 warn("M5 reserved opcode 2 ignored.\n");
243 }}, IsNonSpeculative);
245 warn("M5 reserved opcode 3 ignored.\n");
246 }}, IsNonSpeculative);
248 warn("M5 reserved opcode 4 ignored.\n");
249 }}, IsNonSpeculative);
251 warn("M5 reserved opcode 5 ignored.\n");
252 }}, IsNonSpeculative);
253 default: Inst::UD2();
257 0x05: decode MODE_MODE {
258 0x0: decode MODE_SUBMODE {
259 0x0: Inst::SYSCALL_64();
260 0x1: Inst::SYSCALL_COMPAT();
262 0x1: Inst::SYSCALL_LEGACY();
265 0x05: SyscallInst::syscall('xc->syscall(Rax)', IsSyscall);
268 0x07: decode MODE_SUBMODE {
270 // Return to 64 bit mode.
271 0x8: Inst::SYSRET_TO_64();
272 // Return to compatibility mode.
273 default: Inst::SYSRET_TO_COMPAT();
275 default: Inst::SYSRET_NON_64();
278 0x01: decode OPCODE_OP_BOTTOM3 {
284 0x5: Inst::PREFETCH(Mb);
285 0x6: FailUnimpl::femms();
286 0x7: FailUnimpl::threednow();
288 0x02: decode LEGACY_DECODEVAL {
290 0x0: decode OPCODE_OP_BOTTOM3 {
293 0x2: decode MODRM_MOD {
294 0x3: movhlps_Vq_VRq();
295 default: movlps_Vq_Mq();
300 0x6: decode MODRM_MOD {
301 0x3: movlhps_Vq_VRq();
302 default: movhps_Vq_Mq();
307 0x4: decode OPCODE_OP_BOTTOM3 {
310 0x2: movsldup_Vo_Wo();
311 0x6: movshdup_Vo_Wo();
312 default: Inst::UD2();
314 // operand size (0x66)
315 0x1: decode OPCODE_OP_BOTTOM3 {
318 0x2: Inst::MOVLPD(Vq,Mq);
319 0x3: Inst::MOVLPD(Mq,Vq);
320 0x4: unpcklpd_Vo_Wq();
321 0x5: unpckhpd_Vo_Wo();
326 0x8: decode OPCODE_OP_BOTTOM3 {
327 0x0: Inst::MOVSD(Vq,Wq);
328 0x1: Inst::MOVSD(Wq,Vq);
329 0x2: movddup_Vo_Wq();
330 default: Inst::UD2();
332 default: Inst::UD2();
334 0x03: decode OPCODE_OP_BOTTOM3 {
336 0x0: decode MODRM_REG {
338 0x1: Inst::PREFETCH_T0(Mb);
341 default: Inst::HINT_NOP();
343 0x1: Inst::HINT_NOP();
344 0x2: Inst::HINT_NOP();
345 0x3: Inst::HINT_NOP();
346 0x4: Inst::HINT_NOP();
347 0x5: Inst::HINT_NOP();
348 0x6: Inst::HINT_NOP();
349 0x7: Inst::HINT_NOP();
351 0x04: decode LEGACY_DECODEVAL {
353 0x0: decode OPCODE_OP_BOTTOM3 {
354 0x0: Inst::MOV(Rd,Cd);
355 0x1: Inst::MOV(Rd,Dd);
356 0x2: Inst::MOV(Cd,Rd);
357 0x3: Inst::MOV(Dd,Rd);
360 default: Inst::UD2();
362 // lock prefix (0xF0)
363 0x2: decode OPCODE_OP_BOTTOM3 {
367 default: Inst::UD2();
369 0x05: decode LEGACY_DECODEVAL {
371 0x0: decode OPCODE_OP_BOTTOM3 {
372 //These moves should really use size o (octword), but
373 //because they are split in two, they use q (quadword).
374 0x0: Inst::MOVAPS(Vq,Wq);
375 0x1: Inst::MOVAPS(Wq,Vq);
376 0x2: decode MODRM_MOD {
377 0x3: cvtpi2pS_Vq_Pq();
378 default: cvtpi2ps_Vq_Mq();
380 0x3: movntps_Mo_Vo();
381 0x4: cvttps2pi_Pq_Wq();
382 0x5: cvtpS2pi_Pq_Wq();
383 0x6: ucomiss_Vd_Wd();
387 0x4: decode OPCODE_OP_BOTTOM3 {
388 0x2: cvtsi2ss_Vd_Ed();
389 0x4: cvttss2si_Gd_Wd();
390 0x5: cvtss2si_Gd_Wd();
391 default: Inst::UD2();
393 // operand size (0x66)
394 0x1: decode OPCODE_OP_BOTTOM3 {
397 0x2: decode MODRM_MOD {
398 0x3: cvtpi2pd_Vo_Pq();
399 default: cvtpi2pd_Vo_Mq();
401 0x3: movntpd_Mo_Vo();
402 0x4: cvttpd2pi_Pq_Wo();
403 0x5: cvtpd2pi_Pq_Wo();
404 0x6: Inst::UCOMISD(Vq,Wq);
408 0x8: decode OPCODE_OP_BOTTOM3 {
409 // The size of the V operand should be q, not dp
410 0x2: Inst::CVTSI2SD(Vdp,Edp);
411 // The size of the W operand should be q, not dp
412 0x4: Inst::CVTTSD2SI(Gdp,Wdp);
413 0x5: cvtsd2si_Gd_Wq();
414 default: Inst::UD2();
416 default: Inst::UD2();
418 0x06: decode OPCODE_OP_BOTTOM3 {
426 0x4: SyscallInst::sysenter('xc->syscall(Rax)', IsSyscall);
432 0x07: decode OPCODE_OP_BOTTOM3 {
433 0x0: three_byte_opcode();
434 0x1: three_byte_opcode();
435 0x2: three_byte_opcode();
436 0x3: three_byte_opcode();
437 0x4: three_byte_opcode();
438 0x5: three_byte_opcode();
439 0x6: three_byte_opcode();
440 0x7: three_byte_opcode();
443 0x08: decode OPCODE_OP_BOTTOM3 {
453 0x09: decode OPCODE_OP_BOTTOM3 {
464 0x0A: decode LEGACY_DECODEVAL {
466 0x0: decode OPCODE_OP_BOTTOM3 {
467 0x0: movmskps_Gd_VRo();
469 0x2: rqsrtps_Vo_Wo();
477 0x4: decode OPCODE_OP_BOTTOM3 {
479 0x2: rsqrtss_Vd_Wd();
481 default: Inst::UD2();
483 // operand size (0x66)
484 0x1: decode OPCODE_OP_BOTTOM3 {
485 0x0: movmskpd_Gd_VRo();
490 //This really should be type o, but it works on q sized
492 0x7: Inst::XORPD(Vq,Wq);
493 default: Inst::UD2();
497 0x8: decode OPCODE_OP_BOTTOM3 {
504 0x0B: decode LEGACY_DECODEVAL {
506 0x0: decode OPCODE_OP_BOTTOM3 {
509 0x2: cvtps2pd_Vo_Wq();
510 0x3: cvtdq2ps_Vo_Wo();
517 0x4: decode OPCODE_OP_BOTTOM3 {
520 0x2: cvtss2sd_Vq_Wd();
521 0x3: cvttps2dq_Vo_Wo();
527 // operand size (0x66)
528 0x1: decode OPCODE_OP_BOTTOM3 {
531 0x2: cvtpd2ps_Vo_Wo();
532 0x3: cvtps2dq_Vo_Wo();
539 0x8: decode OPCODE_OP_BOTTOM3 {
540 0x0: Inst::ADDSD(Vq,Wq);
541 0x1: Inst::MULSD(Vq,Wq);
542 0x2: cvtsd2ss_Vd_Wq();
543 0x4: Inst::SUBSD(Vq,Wq);
545 0x6: Inst::DIVSD(Vq,Wq);
547 default: Inst::UD2();
549 default: Inst::UD2();
551 0x0C: decode LEGACY_DECODEVAL {
553 0x0: decode OPCODE_OP_BOTTOM3 {
554 0x0: punpcklbw_Pq_Qd();
555 0x1: punpcklwd_Pq_Qd();
556 0x2: punpckldq_Pq_Qd();
557 0x3: packsswb_Pq_Qq();
558 0x4: pcmpgtb_Pq_Qq();
559 0x5: pcmpgtw_Pq_Qq();
560 0x6: pcmpgtd_Pq_Qq();
561 0x7: packuswb_Pq_Qq();
563 // operand size (0x66)
564 0x1: decode OPCODE_OP_BOTTOM3 {
565 0x0: punpcklbw_Vo_Wq();
566 0x1: punpcklwd_Vo_Wq();
567 0x2: punpckldq_Vo_Wq();
568 0x3: packsswb_Vo_Wo();
569 0x4: pcmpgtb_Vo_Wo();
570 0x5: pcmpgtw_Vo_Wo();
571 0x6: pcmpgtd_Vo_Wo();
572 0x7: packuswb_Vo_Wo();
574 default: Inst::UD2();
576 0x0D: decode LEGACY_DECODEVAL {
578 0x0: decode OPCODE_OP_BOTTOM3 {
579 0x0: punpckhbw_Pq_Qq();
580 0x1: punpckhwd_Pq_Qq();
581 0x2: punpckhdq_Pq_Qq();
582 0x3: packssdw_Pq_Qq();
585 default: Inst::UD2();
588 0x4: decode OPCODE_OP_BOTTOM3 {
590 default: Inst::UD2();
592 // operand size (0x66)
593 0x1: decode OPCODE_OP_BOTTOM3 {
594 0x0: punpckhbw_Vo_Wo();
595 0x1: punpckhwd_Vo_Wo();
596 0x2: punpckhdq_Vo_Wo();
597 0x3: packssdw_Vo_Wo();
598 0x4: punpcklqdq_Vo_Wq();
599 0x5: punpcklqdq_Vo_Wq();
603 default: Inst::UD2();
605 0x0E: decode LEGACY_DECODEVAL {
607 0x0: decode OPCODE_OP_BOTTOM3 {
608 0x0: pshufw_Pq_Qq_Ib();
609 //0x1: group13_pshimw();
610 0x1: decode MODRM_REG {
611 0x2: decode LEGACY_OP {
615 0x4: decode LEGACY_OP {
619 0x6: decode LEGACY_OP {
623 default: Inst::UD2();
625 //0x2: group14_pshimd();
626 0x2: decode MODRM_REG {
627 0x2: decode LEGACY_OP {
631 0x4: decode LEGACY_OP {
635 0x6: decode LEGACY_OP {
639 default: Inst::UD2();
641 //0x3: group15_pshimq();
642 0x3: decode MODRM_REG {
643 0x2: decode LEGACY_OP {
647 0x3: decode LEGACY_OP {
649 0x1: psrldq_VRo_Ib();
651 0x6: decode LEGACY_OP {
655 0x7: decode LEGACY_OP {
657 0x1: pslldq_VRo_Ib();
659 default: Inst::UD2();
661 0x4: pcmpeqb_Pq_Qq();
662 0x5: pcmpeqw_Pq_Qq();
663 0x6: pcmpeqd_Pq_Qq();
667 0x4: decode OPCODE_OP_BOTTOM3 {
668 0x0: pshufhw_Vo_Wo_Ib();
669 default: Inst::UD2();
671 // operand size (0x66)
672 0x1: decode OPCODE_OP_BOTTOM3 {
673 0x0: pshufd_Vo_Wo_Ib();
674 //0x1: group13_pshimw();
675 0x1: decode MODRM_REG {
676 0x2: decode LEGACY_OP {
680 0x4: decode LEGACY_OP {
684 0x6: decode LEGACY_OP {
688 default: Inst::UD2();
690 //0x2: group14_pshimd();
691 0x2: decode MODRM_REG {
692 0x2: decode LEGACY_OP {
696 0x4: decode LEGACY_OP {
700 0x6: decode LEGACY_OP {
704 default: Inst::UD2();
706 //0x3: group15_pshimq();
707 0x3: decode MODRM_REG {
708 0x2: decode LEGACY_OP {
712 0x3: decode LEGACY_OP {
714 0x1: psrldq_VRo_Ib();
716 0x6: decode LEGACY_OP {
720 0x7: decode LEGACY_OP {
722 0x1: pslldq_VRo_Ib();
724 default: Inst::UD2();
726 0x4: pcmpeqb_Vo_Wo();
727 0x5: pcmpeqw_Vo_Wo();
728 0x6: pcmpeqd_Vo_Wo();
729 default: Inst::UD2();
732 0x8: decode OPCODE_OP_BOTTOM3 {
733 0x0: pshuflw_Vo_Wo_Ib();
734 default: Inst::UD2();
736 default: Inst::UD2();
738 0x0F: decode LEGACY_DECODEVAL {
740 0x0: decode OPCODE_OP_BOTTOM3 {
741 0x0: vmread_Ed_or_Eq_Gd_or_Gq();
742 0x1: vmwrite_Gd_or_Gq_Ed_or_Eq();
745 default: Inst::UD2();
748 0x4: decode OPCODE_OP_BOTTOM3 {
749 0x6: movq_Vo_Mq_or_Vq_Vq();
751 default: Inst::UD2();
753 // operand size (0x66)
754 0x1: decode OPCODE_OP_BOTTOM3 {
759 default: Inst::UD2();
762 0x8: decode OPCODE_OP_BOTTOM3 {
765 default: Inst::UD2();
767 default: Inst::UD2();
770 0x10: decode OPCODE_OP_BOTTOM3 {
780 0x11: decode OPCODE_OP_BOTTOM3 {
790 0x12: decode OPCODE_OP_BOTTOM3 {
800 0x13: decode OPCODE_OP_BOTTOM3 {
811 0x14: decode OPCODE_OP_BOTTOM3 {
814 0x2: CPUIDInst::CPUID({{
816 success = doCpuid(xc->tcBase(), bits(Rax, 31, 0), result);
822 0x3: Inst::BT(Ev,Gv);
823 0x4: Inst::SHLD(Ev,Gv,Ib);
824 0x5: Inst::SHLD(Ev,Gv);
825 0x6: xbts_and_cmpxchg();
826 0x7: ibts_and_cmpxchg();
828 0x15: decode OPCODE_OP_BOTTOM3 {
832 0x3: Inst::BTS(Ev,Gv);
833 0x4: Inst::SHRD(Ev,Gv,Ib);
834 0x5: Inst::SHRD(Ev,Gv);
836 0x6: decode MODRM_REG {
842 0x5: decode MODRM_MOD {
843 0x3: BasicOperate::LFENCE(
844 {{/*Nothing*/}}, IsReadBarrier);
845 default: Inst::UD2();
847 0x6: decode MODRM_MOD {
848 0x3: BasicOperate::MFENCE(
849 {{/*Nothing*/}}, IsMemBarrier);
850 default: Inst::UD2();
852 0x7: decode MODRM_MOD {
853 0x3: BasicOperate::SFENCE(
854 {{/*Nothing*/}}, IsWriteBarrier);
855 default: Inst::UD2();
858 0x7: Inst::IMUL(Gv,Ev);
860 0x16: decode OPCODE_OP_BOTTOM3 {
861 0x0: Inst::CMPXCHG(Eb,Gb);
862 0x1: Inst::CMPXCHG(Ev,Gv);
864 0x3: Inst::BTR(Ev,Gv);
867 //The size of the second operand in these instructions should
868 //really be "b" or "w", but it's set to v in order to have a
869 //consistent register size. This shouldn't affect behavior.
870 0x6: Inst::MOVZX_B(Gv,Ev);
871 0x7: Inst::MOVZX_W(Gv,Ev);
873 0x17: decode OPCODE_OP_BOTTOM3 {
874 0x0: jmpe_Jz(); // IA-64?
876 //0x1: group11_UD2();
878 //0x2: group8_Ev_Ib();
879 0x2: decode MODRM_REG {
888 0x4: Inst::BSF(Gv,Ev);
889 0x5: Inst::BSR(Gv,Ev);
890 //The size of the second operand in these instructions should
891 //really be "b" or "w", but it's set to v in order to have a
892 //consistent register size. This shouldn't affect behavior.
893 0x6: Inst::MOVSX_B(Gv,Ev);
894 0x7: Inst::MOVSX_W(Gv,Ev);
896 0x18: decode OPCODE_OP_BOTTOM3 {
897 0x0: Inst::XADD(Eb,Gb);
898 0x1: Inst::XADD(Ev,Gv);
900 0x7: decode MODRM_REG {
902 0x1: Inst::CMPXCHG8B(Mdp);
903 0x6: decode LEGACY_OP {
905 default: decode LEGACY_REP {
911 default: Inst::UD2();
913 default: decode LEGACY_DECODEVAL {
915 0x0: decode OPCODE_OP_BOTTOM3 {
916 0x2: cmpccps_Vo_Wo_Ib();
917 0x3: cvtdq2ps_Vo_Wo();
923 0x4: decode OPCODE_OP_BOTTOM3 {
924 0x2: cmpccss_Vd_Wd_Ib();
925 default: Inst::UD2();
927 // operand size (0x66)
928 0x1: decode OPCODE_OP_BOTTOM3 {
929 0x2: cmpccpd_Vo_Wo_Ib();
933 default: Inst::UD2();
936 0x8: decode OPCODE_OP_BOTTOM3 {
937 0x2: cmpccsd_Vq_Wq_Ib();
938 default: Inst::UD2();
940 default: Inst::UD2();
943 0x19: decode OPSIZE {
944 4: Inst::BSWAP_D(Bd);
945 8: Inst::BSWAP_Q(Bq);
946 default: Inst::UD2();
948 0x1A: decode LEGACY_DECODEVAL {
950 0x0: decode OPCODE_OP_BOTTOM3 {
956 0x7: pmovmskb_Gd_PRq();
957 default: Inst::UD2();
960 0x4: decode OPCODE_OP_BOTTOM3 {
961 0x6: movq2dq_Vo_PRq();
962 default: Inst::UD2();
964 // operand size (0x66)
965 0x1: decode OPCODE_OP_BOTTOM3 {
966 0x0: addsubpd_Vo_Wo();
972 0x6: decode MODRM_MOD {
974 default: movq_Mq_Vq();
976 0x7: pmovmskb_Gd_VRo();
979 0x8: decode OPCODE_OP_BOTTOM3 {
980 0x0: addsubps_Vo_Wo();
981 0x6: movdq2q_Pq_VRq();
982 default: Inst::UD2();
984 default: Inst::UD2();
986 0x1B: decode LEGACY_DECODEVAL {
988 0x0: decode OPCODE_OP_BOTTOM3 {
989 0x0: psubusb_Pq_Qq();
990 0x1: psubusw_Pq_Qq();
993 0x4: paddusb_Pq_Qq();
994 0x5: paddusw_Pq_Qq();
998 // operand size (0x66)
999 0x1: decode OPCODE_OP_BOTTOM3 {
1000 0x0: psubusb_Vo_Wo();
1001 0x1: psubusw_Vo_Wo();
1002 0x2: pminub_Vo_Wo();
1004 0x4: paddusb_Vo_Wo();
1005 0x5: paddusw_Vo_Wo();
1006 0x6: pmaxub_Vo_Wo();
1009 default: Inst::UD2();
1011 0x1C: decode LEGACY_DECODEVAL {
1013 0x0: decode OPCODE_OP_BOTTOM3 {
1018 0x4: pmulhuw_Pq_Qq();
1019 0x5: pmulhw_Pq_Qq();
1020 0x7: movntq_Mq_Pq();
1021 default: Inst::UD2();
1024 0x4: decode OPCODE_OP_BOTTOM3 {
1025 0x6: cvtdq2pd_Vo_Wq();
1026 default: Inst::UD2();
1028 // operand size (0x66)
1029 0x1: decode OPCODE_OP_BOTTOM3 {
1034 0x4: pmulhuw_Vo_Wo();
1035 0x5: pmulhw_Vo_Wo();
1036 0x6: cvttpd2dq_Vo_Wo();
1037 0x7: movntdq_Mo_Vo();
1040 0x8: decode OPCODE_OP_BOTTOM3 {
1041 0x6: cvtpd2dq_Vo_Wo();
1042 default: Inst::UD2();
1044 default: Inst::UD2();
1046 0x1D: decode LEGACY_DECODEVAL {
1048 0x0: decode OPCODE_OP_BOTTOM3 {
1049 0x0: psubsb_Pq_Qq();
1050 0x1: psubsw_Pq_Qq();
1051 0x2: pminsw_Pq_Qq();
1053 0x4: paddsb_Pq_Qq();
1054 0x5: paddsw_Pq_Qq();
1055 0x6: pmaxsw_Pq_Qq();
1058 // operand size (0x66)
1059 0x1: decode OPCODE_OP_BOTTOM3 {
1060 0x0: psubsb_Vo_Wo();
1061 0x1: psubsw_Vo_Wo();
1062 0x2: pminsw_Vo_Wo();
1064 0x4: paddsb_Vo_Wo();
1065 0x5: paddsw_Vo_Wo();
1066 0x6: pmaxsw_Vo_Wo();
1069 default: Inst::UD2();
1071 0x1E: decode LEGACY_DECODEVAL {
1073 0x0: decode OPCODE_OP_BOTTOM3 {
1077 0x4: pmuludq_Pq_Qq();
1078 0x5: pmaddwd_Pq_Qq();
1079 0x6: psadbw_Pq_Qq();
1080 0x7: maskmovq_Pq_PRq();
1081 default: Inst::UD2();
1083 // operand size (0x66)
1084 0x1: decode OPCODE_OP_BOTTOM3 {
1088 0x4: pmuludq_Vo_Wo();
1089 0x5: pmaddwd_Vo_Wo();
1090 0x6: psadbw_Vo_Wo();
1091 0x7: maskmovdqu_Vo_VRo();
1092 default: Inst::UD2();
1095 0x8: decode OPCODE_OP_BOTTOM3 {
1097 default: Inst::UD2();
1099 default: Inst::UD2();
1101 0x1F: decode LEGACY_DECODEVAL {
1103 0x0: decode OPCODE_OP_BOTTOM3 {
1113 // operand size (0x66)
1114 0x1: decode OPCODE_OP_BOTTOM3 {
1124 default: Inst::UD2();
1126 default: FailUnimpl::twoByteOps();
1129 default: M5InternalError::error(
1130 {{"Unexpected first opcode byte in two byte opcode!"}});