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

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

Issue 2582683002: s390x: implement vector support on s390 (Closed)
Patch Set: fix comments and dchecks Created 4 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
« no previous file with comments | « src/s390/simulator-s390.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 <stdarg.h> 5 #include <stdarg.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <cmath> 7 #include <cmath>
8 8
9 #if V8_TARGET_ARCH_S390 9 #if V8_TARGET_ARCH_S390
10 10
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 base::CallOnce(&once, &Simulator::EvalTableInit); 736 base::CallOnce(&once, &Simulator::EvalTableInit);
737 } 737 }
738 738
739 Simulator::EvaluateFuncType Simulator::EvalTable[] = {NULL}; 739 Simulator::EvaluateFuncType Simulator::EvalTable[] = {NULL};
740 740
741 void Simulator::EvalTableInit() { 741 void Simulator::EvalTableInit() {
742 for (int i = 0; i < MAX_NUM_OPCODES; i++) { 742 for (int i = 0; i < MAX_NUM_OPCODES; i++) {
743 EvalTable[i] = &Simulator::Evaluate_Unknown; 743 EvalTable[i] = &Simulator::Evaluate_Unknown;
744 } 744 }
745 745
746 #define CREATE_EVALUATE_TABLE(name, op_name, op_value) \
747 EvalTable[op_name] = &Simulator::Evaluate_##op_name;
748 VRR_C_OPCODE_LIST(CREATE_EVALUATE_TABLE);
749 #undef CREATE_EVALUATE_TABLE
750
746 EvalTable[DUMY] = &Simulator::Evaluate_DUMY; 751 EvalTable[DUMY] = &Simulator::Evaluate_DUMY;
747 EvalTable[BKPT] = &Simulator::Evaluate_BKPT; 752 EvalTable[BKPT] = &Simulator::Evaluate_BKPT;
748 EvalTable[SPM] = &Simulator::Evaluate_SPM; 753 EvalTable[SPM] = &Simulator::Evaluate_SPM;
749 EvalTable[BALR] = &Simulator::Evaluate_BALR; 754 EvalTable[BALR] = &Simulator::Evaluate_BALR;
750 EvalTable[BCTR] = &Simulator::Evaluate_BCTR; 755 EvalTable[BCTR] = &Simulator::Evaluate_BCTR;
751 EvalTable[BCR] = &Simulator::Evaluate_BCR; 756 EvalTable[BCR] = &Simulator::Evaluate_BCR;
752 EvalTable[SVC] = &Simulator::Evaluate_SVC; 757 EvalTable[SVC] = &Simulator::Evaluate_SVC;
753 EvalTable[BSM] = &Simulator::Evaluate_BSM; 758 EvalTable[BSM] = &Simulator::Evaluate_BSM;
754 EvalTable[BASSM] = &Simulator::Evaluate_BASSM; 759 EvalTable[BASSM] = &Simulator::Evaluate_BASSM;
755 EvalTable[BASR] = &Simulator::Evaluate_BASR; 760 EvalTable[BASR] = &Simulator::Evaluate_BASR;
(...skipping 5287 matching lines...) Expand 10 before | Expand all | Expand 10 after
6043 int16_t i2 = AS(RIInstruction)->I2Value(); \ 6048 int16_t i2 = AS(RIInstruction)->I2Value(); \
6044 int length = 4; 6049 int length = 4;
6045 6050
6046 #define DECODE_RXE_INSTRUCTION(r1, b2, x2, d2) \ 6051 #define DECODE_RXE_INSTRUCTION(r1, b2, x2, d2) \
6047 int r1 = AS(RXEInstruction)->R1Value(); \ 6052 int r1 = AS(RXEInstruction)->R1Value(); \
6048 int b2 = AS(RXEInstruction)->B2Value(); \ 6053 int b2 = AS(RXEInstruction)->B2Value(); \
6049 int x2 = AS(RXEInstruction)->X2Value(); \ 6054 int x2 = AS(RXEInstruction)->X2Value(); \
6050 int d2 = AS(RXEInstruction)->D2Value(); \ 6055 int d2 = AS(RXEInstruction)->D2Value(); \
6051 int length = 6; 6056 int length = 6;
6052 6057
6058 #define DECODE_VRR_C_INSTRUCTION(r1, r2, r3, m6, m5, m4) \
6059 int r1 = AS(VRR_C_Instruction)->R1Value(); \
6060 int r2 = AS(VRR_C_Instruction)->R2Value(); \
6061 int r3 = AS(VRR_C_Instruction)->R3Value(); \
6062 int m6 = AS(VRR_C_Instruction)->M6Value(); \
6063 int m5 = AS(VRR_C_Instruction)->M5Value(); \
6064 int m4 = AS(VRR_C_Instruction)->M4Value(); \
6065 int length = 6;
6066
6053 #define GET_ADDRESS(index_reg, base_reg, offset) \ 6067 #define GET_ADDRESS(index_reg, base_reg, offset) \
6054 (((index_reg) == 0) ? 0 : get_register(index_reg)) + \ 6068 (((index_reg) == 0) ? 0 : get_register(index_reg)) + \
6055 (((base_reg) == 0) ? 0 : get_register(base_reg)) + offset 6069 (((base_reg) == 0) ? 0 : get_register(base_reg)) + offset
6056 6070
6057 int Simulator::Evaluate_Unknown(Instruction* instr) { 6071 int Simulator::Evaluate_Unknown(Instruction* instr) {
6058 UNREACHABLE(); 6072 UNREACHABLE();
6059 return 0; 6073 return 0;
6060 } 6074 }
6061 6075
6076 EVALUATE(VFA) {
6077 DCHECK_OPCODE(VFA);
6078 DECODE_VRR_C_INSTRUCTION(r1, r2, r3, m6, m5, m4);
6079 USE(m6);
6080 USE(m5);
6081 USE(m4);
6082 DCHECK(m5 == 8);
6083 DCHECK(m4 == 3);
6084 double r2_val = get_double_from_d_register(r2);
6085 double r3_val = get_double_from_d_register(r3);
6086 double r1_val = r2_val + r3_val;
6087 set_d_register_from_double(r1, r1_val);
6088 return length;
6089 }
6090
6091 EVALUATE(VFS) {
6092 DCHECK_OPCODE(VFS);
6093 DECODE_VRR_C_INSTRUCTION(r1, r2, r3, m6, m5, m4);
6094 USE(m6);
6095 USE(m5);
6096 USE(m4);
6097 DCHECK(m5 == 8);
6098 DCHECK(m4 == 3);
6099 double r2_val = get_double_from_d_register(r2);
6100 double r3_val = get_double_from_d_register(r3);
6101 double r1_val = r2_val - r3_val;
6102 set_d_register_from_double(r1, r1_val);
6103 return length;
6104 }
6105
6106 EVALUATE(VFM) {
6107 DCHECK_OPCODE(VFM);
6108 DECODE_VRR_C_INSTRUCTION(r1, r2, r3, m6, m5, m4);
6109 USE(m6);
6110 USE(m5);
6111 USE(m4);
6112 DCHECK(m5 == 8);
6113 DCHECK(m4 == 3);
6114 double r2_val = get_double_from_d_register(r2);
6115 double r3_val = get_double_from_d_register(r3);
6116 double r1_val = r2_val * r3_val;
6117 set_d_register_from_double(r1, r1_val);
6118 return length;
6119 }
6120
6121 EVALUATE(VFD) {
6122 DCHECK_OPCODE(VFD);
6123 DECODE_VRR_C_INSTRUCTION(r1, r2, r3, m6, m5, m4);
6124 USE(m6);
6125 USE(m5);
6126 USE(m4);
6127 DCHECK(m5 == 8);
6128 DCHECK(m4 == 3);
6129 double r2_val = get_double_from_d_register(r2);
6130 double r3_val = get_double_from_d_register(r3);
6131 double r1_val = r2_val / r3_val;
6132 set_d_register_from_double(r1, r1_val);
6133 return length;
6134 }
6135
6062 EVALUATE(DUMY) { 6136 EVALUATE(DUMY) {
6063 DCHECK_OPCODE(DUMY); 6137 DCHECK_OPCODE(DUMY);
6138 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
6139 USE(r1);
6140 USE(x2);
6141 USE(b2);
6142 USE(d2);
6064 // dummy instruction does nothing. 6143 // dummy instruction does nothing.
6065 return 6; 6144 return length;
6066 } 6145 }
6067 6146
6068 EVALUATE(CLR) { 6147 EVALUATE(CLR) {
6069 DCHECK_OPCODE(CLR); 6148 DCHECK_OPCODE(CLR);
6070 DECODE_RR_INSTRUCTION(r1, r2); 6149 DECODE_RR_INSTRUCTION(r1, r2);
6071 uint32_t r1_val = get_low_register<uint32_t>(r1); 6150 uint32_t r1_val = get_low_register<uint32_t>(r1);
6072 uint32_t r2_val = get_low_register<uint32_t>(r2); 6151 uint32_t r2_val = get_low_register<uint32_t>(r2);
6073 SetS390ConditionCode<uint32_t>(r1_val, r2_val); 6152 SetS390ConditionCode<uint32_t>(r1_val, r2_val);
6074 return length; 6153 return length;
6075 } 6154 }
(...skipping 6568 matching lines...) Expand 10 before | Expand all | Expand 10 after
12644 return 0; 12723 return 0;
12645 } 12724 }
12646 12725
12647 #undef EVALUATE 12726 #undef EVALUATE
12648 12727
12649 } // namespace internal 12728 } // namespace internal
12650 } // namespace v8 12729 } // namespace v8
12651 12730
12652 #endif // USE_SIMULATOR 12731 #endif // USE_SIMULATOR
12653 #endif // V8_TARGET_ARCH_S390 12732 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/s390/simulator-s390.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698