Reviewers: Lasse Reichstein,

Description:
Add fucomip instruction to disassembler.  Fix some other floating point
instructions.

Please review this at http://codereview.chromium.org/316010

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/ia32/disasm-ia32.cc
   M     src/x64/disasm-x64.cc


Index: src/ia32/disasm-ia32.cc
===================================================================
--- src/ia32/disasm-ia32.cc     (revision 3112)
+++ src/ia32/disasm-ia32.cc     (working copy)
@@ -691,6 +691,7 @@
      const char* mnem = "?";
      switch (regop) {
        case eax: mnem = "fild_s"; break;
+      case ecx: mnem = "fisttp_s"; break;
        case edx: mnem = "fist_s"; break;
        case ebx: mnem = "fistp_s"; break;
        default: UnimplementedInstruction();
@@ -702,6 +703,9 @@
      if (b2 == 0xE0) {
        AppendToBuffer("fnstsw_ax");
        return 2;
+    } else if ((b2 & 0xF8) == 0xE8) {
+      AppendToBuffer("fucomip st%d", b2 & 0x7);
+      return 2;
      }
      int mod, regop, rm;
      get_modrm(*(data+1), &mod, &regop, &rm);
Index: src/x64/disasm-x64.cc
===================================================================
--- src/x64/disasm-x64.cc       (revision 3112)
+++ src/x64/disasm-x64.cc       (working copy)
@@ -568,6 +568,12 @@
  }


+int DisassemblerX64::PrintRightXMMOperand(byte* modrmp) {
+  return PrintRightOperandHelper(modrmp,
+                                 &DisassemblerX64::NameOfXMMRegister);
+}
+
+
  // Returns number of bytes used including the current *data.
  // Writes instruction's mnemonic, left and right operands to 'tmp_buffer_'.
  int DisassemblerX64::PrintOperands(const char* mnem,
@@ -884,11 +890,20 @@
    } else if (b1 == 0xDB) {
      int mod, regop, rm;
      get_modrm(*(data + 1), &mod, &regop, &rm);
+    if (mod == 0x3) {
+      if (b2 == 0xE2) {
+        AppendToBuffer("fnclex");
+        return 2;
+      }
+    }
      const char* mnem = "?";
      switch (regop) {
        case 0:
          mnem = "fild_s";
          break;
+      case 1:
+        mnem = "fisttp_s";
+        break;
        case 2:
          mnem = "fist_s";
          break;
@@ -905,7 +920,11 @@
      if (b2 == 0xE0) {
        AppendToBuffer("fnstsw_ax");
        return 2;
+    } else if ((b2 & 0xF8) == 0xE8) {
+      AppendToBuffer("fucomip st%d", b2 & 0x7);
+      return 2;
      }
+
      int mod, regop, rm;
      get_modrm(*(data + 1), &mod, &regop, &rm);
      const char* mnem = "?";
@@ -1035,13 +1054,13 @@
        int mod, regop, rm;
        get_modrm(*current, &mod, &regop, &rm);
        AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop));
-      data += PrintRightOperand(data);
+      current += PrintRightOperand(current);
      } else if ((opcode & 0xF8) == 0x58) {
        // XMM arithmetic. Mnemonic was retrieved at the start of this  
function.
        int mod, regop, rm;
        get_modrm(*current, &mod, &regop, &rm);
-      AppendToBuffer("%s %s,%s", mnemonic, NameOfXMMRegister(regop),
-                     NameOfXMMRegister(rm));
+      AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop));
+      current += PrintRightXMMOperand(current);
      } else {
        UnimplementedInstruction();
      }



--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to