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/base/bits.h" | 5 #include "src/base/bits.h" |
6 #include "src/base/division-by-constant.h" | 6 #include "src/base/division-by-constant.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/machine-operator-reducer.h" | 8 #include "src/compiler/machine-operator-reducer.h" |
9 #include "src/compiler/typer.h" | 9 #include "src/compiler/typer.h" |
10 #include "test/unittests/compiler/graph-unittest.h" | 10 #include "test/unittests/compiler/graph-unittest.h" |
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 Reduction r = Reduce( | 1429 Reduction r = Reduce( |
1430 graph()->NewNode(machine()->Float64Mul(), Float64Constant(-1.0), p0)); | 1430 graph()->NewNode(machine()->Float64Mul(), Float64Constant(-1.0), p0)); |
1431 ASSERT_TRUE(r.Changed()); | 1431 ASSERT_TRUE(r.Changed()); |
1432 EXPECT_THAT(r.replacement(), | 1432 EXPECT_THAT(r.replacement(), |
1433 IsFloat64Sub(IsFloat64Constant(BitEq(-0.0)), p0)); | 1433 IsFloat64Sub(IsFloat64Constant(BitEq(-0.0)), p0)); |
1434 } | 1434 } |
1435 } | 1435 } |
1436 | 1436 |
1437 | 1437 |
1438 // ----------------------------------------------------------------------------- | 1438 // ----------------------------------------------------------------------------- |
| 1439 // Float64InsertWord32 |
| 1440 |
| 1441 |
| 1442 TEST_F(MachineOperatorReducerTest, Float64InsertWord32WithConstant) { |
| 1443 TRACED_FOREACH(double, x, kFloat64Values) { |
| 1444 TRACED_FOREACH(uint32_t, y, kUint32Values) { |
| 1445 TRACED_FORRANGE(int, location, 0, 1) { |
| 1446 Reduction const r = |
| 1447 Reduce(graph()->NewNode(machine()->Float64InsertWord32(location), |
| 1448 Float64Constant(x), Uint32Constant(y))); |
| 1449 ASSERT_TRUE(r.Changed()); |
| 1450 EXPECT_THAT(r.replacement(), |
| 1451 IsFloat64Constant( |
| 1452 BitEq(bit_cast<double>(base::bits::InsertElement64( |
| 1453 bit_cast<uint64_t>(x), y, location))))); |
| 1454 } |
| 1455 } |
| 1456 } |
| 1457 } |
| 1458 |
| 1459 |
| 1460 // ----------------------------------------------------------------------------- |
1439 // Store | 1461 // Store |
1440 | 1462 |
1441 | 1463 |
1442 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { | 1464 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { |
1443 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier); | 1465 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier); |
1444 Node* const base = Parameter(0); | 1466 Node* const base = Parameter(0); |
1445 Node* const index = Parameter(1); | 1467 Node* const index = Parameter(1); |
1446 Node* const value = Parameter(2); | 1468 Node* const value = Parameter(2); |
1447 Node* const effect = graph()->start(); | 1469 Node* const effect = graph()->start(); |
1448 Node* const control = graph()->start(); | 1470 Node* const control = graph()->start(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 Reduction r = Reduce(node); | 1548 Reduction r = Reduce(node); |
1527 ASSERT_TRUE(r.Changed()); | 1549 ASSERT_TRUE(r.Changed()); |
1528 EXPECT_THAT(r.replacement(), | 1550 EXPECT_THAT(r.replacement(), |
1529 IsStore(rep, base, index, value, effect, control)); | 1551 IsStore(rep, base, index, value, effect, control)); |
1530 } | 1552 } |
1531 } | 1553 } |
1532 | 1554 |
1533 } // namespace compiler | 1555 } // namespace compiler |
1534 } // namespace internal | 1556 } // namespace internal |
1535 } // namespace v8 | 1557 } // namespace v8 |
OLD | NEW |