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 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1765 Reduction const r = | 1765 Reduction const r = |
1766 Reduce(graph()->NewNode(machine()->Float64Log1p(), Float64Constant(x))); | 1766 Reduce(graph()->NewNode(machine()->Float64Log1p(), Float64Constant(x))); |
1767 ASSERT_TRUE(r.Changed()); | 1767 ASSERT_TRUE(r.Changed()); |
1768 EXPECT_THAT( | 1768 EXPECT_THAT( |
1769 r.replacement(), | 1769 r.replacement(), |
1770 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::log1p(x)))); | 1770 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::log1p(x)))); |
1771 } | 1771 } |
1772 } | 1772 } |
1773 | 1773 |
1774 // ----------------------------------------------------------------------------- | 1774 // ----------------------------------------------------------------------------- |
1775 // Float64Pow | |
1776 | |
1777 TEST_F(MachineOperatorReducerTest, Float64PowWithConstant) { | |
1778 TRACED_FOREACH(double, x, kFloat64Values) { | |
1779 TRACED_FOREACH(double, y, kFloat64Values) { | |
1780 Reduction const r = Reduce(graph()->NewNode( | |
1781 machine()->Float64Pow(), Float64Constant(x), Float64Constant(y))); | |
1782 ASSERT_TRUE(r.Changed()); | |
1783 EXPECT_THAT(r.replacement(), | |
1784 IsFloat64Constant(NanSensitiveDoubleEq(Pow(x, y)))); | |
1785 } | |
1786 } | |
1787 } | |
1788 | |
ahaas
2016/09/12 10:45:23
Nit: could you add a test for x ** +-0.0 => 1.0?
Benedikt Meurer
2016/09/12 10:52:03
Done.
| |
1789 // ----------------------------------------------------------------------------- | |
1775 // Float64Sin | 1790 // Float64Sin |
1776 | 1791 |
1777 TEST_F(MachineOperatorReducerTest, Float64SinWithConstant) { | 1792 TEST_F(MachineOperatorReducerTest, Float64SinWithConstant) { |
1778 TRACED_FOREACH(double, x, kFloat64Values) { | 1793 TRACED_FOREACH(double, x, kFloat64Values) { |
1779 Reduction const r = | 1794 Reduction const r = |
1780 Reduce(graph()->NewNode(machine()->Float64Sin(), Float64Constant(x))); | 1795 Reduce(graph()->NewNode(machine()->Float64Sin(), Float64Constant(x))); |
1781 ASSERT_TRUE(r.Changed()); | 1796 ASSERT_TRUE(r.Changed()); |
1782 EXPECT_THAT(r.replacement(), | 1797 EXPECT_THAT(r.replacement(), |
1783 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::sin(x)))); | 1798 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::sin(x)))); |
1784 } | 1799 } |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2069 Reduction r = Reduce(node); | 2084 Reduction r = Reduce(node); |
2070 ASSERT_TRUE(r.Changed()); | 2085 ASSERT_TRUE(r.Changed()); |
2071 EXPECT_THAT(r.replacement(), | 2086 EXPECT_THAT(r.replacement(), |
2072 IsStore(rep, base, index, value, effect, control)); | 2087 IsStore(rep, base, index, value, effect, control)); |
2073 } | 2088 } |
2074 } | 2089 } |
2075 | 2090 |
2076 } // namespace compiler | 2091 } // namespace compiler |
2077 } // namespace internal | 2092 } // namespace internal |
2078 } // namespace v8 | 2093 } // namespace v8 |
OLD | NEW |