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 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 TRACED_FOREACH(double, x, kFloat64Values) { | 1407 TRACED_FOREACH(double, x, kFloat64Values) { |
1408 Reduction const r = | 1408 Reduction const r = |
1409 Reduce(graph()->NewNode(machine()->Float64Log(), Float64Constant(x))); | 1409 Reduce(graph()->NewNode(machine()->Float64Log(), Float64Constant(x))); |
1410 ASSERT_TRUE(r.Changed()); | 1410 ASSERT_TRUE(r.Changed()); |
1411 EXPECT_THAT(r.replacement(), | 1411 EXPECT_THAT(r.replacement(), |
1412 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::log(x)))); | 1412 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::log(x)))); |
1413 } | 1413 } |
1414 } | 1414 } |
1415 | 1415 |
1416 // ----------------------------------------------------------------------------- | 1416 // ----------------------------------------------------------------------------- |
| 1417 // Float64Log1p |
| 1418 |
| 1419 TEST_F(MachineOperatorReducerTest, Float64Log1pWithConstant) { |
| 1420 TRACED_FOREACH(double, x, kFloat64Values) { |
| 1421 Reduction const r = |
| 1422 Reduce(graph()->NewNode(machine()->Float64Log1p(), Float64Constant(x))); |
| 1423 ASSERT_TRUE(r.Changed()); |
| 1424 EXPECT_THAT( |
| 1425 r.replacement(), |
| 1426 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::log1p(x)))); |
| 1427 } |
| 1428 } |
| 1429 |
| 1430 // ----------------------------------------------------------------------------- |
1417 // Float64InsertLowWord32 | 1431 // Float64InsertLowWord32 |
1418 | 1432 |
1419 TEST_F(MachineOperatorReducerTest, Float64InsertLowWord32WithConstant) { | 1433 TEST_F(MachineOperatorReducerTest, Float64InsertLowWord32WithConstant) { |
1420 TRACED_FOREACH(double, x, kFloat64Values) { | 1434 TRACED_FOREACH(double, x, kFloat64Values) { |
1421 TRACED_FOREACH(uint32_t, y, kUint32Values) { | 1435 TRACED_FOREACH(uint32_t, y, kUint32Values) { |
1422 Reduction const r = | 1436 Reduction const r = |
1423 Reduce(graph()->NewNode(machine()->Float64InsertLowWord32(), | 1437 Reduce(graph()->NewNode(machine()->Float64InsertLowWord32(), |
1424 Float64Constant(x), Uint32Constant(y))); | 1438 Float64Constant(x), Uint32Constant(y))); |
1425 ASSERT_TRUE(r.Changed()); | 1439 ASSERT_TRUE(r.Changed()); |
1426 EXPECT_THAT( | 1440 EXPECT_THAT( |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 Reduction r = Reduce(node); | 1671 Reduction r = Reduce(node); |
1658 ASSERT_TRUE(r.Changed()); | 1672 ASSERT_TRUE(r.Changed()); |
1659 EXPECT_THAT(r.replacement(), | 1673 EXPECT_THAT(r.replacement(), |
1660 IsStore(rep, base, index, value, effect, control)); | 1674 IsStore(rep, base, index, value, effect, control)); |
1661 } | 1675 } |
1662 } | 1676 } |
1663 | 1677 |
1664 } // namespace compiler | 1678 } // namespace compiler |
1665 } // namespace internal | 1679 } // namespace internal |
1666 } // namespace v8 | 1680 } // namespace v8 |
OLD | NEW |