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

Unified Diff: src/mips64/simulator-mips64.cc

Issue 1005123002: MIPS64: Unify and improve Word32 compares to use same instructions as Word64 compares. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
Index: src/mips64/simulator-mips64.cc
diff --git a/src/mips64/simulator-mips64.cc b/src/mips64/simulator-mips64.cc
index 5ddad8d5b4651214b96f69e1dbf435cdefea0a80..cc5eaea3023aff42bea2efd61d344c0fb6fce29e 100644
--- a/src/mips64/simulator-mips64.cc
+++ b/src/mips64/simulator-mips64.cc
@@ -1995,7 +1995,7 @@ void Simulator::ConfigureTypeRegister(Instruction* instr,
*return_addr_reg = instr->RdValue();
break;
case SLL:
- *alu_out = (int32_t)rt << sa;
+ *alu_out = static_cast<int32_t>(rt) << sa;
break;
case DSLL:
*alu_out = rt << sa;
@@ -2007,12 +2007,14 @@ void Simulator::ConfigureTypeRegister(Instruction* instr,
if (rs_reg == 0) {
// Regular logical right shift of a word by a fixed number of
// bits instruction. RS field is always equal to 0.
- *alu_out = (uint32_t)rt_u >> sa;
+ // Sign-extend the 32-bit result.
+ *alu_out = static_cast<int32_t>(static_cast<uint32_t>(rt_u) >> sa);
} else {
// Logical right-rotate of a word by a fixed number of bits. This
// is special case of SRL instruction, added in MIPS32 Release 2.
// RS field is equal to 00001.
- *alu_out = base::bits::RotateRight32((uint32_t)rt_u, sa);
+ *alu_out = static_cast<int32_t>(
+ base::bits::RotateRight32((uint32_t)rt_u, sa));
}
break;
case DSRL:
@@ -2040,12 +2042,13 @@ void Simulator::ConfigureTypeRegister(Instruction* instr,
if (sa == 0) {
// Regular logical right-shift of a word by a variable number of
// bits instruction. SA field is always equal to 0.
- *alu_out = (uint32_t)rt_u >> rs;
+ *alu_out = static_cast<int32_t>((uint32_t)rt_u >> rs);
} else {
// Logical right-rotate of a word by a variable number of bits.
// This is special case od SRLV instruction, added in MIPS32
// Release 2. SA field is equal to 00001.
- *alu_out = base::bits::RotateRight32((uint32_t)rt_u, rs_u);
+ *alu_out = static_cast<int32_t>(
+ base::bits::RotateRight32((uint32_t)rt_u, rs_u));
}
break;
case DSRLV:

Powered by Google App Engine
This is Rietveld 408576698