Revision: 24475
Author:   [email protected]
Date:     Wed Oct  8 16:15:28 2014 UTC
Log:      MIPS64: Fix TruncatingDiv.

- Fix the Macroassembler::TruncatingDiv to compute
  the correct result even when the magic number is negative.
- Fix the MULT instruction in the simulator.

TEST=mjsunit/compiler/division-by-constant
BUG=
[email protected]

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

Modified:
 /branches/bleeding_edge/src/mips64/macro-assembler-mips64.cc
 /branches/bleeding_edge/src/mips64/simulator-mips64.cc

=======================================
--- /branches/bleeding_edge/src/mips64/macro-assembler-mips64.cc Thu Sep 25 07:16:15 2014 UTC +++ /branches/bleeding_edge/src/mips64/macro-assembler-mips64.cc Wed Oct 8 16:15:28 2014 UTC
@@ -6069,7 +6069,7 @@
   DCHECK(!result.is(at));
   base::MagicNumbersForDivision<uint32_t> mag =
   base::SignedDivisionByConstant(static_cast<uint32_t>(divisor));
-  li(at, Operand(mag.multiplier));
+  li(at, Operand(static_cast<int32_t>(mag.multiplier)));
   Mulh(result, dividend, Operand(at));
   bool neg = (mag.multiplier & (static_cast<uint32_t>(1) << 31)) != 0;
   if (divisor > 0 && neg) {
=======================================
--- /branches/bleeding_edge/src/mips64/simulator-mips64.cc Wed Sep 17 16:21:22 2014 UTC +++ /branches/bleeding_edge/src/mips64/simulator-mips64.cc Wed Oct 8 16:15:28 2014 UTC
@@ -2085,8 +2085,7 @@
           // regs.
// TODO(plind) - make the 32-bit MULT ops conform to spec regarding // checking of 32-bit input values, and un-define operations of HW.
-          *i64hilo = static_cast<int64_t>((int32_t)rs) *
-              static_cast<int64_t>((int32_t)rt);
+          *i64hilo = rs * rt;
           break;
         case MULTU:
*u64hilo = static_cast<uint64_t>(rs_u) * static_cast<uint64_t>(rt_u);

--
--
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