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 #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/ieee754.h" | 10 #include "src/base/ieee754.h" |
(...skipping 5478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5489 FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(std::abs(*i), m.Call(*i)); } | 5489 FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(std::abs(*i), m.Call(*i)); } |
5490 } | 5490 } |
5491 | 5491 |
5492 | 5492 |
5493 TEST(RunFloat64Abs) { | 5493 TEST(RunFloat64Abs) { |
5494 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); | 5494 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); |
5495 m.Return(m.Float64Abs(m.Parameter(0))); | 5495 m.Return(m.Float64Abs(m.Parameter(0))); |
5496 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(std::abs(*i), m.Call(*i)); } | 5496 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(std::abs(*i), m.Call(*i)); } |
5497 } | 5497 } |
5498 | 5498 |
| 5499 TEST(RunFloat64Atan) { |
| 5500 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); |
| 5501 m.Return(m.Float64Atan(m.Parameter(0))); |
| 5502 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); |
| 5503 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); |
| 5504 CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0)); |
| 5505 CHECK_DOUBLE_EQ(0.0, m.Call(0.0)); |
| 5506 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::atan(*i), m.Call(*i)); } |
| 5507 } |
| 5508 |
| 5509 TEST(RunFloat64Atan2) { |
| 5510 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(), |
| 5511 MachineType::Float64()); |
| 5512 m.Return(m.Float64Atan2(m.Parameter(0), m.Parameter(1))); |
| 5513 FOR_FLOAT64_INPUTS(i) { |
| 5514 FOR_FLOAT64_INPUTS(j) { |
| 5515 CHECK_DOUBLE_EQ(ieee754::atan2(*i, *j), m.Call(*i, *j)); |
| 5516 } |
| 5517 } |
| 5518 } |
| 5519 |
5499 TEST(RunFloat64Log) { | 5520 TEST(RunFloat64Log) { |
5500 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); | 5521 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); |
5501 m.Return(m.Float64Log(m.Parameter(0))); | 5522 m.Return(m.Float64Log(m.Parameter(0))); |
5502 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); | 5523 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); |
5503 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); | 5524 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); |
5504 CHECK(std::isnan(m.Call(-std::numeric_limits<double>::infinity()))); | 5525 CHECK(std::isnan(m.Call(-std::numeric_limits<double>::infinity()))); |
5505 CHECK(std::isnan(m.Call(-1.0))); | 5526 CHECK(std::isnan(m.Call(-1.0))); |
5506 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-0.0)); | 5527 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-0.0)); |
5507 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(0.0)); | 5528 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(0.0)); |
5508 CHECK_DOUBLE_EQ(0.0, m.Call(1.0)); | 5529 CHECK_DOUBLE_EQ(0.0, m.Call(1.0)); |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6287 r.Goto(&merge); | 6308 r.Goto(&merge); |
6288 r.Bind(&merge); | 6309 r.Bind(&merge); |
6289 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); | 6310 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); |
6290 r.Return(phi); | 6311 r.Return(phi); |
6291 CHECK_EQ(1, r.Call(1)); | 6312 CHECK_EQ(1, r.Call(1)); |
6292 } | 6313 } |
6293 | 6314 |
6294 } // namespace compiler | 6315 } // namespace compiler |
6295 } // namespace internal | 6316 } // namespace internal |
6296 } // namespace v8 | 6317 } // namespace v8 |
OLD | NEW |