Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: test/unittests/compiler/machine-operator-reducer-unittest.cc

Issue 1333353005: [turbofan] Limit the load/store machine types to the ones we actually use. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "src/conversions-inl.h" 10 #include "src/conversions-inl.h"
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 ASSERT_TRUE(r.Changed()); 1485 ASSERT_TRUE(r.Changed());
1486 EXPECT_THAT(r.replacement(), IsFloat32LessThanOrEqual(p0, p1)); 1486 EXPECT_THAT(r.replacement(), IsFloat32LessThanOrEqual(p0, p1));
1487 } 1487 }
1488 1488
1489 1489
1490 // ----------------------------------------------------------------------------- 1490 // -----------------------------------------------------------------------------
1491 // Store 1491 // Store
1492 1492
1493 1493
1494 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { 1494 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) {
1495 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier); 1495 const StoreRepresentation rep(kMachUint8, kNoWriteBarrier);
1496 Node* const base = Parameter(0); 1496 Node* const base = Parameter(0);
1497 Node* const index = Parameter(1); 1497 Node* const index = Parameter(1);
1498 Node* const value = Parameter(2); 1498 Node* const value = Parameter(2);
1499 Node* const effect = graph()->start(); 1499 Node* const effect = graph()->start();
1500 Node* const control = graph()->start(); 1500 Node* const control = graph()->start();
1501 TRACED_FOREACH(uint32_t, x, kUint32Values) { 1501 TRACED_FOREACH(uint32_t, x, kUint32Values) {
1502 Node* const node = 1502 Node* const node =
1503 graph()->NewNode(machine()->Store(rep), base, index, 1503 graph()->NewNode(machine()->Store(rep), base, index,
1504 graph()->NewNode(machine()->Word32And(), value, 1504 graph()->NewNode(machine()->Word32And(), value,
1505 Uint32Constant(x | 0xffu)), 1505 Uint32Constant(x | 0xffu)),
1506 effect, control); 1506 effect, control);
1507 1507
1508 Reduction r = Reduce(node); 1508 Reduction r = Reduce(node);
1509 ASSERT_TRUE(r.Changed()); 1509 ASSERT_TRUE(r.Changed());
1510 EXPECT_THAT(r.replacement(), 1510 EXPECT_THAT(r.replacement(),
1511 IsStore(rep, base, index, value, effect, control)); 1511 IsStore(rep, base, index, value, effect, control));
1512 } 1512 }
1513 } 1513 }
1514 1514
1515 1515
1516 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32SarAndWord32Shl) { 1516 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32SarAndWord32Shl) {
1517 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier); 1517 const StoreRepresentation rep(kMachUint8, kNoWriteBarrier);
1518 Node* const base = Parameter(0); 1518 Node* const base = Parameter(0);
1519 Node* const index = Parameter(1); 1519 Node* const index = Parameter(1);
1520 Node* const value = Parameter(2); 1520 Node* const value = Parameter(2);
1521 Node* const effect = graph()->start(); 1521 Node* const effect = graph()->start();
1522 Node* const control = graph()->start(); 1522 Node* const control = graph()->start();
1523 TRACED_FORRANGE(int32_t, x, 1, 24) { 1523 TRACED_FORRANGE(int32_t, x, 1, 24) {
1524 Node* const node = graph()->NewNode( 1524 Node* const node = graph()->NewNode(
1525 machine()->Store(rep), base, index, 1525 machine()->Store(rep), base, index,
1526 graph()->NewNode( 1526 graph()->NewNode(
1527 machine()->Word32Sar(), 1527 machine()->Word32Sar(),
1528 graph()->NewNode(machine()->Word32Shl(), value, Int32Constant(x)), 1528 graph()->NewNode(machine()->Word32Shl(), value, Int32Constant(x)),
1529 Int32Constant(x)), 1529 Int32Constant(x)),
1530 effect, control); 1530 effect, control);
1531 1531
1532 Reduction r = Reduce(node); 1532 Reduction r = Reduce(node);
1533 ASSERT_TRUE(r.Changed()); 1533 ASSERT_TRUE(r.Changed());
1534 EXPECT_THAT(r.replacement(), 1534 EXPECT_THAT(r.replacement(),
1535 IsStore(rep, base, index, value, effect, control)); 1535 IsStore(rep, base, index, value, effect, control));
1536 } 1536 }
1537 } 1537 }
1538 1538
1539 1539
1540 TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32And) { 1540 TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32And) {
1541 const StoreRepresentation rep(kRepWord16, kNoWriteBarrier); 1541 const StoreRepresentation rep(kMachUint16, kNoWriteBarrier);
1542 Node* const base = Parameter(0); 1542 Node* const base = Parameter(0);
1543 Node* const index = Parameter(1); 1543 Node* const index = Parameter(1);
1544 Node* const value = Parameter(2); 1544 Node* const value = Parameter(2);
1545 Node* const effect = graph()->start(); 1545 Node* const effect = graph()->start();
1546 Node* const control = graph()->start(); 1546 Node* const control = graph()->start();
1547 TRACED_FOREACH(uint32_t, x, kUint32Values) { 1547 TRACED_FOREACH(uint32_t, x, kUint32Values) {
1548 Node* const node = 1548 Node* const node =
1549 graph()->NewNode(machine()->Store(rep), base, index, 1549 graph()->NewNode(machine()->Store(rep), base, index,
1550 graph()->NewNode(machine()->Word32And(), value, 1550 graph()->NewNode(machine()->Word32And(), value,
1551 Uint32Constant(x | 0xffffu)), 1551 Uint32Constant(x | 0xffffu)),
1552 effect, control); 1552 effect, control);
1553 1553
1554 Reduction r = Reduce(node); 1554 Reduction r = Reduce(node);
1555 ASSERT_TRUE(r.Changed()); 1555 ASSERT_TRUE(r.Changed());
1556 EXPECT_THAT(r.replacement(), 1556 EXPECT_THAT(r.replacement(),
1557 IsStore(rep, base, index, value, effect, control)); 1557 IsStore(rep, base, index, value, effect, control));
1558 } 1558 }
1559 } 1559 }
1560 1560
1561 1561
1562 TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32SarAndWord32Shl) { 1562 TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32SarAndWord32Shl) {
1563 const StoreRepresentation rep(kRepWord16, kNoWriteBarrier); 1563 const StoreRepresentation rep(kMachUint16, kNoWriteBarrier);
1564 Node* const base = Parameter(0); 1564 Node* const base = Parameter(0);
1565 Node* const index = Parameter(1); 1565 Node* const index = Parameter(1);
1566 Node* const value = Parameter(2); 1566 Node* const value = Parameter(2);
1567 Node* const effect = graph()->start(); 1567 Node* const effect = graph()->start();
1568 Node* const control = graph()->start(); 1568 Node* const control = graph()->start();
1569 TRACED_FORRANGE(int32_t, x, 1, 16) { 1569 TRACED_FORRANGE(int32_t, x, 1, 16) {
1570 Node* const node = graph()->NewNode( 1570 Node* const node = graph()->NewNode(
1571 machine()->Store(rep), base, index, 1571 machine()->Store(rep), base, index,
1572 graph()->NewNode( 1572 graph()->NewNode(
1573 machine()->Word32Sar(), 1573 machine()->Word32Sar(),
1574 graph()->NewNode(machine()->Word32Shl(), value, Int32Constant(x)), 1574 graph()->NewNode(machine()->Word32Shl(), value, Int32Constant(x)),
1575 Int32Constant(x)), 1575 Int32Constant(x)),
1576 effect, control); 1576 effect, control);
1577 1577
1578 Reduction r = Reduce(node); 1578 Reduction r = Reduce(node);
1579 ASSERT_TRUE(r.Changed()); 1579 ASSERT_TRUE(r.Changed());
1580 EXPECT_THAT(r.replacement(), 1580 EXPECT_THAT(r.replacement(),
1581 IsStore(rep, base, index, value, effect, control)); 1581 IsStore(rep, base, index, value, effect, control));
1582 } 1582 }
1583 } 1583 }
1584 1584
1585 } // namespace compiler 1585 } // namespace compiler
1586 } // namespace internal 1586 } // namespace internal
1587 } // namespace v8 1587 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-simplified-lowering.cc ('k') | test/unittests/compiler/machine-operator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698