hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/x86/FloatDecoder.java
author trims
Thu, 27 May 2010 19:08:38 -0700
changeset 5547 f4b087cbb361
parent 1 489c9b5090e2
permissions -rw-r--r--
6941466: Oracle rebranding changes for Hotspot repositories Summary: Change all the Sun copyrights to Oracle copyright Reviewed-by: ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
     2
 * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
package sun.jvm.hotspot.asm.x86;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
import sun.jvm.hotspot.asm.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
public class FloatDecoder extends FPInstructionDecoder {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
   public FloatDecoder() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
      super(null);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
   //Please refer to IA-32 Intel Architecture Software Developer's Manual Volume 2
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
   //APPENDIX A - Escape opcodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
   /*When ModR/M byte is within 00h to BFh*/
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
   private static final FPInstructionDecoder floatMapOne[][] = {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
      /* d8 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
      new FPArithmeticDecoder("fadds", ADDR_E, v_mode, RTLOP_ADD),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
      new FPArithmeticDecoder("fmuls", ADDR_E, v_mode, RTLOP_SMUL),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
      new FPInstructionDecoder("fcoms", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
      new FPInstructionDecoder("fcomps", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
      new FPArithmeticDecoder("fsubs", ADDR_E, v_mode, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
      new FPArithmeticDecoder("fsubrs", ADDR_E, v_mode, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
      new FPArithmeticDecoder("fdivs", ADDR_E, v_mode, RTLOP_SDIV),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
      new FPArithmeticDecoder("fdivrs", ADDR_E, v_mode, RTLOP_SDIV)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
      /*  d9 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
      new FPLoadDecoder("flds", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
      new FPStoreDecoder("fsts", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
      new FPStoreDecoder("fstps", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
      new FPStoreDecoder("fldenv", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
      new FPStoreDecoder("fldcw", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
      new FPStoreDecoder("fNstenv", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
      new FPStoreDecoder("fNstcw", ADDR_E, v_mode)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
      /* da */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
      new FPArithmeticDecoder("fiaddl", ADDR_E, v_mode, RTLOP_ADD),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
      new FPArithmeticDecoder("fimull", ADDR_E, v_mode, RTLOP_SMUL),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
      new FPInstructionDecoder("ficoml", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
      new FPInstructionDecoder("ficompl", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
      new FPArithmeticDecoder("fisubl", ADDR_E, v_mode, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
      new FPArithmeticDecoder("fisubrl", ADDR_E, v_mode, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
      new FPArithmeticDecoder("fidivl", ADDR_E, v_mode, RTLOP_SDIV),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
      new FPArithmeticDecoder("fidivrl", ADDR_E, v_mode, RTLOP_SDIV)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
      /* db */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
      new FPLoadDecoder("fildl", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
      new FPStoreDecoder("fistl", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
      new FPStoreDecoder("fistpl", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
      new FPLoadDecoder("fldt", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
      new FPStoreDecoder("fstpt", ADDR_E, v_mode)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
      /* dc */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
      new FPArithmeticDecoder("faddl", ADDR_E, v_mode, RTLOP_ADD),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
      new FPArithmeticDecoder("fmull", ADDR_E, v_mode, RTLOP_SMUL),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
      new FPInstructionDecoder("fcoml", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
      new FPInstructionDecoder("fcompl", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
      new FPArithmeticDecoder("fsubl", ADDR_E, v_mode, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
      new FPArithmeticDecoder("fsubrl", ADDR_E, v_mode, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
      new FPArithmeticDecoder("fdivl", ADDR_E, v_mode, RTLOP_SDIV),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
      new FPArithmeticDecoder("fdivrl", ADDR_E, v_mode, RTLOP_SDIV)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
      /* dd */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
      new FPLoadDecoder("fldl", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
      new FPStoreDecoder("fstl", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
      new FPStoreDecoder("fstpl", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
      new FPStoreDecoder("frstor", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
      new FPStoreDecoder("fNsave", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
      new FPStoreDecoder("fNstsw", ADDR_E, v_mode)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
      /* de */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
      new FPArithmeticDecoder("fiadd", ADDR_E, v_mode, RTLOP_ADD),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
      new FPArithmeticDecoder("fimul", ADDR_E, v_mode, RTLOP_SMUL),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
      new FPInstructionDecoder("ficom", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
      new FPInstructionDecoder("ficomp", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
      new FPArithmeticDecoder("fisub", ADDR_E, v_mode, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
      new FPArithmeticDecoder("fisubr", ADDR_E, v_mode, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
      new FPArithmeticDecoder("fidiv", ADDR_E, v_mode, RTLOP_SDIV),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
      new FPArithmeticDecoder("fidivr", ADDR_E, v_mode, RTLOP_SDIV)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
      /* df */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
      new FPLoadDecoder("fild", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
      new FPStoreDecoder("fist", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
      new FPStoreDecoder("fistp", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
      new FPLoadDecoder("fbld", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
      new FPLoadDecoder("fildll", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
      new FPStoreDecoder("fbstp", ADDR_E, v_mode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
      new FPStoreDecoder("fistpll", ADDR_E, v_mode)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
   };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
   /*When ModR/M byte is outside 00h to BFh*/
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
   private static final FPInstructionDecoder floatMapTwo[][] = {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
      /* d8 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
      /*parameter for ADDR_FPREG, 0 means ST(0), 1 means ST at rm value. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
      new FPArithmeticDecoder("fadd", ADDR_FPREG, 0, ADDR_FPREG, 1, RTLOP_ADD),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
      new FPArithmeticDecoder("fmul", ADDR_FPREG, 0, ADDR_FPREG, 1, RTLOP_SMUL),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
      new FPInstructionDecoder("fcom", ADDR_FPREG, 1),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
      new FPInstructionDecoder("fcomp", ADDR_FPREG, 1),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
      new FPArithmeticDecoder("fsub", ADDR_FPREG, 0, ADDR_FPREG, 1, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
      new FPArithmeticDecoder("fsubr", ADDR_FPREG, 0, ADDR_FPREG, 1, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
      new FPArithmeticDecoder("fdiv", ADDR_FPREG, 0, ADDR_FPREG, 1, RTLOP_SDIV),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
      new FPArithmeticDecoder("fdivr", ADDR_FPREG, 0, ADDR_FPREG, 1, RTLOP_SDIV)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
      /* d9 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
      new FPLoadDecoder("fld", ADDR_FPREG, 1),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
      new FPInstructionDecoder("fxch", ADDR_FPREG, 1),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
      new FloatGRPDecoder(null, 0),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
      new FloatGRPDecoder(null, 1),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
      new FloatGRPDecoder(null, 2),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
      new FloatGRPDecoder(null, 3),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
      new FloatGRPDecoder(null, 4)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
      /* da */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
      new FloatGRPDecoder(null, 5),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
      null
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
      /* db */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
      new FloatGRPDecoder(null, 6),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
      null
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
      /* dc */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
      new FPArithmeticDecoder("fadd", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_ADD),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
      new FPArithmeticDecoder("fmul", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SMUL),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
      new FPArithmeticDecoder("fsub", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
      new FPArithmeticDecoder("fsubr",ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
      new FPArithmeticDecoder("fdiv", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SDIV),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
      new FPArithmeticDecoder("fdivr", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SDIV)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
      /* dd */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
      new FPInstructionDecoder("ffree", ADDR_FPREG, 1),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
      new FPStoreDecoder("fst", ADDR_FPREG, 1),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
      new FPStoreDecoder("fstp", ADDR_FPREG, 1),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
      new FPInstructionDecoder("fucom", ADDR_FPREG, 1),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
      new FPInstructionDecoder("fucomp", ADDR_FPREG, 1),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
      null
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
      /* de */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
      new FPArithmeticDecoder("faddp", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_ADD),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
      new FPArithmeticDecoder("fmulp", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SMUL),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
      new FloatGRPDecoder(null, 7),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
      new FPArithmeticDecoder("fsubrp", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
      new FPArithmeticDecoder("fsubp", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SUB),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
      new FPArithmeticDecoder("fdivrp", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SDIV),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
      new FPArithmeticDecoder("fdivp", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SDIV)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
      },
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
      /* df */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
      new FloatGRPDecoder(null, 7),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
      null,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
      null
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
   };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
   public Instruction decode(byte[] bytesArray, int index, int instrStartIndex, int segmentOverride, int prefixes, X86InstructionFactory factory) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
      this.byteIndex = index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
      this.instrStartIndex = instrStartIndex;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
      this.prefixes = prefixes;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
      int ModRM = readByte(bytesArray, byteIndex);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
      int reg = (ModRM >> 3) & 7;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
      int regOrOpcode = (ModRM >> 3) & 7;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
      int rm = ModRM & 7;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
      int floatOpcode = InstructionDecoder.readByte(bytesArray, instrStartIndex);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
      FPInstructionDecoder instrDecoder = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
      if(ModRM < 0xbf) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
         instrDecoder = floatMapOne[floatOpcode - 0xd8][reg];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
      else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
         instrDecoder = floatMapTwo[floatOpcode - 0xd8][reg];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
      Instruction instr = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
      if(instrDecoder != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
         instr = instrDecoder.decode(bytesArray, byteIndex, instrStartIndex, segmentOverride, prefixes, factory);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
         byteIndex = instrDecoder.getCurrentIndex();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
          instr = factory.newIllegalInstruction();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
      return instr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
}