OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this | 1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 // TODO(jochen): Remove this after the setting is turned on globally. | 5 // TODO(jochen): Remove this after the setting is turned on globally. |
6 #define V8_IMMINENT_DEPRECATION_WARNINGS | 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 #include <functional> | 9 #include <functional> |
10 #include <limits> | 10 #include <limits> |
(...skipping 5402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5413 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64); | 5413 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64); |
5414 m.Return(m.TruncateFloat64ToInt64(m.Parameter(0))); | 5414 m.Return(m.TruncateFloat64ToInt64(m.Parameter(0))); |
5415 | 5415 |
5416 FOR_INT64_INPUTS(i) { | 5416 FOR_INT64_INPUTS(i) { |
5417 double input = static_cast<double>(*i); | 5417 double input = static_cast<double>(*i); |
5418 CHECK_EQ(static_cast<int64_t>(input), m.Call(input)); | 5418 CHECK_EQ(static_cast<int64_t>(input), m.Call(input)); |
5419 } | 5419 } |
5420 } | 5420 } |
5421 | 5421 |
5422 | 5422 |
| 5423 TEST(RunTruncateFloat32ToUint64) { |
| 5424 BufferedRawMachineAssemblerTester<uint64_t> m(kMachFloat32); |
| 5425 m.Return(m.TruncateFloat32ToUint64(m.Parameter(0))); |
| 5426 |
| 5427 FOR_UINT64_INPUTS(i) { |
| 5428 float input = static_cast<float>(*i); |
| 5429 if (input < 18446744073709551616.0) { |
| 5430 CHECK_EQ(static_cast<uint64_t>(input), m.Call(input)); |
| 5431 } |
| 5432 } |
| 5433 FOR_FLOAT32_INPUTS(j) { |
| 5434 if (*j < 18446744073709551616.0 && *j >= 0) { |
| 5435 CHECK_EQ(static_cast<uint64_t>(*j), m.Call(*j)); |
| 5436 } |
| 5437 } |
| 5438 } |
| 5439 |
| 5440 |
5423 TEST(RunTruncateFloat64ToUint64) { | 5441 TEST(RunTruncateFloat64ToUint64) { |
5424 BufferedRawMachineAssemblerTester<uint64_t> m(kMachFloat64); | 5442 BufferedRawMachineAssemblerTester<uint64_t> m(kMachFloat64); |
5425 m.Return(m.TruncateFloat64ToUint64(m.Parameter(0))); | 5443 m.Return(m.TruncateFloat64ToUint64(m.Parameter(0))); |
5426 | 5444 |
5427 FOR_UINT64_INPUTS(j) { | 5445 FOR_UINT64_INPUTS(j) { |
5428 double input = static_cast<double>(*j); | 5446 double input = static_cast<double>(*j); |
5429 | 5447 |
5430 if (input < 18446744073709551616.0) { | 5448 if (input < 18446744073709551616.0) { |
5431 CHECK_EQ(static_cast<uint64_t>(input), m.Call(input)); | 5449 CHECK_EQ(static_cast<uint64_t>(input), m.Call(input)); |
5432 } | 5450 } |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5711 Node* call = r.AddNode(r.common()->Call(desc), phi); | 5729 Node* call = r.AddNode(r.common()->Call(desc), phi); |
5712 r.Return(call); | 5730 r.Return(call); |
5713 | 5731 |
5714 CHECK_EQ(33, r.Call(1)); | 5732 CHECK_EQ(33, r.Call(1)); |
5715 CHECK_EQ(44, r.Call(0)); | 5733 CHECK_EQ(44, r.Call(0)); |
5716 } | 5734 } |
5717 | 5735 |
5718 } // namespace compiler | 5736 } // namespace compiler |
5719 } // namespace internal | 5737 } // namespace internal |
5720 } // namespace v8 | 5738 } // namespace v8 |
OLD | NEW |