| Index: src/compiler/mips/code-generator-mips.cc
|
| diff --git a/src/compiler/mips/code-generator-mips.cc b/src/compiler/mips/code-generator-mips.cc
|
| index 45ab52c54a8616ded9d5a492d4fc87f8cc58785e..8a6665b7857ed433f83705d98f0ef01100da682d 100644
|
| --- a/src/compiler/mips/code-generator-mips.cc
|
| +++ b/src/compiler/mips/code-generator-mips.cc
|
| @@ -299,19 +299,6 @@ Condition FlagsConditionToConditionTst(FlagsCondition condition) {
|
| }
|
|
|
|
|
| -Condition FlagsConditionToConditionOvf(FlagsCondition condition) {
|
| - switch (condition) {
|
| - case kOverflow:
|
| - return lt;
|
| - case kNotOverflow:
|
| - return ge;
|
| - default:
|
| - break;
|
| - }
|
| - UNREACHABLE();
|
| - return kNoCondition;
|
| -}
|
| -
|
| FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
|
| FlagsCondition condition) {
|
| switch (condition) {
|
| @@ -627,15 +614,13 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
|
| __ Addu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1));
|
| break;
|
| case kMipsAddOvf:
|
| - __ AdduAndCheckForOverflow(i.OutputRegister(), i.InputRegister(0),
|
| - i.InputOperand(1), kCompareReg, kScratchReg);
|
| + // Pseudo-instruction used for overflow/branch. No opcode emitted here.
|
| break;
|
| case kMipsSub:
|
| __ Subu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1));
|
| break;
|
| case kMipsSubOvf:
|
| - __ SubuAndCheckForOverflow(i.OutputRegister(), i.InputRegister(0),
|
| - i.InputOperand(1), kCompareReg, kScratchReg);
|
| + // Pseudo-instruction used for overflow/branch. No opcode emitted here.
|
| break;
|
| case kMipsMul:
|
| __ Mul(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1));
|
| @@ -1109,11 +1094,34 @@ void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
|
| cc = FlagsConditionToConditionTst(branch->condition);
|
| __ And(at, i.InputRegister(0), i.InputOperand(1));
|
| __ Branch(tlabel, cc, at, Operand(zero_reg));
|
| - } else if (instr->arch_opcode() == kMipsAddOvf ||
|
| - instr->arch_opcode() == kMipsSubOvf) {
|
| - // kMipsAddOvf, SubOvf emit negative result to 'kCompareReg' on overflow.
|
| - cc = FlagsConditionToConditionOvf(branch->condition);
|
| - __ Branch(tlabel, cc, kCompareReg, Operand(zero_reg));
|
| + } else if (instr->arch_opcode() == kMipsAddOvf) {
|
| + switch (branch->condition) {
|
| + case kOverflow:
|
| + __ AddBranchOvf(i.OutputRegister(), i.InputRegister(0),
|
| + i.InputOperand(1), tlabel, flabel);
|
| + break;
|
| + case kNotOverflow:
|
| + __ AddBranchOvf(i.OutputRegister(), i.InputRegister(0),
|
| + i.InputOperand(1), flabel, tlabel);
|
| + break;
|
| + default:
|
| + UNSUPPORTED_COND(kMipsAddOvf, branch->condition);
|
| + break;
|
| + }
|
| + } else if (instr->arch_opcode() == kMipsSubOvf) {
|
| + switch (branch->condition) {
|
| + case kOverflow:
|
| + __ SubBranchOvf(i.OutputRegister(), i.InputRegister(0),
|
| + i.InputOperand(1), tlabel, flabel);
|
| + break;
|
| + case kNotOverflow:
|
| + __ SubBranchOvf(i.OutputRegister(), i.InputRegister(0),
|
| + i.InputOperand(1), flabel, tlabel);
|
| + break;
|
| + default:
|
| + UNSUPPORTED_COND(kMipsAddOvf, branch->condition);
|
| + break;
|
| + }
|
| } else if (instr->arch_opcode() == kMipsCmp) {
|
| cc = FlagsConditionToConditionCmp(branch->condition);
|
| __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1));
|
| @@ -1180,13 +1188,26 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr,
|
| return;
|
| } else if (instr->arch_opcode() == kMipsAddOvf ||
|
| instr->arch_opcode() == kMipsSubOvf) {
|
| - // kMipsAddOvf, SubOvf emits negative result to 'kCompareReg' on overflow.
|
| - cc = FlagsConditionToConditionOvf(condition);
|
| - // Return 1 on overflow.
|
| - __ Slt(result, kCompareReg, Operand(zero_reg));
|
| - if (cc == ge) // Invert result on not overflow.
|
| - __ xori(result, result, 1);
|
| - return;
|
| + Label flabel, tlabel;
|
| + switch (instr->arch_opcode()) {
|
| + case kMipsAddOvf:
|
| + __ AddBranchNoOvf(i.OutputRegister(), i.InputRegister(0),
|
| + i.InputOperand(1), &flabel);
|
| +
|
| + break;
|
| + case kMipsSubOvf:
|
| + __ SubBranchNoOvf(i.OutputRegister(), i.InputRegister(0),
|
| + i.InputOperand(1), &flabel);
|
| + break;
|
| + default:
|
| + UNREACHABLE();
|
| + break;
|
| + }
|
| + __ li(result, 1);
|
| + __ Branch(&tlabel);
|
| + __ bind(&flabel);
|
| + __ li(result, 0);
|
| + __ bind(&tlabel);
|
| } else if (instr->arch_opcode() == kMipsCmp) {
|
| cc = FlagsConditionToConditionCmp(condition);
|
| switch (cc) {
|
|
|