Chromium Code Reviews| Index: runtime/vm/assembler_mips.h |
| =================================================================== |
| --- runtime/vm/assembler_mips.h (revision 42354) |
| +++ runtime/vm/assembler_mips.h (working copy) |
| @@ -561,7 +561,7 @@ |
| void lui(Register rt, const Immediate& imm) { |
| ASSERT(Utils::IsUint(kImmBits, imm.value())); |
| - uint16_t imm_value = static_cast<uint16_t>(imm.value()); |
| + const uint16_t imm_value = static_cast<uint16_t>(imm.value()); |
| EmitIType(LUI, R0, rt, imm_value); |
| } |
| @@ -673,7 +673,7 @@ |
| void ori(Register rt, Register rs, const Immediate& imm) { |
| ASSERT(Utils::IsUint(kImmBits, imm.value())); |
| - uint16_t imm_value = static_cast<uint16_t>(imm.value()); |
| + const uint16_t imm_value = static_cast<uint16_t>(imm.value()); |
| EmitIType(ORI, rs, rt, imm_value); |
| } |
| @@ -704,13 +704,16 @@ |
| void slti(Register rt, Register rs, const Immediate& imm) { |
| ASSERT(Utils::IsInt(kImmBits, imm.value())); |
| - int16_t imm_value = static_cast<int16_t>(imm.value()); |
| + const uint16_t imm_value = static_cast<uint16_t>(imm.value()); |
| EmitIType(SLTI, rs, rt, imm_value); |
| } |
| + // Although imm argument is int32_t, it is interpreted as an uint32_t. |
| + // For example, -1 stands for 0xffffffffUL: it is encoded as 0xffff in the |
| + // instruction imm field and is then sign extended back to 0xffffffffUL. |
| void sltiu(Register rt, Register rs, const Immediate& imm) { |
|
zra
2014/12/13 03:12:59
This is a weird instruction.
|
| - ASSERT(Utils::IsUint(kImmBits, imm.value())); |
| - uint16_t imm_value = static_cast<uint16_t>(imm.value()); |
| + ASSERT(Utils::IsInt(kImmBits, imm.value())); |
| + const uint16_t imm_value = static_cast<uint16_t>(imm.value()); |
| EmitIType(SLTIU, rs, rt, imm_value); |
| } |
| @@ -1082,7 +1085,7 @@ |
| void BranchUnsignedLess(Register rd, const Immediate& imm, Label* l) { |
| ASSERT(!in_delay_slot_); |
| ASSERT(imm.value() != 0); |
| - if (Utils::IsUint(kImmBits, imm.value())) { |
| + if (Utils::IsInt(kImmBits, imm.value())) { |
| sltiu(CMPRES2, rd, imm); |
| bne(CMPRES2, ZR, l); |
| } else { |