Index: src/mips/macro-assembler-mips.cc |
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc |
index a5af1b8d65b1450d777d346c702fb44a1f2d5292..deb3ff6639c0ba084136b01f4d5f3803be2d5217 100644 |
--- a/src/mips/macro-assembler-mips.cc |
+++ b/src/mips/macro-assembler-mips.cc |
@@ -2037,18 +2037,26 @@ void MacroAssembler::BranchShort(int16_t offset, Condition cond, Register rs, |
b(offset); |
break; |
case eq: |
- // We don't want any other register but scratch clobbered. |
- DCHECK(!scratch.is(rs)); |
- r2 = scratch; |
- li(r2, rt); |
- beq(rs, r2, offset); |
+ if (rt.imm32_ == 0) { |
+ beq(rs, zero_reg, offset); |
+ } else { |
+ // We don't want any other register but scratch clobbered. |
+ DCHECK(!scratch.is(rs)); |
+ r2 = scratch; |
+ li(r2, rt); |
+ beq(rs, r2, offset); |
+ } |
break; |
case ne: |
- // We don't want any other register but scratch clobbered. |
- DCHECK(!scratch.is(rs)); |
- r2 = scratch; |
- li(r2, rt); |
- bne(rs, r2, offset); |
+ if (rt.imm32_ == 0) { |
+ bne(rs, zero_reg, offset); |
+ } else { |
+ // We don't want any other register but scratch clobbered. |
+ DCHECK(!scratch.is(rs)); |
+ r2 = scratch; |
+ li(r2, rt); |
+ bne(rs, r2, offset); |
+ } |
break; |
// Signed comparison. |
case greater: |
@@ -2290,18 +2298,28 @@ void MacroAssembler::BranchShort(Label* L, Condition cond, Register rs, |
b(offset); |
break; |
case eq: |
- DCHECK(!scratch.is(rs)); |
- r2 = scratch; |
- li(r2, rt); |
- offset = shifted_branch_offset(L, false); |
- beq(rs, r2, offset); |
+ if (rt.imm32_ == 0) { |
+ offset = shifted_branch_offset(L, false); |
+ beq(rs, zero_reg, offset); |
+ } else { |
+ DCHECK(!scratch.is(rs)); |
+ r2 = scratch; |
+ li(r2, rt); |
+ offset = shifted_branch_offset(L, false); |
+ beq(rs, r2, offset); |
+ } |
break; |
case ne: |
- DCHECK(!scratch.is(rs)); |
- r2 = scratch; |
- li(r2, rt); |
- offset = shifted_branch_offset(L, false); |
- bne(rs, r2, offset); |
+ if (rt.imm32_ == 0) { |
+ offset = shifted_branch_offset(L, false); |
+ bne(rs, zero_reg, offset); |
+ } else { |
+ DCHECK(!scratch.is(rs)); |
+ r2 = scratch; |
+ li(r2, rt); |
+ offset = shifted_branch_offset(L, false); |
+ bne(rs, r2, offset); |
+ } |
break; |
// Signed comparison. |
case greater: |