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

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

Issue 1413463009: Implemented the Word64Clz TurboFan operator for x64, arm64, and mips64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed a typing problem, and added mips64. Created 5 years, 1 month 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 | « src/mips64/disasm-mips64.cc ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/simulator-mips64.cc
diff --git a/src/mips64/simulator-mips64.cc b/src/mips64/simulator-mips64.cc
index 0ed2e3dbe0a562e38f0a928de19d3b325fd01955..4a7fd7c10f27895bbdb7d13ba22dc7a0d8400f0b 100644
--- a/src/mips64/simulator-mips64.cc
+++ b/src/mips64/simulator-mips64.cc
@@ -3364,8 +3364,17 @@ void Simulator::DecodeTypeRegisterSPECIAL() {
}
SetResult(rd_reg(), alu_out);
break;
- case MFLO:
- SetResult(rd_reg(), get_register(LO));
+ case MFLO: // MFLO == DCLZ on R6.
+ if (kArchVariant != kMips64r6) {
+ DCHECK(sa() == 0);
+ alu_out = get_register(LO);
+ } else {
+ // MIPS spec: If no bits were set in GPR rs(), the result written to
+ // GPR rd() is 64.
+ DCHECK(sa() == 1);
+ alu_out = base::bits::CountLeadingZeros64(static_cast<int64_t>(rs_u()));
+ }
+ SetResult(rd_reg(), alu_out);
break;
// Instructions using HI and LO registers.
case MULT: { // MULT == D_MUL_MUH.
@@ -3665,7 +3674,13 @@ void Simulator::DecodeTypeRegisterSPECIAL2() {
// MIPS32 spec: If no bits were set in GPR rs(), the result written to
// GPR rd is 32.
alu_out = base::bits::CountLeadingZeros32(static_cast<uint32_t>(rs_u()));
- set_register(rd_reg(), alu_out);
+ SetResult(rd_reg(), alu_out);
+ break;
+ case DCLZ:
+ // MIPS64 spec: If no bits were set in GPR rs(), the result written to
+ // GPR rd is 64.
+ alu_out = base::bits::CountLeadingZeros64(static_cast<uint64_t>(rs_u()));
+ SetResult(rd_reg(), alu_out);
break;
default:
alu_out = 0x12345678;
« no previous file with comments | « src/mips64/disasm-mips64.cc ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698