Index: src/mips/macro-assembler-mips.cc |
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc |
index dec879ed2b8ebd2cb1f8a0d2ddffd1fce735f4af..4553dbc9e8e8264504ec348ba03268726cf76eaf 100644 |
--- a/src/mips/macro-assembler-mips.cc |
+++ b/src/mips/macro-assembler-mips.cc |
@@ -564,8 +564,13 @@ void MacroAssembler::Subu(Register rd, Register rs, const Operand& rt) { |
if (rt.is_reg()) { |
subu(rd, rs, rt.rm()); |
} else { |
- if (is_int16(rt.imm32_) && !MustUseReg(rt.rmode_)) { |
+ if (is_int16(-rt.imm32_) && !MustUseReg(rt.rmode_)) { |
addiu(rd, rs, -rt.imm32_); // No subiu instr, use addiu(x, y, -imm). |
+ } else if (!(-rt.imm32_ & kHiMask) && !MustUseReg(rt.rmode_)) { // Use load |
+ // -imm and addu for cases where loading -imm generates one instruction. |
+ DCHECK(!rs.is(at)); |
+ li(at, -rt.imm32_); |
+ addu(rd, rs, at); |
} else { |
// li handles the relocation. |
DCHECK(!rs.is(at)); |