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

Unified Diff: runtime/vm/assembler_mips.h

Issue 802023002: Fix SLTIU instruction in MIPS assembler, disassembler, and simulator. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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 | runtime/vm/assembler_mips_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « no previous file | runtime/vm/assembler_mips_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698