Chromium Code Reviews| 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 54bb55a146085cfca2baaecc3d1007aff64add97..b3af1a9d8ae95dbd9194a9c581423b870fa9bdd2 100644 |
| --- a/src/compiler/mips/code-generator-mips.cc |
| +++ b/src/compiler/mips/code-generator-mips.cc |
| @@ -584,8 +584,7 @@ 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); |
| + // Noop, AdduAndCheckForOverflow() executed at branch/result processing. |
|
paul.l...
2015/11/13 02:16:20
Other similar opcodes use:
// Pseudo-instruction u
balazs.kilvady
2015/11/20 19:28:08
Done.
|
| break; |
| case kMipsSub: |
| __ Subu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); |
| @@ -1036,9 +1035,22 @@ 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. |
| + } else if (instr->arch_opcode() == kMipsAddOvf) { |
| + switch (branch->condition) { |
| + case kOverflow: |
| + __ AdduAndCheckForOverflow(i.OutputRegister(), i.InputRegister(0), |
| + i.InputOperand(1), tlabel, flabel); |
| + break; |
| + case kNotOverflow: |
| + __ AdduAndCheckForOverflow(i.OutputRegister(), i.InputRegister(0), |
| + i.InputOperand(1), flabel, tlabel); |
| + break; |
| + default: |
| + UNSUPPORTED_COND(kMipsAddOvf, branch->condition); |
| + break; |
| + } |
| + } else if (instr->arch_opcode() == kMipsSubOvf) { |
| + // kMipsSubOvf emit negative result to 'kCompareReg' on overflow. |
| cc = FlagsConditionToConditionOvf(branch->condition); |
| __ Branch(tlabel, cc, kCompareReg, Operand(zero_reg)); |
| } else if (instr->arch_opcode() == kMipsCmp) { |
| @@ -1105,8 +1117,16 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr, |
| __ xori(result, result, 1); |
| } |
| return; |
| - } else if (instr->arch_opcode() == kMipsAddOvf || |
| - instr->arch_opcode() == kMipsSubOvf) { |
| + } else if (instr->arch_opcode() == kMipsAddOvf) { |
| + Label flabel, tlabel; |
| + __ AdduAndCheckForOverflow(i.OutputRegister(), i.InputRegister(0), |
| + i.InputOperand(1), nullptr, &flabel); |
| + __ li(result, 1); |
|
Alan Li
2015/11/20 01:28:39
So I guess another very easy way to detect unsigne
balazs.kilvady
2015/11/20 19:28:08
i.OutputRegister() is never (unsigned) less then i
|
| + __ Branch(&tlabel); |
| + __ bind(&flabel); |
| + __ li(result, 0); |
| + __ bind(&tlabel); |
| + } else if (instr->arch_opcode() == kMipsSubOvf) { |
| // kMipsAddOvf, SubOvf emits negative result to 'kCompareReg' on overflow. |
| cc = FlagsConditionToConditionOvf(condition); |
| // Return 1 on overflow. |