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 5158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5169 | 5169 |
5170 TEST(RunFloat64RoundUp) { | 5170 TEST(RunFloat64RoundUp) { |
5171 BufferedRawMachineAssemblerTester<double> m(kMachFloat64); | 5171 BufferedRawMachineAssemblerTester<double> m(kMachFloat64); |
5172 if (!m.machine()->Float64RoundUp().IsSupported()) return; | 5172 if (!m.machine()->Float64RoundUp().IsSupported()) return; |
5173 m.Return(m.Float64RoundUp(m.Parameter(0))); | 5173 m.Return(m.Float64RoundUp(m.Parameter(0))); |
5174 | 5174 |
5175 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(std::ceil(*i), m.Call(*i)); } | 5175 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(std::ceil(*i), m.Call(*i)); } |
5176 } | 5176 } |
5177 | 5177 |
5178 | 5178 |
| 5179 TEST(RunFloat64RoundTiesEven) { |
| 5180 BufferedRawMachineAssemblerTester<double> m(kMachFloat64); |
| 5181 if (!m.machine()->Float64RoundTiesEven().IsSupported()) return; |
| 5182 m.Return(m.Float64RoundTiesEven(m.Parameter(0))); |
| 5183 |
| 5184 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(nearbyint(*i), m.Call(*i)); } |
| 5185 } |
| 5186 |
| 5187 |
5179 TEST(RunFloat64RoundTruncate) { | 5188 TEST(RunFloat64RoundTruncate) { |
5180 BufferedRawMachineAssemblerTester<double> m(kMachFloat64); | 5189 BufferedRawMachineAssemblerTester<double> m(kMachFloat64); |
5181 if (!m.machine()->Float64RoundTruncate().IsSupported()) return; | 5190 if (!m.machine()->Float64RoundTruncate().IsSupported()) return; |
5182 m.Return(m.Float64RoundTruncate(m.Parameter(0))); | 5191 m.Return(m.Float64RoundTruncate(m.Parameter(0))); |
5183 for (size_t i = 0; i < arraysize(kValues); ++i) { | 5192 for (size_t i = 0; i < arraysize(kValues); ++i) { |
5184 CHECK_EQ(trunc(kValues[i]), m.Call(kValues[i])); | 5193 CHECK_EQ(trunc(kValues[i]), m.Call(kValues[i])); |
5185 } | 5194 } |
5186 } | 5195 } |
5187 | 5196 |
5188 | 5197 |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5604 Node* call = r.AddNode(r.common()->Call(desc), phi); | 5613 Node* call = r.AddNode(r.common()->Call(desc), phi); |
5605 r.Return(call); | 5614 r.Return(call); |
5606 | 5615 |
5607 CHECK_EQ(33, r.Call(1)); | 5616 CHECK_EQ(33, r.Call(1)); |
5608 CHECK_EQ(44, r.Call(0)); | 5617 CHECK_EQ(44, r.Call(0)); |
5609 } | 5618 } |
5610 | 5619 |
5611 } // namespace compiler | 5620 } // namespace compiler |
5612 } // namespace internal | 5621 } // namespace internal |
5613 } // namespace v8 | 5622 } // namespace v8 |
OLD | NEW |