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