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 5346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5357 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64); | 5357 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64); |
5358 m.Return(m.ChangeFloat64ToInt64(m.Parameter(0))); | 5358 m.Return(m.ChangeFloat64ToInt64(m.Parameter(0))); |
5359 | 5359 |
5360 FOR_INT64_INPUTS(i) { | 5360 FOR_INT64_INPUTS(i) { |
5361 double input = static_cast<double>(*i); | 5361 double input = static_cast<double>(*i); |
5362 CHECK_EQ(static_cast<int64_t>(input), m.Call(input)); | 5362 CHECK_EQ(static_cast<int64_t>(input), m.Call(input)); |
5363 } | 5363 } |
5364 } | 5364 } |
5365 | 5365 |
5366 | 5366 |
| 5367 TEST(RunTruncateFloat64ToUint64) { |
| 5368 BufferedRawMachineAssemblerTester<uint64_t> m(kMachFloat64); |
| 5369 m.Return(m.TruncateFloat64ToUint64(m.Parameter(0))); |
| 5370 |
| 5371 FOR_UINT64_INPUTS(j) { |
| 5372 double input = static_cast<double>(*j); |
| 5373 |
| 5374 if (input < 18446744073709551616.0) { |
| 5375 CHECK_EQ(static_cast<uint64_t>(input), m.Call(input)); |
| 5376 } |
| 5377 } |
| 5378 |
| 5379 FOR_FLOAT64_INPUTS(i) { |
| 5380 if (*i < 18446744073709551616.0 && *i >= 0) { |
| 5381 CHECK_EQ(static_cast<uint64_t>(*i), m.Call(*i)); |
| 5382 } |
| 5383 } |
| 5384 } |
| 5385 |
| 5386 |
5367 TEST(RunRoundInt64ToFloat32) { | 5387 TEST(RunRoundInt64ToFloat32) { |
5368 BufferedRawMachineAssemblerTester<float> m(kMachInt64); | 5388 BufferedRawMachineAssemblerTester<float> m(kMachInt64); |
5369 m.Return(m.RoundInt64ToFloat32(m.Parameter(0))); | 5389 m.Return(m.RoundInt64ToFloat32(m.Parameter(0))); |
5370 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), m.Call(*i)); } | 5390 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), m.Call(*i)); } |
5371 } | 5391 } |
5372 | 5392 |
5373 | 5393 |
5374 TEST(RunRoundInt64ToFloat64) { | 5394 TEST(RunRoundInt64ToFloat64) { |
5375 BufferedRawMachineAssemblerTester<double> m(kMachInt64); | 5395 BufferedRawMachineAssemblerTester<double> m(kMachInt64); |
5376 m.Return(m.RoundInt64ToFloat64(m.Parameter(0))); | 5396 m.Return(m.RoundInt64ToFloat64(m.Parameter(0))); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5635 Node* call = r.AddNode(r.common()->Call(desc), phi); | 5655 Node* call = r.AddNode(r.common()->Call(desc), phi); |
5636 r.Return(call); | 5656 r.Return(call); |
5637 | 5657 |
5638 CHECK_EQ(33, r.Call(1)); | 5658 CHECK_EQ(33, r.Call(1)); |
5639 CHECK_EQ(44, r.Call(0)); | 5659 CHECK_EQ(44, r.Call(0)); |
5640 } | 5660 } |
5641 | 5661 |
5642 } // namespace compiler | 5662 } // namespace compiler |
5643 } // namespace internal | 5663 } // namespace internal |
5644 } // namespace v8 | 5664 } // namespace v8 |
OLD | NEW |