Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1114 // li handles the relocation. | 1114 // li handles the relocation. |
| 1115 DCHECK(!rs.is(at)); | 1115 DCHECK(!rs.is(at)); |
| 1116 li(at, rt); | 1116 li(at, rt); |
| 1117 slt(rd, rs, at); | 1117 slt(rd, rs, at); |
| 1118 } | 1118 } |
| 1119 } | 1119 } |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 | 1122 |
| 1123 void MacroAssembler::Sltu(Register rd, Register rs, const Operand& rt) { | 1123 void MacroAssembler::Sltu(Register rd, Register rs, const Operand& rt) { |
| 1124 const uint32_t int16_min = std::numeric_limits<int16_t>::min(); | |
|
balazs.kilvady
2016/09/30 17:45:19
This should be in the else branch.
akos.palfi.imgtec
2016/09/30 17:55:10
Acknowledged.
| |
| 1124 if (rt.is_reg()) { | 1125 if (rt.is_reg()) { |
| 1125 sltu(rd, rs, rt.rm()); | 1126 sltu(rd, rs, rt.rm()); |
| 1126 } else { | 1127 } else { |
| 1127 if (is_uint16(rt.imm32_) && !MustUseReg(rt.rmode_)) { | 1128 if (is_uint15(rt.imm32_) && !MustUseReg(rt.rmode_)) { |
| 1129 // Imm range is: [0, 32767]. | |
| 1128 sltiu(rd, rs, rt.imm32_); | 1130 sltiu(rd, rs, rt.imm32_); |
| 1131 } else if (is_uint15(rt.imm32_ - int16_min) && !MustUseReg(rt.rmode_)) { | |
| 1132 // Imm range is: [max_unsigned-32767,max_unsigned]. | |
| 1133 sltiu(rd, rs, static_cast<uint16_t>(rt.imm32_)); | |
|
balazs.kilvady
2016/09/30 17:45:19
sltiu() expects int16 or uint16? Is this cast ok?
akos.palfi.imgtec
2016/09/30 17:55:10
It expects int32. This casts [ffff8000, ffffffff]
| |
| 1129 } else { | 1134 } else { |
| 1130 // li handles the relocation. | 1135 // li handles the relocation. |
| 1131 DCHECK(!rs.is(at)); | 1136 DCHECK(!rs.is(at)); |
| 1132 li(at, rt); | 1137 li(at, rt); |
| 1133 sltu(rd, rs, at); | 1138 sltu(rd, rs, at); |
| 1134 } | 1139 } |
| 1135 } | 1140 } |
| 1136 } | 1141 } |
| 1137 | 1142 |
| 1138 | 1143 |
| (...skipping 5841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6980 if (mag.shift > 0) sra(result, result, mag.shift); | 6985 if (mag.shift > 0) sra(result, result, mag.shift); |
| 6981 srl(at, dividend, 31); | 6986 srl(at, dividend, 31); |
| 6982 Addu(result, result, Operand(at)); | 6987 Addu(result, result, Operand(at)); |
| 6983 } | 6988 } |
| 6984 | 6989 |
| 6985 | 6990 |
| 6986 } // namespace internal | 6991 } // namespace internal |
| 6987 } // namespace v8 | 6992 } // namespace v8 |
| 6988 | 6993 |
| 6989 #endif // V8_TARGET_ARCH_MIPS | 6994 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |