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 <cmath> | 5 #include <cmath> |
6 #include <functional> | 6 #include <functional> |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/utils/random-number-generator.h" | 10 #include "src/base/utils/random-number-generator.h" |
(...skipping 4822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4833 {9.6714157802890681e+24, -2147483648.0}, | 4833 {9.6714157802890681e+24, -2147483648.0}, |
4834 {-9.6714157802890681e+24, -2147483648.0}, | 4834 {-9.6714157802890681e+24, -2147483648.0}, |
4835 {1.9342813113834065e+25, 2147483648.0}, | 4835 {1.9342813113834065e+25, 2147483648.0}, |
4836 {-1.9342813113834065e+25, 2147483648.0}, | 4836 {-1.9342813113834065e+25, 2147483648.0}, |
4837 {3.868562622766813e+25, 0}, | 4837 {3.868562622766813e+25, 0}, |
4838 {-3.868562622766813e+25, 0}, | 4838 {-3.868562622766813e+25, 0}, |
4839 {1.7976931348623157e+308, 0}, | 4839 {1.7976931348623157e+308, 0}, |
4840 {-1.7976931348623157e+308, 0}}; | 4840 {-1.7976931348623157e+308, 0}}; |
4841 double input = -1.0; | 4841 double input = -1.0; |
4842 RawMachineAssemblerTester<int32_t> m; | 4842 RawMachineAssemblerTester<int32_t> m; |
4843 m.Return(m.TruncateFloat64ToInt32(m.LoadFromPointer(&input, kMachFloat64))); | 4843 m.Return(m.TruncateFloat64ToInt32(TruncationMode::kJavaScript, |
| 4844 m.LoadFromPointer(&input, kMachFloat64))); |
4844 for (size_t i = 0; i < arraysize(kValues); ++i) { | 4845 for (size_t i = 0; i < arraysize(kValues); ++i) { |
4845 input = kValues[i].from; | 4846 input = kValues[i].from; |
4846 uint64_t expected = static_cast<int64_t>(kValues[i].raw); | 4847 uint64_t expected = static_cast<int64_t>(kValues[i].raw); |
4847 CHECK_EQ(static_cast<int>(expected), m.Call()); | 4848 CHECK_EQ(static_cast<int>(expected), m.Call()); |
4848 } | 4849 } |
4849 } | 4850 } |
4850 | 4851 |
4851 | 4852 |
4852 TEST(RunChangeFloat32ToFloat64) { | 4853 TEST(RunChangeFloat32ToFloat64) { |
4853 double actual = 0.0f; | 4854 double actual = 0.0f; |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5268 param, param, param, param)); | 5269 param, param, param, param)); |
5269 FOR_INT32_INPUTS(i) { | 5270 FOR_INT32_INPUTS(i) { |
5270 int32_t const x = *i; | 5271 int32_t const x = *i; |
5271 CHECK_EQ(x * 8, m.Call(x)); | 5272 CHECK_EQ(x * 8, m.Call(x)); |
5272 } | 5273 } |
5273 } | 5274 } |
5274 | 5275 |
5275 #endif // USE_SIMULATOR | 5276 #endif // USE_SIMULATOR |
5276 | 5277 |
5277 #endif // V8_TURBOFAN_TARGET | 5278 #endif // V8_TURBOFAN_TARGET |
OLD | NEW |