OLD | NEW |
---|---|
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 4136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4147 case CDGBR: | 4147 case CDGBR: |
4148 case CEGBR: | 4148 case CEGBR: |
4149 case CGEBR: | 4149 case CGEBR: |
4150 case CFDBR: | 4150 case CFDBR: |
4151 case CGDBR: | 4151 case CGDBR: |
4152 case SQDBR: | 4152 case SQDBR: |
4153 case SQEBR: | 4153 case SQEBR: |
4154 case CFEBR: | 4154 case CFEBR: |
4155 case CEFBR: | 4155 case CEFBR: |
4156 case LCDBR: | 4156 case LCDBR: |
4157 case LCEBR: | |
4157 case LPDBR: | 4158 case LPDBR: |
4158 case LPEBR: { | 4159 case LPEBR: { |
4159 RREInstruction* rreInstr = reinterpret_cast<RREInstruction*>(instr); | 4160 RREInstruction* rreInstr = reinterpret_cast<RREInstruction*>(instr); |
4160 int r1 = rreInstr->R1Value(); | 4161 int r1 = rreInstr->R1Value(); |
4161 int r2 = rreInstr->R2Value(); | 4162 int r2 = rreInstr->R2Value(); |
4162 double r1_val = get_double_from_d_register(r1); | 4163 double r1_val = get_double_from_d_register(r1); |
4163 double r2_val = get_double_from_d_register(r2); | 4164 double r2_val = get_double_from_d_register(r2); |
4164 float fr1_val = get_float32_from_d_register(r1); | 4165 float fr1_val = get_float32_from_d_register(r1); |
4165 float fr2_val = get_float32_from_d_register(r2); | 4166 float fr2_val = get_float32_from_d_register(r2); |
4166 if (op == ADBR) { | 4167 if (op == ADBR) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4253 set_d_register_from_double(r1, r1_val); | 4254 set_d_register_from_double(r1, r1_val); |
4254 if (r2_val != r2_val) { // input is NaN | 4255 if (r2_val != r2_val) { // input is NaN |
4255 condition_reg_ = CC_OF; | 4256 condition_reg_ = CC_OF; |
4256 } else if (r2_val == 0) { | 4257 } else if (r2_val == 0) { |
4257 condition_reg_ = CC_EQ; | 4258 condition_reg_ = CC_EQ; |
4258 } else if (r2_val < 0) { | 4259 } else if (r2_val < 0) { |
4259 condition_reg_ = CC_LT; | 4260 condition_reg_ = CC_LT; |
4260 } else if (r2_val > 0) { | 4261 } else if (r2_val > 0) { |
4261 condition_reg_ = CC_GT; | 4262 condition_reg_ = CC_GT; |
4262 } | 4263 } |
4264 } else if (op == LCEBR) { | |
4265 fr1_val = -fr2_val; | |
4266 set_d_register_from_float32(r1, fr1_val); | |
4267 if (fr2_val != fr2_val) { // input is NaN | |
4268 condition_reg_ = CC_OF; | |
4269 } else if (fr2_val == 0) { | |
4270 condition_reg_ = CC_EQ; | |
4271 } else if (fr2_val < 0) { | |
4272 condition_reg_ = CC_LT; | |
4273 } else if (fr2_val > 0) { | |
4274 condition_reg_ = CC_GT; | |
4275 } | |
4263 } else if (op == LPDBR) { | 4276 } else if (op == LPDBR) { |
4264 r1_val = std::fabs(r2_val); | 4277 r1_val = std::fabs(r2_val); |
4265 set_d_register_from_double(r1, r1_val); | 4278 set_d_register_from_double(r1, r1_val); |
4266 if (r2_val != r2_val) { // input is NaN | 4279 if (r2_val != r2_val) { // input is NaN |
4267 condition_reg_ = CC_OF; | 4280 condition_reg_ = CC_OF; |
4268 } else if (r2_val == 0) { | 4281 } else if (r2_val == 0) { |
4269 condition_reg_ = CC_EQ; | 4282 condition_reg_ = CC_EQ; |
4270 } else { | 4283 } else { |
4271 condition_reg_ = CC_GT; | 4284 condition_reg_ = CC_GT; |
4272 } | 4285 } |
(...skipping 4219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8492 DCHECK_OPCODE(LTEBR); | 8505 DCHECK_OPCODE(LTEBR); |
8493 DECODE_RRE_INSTRUCTION(r1, r2); | 8506 DECODE_RRE_INSTRUCTION(r1, r2); |
8494 int64_t r2_val = get_d_register(r2); | 8507 int64_t r2_val = get_d_register(r2); |
8495 float fr2_val = get_float32_from_d_register(r2); | 8508 float fr2_val = get_float32_from_d_register(r2); |
8496 SetS390ConditionCode<float>(fr2_val, 0.0); | 8509 SetS390ConditionCode<float>(fr2_val, 0.0); |
8497 set_d_register(r1, r2_val); | 8510 set_d_register(r1, r2_val); |
8498 return length; | 8511 return length; |
8499 } | 8512 } |
8500 | 8513 |
8501 EVALUATE(LCEBR) { | 8514 EVALUATE(LCEBR) { |
8502 UNIMPLEMENTED(); | 8515 DCHECK_OPCODE(LCEBR); |
8503 USE(instr); | 8516 DECODE_RRE_INSTRUCTION(r1, r2); |
8504 return 0; | 8517 float fr1_val = get_float32_from_d_register(r1); |
8518 float fr2_val = get_float32_from_d_register(r2); | |
8519 fr1_val = -fr2_val; | |
8520 set_d_register_from_float32(r1, fr1_val); | |
8521 if (fr2_val != fr2_val) { // input is NaN | |
8522 condition_reg_ = CC_OF; | |
8523 } else if (fr2_val == 0) { | |
8524 condition_reg_ = CC_EQ; | |
8525 } else if (fr2_val < 0) { | |
8526 condition_reg_ = CC_LT; | |
8527 } else if (fr2_val > 0) { | |
8528 condition_reg_ = CC_GT; | |
8529 } | |
8530 return length; | |
8505 } | 8531 } |
8506 | 8532 |
8507 EVALUATE(LDEBR) { | 8533 EVALUATE(LDEBR) { |
8508 DCHECK_OPCODE(LDEBR); | 8534 DCHECK_OPCODE(LDEBR); |
8509 DECODE_RRE_INSTRUCTION(r1, r2); | 8535 DECODE_RRE_INSTRUCTION(r1, r2); |
8510 float fp_val = get_float32_from_d_register(r2); | 8536 float fp_val = get_float32_from_d_register(r2); |
8511 double db_val = static_cast<double>(fp_val); | 8537 double db_val = static_cast<double>(fp_val); |
8512 set_d_register_from_double(r1, db_val); | 8538 set_d_register_from_double(r1, db_val); |
john.yan
2016/08/09 02:24:03
I guess we need to set the condition code for this
| |
8513 return length; | 8539 return length; |
8514 } | 8540 } |
8515 | 8541 |
8516 EVALUATE(LXDBR) { | 8542 EVALUATE(LXDBR) { |
8517 UNIMPLEMENTED(); | 8543 UNIMPLEMENTED(); |
8518 USE(instr); | 8544 USE(instr); |
8519 return 0; | 8545 return 0; |
8520 } | 8546 } |
8521 | 8547 |
8522 EVALUATE(LXEBR) { | 8548 EVALUATE(LXEBR) { |
(...skipping 4036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12559 return 0; | 12585 return 0; |
12560 } | 12586 } |
12561 | 12587 |
12562 #undef EVALUATE | 12588 #undef EVALUATE |
12563 | 12589 |
12564 } // namespace internal | 12590 } // namespace internal |
12565 } // namespace v8 | 12591 } // namespace v8 |
12566 | 12592 |
12567 #endif // USE_SIMULATOR | 12593 #endif // USE_SIMULATOR |
12568 #endif // V8_TARGET_ARCH_S390 | 12594 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |