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 6247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6258 float r2_val = get_float32_from_d_register(r2); | 6258 float r2_val = get_float32_from_d_register(r2); |
6259 uint32_t r1_val = static_cast<uint32_t>(r2_val); | 6259 uint32_t r1_val = static_cast<uint32_t>(r2_val); |
6260 set_low_register(r1, r1_val); | 6260 set_low_register(r1, r1_val); |
6261 SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT32_MAX); | 6261 SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT32_MAX); |
6262 return length; | 6262 return length; |
6263 } | 6263 } |
6264 | 6264 |
6265 EVALUATE(CLFDBR) { | 6265 EVALUATE(CLFDBR) { |
6266 DCHECK_OPCODE(CLFDBR); | 6266 DCHECK_OPCODE(CLFDBR); |
6267 DECODE_RRE_INSTRUCTION(r1, r2); | 6267 DECODE_RRE_INSTRUCTION(r1, r2); |
6268 double r2_val = get_double_from_d_register(r2); | 6268 double a = get_double_from_d_register(r2); |
6269 uint32_t r1_val = static_cast<uint32_t>(r2_val); | 6269 double n = std::round(a); |
| 6270 uint32_t r1_val = static_cast<uint32_t>(n); |
6270 set_low_register(r1, r1_val); | 6271 set_low_register(r1, r1_val); |
6271 SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT32_MAX); | 6272 if (std::isfinite(a) && a < 0.0) { |
| 6273 DCHECK(n <= 0.0 && std::isfinite(n)); |
| 6274 condition_reg_ = (n < 0.0) ? 0x1 : 0x4; |
| 6275 } else if (a == 0.0) { |
| 6276 condition_reg_ = 0x8; |
| 6277 } else if (std::isfinite(a) && a > 0.0) { |
| 6278 DCHECK(n >= 0.0 && std::isfinite(n)); |
| 6279 condition_reg_ = (n <= static_cast<double>(UINT32_MAX)) ? 0x2 : 0x1; |
| 6280 } else { |
| 6281 condition_reg_ = 0x1; |
| 6282 } |
6272 return length; | 6283 return length; |
6273 } | 6284 } |
6274 | 6285 |
6275 EVALUATE(CLFXBR) { | 6286 EVALUATE(CLFXBR) { |
6276 UNIMPLEMENTED(); | 6287 UNIMPLEMENTED(); |
6277 USE(instr); | 6288 USE(instr); |
6278 return 0; | 6289 return 0; |
6279 } | 6290 } |
6280 | 6291 |
6281 EVALUATE(CELGBR) { | 6292 EVALUATE(CELGBR) { |
(...skipping 3532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9814 return 0; | 9825 return 0; |
9815 } | 9826 } |
9816 | 9827 |
9817 #undef EVALUATE | 9828 #undef EVALUATE |
9818 | 9829 |
9819 } // namespace internal | 9830 } // namespace internal |
9820 } // namespace v8 | 9831 } // namespace v8 |
9821 | 9832 |
9822 #endif // USE_SIMULATOR | 9833 #endif // USE_SIMULATOR |
9823 #endif // V8_TARGET_ARCH_S390 | 9834 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |