| 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 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1587 } | 1587 } |
| 1588 { | 1588 { |
| 1589 Reduction r = Reduce( | 1589 Reduction r = Reduce( |
| 1590 graph()->NewNode(machine()->Float64Mul(), Float64Constant(-1.0), p0)); | 1590 graph()->NewNode(machine()->Float64Mul(), Float64Constant(-1.0), p0)); |
| 1591 ASSERT_TRUE(r.Changed()); | 1591 ASSERT_TRUE(r.Changed()); |
| 1592 EXPECT_THAT(r.replacement(), | 1592 EXPECT_THAT(r.replacement(), |
| 1593 IsFloat64Sub(IsFloat64Constant(BitEq(-0.0)), p0)); | 1593 IsFloat64Sub(IsFloat64Constant(BitEq(-0.0)), p0)); |
| 1594 } | 1594 } |
| 1595 } | 1595 } |
| 1596 | 1596 |
| 1597 TEST_F(MachineOperatorReducerTest, Float64SubMinusZeroMinusX) { |
| 1598 Node* const p0 = Parameter(0); |
| 1599 { |
| 1600 Reduction r = Reduce( |
| 1601 graph()->NewNode(machine()->Float64Sub(), Float64Constant(-0.0), p0)); |
| 1602 ASSERT_TRUE(r.Changed()); |
| 1603 EXPECT_THAT(r.replacement(), IsFloat64Neg(p0)); |
| 1604 } |
| 1605 } |
| 1606 |
| 1607 TEST_F(MachineOperatorReducerTest, Float32SubMinusZeroMinusX) { |
| 1608 Node* const p0 = Parameter(0); |
| 1609 { |
| 1610 Reduction r = Reduce( |
| 1611 graph()->NewNode(machine()->Float32Sub(), Float32Constant(-0.0), p0)); |
| 1612 ASSERT_TRUE(r.Changed()); |
| 1613 EXPECT_THAT(r.replacement(), IsFloat32Neg(p0)); |
| 1614 } |
| 1615 } |
| 1616 |
| 1597 // ----------------------------------------------------------------------------- | 1617 // ----------------------------------------------------------------------------- |
| 1598 // Float64Acos | 1618 // Float64Acos |
| 1599 | 1619 |
| 1600 TEST_F(MachineOperatorReducerTest, Float64AcosWithConstant) { | 1620 TEST_F(MachineOperatorReducerTest, Float64AcosWithConstant) { |
| 1601 TRACED_FOREACH(double, x, kFloat64Values) { | 1621 TRACED_FOREACH(double, x, kFloat64Values) { |
| 1602 Reduction const r = | 1622 Reduction const r = |
| 1603 Reduce(graph()->NewNode(machine()->Float64Acos(), Float64Constant(x))); | 1623 Reduce(graph()->NewNode(machine()->Float64Acos(), Float64Constant(x))); |
| 1604 ASSERT_TRUE(r.Changed()); | 1624 ASSERT_TRUE(r.Changed()); |
| 1605 EXPECT_THAT( | 1625 EXPECT_THAT( |
| 1606 r.replacement(), | 1626 r.replacement(), |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2076 Reduction r = Reduce(node); | 2096 Reduction r = Reduce(node); |
| 2077 ASSERT_TRUE(r.Changed()); | 2097 ASSERT_TRUE(r.Changed()); |
| 2078 EXPECT_THAT(r.replacement(), | 2098 EXPECT_THAT(r.replacement(), |
| 2079 IsStore(rep, base, index, value, effect, control)); | 2099 IsStore(rep, base, index, value, effect, control)); |
| 2080 } | 2100 } |
| 2081 } | 2101 } |
| 2082 | 2102 |
| 2083 } // namespace compiler | 2103 } // namespace compiler |
| 2084 } // namespace internal | 2104 } // namespace internal |
| 2085 } // namespace v8 | 2105 } // namespace v8 |
| OLD | NEW |