From dcf8251ecfec4e7884db5a6e9618f6847fe0363f Mon Sep 17 00:00:00 2001 From: "marija.antic" Date: Tue, 19 Jul 2016 04:08:22 -0700 Subject: [PATCH] MIPS: Fix 'Port [turbofan] Introduce integer multiplication with overflow.' Port 8e18a5f2a0357c6899cd32f5ab66b73d72fdd996 Failing on r6 due to wrong registers used in macro assembler. TEST=test-run-machops/RunInt32MulWithOverflowImm BUG= Review-Url: https://codereview.chromium.org/2165533002 Cr-Commit-Position: refs/heads/master@{#37861} --- src/mips/macro-assembler-mips.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index 6c56ac4727..22b44ca485 100644 --- a/src/mips/macro-assembler-mips.cc +++ b/src/mips/macro-assembler-mips.cc @@ -5648,9 +5648,16 @@ void MacroAssembler::MulBranchOvf(Register dst, Register left, Register right, DCHECK(!scratch.is(left)); DCHECK(!scratch.is(right)); - Mul(overflow_dst, dst, left, right); - sra(scratch, dst, 31); - xor_(overflow_dst, overflow_dst, scratch); + if (IsMipsArchVariant(kMips32r6) && dst.is(right)) { + mov(scratch, right); + Mul(overflow_dst, dst, left, scratch); + sra(scratch, dst, 31); + xor_(overflow_dst, overflow_dst, scratch); + } else { + Mul(overflow_dst, dst, left, right); + sra(scratch, dst, 31); + xor_(overflow_dst, overflow_dst, scratch); + } BranchOvfHelperMult(this, overflow_dst, overflow_label, no_overflow_label); }