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

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

Issue 1481493002: (mips) adding simulator support for AUI/DAUI/DAHI/DATI instructions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: adding disasm tests. 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 4003 matching lines...) Expand 10 before | Expand all | Expand 10 after
4014 break; 4014 break;
4015 case BGEZ: 4015 case BGEZ:
4016 BranchHelper(rs >= 0); 4016 BranchHelper(rs >= 0);
4017 break; 4017 break;
4018 case BLTZAL: 4018 case BLTZAL:
4019 BranchAndLinkHelper(rs < 0); 4019 BranchAndLinkHelper(rs < 0);
4020 break; 4020 break;
4021 case BGEZAL: 4021 case BGEZAL:
4022 BranchAndLinkHelper(rs >= 0); 4022 BranchAndLinkHelper(rs >= 0);
4023 break; 4023 break;
4024 case DAHI:
4025 SetResult(rs_reg, rs + (se_imm16 << 32));
4026 break;
4027 case DATI:
4028 SetResult(rs_reg, rs + (se_imm16 << 48));
4029 break;
4024 default: 4030 default:
4025 UNREACHABLE(); 4031 UNREACHABLE();
4026 } 4032 }
4027 break; // case REGIMM. 4033 break; // case REGIMM.
4028 // ------------- Branch instructions. 4034 // ------------- Branch instructions.
4029 // When comparing to zero, the encoding of rt field is always 0, so we don't 4035 // When comparing to zero, the encoding of rt field is always 0, so we don't
4030 // need to replace rt with zero. 4036 // need to replace rt with zero.
4031 case BEQ: 4037 case BEQ:
4032 BranchHelper(rs == rt); 4038 BranchHelper(rs == rt);
4033 break; 4039 break;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
4100 break; 4106 break;
4101 case ANDI: 4107 case ANDI:
4102 SetResult(rt_reg, rs & oe_imm16); 4108 SetResult(rt_reg, rs & oe_imm16);
4103 break; 4109 break;
4104 case ORI: 4110 case ORI:
4105 SetResult(rt_reg, rs | oe_imm16); 4111 SetResult(rt_reg, rs | oe_imm16);
4106 break; 4112 break;
4107 case XORI: 4113 case XORI:
4108 SetResult(rt_reg, rs ^ oe_imm16); 4114 SetResult(rt_reg, rs ^ oe_imm16);
4109 break; 4115 break;
4110 case LUI: { 4116 case LUI:
balazs.kilvady 2015/11/26 17:10:51 Please use this kind of comment (like at branches)
4111 int32_t alu32_out = static_cast<int32_t>(oe_imm16 << 16); 4117 if (rs_reg != 0) {
4112 // Sign-extend result of 32bit operation into 64bit register. 4118 // AUI instruction.
4113 SetResult(rt_reg, static_cast<int64_t>(alu32_out)); 4119 DCHECK(kArchVariant == kMips64r6);
4120 int32_t alu32_out = static_cast<int32_t>(rs + (se_imm16 << 16));
4121 SetResult(rt_reg, static_cast<int64_t>(alu32_out));
4122 } else {
4123 // LUI instruction.
4124 int32_t alu32_out = static_cast<int32_t>(oe_imm16 << 16);
4125 // Sign-extend result of 32bit operation into 64bit register.
4126 SetResult(rt_reg, static_cast<int64_t>(alu32_out));
4127 }
4114 break; 4128 break;
4115 } 4129 case DAUI:
4130 DCHECK(kArchVariant == kMips64r6);
4131 DCHECK(rs_reg != 0);
4132 SetResult(rt_reg, rs + (se_imm16 << 16));
4133 break;
4116 // ------------- Memory instructions. 4134 // ------------- Memory instructions.
4117 case LB: 4135 case LB:
4118 set_register(rt_reg, ReadB(rs + se_imm16)); 4136 set_register(rt_reg, ReadB(rs + se_imm16));
4119 break; 4137 break;
4120 case LH: 4138 case LH:
4121 set_register(rt_reg, ReadH(rs + se_imm16, instr)); 4139 set_register(rt_reg, ReadH(rs + se_imm16, instr));
4122 break; 4140 break;
4123 case LWL: { 4141 case LWL: {
4124 // al_offset is offset of the effective address within an aligned word. 4142 // al_offset is offset of the effective address within an aligned word.
4125 uint8_t al_offset = (rs + se_imm16) & kInt32AlignmentMask; 4143 uint8_t al_offset = (rs + se_imm16) & kInt32AlignmentMask;
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
4568 } 4586 }
4569 4587
4570 4588
4571 #undef UNSUPPORTED 4589 #undef UNSUPPORTED
4572 } // namespace internal 4590 } // namespace internal
4573 } // namespace v8 4591 } // namespace v8
4574 4592
4575 #endif // USE_SIMULATOR 4593 #endif // USE_SIMULATOR
4576 4594
4577 #endif // V8_TARGET_ARCH_MIPS64 4595 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698