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 5499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5510 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(), | 5510 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(), |
5511 MachineType::Float64()); | 5511 MachineType::Float64()); |
5512 m.Return(m.Float64Atan2(m.Parameter(0), m.Parameter(1))); | 5512 m.Return(m.Float64Atan2(m.Parameter(0), m.Parameter(1))); |
5513 FOR_FLOAT64_INPUTS(i) { | 5513 FOR_FLOAT64_INPUTS(i) { |
5514 FOR_FLOAT64_INPUTS(j) { | 5514 FOR_FLOAT64_INPUTS(j) { |
5515 CHECK_DOUBLE_EQ(ieee754::atan2(*i, *j), m.Call(*i, *j)); | 5515 CHECK_DOUBLE_EQ(ieee754::atan2(*i, *j), m.Call(*i, *j)); |
5516 } | 5516 } |
5517 } | 5517 } |
5518 } | 5518 } |
5519 | 5519 |
5520 TEST(RunFloat64Exp) { | |
5521 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); | |
5522 m.Return(m.Float64Exp(m.Parameter(0))); | |
5523 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); | |
5524 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); | |
5525 CHECK_EQ(0.0, m.Call(-std::numeric_limits<double>::infinity())); | |
5526 CHECK_DOUBLE_EQ(1.0, m.Call(-0.0)); | |
5527 CHECK_DOUBLE_EQ(1.0, m.Call(0.0)); | |
5528 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), | |
5529 m.Call(std::numeric_limits<double>::infinity())); | |
5530 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::exp(*i), m.Call(*i)); } | |
5531 } | |
5532 | |
5533 TEST(RunFloat64Log) { | 5520 TEST(RunFloat64Log) { |
5534 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); | 5521 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); |
5535 m.Return(m.Float64Log(m.Parameter(0))); | 5522 m.Return(m.Float64Log(m.Parameter(0))); |
5536 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); | 5523 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); |
5537 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); | 5524 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); |
5538 CHECK(std::isnan(m.Call(-std::numeric_limits<double>::infinity()))); | 5525 CHECK(std::isnan(m.Call(-std::numeric_limits<double>::infinity()))); |
5539 CHECK(std::isnan(m.Call(-1.0))); | 5526 CHECK(std::isnan(m.Call(-1.0))); |
5540 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)); |
5541 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)); |
5542 CHECK_DOUBLE_EQ(0.0, m.Call(1.0)); | 5529 CHECK_DOUBLE_EQ(0.0, m.Call(1.0)); |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6350 r.Goto(&merge); | 6337 r.Goto(&merge); |
6351 r.Bind(&merge); | 6338 r.Bind(&merge); |
6352 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); | 6339 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); |
6353 r.Return(phi); | 6340 r.Return(phi); |
6354 CHECK_EQ(1, r.Call(1)); | 6341 CHECK_EQ(1, r.Call(1)); |
6355 } | 6342 } |
6356 | 6343 |
6357 } // namespace compiler | 6344 } // namespace compiler |
6358 } // namespace internal | 6345 } // namespace internal |
6359 } // namespace v8 | 6346 } // namespace v8 |
OLD | NEW |