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

Side by Side Diff: src/mips64/simulator-mips64.cc

Issue 1485023004: MIPS:[turbofan] Use Ins, Dins to clear bits instead of And with inverted immediate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comments. Created 5 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
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 3678 matching lines...) Expand 10 before | Expand all | Expand 10 after
3689 default: 3689 default:
3690 alu_out = 0x12345678; 3690 alu_out = 0x12345678;
3691 UNREACHABLE(); 3691 UNREACHABLE();
3692 } 3692 }
3693 } 3693 }
3694 3694
3695 3695
3696 void Simulator::DecodeTypeRegisterSPECIAL3() { 3696 void Simulator::DecodeTypeRegisterSPECIAL3() {
3697 int64_t alu_out; 3697 int64_t alu_out;
3698 switch (get_instr()->FunctionFieldRaw()) { 3698 switch (get_instr()->FunctionFieldRaw()) {
3699 case INS: { // Mips32r2 instruction. 3699 case INS: { // Mips64r2 instruction.
3700 // Interpret rd field as 5-bit msb of insert. 3700 // Interpret rd field as 5-bit msb of insert.
3701 uint16_t msb = rd_reg(); 3701 uint16_t msb = rd_reg();
3702 // Interpret sa field as 5-bit lsb of insert. 3702 // Interpret sa field as 5-bit lsb of insert.
3703 uint16_t lsb = sa();
3704 uint16_t size = msb - lsb + 1;
3705 uint64_t mask = (1ULL << size) - 1;
3706 alu_out = static_cast<int32_t>((rt_u() & ~(mask << lsb)) |
3707 ((rs_u() & mask) << lsb));
3708 SetResult(rt_reg(), alu_out);
3709 break;
3710 }
3711 case DINS: { // Mips64r2 instruction.
3712 // Interpret rd field as 5-bit msb of insert.
3713 uint16_t msb = rd_reg();
3714 // Interpret sa field as 5-bit lsb of insert.
3703 uint16_t lsb = sa(); 3715 uint16_t lsb = sa();
3704 uint16_t size = msb - lsb + 1; 3716 uint16_t size = msb - lsb + 1;
3705 uint64_t mask = (1ULL << size) - 1; 3717 uint64_t mask = (1ULL << size) - 1;
3706 alu_out = (rt_u() & ~(mask << lsb)) | ((rs_u() & mask) << lsb); 3718 alu_out = (rt_u() & ~(mask << lsb)) | ((rs_u() & mask) << lsb);
3707 SetResult(rt_reg(), alu_out); 3719 SetResult(rt_reg(), alu_out);
3708 break; 3720 break;
3709 } 3721 }
3710 case EXT: { // Mips32r2 instruction. 3722 case EXT: { // Mips64r2 instruction.
3711 // Interpret rd field as 5-bit msb of extract. 3723 // Interpret rd field as 5-bit msb of extract.
3712 uint16_t msb = rd_reg(); 3724 uint16_t msb = rd_reg();
3713 // Interpret sa field as 5-bit lsb of extract. 3725 // Interpret sa field as 5-bit lsb of extract.
3714 uint16_t lsb = sa(); 3726 uint16_t lsb = sa();
3715 uint16_t size = msb + 1; 3727 uint16_t size = msb + 1;
3716 uint64_t mask = (1ULL << size) - 1; 3728 uint64_t mask = (1ULL << size) - 1;
3717 alu_out = static_cast<int32_t>((rs_u() & (mask << lsb)) >> lsb); 3729 alu_out = static_cast<int32_t>((rs_u() & (mask << lsb)) >> lsb);
3718 SetResult(rt_reg(), alu_out); 3730 SetResult(rt_reg(), alu_out);
3719 break; 3731 break;
3720 } 3732 }
3721 case DEXT: { // Mips32r2 instruction. 3733 case DEXT: { // Mips64r2 instruction.
3722 // Interpret rd field as 5-bit msb of extract. 3734 // Interpret rd field as 5-bit msb of extract.
3723 uint16_t msb = rd_reg(); 3735 uint16_t msb = rd_reg();
3724 // Interpret sa field as 5-bit lsb of extract. 3736 // Interpret sa field as 5-bit lsb of extract.
3725 uint16_t lsb = sa(); 3737 uint16_t lsb = sa();
3726 uint16_t size = msb + 1; 3738 uint16_t size = msb + 1;
3727 uint64_t mask = (1ULL << size) - 1; 3739 uint64_t mask = (1ULL << size) - 1;
3728 alu_out = static_cast<int64_t>((rs_u() & (mask << lsb)) >> lsb); 3740 alu_out = static_cast<int64_t>((rs_u() & (mask << lsb)) >> lsb);
3729 SetResult(rt_reg(), alu_out); 3741 SetResult(rt_reg(), alu_out);
3730 break; 3742 break;
3731 } 3743 }
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
4572 } 4584 }
4573 4585
4574 4586
4575 #undef UNSUPPORTED 4587 #undef UNSUPPORTED
4576 } // namespace internal 4588 } // namespace internal
4577 } // namespace v8 4589 } // namespace v8
4578 4590
4579 #endif // USE_SIMULATOR 4591 #endif // USE_SIMULATOR
4580 4592
4581 #endif // V8_TARGET_ARCH_MIPS64 4593 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/macro-assembler-mips64.cc ('k') | test/unittests/compiler/mips/instruction-selector-mips-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698