Index: src/mips/macro-assembler-mips.cc |
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc |
index a6b818a67ac08796eba5972bae3382f73774f46e..d61717d22257909d844f297cb65b48cea4777b72 100644 |
--- a/src/mips/macro-assembler-mips.cc |
+++ b/src/mips/macro-assembler-mips.cc |
@@ -1124,8 +1124,13 @@ void MacroAssembler::Sltu(Register rd, Register rs, const Operand& rt) { |
if (rt.is_reg()) { |
sltu(rd, rs, rt.rm()); |
} else { |
- if (is_uint16(rt.imm32_) && !MustUseReg(rt.rmode_)) { |
+ const uint32_t int16_min = std::numeric_limits<int16_t>::min(); |
+ if (is_uint15(rt.imm32_) && !MustUseReg(rt.rmode_)) { |
+ // Imm range is: [0, 32767]. |
sltiu(rd, rs, rt.imm32_); |
+ } else if (is_uint15(rt.imm32_ - int16_min) && !MustUseReg(rt.rmode_)) { |
+ // Imm range is: [max_unsigned-32767,max_unsigned]. |
+ sltiu(rd, rs, static_cast<uint16_t>(rt.imm32_)); |
} else { |
// li handles the relocation. |
DCHECK(!rs.is(at)); |