Revision: 24395
Author:   [email protected]
Date:     Thu Oct  2 12:22:36 2014 UTC
Log:      fix imul(reg, op, imm) emission on x64

[email protected]

BUG=

Review URL: https://codereview.chromium.org/619903005
https://code.google.com/p/v8/source/detail?r=24395

Modified:
 /branches/bleeding_edge/src/x64/assembler-x64.cc
 /branches/bleeding_edge/src/x64/disasm-x64.cc
 /branches/bleeding_edge/test/cctest/test-disasm-x64.cc

=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.cc Thu Oct 2 09:08:09 2014 UTC +++ /branches/bleeding_edge/src/x64/assembler-x64.cc Thu Oct 2 12:22:36 2014 UTC
@@ -974,11 +974,13 @@
   emit_rex(dst, src, size);
   if (is_int8(imm.value_)) {
     emit(0x6B);
+    emit_operand(dst, src);
+    emit(imm.value_);
   } else {
     emit(0x69);
+    emit_operand(dst, src);
+    emitl(imm.value_);
   }
-  emit_operand(dst, src);
-  emit(imm.value_);
 }


=======================================
--- /branches/bleeding_edge/src/x64/disasm-x64.cc Thu Oct 2 09:08:09 2014 UTC +++ /branches/bleeding_edge/src/x64/disasm-x64.cc Thu Oct 2 12:22:36 2014 UTC
@@ -1486,15 +1486,15 @@

       case 0x69:  // fall through
       case 0x6B: {
-        int mod, regop, rm;
-        get_modrm(*(data + 1), &mod, &regop, &rm);
-        int32_t imm = *data == 0x6B ? *(data + 2)
-            : *reinterpret_cast<int32_t*>(data + 2);
-        AppendToBuffer("imul%c %s,%s,0x%x",
-                       operand_size_code(),
-                       NameOfCPURegister(regop),
-                       NameOfCPURegister(rm), imm);
-        data += 2 + (*data == 0x6B ? 1 : 4);
+        int count = 1;
+        count += PrintOperands("imul", REG_OPER_OP_ORDER, data + count);
+        AppendToBuffer(",0x");
+        if (*data == 0x69) {
+          count += PrintImmediate(data + count, operand_size());
+        } else {
+          count += PrintImmediate(data + count, OPERAND_BYTE_SIZE);
+        }
+        data += count;
         break;
       }

=======================================
--- /branches/bleeding_edge/test/cctest/test-disasm-x64.cc Thu Oct 2 09:08:09 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-disasm-x64.cc Thu Oct 2 12:22:36 2014 UTC
@@ -184,10 +184,16 @@
   __ notq(rdx);
   __ testq(Operand(rbx, rcx, times_4, 10000), rdx);

-  __ imulq(rdx, Operand(rbx, rcx, times_4, 10000));
   __ imulq(rdx, rcx, Immediate(12));
   __ imulq(rdx, rcx, Immediate(1000));
+  __ imulq(rdx, Operand(rbx, rcx, times_4, 10000));
+  __ imulq(rdx, Operand(rbx, rcx, times_4, 10000), Immediate(12));
   __ imulq(rdx, Operand(rbx, rcx, times_4, 10000), Immediate(1000));
+  __ imull(r15, rcx, Immediate(12));
+  __ imull(r15, rcx, Immediate(1000));
+  __ imull(r15, Operand(rbx, rcx, times_4, 10000));
+  __ imull(r15, Operand(rbx, rcx, times_4, 10000), Immediate(12));
+  __ imull(r15, Operand(rbx, rcx, times_4, 10000), Immediate(1000));

   __ incq(rdx);
   __ incq(Operand(rbx, rcx, times_4, 10000));

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to