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 "src/compiler/machine-operator-reducer.h" | 5 #include "src/compiler/machine-operator-reducer.h" |
6 #include "src/base/bits.h" | 6 #include "src/base/bits.h" |
7 #include "src/base/division-by-constant.h" | 7 #include "src/base/division-by-constant.h" |
8 #include "src/base/ieee754.h" | 8 #include "src/base/ieee754.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/typer.h" | 10 #include "src/compiler/typer.h" |
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 } | 1441 } |
1442 { | 1442 { |
1443 Reduction const r = | 1443 Reduction const r = |
1444 Reduce(graph()->NewNode(machine()->Float64Atan2(), nan, p0)); | 1444 Reduce(graph()->NewNode(machine()->Float64Atan2(), nan, p0)); |
1445 ASSERT_TRUE(r.Changed()); | 1445 ASSERT_TRUE(r.Changed()); |
1446 EXPECT_EQ(nan, r.replacement()); | 1446 EXPECT_EQ(nan, r.replacement()); |
1447 } | 1447 } |
1448 } | 1448 } |
1449 | 1449 |
1450 // ----------------------------------------------------------------------------- | 1450 // ----------------------------------------------------------------------------- |
| 1451 // Float64Exp |
| 1452 |
| 1453 TEST_F(MachineOperatorReducerTest, Float64ExpWithConstant) { |
| 1454 TRACED_FOREACH(double, x, kFloat64Values) { |
| 1455 Reduction const r = |
| 1456 Reduce(graph()->NewNode(machine()->Float64Exp(), Float64Constant(x))); |
| 1457 ASSERT_TRUE(r.Changed()); |
| 1458 EXPECT_THAT(r.replacement(), |
| 1459 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::exp(x)))); |
| 1460 } |
| 1461 } |
| 1462 |
| 1463 // ----------------------------------------------------------------------------- |
1451 // Float64Log | 1464 // Float64Log |
1452 | 1465 |
1453 TEST_F(MachineOperatorReducerTest, Float64LogWithConstant) { | 1466 TEST_F(MachineOperatorReducerTest, Float64LogWithConstant) { |
1454 TRACED_FOREACH(double, x, kFloat64Values) { | 1467 TRACED_FOREACH(double, x, kFloat64Values) { |
1455 Reduction const r = | 1468 Reduction const r = |
1456 Reduce(graph()->NewNode(machine()->Float64Log(), Float64Constant(x))); | 1469 Reduce(graph()->NewNode(machine()->Float64Log(), Float64Constant(x))); |
1457 ASSERT_TRUE(r.Changed()); | 1470 ASSERT_TRUE(r.Changed()); |
1458 EXPECT_THAT(r.replacement(), | 1471 EXPECT_THAT(r.replacement(), |
1459 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::log(x)))); | 1472 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::log(x)))); |
1460 } | 1473 } |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 Reduction r = Reduce(node); | 1731 Reduction r = Reduce(node); |
1719 ASSERT_TRUE(r.Changed()); | 1732 ASSERT_TRUE(r.Changed()); |
1720 EXPECT_THAT(r.replacement(), | 1733 EXPECT_THAT(r.replacement(), |
1721 IsStore(rep, base, index, value, effect, control)); | 1734 IsStore(rep, base, index, value, effect, control)); |
1722 } | 1735 } |
1723 } | 1736 } |
1724 | 1737 |
1725 } // namespace compiler | 1738 } // namespace compiler |
1726 } // namespace internal | 1739 } // namespace internal |
1727 } // namespace v8 | 1740 } // namespace v8 |
OLD | NEW |