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

Side by Side Diff: test/unittests/compiler/arm/instruction-selector-arm-unittest.cc

Issue 620773003: Rename Int32{UMod,UDiv} to Uint32{Div,Mod} and Int64{UMod,UDiv} to Uint64{Div,Mod}. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
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 "test/unittests/compiler/instruction-selector-unittest.h" 5 #include "test/unittests/compiler/instruction-selector-unittest.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace compiler { 9 namespace compiler {
10 10
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 m.Return( 1573 m.Return(
1574 m.Int32Sub(m.Parameter(0), m.Int32Mul(m.Parameter(1), m.Parameter(2)))); 1574 m.Int32Sub(m.Parameter(0), m.Int32Mul(m.Parameter(1), m.Parameter(2))));
1575 Stream s = m.Build(MLS); 1575 Stream s = m.Build(MLS);
1576 ASSERT_EQ(1U, s.size()); 1576 ASSERT_EQ(1U, s.size());
1577 EXPECT_EQ(kArmMls, s[0]->arch_opcode()); 1577 EXPECT_EQ(kArmMls, s[0]->arch_opcode());
1578 EXPECT_EQ(1U, s[0]->OutputCount()); 1578 EXPECT_EQ(1U, s[0]->OutputCount());
1579 EXPECT_EQ(3U, s[0]->InputCount()); 1579 EXPECT_EQ(3U, s[0]->InputCount());
1580 } 1580 }
1581 1581
1582 1582
1583 TEST_F(InstructionSelectorTest, Int32UDivWithParameters) { 1583 TEST_F(InstructionSelectorTest, Uint32DivWithParameters) {
1584 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); 1584 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
1585 m.Return(m.Int32UDiv(m.Parameter(0), m.Parameter(1))); 1585 m.Return(m.Uint32Div(m.Parameter(0), m.Parameter(1)));
1586 Stream s = m.Build(); 1586 Stream s = m.Build();
1587 ASSERT_EQ(4U, s.size()); 1587 ASSERT_EQ(4U, s.size());
1588 EXPECT_EQ(kArmVcvtF64U32, s[0]->arch_opcode()); 1588 EXPECT_EQ(kArmVcvtF64U32, s[0]->arch_opcode());
1589 ASSERT_EQ(1U, s[0]->OutputCount()); 1589 ASSERT_EQ(1U, s[0]->OutputCount());
1590 EXPECT_EQ(kArmVcvtF64U32, s[1]->arch_opcode()); 1590 EXPECT_EQ(kArmVcvtF64U32, s[1]->arch_opcode());
1591 ASSERT_EQ(1U, s[1]->OutputCount()); 1591 ASSERT_EQ(1U, s[1]->OutputCount());
1592 EXPECT_EQ(kArmVdivF64, s[2]->arch_opcode()); 1592 EXPECT_EQ(kArmVdivF64, s[2]->arch_opcode());
1593 ASSERT_EQ(2U, s[2]->InputCount()); 1593 ASSERT_EQ(2U, s[2]->InputCount());
1594 ASSERT_EQ(1U, s[2]->OutputCount()); 1594 ASSERT_EQ(1U, s[2]->OutputCount());
1595 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[2]->InputAt(0))); 1595 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[2]->InputAt(0)));
1596 EXPECT_EQ(s.ToVreg(s[1]->Output()), s.ToVreg(s[2]->InputAt(1))); 1596 EXPECT_EQ(s.ToVreg(s[1]->Output()), s.ToVreg(s[2]->InputAt(1)));
1597 EXPECT_EQ(kArmVcvtU32F64, s[3]->arch_opcode()); 1597 EXPECT_EQ(kArmVcvtU32F64, s[3]->arch_opcode());
1598 ASSERT_EQ(1U, s[3]->InputCount()); 1598 ASSERT_EQ(1U, s[3]->InputCount());
1599 EXPECT_EQ(s.ToVreg(s[2]->Output()), s.ToVreg(s[3]->InputAt(0))); 1599 EXPECT_EQ(s.ToVreg(s[2]->Output()), s.ToVreg(s[3]->InputAt(0)));
1600 } 1600 }
1601 1601
1602 1602
1603 TEST_F(InstructionSelectorTest, Int32UDivWithParametersForSUDIV) { 1603 TEST_F(InstructionSelectorTest, Uint32DivWithParametersForSUDIV) {
1604 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); 1604 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
1605 m.Return(m.Int32UDiv(m.Parameter(0), m.Parameter(1))); 1605 m.Return(m.Uint32Div(m.Parameter(0), m.Parameter(1)));
1606 Stream s = m.Build(SUDIV); 1606 Stream s = m.Build(SUDIV);
1607 ASSERT_EQ(1U, s.size()); 1607 ASSERT_EQ(1U, s.size());
1608 EXPECT_EQ(kArmUdiv, s[0]->arch_opcode()); 1608 EXPECT_EQ(kArmUdiv, s[0]->arch_opcode());
1609 } 1609 }
1610 1610
1611 1611
1612 TEST_F(InstructionSelectorTest, Int32UModWithParameters) { 1612 TEST_F(InstructionSelectorTest, Uint32ModWithParameters) {
1613 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); 1613 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
1614 m.Return(m.Int32UMod(m.Parameter(0), m.Parameter(1))); 1614 m.Return(m.Uint32Mod(m.Parameter(0), m.Parameter(1)));
1615 Stream s = m.Build(); 1615 Stream s = m.Build();
1616 ASSERT_EQ(6U, s.size()); 1616 ASSERT_EQ(6U, s.size());
1617 EXPECT_EQ(kArmVcvtF64U32, s[0]->arch_opcode()); 1617 EXPECT_EQ(kArmVcvtF64U32, s[0]->arch_opcode());
1618 ASSERT_EQ(1U, s[0]->OutputCount()); 1618 ASSERT_EQ(1U, s[0]->OutputCount());
1619 EXPECT_EQ(kArmVcvtF64U32, s[1]->arch_opcode()); 1619 EXPECT_EQ(kArmVcvtF64U32, s[1]->arch_opcode());
1620 ASSERT_EQ(1U, s[1]->OutputCount()); 1620 ASSERT_EQ(1U, s[1]->OutputCount());
1621 EXPECT_EQ(kArmVdivF64, s[2]->arch_opcode()); 1621 EXPECT_EQ(kArmVdivF64, s[2]->arch_opcode());
1622 ASSERT_EQ(2U, s[2]->InputCount()); 1622 ASSERT_EQ(2U, s[2]->InputCount());
1623 ASSERT_EQ(1U, s[2]->OutputCount()); 1623 ASSERT_EQ(1U, s[2]->OutputCount());
1624 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[2]->InputAt(0))); 1624 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[2]->InputAt(0)));
1625 EXPECT_EQ(s.ToVreg(s[1]->Output()), s.ToVreg(s[2]->InputAt(1))); 1625 EXPECT_EQ(s.ToVreg(s[1]->Output()), s.ToVreg(s[2]->InputAt(1)));
1626 EXPECT_EQ(kArmVcvtU32F64, s[3]->arch_opcode()); 1626 EXPECT_EQ(kArmVcvtU32F64, s[3]->arch_opcode());
1627 ASSERT_EQ(1U, s[3]->InputCount()); 1627 ASSERT_EQ(1U, s[3]->InputCount());
1628 EXPECT_EQ(s.ToVreg(s[2]->Output()), s.ToVreg(s[3]->InputAt(0))); 1628 EXPECT_EQ(s.ToVreg(s[2]->Output()), s.ToVreg(s[3]->InputAt(0)));
1629 EXPECT_EQ(kArmMul, s[4]->arch_opcode()); 1629 EXPECT_EQ(kArmMul, s[4]->arch_opcode());
1630 ASSERT_EQ(1U, s[4]->OutputCount()); 1630 ASSERT_EQ(1U, s[4]->OutputCount());
1631 ASSERT_EQ(2U, s[4]->InputCount()); 1631 ASSERT_EQ(2U, s[4]->InputCount());
1632 EXPECT_EQ(s.ToVreg(s[3]->Output()), s.ToVreg(s[4]->InputAt(0))); 1632 EXPECT_EQ(s.ToVreg(s[3]->Output()), s.ToVreg(s[4]->InputAt(0)));
1633 EXPECT_EQ(s.ToVreg(s[1]->InputAt(0)), s.ToVreg(s[4]->InputAt(1))); 1633 EXPECT_EQ(s.ToVreg(s[1]->InputAt(0)), s.ToVreg(s[4]->InputAt(1)));
1634 EXPECT_EQ(kArmSub, s[5]->arch_opcode()); 1634 EXPECT_EQ(kArmSub, s[5]->arch_opcode());
1635 ASSERT_EQ(1U, s[5]->OutputCount()); 1635 ASSERT_EQ(1U, s[5]->OutputCount());
1636 ASSERT_EQ(2U, s[5]->InputCount()); 1636 ASSERT_EQ(2U, s[5]->InputCount());
1637 EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[5]->InputAt(0))); 1637 EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[5]->InputAt(0)));
1638 EXPECT_EQ(s.ToVreg(s[4]->Output()), s.ToVreg(s[5]->InputAt(1))); 1638 EXPECT_EQ(s.ToVreg(s[4]->Output()), s.ToVreg(s[5]->InputAt(1)));
1639 } 1639 }
1640 1640
1641 1641
1642 TEST_F(InstructionSelectorTest, Int32UModWithParametersForSUDIV) { 1642 TEST_F(InstructionSelectorTest, Uint32ModWithParametersForSUDIV) {
1643 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); 1643 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
1644 m.Return(m.Int32UMod(m.Parameter(0), m.Parameter(1))); 1644 m.Return(m.Uint32Mod(m.Parameter(0), m.Parameter(1)));
1645 Stream s = m.Build(SUDIV); 1645 Stream s = m.Build(SUDIV);
1646 ASSERT_EQ(3U, s.size()); 1646 ASSERT_EQ(3U, s.size());
1647 EXPECT_EQ(kArmUdiv, s[0]->arch_opcode()); 1647 EXPECT_EQ(kArmUdiv, s[0]->arch_opcode());
1648 ASSERT_EQ(1U, s[0]->OutputCount()); 1648 ASSERT_EQ(1U, s[0]->OutputCount());
1649 ASSERT_EQ(2U, s[0]->InputCount()); 1649 ASSERT_EQ(2U, s[0]->InputCount());
1650 EXPECT_EQ(kArmMul, s[1]->arch_opcode()); 1650 EXPECT_EQ(kArmMul, s[1]->arch_opcode());
1651 ASSERT_EQ(1U, s[1]->OutputCount()); 1651 ASSERT_EQ(1U, s[1]->OutputCount());
1652 ASSERT_EQ(2U, s[1]->InputCount()); 1652 ASSERT_EQ(2U, s[1]->InputCount());
1653 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0))); 1653 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0)));
1654 EXPECT_EQ(s.ToVreg(s[0]->InputAt(1)), s.ToVreg(s[1]->InputAt(1))); 1654 EXPECT_EQ(s.ToVreg(s[0]->InputAt(1)), s.ToVreg(s[1]->InputAt(1)));
1655 EXPECT_EQ(kArmSub, s[2]->arch_opcode()); 1655 EXPECT_EQ(kArmSub, s[2]->arch_opcode());
1656 ASSERT_EQ(1U, s[2]->OutputCount()); 1656 ASSERT_EQ(1U, s[2]->OutputCount());
1657 ASSERT_EQ(2U, s[2]->InputCount()); 1657 ASSERT_EQ(2U, s[2]->InputCount());
1658 EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[2]->InputAt(0))); 1658 EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[2]->InputAt(0)));
1659 EXPECT_EQ(s.ToVreg(s[1]->Output()), s.ToVreg(s[2]->InputAt(1))); 1659 EXPECT_EQ(s.ToVreg(s[1]->Output()), s.ToVreg(s[2]->InputAt(1)));
1660 } 1660 }
1661 1661
1662 1662
1663 TEST_F(InstructionSelectorTest, Int32UModWithParametersForSUDIVAndMLS) { 1663 TEST_F(InstructionSelectorTest, Uint32ModWithParametersForSUDIVAndMLS) {
1664 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); 1664 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
1665 m.Return(m.Int32UMod(m.Parameter(0), m.Parameter(1))); 1665 m.Return(m.Uint32Mod(m.Parameter(0), m.Parameter(1)));
1666 Stream s = m.Build(MLS, SUDIV); 1666 Stream s = m.Build(MLS, SUDIV);
1667 ASSERT_EQ(2U, s.size()); 1667 ASSERT_EQ(2U, s.size());
1668 EXPECT_EQ(kArmUdiv, s[0]->arch_opcode()); 1668 EXPECT_EQ(kArmUdiv, s[0]->arch_opcode());
1669 ASSERT_EQ(1U, s[0]->OutputCount()); 1669 ASSERT_EQ(1U, s[0]->OutputCount());
1670 ASSERT_EQ(2U, s[0]->InputCount()); 1670 ASSERT_EQ(2U, s[0]->InputCount());
1671 EXPECT_EQ(kArmMls, s[1]->arch_opcode()); 1671 EXPECT_EQ(kArmMls, s[1]->arch_opcode());
1672 ASSERT_EQ(1U, s[1]->OutputCount()); 1672 ASSERT_EQ(1U, s[1]->OutputCount());
1673 ASSERT_EQ(3U, s[1]->InputCount()); 1673 ASSERT_EQ(3U, s[1]->InputCount());
1674 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0))); 1674 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0)));
1675 EXPECT_EQ(s.ToVreg(s[0]->InputAt(1)), s.ToVreg(s[1]->InputAt(1))); 1675 EXPECT_EQ(s.ToVreg(s[0]->InputAt(1)), s.ToVreg(s[1]->InputAt(1)));
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 ASSERT_EQ(3U, s[0]->InputCount()); 1916 ASSERT_EQ(3U, s[0]->InputCount());
1917 EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1))); 1917 EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1)));
1918 EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2))); 1918 EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2)));
1919 } 1919 }
1920 } 1920 }
1921 } 1921 }
1922 1922
1923 } // namespace compiler 1923 } // namespace compiler
1924 } // namespace internal 1924 } // namespace internal
1925 } // namespace v8 1925 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-machops.cc ('k') | test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698