Chromium Code Reviews| 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 5126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5137 -two_52, | 5137 -two_52, |
| 5138 -two_52 - 0.1, | 5138 -two_52 - 0.1, |
| 5139 -two_52 - 0.5, | 5139 -two_52 - 0.5, |
| 5140 -two_52 - 0.7, | 5140 -two_52 - 0.7, |
| 5141 -two_52 + 1, | 5141 -two_52 + 1, |
| 5142 -two_52 + 1 - 0.1, | 5142 -two_52 + 1 - 0.1, |
| 5143 -two_52 + 1 - 0.5, | 5143 -two_52 + 1 - 0.5, |
| 5144 -two_52 + 1 - 0.7}; | 5144 -two_52 + 1 - 0.7}; |
| 5145 | 5145 |
| 5146 | 5146 |
| 5147 TEST(RunFloat32RoundDown) { | |
| 5148 BufferedRawMachineAssemblerTester<float> m(kMachFloat32); | |
| 5149 if (!m.machine()->Float32RoundDown().IsSupported()) return; | |
| 5150 | |
| 5151 m.Return(m.Float32RoundDown(m.Parameter(0))); | |
| 5152 | |
| 5153 FOR_FLOAT32_INPUTS(i) { CheckFloatEq(floorf(*i), m.Call(*i)); } | |
|
jbramley
2015/11/25 10:46:16
Again, why not std::floor?
| |
| 5154 } | |
| 5155 | |
| 5156 | |
| 5147 TEST(RunFloat64RoundDown1) { | 5157 TEST(RunFloat64RoundDown1) { |
| 5148 BufferedRawMachineAssemblerTester<double> m(kMachFloat64); | 5158 BufferedRawMachineAssemblerTester<double> m(kMachFloat64); |
| 5149 if (!m.machine()->Float64RoundDown().IsSupported()) return; | 5159 if (!m.machine()->Float64RoundDown().IsSupported()) return; |
| 5150 | 5160 |
| 5151 m.Return(m.Float64RoundDown(m.Parameter(0))); | 5161 m.Return(m.Float64RoundDown(m.Parameter(0))); |
| 5152 | 5162 |
| 5153 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(std::floor(*i), m.Call(*i)); } | 5163 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(std::floor(*i), m.Call(*i)); } |
| 5154 } | 5164 } |
| 5155 | 5165 |
| 5156 | 5166 |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5655 Node* call = r.AddNode(r.common()->Call(desc), phi); | 5665 Node* call = r.AddNode(r.common()->Call(desc), phi); |
| 5656 r.Return(call); | 5666 r.Return(call); |
| 5657 | 5667 |
| 5658 CHECK_EQ(33, r.Call(1)); | 5668 CHECK_EQ(33, r.Call(1)); |
| 5659 CHECK_EQ(44, r.Call(0)); | 5669 CHECK_EQ(44, r.Call(0)); |
| 5660 } | 5670 } |
| 5661 | 5671 |
| 5662 } // namespace compiler | 5672 } // namespace compiler |
| 5663 } // namespace internal | 5673 } // namespace internal |
| 5664 } // namespace v8 | 5674 } // namespace v8 |
| OLD | NEW |