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

Side by Side Diff: runtime/vm/simulator_mips.cc

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 unified diff | Download patch | Annotate | Revision Log
« runtime/vm/assembler_mips.h ('K') | « runtime/vm/disassembler_mips.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <setjmp.h> 5 #include <setjmp.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #if defined(TARGET_ARCH_MIPS) 9 #if defined(TARGET_ARCH_MIPS)
10 10
(...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 break; 2176 break;
2177 } 2177 }
2178 case SLTI: { 2178 case SLTI: {
2179 // Format(instr, "slti 'rt, 'rs, 'imms"); 2179 // Format(instr, "slti 'rt, 'rs, 'imms");
2180 int32_t rs_val = get_register(instr->RsField()); 2180 int32_t rs_val = get_register(instr->RsField());
2181 int32_t imm_val = instr->SImmField(); 2181 int32_t imm_val = instr->SImmField();
2182 set_register(instr->RtField(), rs_val < imm_val ? 1 : 0); 2182 set_register(instr->RtField(), rs_val < imm_val ? 1 : 0);
2183 break; 2183 break;
2184 } 2184 }
2185 case SLTIU: { 2185 case SLTIU: {
2186 // Format(instr, "slti 'rt, 'rs, 'immu"); 2186 // Format(instr, "sltiu 'rt, 'rs, 'imms");
2187 uint32_t rs_val = get_register(instr->RsField()); 2187 uint32_t rs_val = get_register(instr->RsField());
2188 uint32_t imm_val = instr->UImmField(); 2188 int32_t imm_val = instr->SImmField(); // Sign extend to 32-bit.
2189 set_register(instr->RtField(), rs_val < imm_val ? 1 : 0); 2189 uint32_t immu_val = static_cast<uint32_t>(imm_val); // Treat as unsigned.
2190 set_register(instr->RtField(), rs_val < immu_val ? 1 : 0);
2190 break; 2191 break;
2191 } 2192 }
2192 case SDC1: { 2193 case SDC1: {
2193 // Format(instr, "sdc1 'ft, 'imms('rs)"); 2194 // Format(instr, "sdc1 'ft, 'imms('rs)");
2194 int32_t base_val = get_register(instr->RsField()); 2195 int32_t base_val = get_register(instr->RsField());
2195 int32_t imm_val = instr->SImmField(); 2196 int32_t imm_val = instr->SImmField();
2196 uword addr = base_val + imm_val; 2197 uword addr = base_val + imm_val;
2197 if (Simulator::IsIllegalAddress(addr)) { 2198 if (Simulator::IsIllegalAddress(addr)) {
2198 HandleIllegalAccess(addr, instr); 2199 HandleIllegalAccess(addr, instr);
2199 } else { 2200 } else {
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
2474 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); 2475 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
2475 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); 2476 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
2476 buf->Longjmp(); 2477 buf->Longjmp();
2477 } 2478 }
2478 2479
2479 } // namespace dart 2480 } // namespace dart
2480 2481
2481 #endif // !defined(HOST_ARCH_MIPS) 2482 #endif // !defined(HOST_ARCH_MIPS)
2482 2483
2483 #endif // defined TARGET_ARCH_MIPS 2484 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« runtime/vm/assembler_mips.h ('K') | « runtime/vm/disassembler_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698