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 5354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5365 | 5365 |
5366 | 5366 |
5367 TEST(RunBitcastFloat64ToInt64) { | 5367 TEST(RunBitcastFloat64ToInt64) { |
5368 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64); | 5368 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64); |
5369 | 5369 |
5370 m.Return(m.BitcastFloat64ToInt64(m.Parameter(0))); | 5370 m.Return(m.BitcastFloat64ToInt64(m.Parameter(0))); |
5371 FOR_FLOAT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(*i), m.Call(*i)); } | 5371 FOR_FLOAT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(*i), m.Call(*i)); } |
5372 } | 5372 } |
5373 | 5373 |
5374 | 5374 |
5375 TEST(RunTruncateFloat32ToInt64) { | |
5376 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat32); | |
5377 m.Return(m.TruncateFloat32ToInt64(m.Parameter(0))); | |
5378 | |
5379 FOR_INT64_INPUTS(i) { | |
5380 float input = static_cast<float>(*i); | |
5381 if (input < 9223372036854775808.0 && input > -9223372036854775809.0) { | |
5382 CHECK_EQ(static_cast<int64_t>(input), m.Call(input)); | |
5383 } | |
5384 } | |
5385 FOR_FLOAT32_INPUTS(j) { | |
5386 if (*j < 9223372036854775808.0 && *j > -9223372036854775809.0) { | |
5387 CHECK_EQ(static_cast<int64_t>(*j), m.Call(*j)); | |
5388 } | |
5389 } | |
5390 } | |
5391 | |
5392 | |
5393 TEST(RunTruncateFloat64ToInt64) { | 5375 TEST(RunTruncateFloat64ToInt64) { |
5394 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64); | 5376 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64); |
5395 m.Return(m.TruncateFloat64ToInt64(m.Parameter(0))); | 5377 m.Return(m.TruncateFloat64ToInt64(m.Parameter(0))); |
5396 | 5378 |
5397 FOR_INT64_INPUTS(i) { | 5379 FOR_INT64_INPUTS(i) { |
5398 double input = static_cast<double>(*i); | 5380 double input = static_cast<double>(*i); |
5399 CHECK_EQ(static_cast<int64_t>(input), m.Call(input)); | 5381 CHECK_EQ(static_cast<int64_t>(input), m.Call(input)); |
5400 } | 5382 } |
5401 } | 5383 } |
5402 | 5384 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5692 Node* call = r.AddNode(r.common()->Call(desc), phi); | 5674 Node* call = r.AddNode(r.common()->Call(desc), phi); |
5693 r.Return(call); | 5675 r.Return(call); |
5694 | 5676 |
5695 CHECK_EQ(33, r.Call(1)); | 5677 CHECK_EQ(33, r.Call(1)); |
5696 CHECK_EQ(44, r.Call(0)); | 5678 CHECK_EQ(44, r.Call(0)); |
5697 } | 5679 } |
5698 | 5680 |
5699 } // namespace compiler | 5681 } // namespace compiler |
5700 } // namespace internal | 5682 } // namespace internal |
5701 } // namespace v8 | 5683 } // namespace v8 |
OLD | NEW |