Commit 29b89b48 authored by Miran.Karic's avatar Miran.Karic Committed by Commit bot

Revert of MIPS: [turbofan] Fix addition for deoptimization. (patchset #3...

Revert of MIPS: [turbofan] Fix addition for deoptimization. (patchset #3 id:40001 of https://codereview.chromium.org/2102063002/ )

Reason for revert:
This workaround is no longer needed, port of e60c4053 fixes the issue.

Original issue's description:
> MIPS: [turbofan] Fix addition for deoptimization.
>
> In turbofan, after an addition operation where the same register is the
> output and both inputs, if deoptimization is performed the input is
> overwritten with the output value and the final result is not correct.
> This is fixed by restoring the original value of the input before
> deoptimization.
>
> BUG=
> TEST=mjsunit/regress/regress-int32-truncation
>
> Committed: https://crrev.com/99385e8e4bcef1f333ede61c936528bfc0c8ecfa
> Cr-Commit-Position: refs/heads/master@{#37524}

TBR=akos.palfi@imgtec.com,balazs.kilvady@imgtec.com,ivica.bogosavljevic@imgtec.com
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=

Review-Url: https://codereview.chromium.org/2129083003
Cr-Commit-Position: refs/heads/master@{#37612}
parent 2dc9909c
......@@ -1803,21 +1803,10 @@ void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
__ Branch(tlabel, cc, at, Operand(zero_reg));
} else if (instr->arch_opcode() == kMips64Dadd ||
instr->arch_opcode() == kMips64Dsub) {
Label done;
cc = FlagsConditionToConditionOvf(branch->condition);
__ dsra32(kScratchReg, i.OutputRegister(), 0);
__ sra(at, i.OutputRegister(), 31);
__ Branch(&done, NegateCondition(cc), at, Operand(kScratchReg));
// If we deoptimize, check if output register is the same as input
// registers, if yes input values are overwritten so fix them first.
if (instr->InputAt(1)->IsRegister()) {
if (i.InputRegister(0).is(i.OutputRegister()) &&
i.InputRegister(1).is(i.OutputRegister())) {
__ dsra(i.OutputRegister(), i.OutputRegister(), 1);
}
}
__ Branch(tlabel);
__ bind(&done);
__ Branch(tlabel, cc, at, Operand(kScratchReg));
} else if (instr->arch_opcode() == kMips64DaddOvf) {
switch (branch->condition) {
case kOverflow:
......
......@@ -5493,14 +5493,11 @@ void MacroAssembler::AddBranchOvf(Register dst, Register left, Register right,
DCHECK(!right.is(scratch));
if (left.is(right) && dst.is(left)) {
mov(scratch, left); // Preserve left and right.
addu(dst, left, right); // Both are overwritten.
xor_(overflow_dst, dst, scratch); // Left and right are equal.
Label done; // Restore inputs if overflow.
Branch(&done, ge, overflow_dst, Operand(zero_reg));
mov(left, scratch); // Original left and right.
bind(&done);
} else if (dst.is(left)) {
mov(overflow_dst, right);
right = overflow_dst;
}
if (dst.is(left)) {
mov(scratch, left); // Preserve left.
addu(dst, left, right); // Left is overwritten.
xor_(scratch, dst, scratch); // Original left.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment