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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/mips64/disasm-mips64.cc ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits.h> 5 #include <limits.h>
6 #include <stdarg.h> 6 #include <stdarg.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <cmath> 8 #include <cmath>
9 9
10 #if V8_TARGET_ARCH_MIPS64 10 #if V8_TARGET_ARCH_MIPS64
(...skipping 3346 matching lines...) Expand 10 before | Expand all | Expand 10 after
3357 DCHECK(sa() == 0); 3357 DCHECK(sa() == 0);
3358 alu_out = get_register(HI); 3358 alu_out = get_register(HI);
3359 } else { 3359 } else {
3360 // MIPS spec: If no bits were set in GPR rs(), the result written to 3360 // MIPS spec: If no bits were set in GPR rs(), the result written to
3361 // GPR rd() is 32. 3361 // GPR rd() is 32.
3362 DCHECK(sa() == 1); 3362 DCHECK(sa() == 1);
3363 alu_out = base::bits::CountLeadingZeros32(static_cast<int32_t>(rs_u())); 3363 alu_out = base::bits::CountLeadingZeros32(static_cast<int32_t>(rs_u()));
3364 } 3364 }
3365 SetResult(rd_reg(), alu_out); 3365 SetResult(rd_reg(), alu_out);
3366 break; 3366 break;
3367 case MFLO: 3367 case MFLO: // MFLO == DCLZ on R6.
3368 SetResult(rd_reg(), get_register(LO)); 3368 if (kArchVariant != kMips64r6) {
3369 DCHECK(sa() == 0);
3370 alu_out = get_register(LO);
3371 } else {
3372 // MIPS spec: If no bits were set in GPR rs(), the result written to
3373 // GPR rd() is 64.
3374 DCHECK(sa() == 1);
3375 alu_out = base::bits::CountLeadingZeros64(static_cast<int64_t>(rs_u()));
3376 }
3377 SetResult(rd_reg(), alu_out);
3369 break; 3378 break;
3370 // Instructions using HI and LO registers. 3379 // Instructions using HI and LO registers.
3371 case MULT: { // MULT == D_MUL_MUH. 3380 case MULT: { // MULT == D_MUL_MUH.
3372 int32_t rs_lo = static_cast<int32_t>(rs()); 3381 int32_t rs_lo = static_cast<int32_t>(rs());
3373 int32_t rt_lo = static_cast<int32_t>(rt()); 3382 int32_t rt_lo = static_cast<int32_t>(rt());
3374 i64hilo = static_cast<int64_t>(rs_lo) * static_cast<int64_t>(rt_lo); 3383 i64hilo = static_cast<int64_t>(rs_lo) * static_cast<int64_t>(rt_lo);
3375 if (kArchVariant != kMips64r6) { 3384 if (kArchVariant != kMips64r6) {
3376 set_register(LO, static_cast<int32_t>(i64hilo & 0xffffffff)); 3385 set_register(LO, static_cast<int32_t>(i64hilo & 0xffffffff));
3377 set_register(HI, static_cast<int32_t>(i64hilo >> 32)); 3386 set_register(HI, static_cast<int32_t>(i64hilo >> 32));
3378 } else { 3387 } else {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
3658 alu_out = static_cast<int32_t>(rs_u()) * static_cast<int32_t>(rt_u()); 3667 alu_out = static_cast<int32_t>(rs_u()) * static_cast<int32_t>(rt_u());
3659 SetResult(rd_reg(), alu_out); 3668 SetResult(rd_reg(), alu_out);
3660 // HI and LO are UNPREDICTABLE after the operation. 3669 // HI and LO are UNPREDICTABLE after the operation.
3661 set_register(LO, Unpredictable); 3670 set_register(LO, Unpredictable);
3662 set_register(HI, Unpredictable); 3671 set_register(HI, Unpredictable);
3663 break; 3672 break;
3664 case CLZ: 3673 case CLZ:
3665 // MIPS32 spec: If no bits were set in GPR rs(), the result written to 3674 // MIPS32 spec: If no bits were set in GPR rs(), the result written to
3666 // GPR rd is 32. 3675 // GPR rd is 32.
3667 alu_out = base::bits::CountLeadingZeros32(static_cast<uint32_t>(rs_u())); 3676 alu_out = base::bits::CountLeadingZeros32(static_cast<uint32_t>(rs_u()));
3668 set_register(rd_reg(), alu_out); 3677 SetResult(rd_reg(), alu_out);
3678 break;
3679 case DCLZ:
3680 // MIPS64 spec: If no bits were set in GPR rs(), the result written to
3681 // GPR rd is 64.
3682 alu_out = base::bits::CountLeadingZeros64(static_cast<uint64_t>(rs_u()));
3683 SetResult(rd_reg(), alu_out);
3669 break; 3684 break;
3670 default: 3685 default:
3671 alu_out = 0x12345678; 3686 alu_out = 0x12345678;
3672 UNREACHABLE(); 3687 UNREACHABLE();
3673 } 3688 }
3674 } 3689 }
3675 3690
3676 3691
3677 void Simulator::DecodeTypeRegisterSPECIAL3() { 3692 void Simulator::DecodeTypeRegisterSPECIAL3() {
3678 int64_t alu_out; 3693 int64_t alu_out;
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
4553 } 4568 }
4554 4569
4555 4570
4556 #undef UNSUPPORTED 4571 #undef UNSUPPORTED
4557 } // namespace internal 4572 } // namespace internal
4558 } // namespace v8 4573 } // namespace v8
4559 4574
4560 #endif // USE_SIMULATOR 4575 #endif // USE_SIMULATOR
4561 4576
4562 #endif // V8_TARGET_ARCH_MIPS64 4577 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« 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