Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Unified Diff: src/mips/macro-assembler-mips.cc

Issue 2386673002: MIPS: Fix Sltu macro instruction. (Closed)
Patch Set: Fix nits. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/mips64/macro-assembler-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « no previous file | src/mips64/macro-assembler-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698