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

Side by Side Diff: runtime/vm/assembler_arm_test.cc

Issue 18684008: Begins implementation of ARM neon instructions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 } 1589 }
1590 1590
1591 1591
1592 ASSEMBLER_TEST_RUN(Muls, test) { 1592 ASSEMBLER_TEST_RUN(Muls, test) {
1593 EXPECT(test != NULL); 1593 EXPECT(test != NULL);
1594 typedef int (*Tst)(); 1594 typedef int (*Tst)();
1595 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); 1595 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1596 } 1596 }
1597 1597
1598 1598
1599 ASSEMBLER_TEST_GENERATE(Vaddqi8, assembler) {
1600 if (CPUFeatures::neon_supported()) {
1601 __ mov(R0, ShifterOperand(1));
1602 __ vmovsr(S0, R0);
1603 __ vmovsr(S1, R0);
1604 __ vmovsr(S2, R0);
1605 __ vmovsr(S3, R0);
1606 __ vmovsr(S4, R0);
1607 __ vmovsr(S5, R0);
1608 __ vmovsr(S6, R0);
1609 __ vmovsr(S7, R0);
1610
1611 __ vaddqi(0, Q2, Q0, Q1);
1612
1613 __ vmovrs(R0, S8);
1614 __ vmovrs(R1, S9);
1615 __ vmovrs(R2, S10);
1616 __ vmovrs(R3, S11);
1617
1618 __ add(R0, R0, ShifterOperand(R1));
1619 __ add(R0, R0, ShifterOperand(R2));
1620 __ add(R0, R0, ShifterOperand(R3));
1621 __ bx(LR);
1622 } else {
1623 __ LoadImmediate(R0, 8);
1624 __ bx(LR);
1625 }
1626 }
1627
1628
1629 ASSEMBLER_TEST_RUN(Vaddqi8, test) {
1630 EXPECT(test != NULL);
1631 typedef int (*Tst)();
1632 EXPECT_EQ(8, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1633 }
1634
1635
1636 ASSEMBLER_TEST_GENERATE(Vaddqi16, assembler) {
1637 if (CPUFeatures::neon_supported()) {
1638 __ mov(R0, ShifterOperand(1));
1639 __ vmovsr(S0, R0);
1640 __ vmovsr(S1, R0);
1641 __ vmovsr(S2, R0);
1642 __ vmovsr(S3, R0);
1643 __ vmovsr(S4, R0);
1644 __ vmovsr(S5, R0);
1645 __ vmovsr(S6, R0);
1646 __ vmovsr(S7, R0);
1647
1648 __ vaddqi(1, Q2, Q0, Q1);
1649
1650 __ vmovrs(R0, S8);
1651 __ vmovrs(R1, S9);
1652 __ vmovrs(R2, S10);
1653 __ vmovrs(R3, S11);
1654
1655 __ add(R0, R0, ShifterOperand(R1));
1656 __ add(R0, R0, ShifterOperand(R2));
1657 __ add(R0, R0, ShifterOperand(R3));
1658 __ bx(LR);
1659 } else {
1660 __ LoadImmediate(R0, 8);
1661 __ bx(LR);
1662 }
1663 }
1664
1665
1666 ASSEMBLER_TEST_RUN(Vaddqi16, test) {
1667 EXPECT(test != NULL);
1668 typedef int (*Tst)();
1669 EXPECT_EQ(8, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1670 }
1671
1672
1673 ASSEMBLER_TEST_GENERATE(Vaddqi32, assembler) {
1674 if (CPUFeatures::neon_supported()) {
1675 __ mov(R0, ShifterOperand(1));
1676 __ vmovsr(S0, R0);
1677 __ vmovsr(S1, R0);
1678 __ vmovsr(S2, R0);
1679 __ vmovsr(S3, R0);
1680 __ vmovsr(S4, R0);
1681 __ vmovsr(S5, R0);
1682 __ vmovsr(S6, R0);
1683 __ vmovsr(S7, R0);
1684
1685 __ vaddqi(2, Q2, Q0, Q1);
1686
1687 __ vmovrs(R0, S8);
1688 __ vmovrs(R1, S9);
1689 __ vmovrs(R2, S10);
1690 __ vmovrs(R3, S11);
1691
1692 __ add(R0, R0, ShifterOperand(R1));
1693 __ add(R0, R0, ShifterOperand(R2));
1694 __ add(R0, R0, ShifterOperand(R3));
1695 __ bx(LR);
1696 } else {
1697 __ LoadImmediate(R0, 8);
1698 __ bx(LR);
1699 }
1700 }
1701
1702
1703 ASSEMBLER_TEST_RUN(Vaddqi32, test) {
1704 EXPECT(test != NULL);
1705 typedef int (*Tst)();
1706 EXPECT_EQ(8, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1707 }
1708
1709
1710 ASSEMBLER_TEST_GENERATE(Vaddqi64, assembler) {
1711 if (CPUFeatures::neon_supported()) {
1712 __ mov(R0, ShifterOperand(1));
1713 __ vmovsr(S0, R0);
1714 __ vmovsr(S2, R0);
1715 __ vmovsr(S4, R0);
1716 __ vmovsr(S6, R0);
1717
1718 __ vaddqi(3, Q2, Q0, Q1);
1719
1720 __ vmovrs(R0, S8);
1721 __ vmovrs(R2, S10);
1722
1723 __ add(R0, R0, ShifterOperand(R2));
1724 __ bx(LR);
1725 } else {
1726 __ LoadImmediate(R0, 4);
1727 __ bx(LR);
1728 }
1729 }
1730
1731
1732 ASSEMBLER_TEST_RUN(Vaddqi64, test) {
1733 EXPECT(test != NULL);
1734 typedef int (*Tst)();
1735 EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1736 }
1737
1738
1739 ASSEMBLER_TEST_GENERATE(Vaddqs, assembler) {
1740 if (CPUFeatures::neon_supported()) {
1741 __ LoadSImmediate(S0, 1.0);
1742 __ vmovs(S1, S0);
1743 __ vmovs(S2, S0);
1744 __ vmovs(S3, S0);
1745 __ vmovs(S4, S0);
1746 __ vmovs(S5, S0);
1747 __ vmovs(S6, S0);
1748 __ vmovs(S7, S0);
1749
1750 __ vaddqs(Q2, Q0, Q1);
1751
1752 __ vadds(S8, S8, S9);
1753 __ vadds(S8, S8, S10);
1754 __ vadds(S8, S8, S11);
1755
1756 __ vcvtis(S0, S8);
1757 __ vmovrs(R0, S0);
1758
1759 __ bx(LR);
1760 } else {
1761 __ LoadImmediate(R0, 8);
1762 __ bx(LR);
1763 }
1764 }
1765
1766
1767 ASSEMBLER_TEST_RUN(Vaddqs, test) {
1768 EXPECT(test != NULL);
1769 typedef int (*Tst)();
1770 EXPECT_EQ(8, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1771 }
1772
1773
1599 // Called from assembler_test.cc. 1774 // Called from assembler_test.cc.
1600 // LR: return address. 1775 // LR: return address.
1601 // R0: context. 1776 // R0: context.
1602 // R1: value. 1777 // R1: value.
1603 // R2: growable array. 1778 // R2: growable array.
1604 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { 1779 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
1605 __ PushList((1 << CTX) | (1 << LR)); 1780 __ PushList((1 << CTX) | (1 << LR));
1606 __ mov(CTX, ShifterOperand(R0)); 1781 __ mov(CTX, ShifterOperand(R0));
1607 __ StoreIntoObject(R2, 1782 __ StoreIntoObject(R2,
1608 FieldAddress(R2, GrowableObjectArray::data_offset()), 1783 FieldAddress(R2, GrowableObjectArray::data_offset()),
1609 R1); 1784 R1);
1610 __ PopList((1 << CTX) | (1 << LR)); 1785 __ PopList((1 << CTX) | (1 << LR));
1611 __ Ret(); 1786 __ Ret();
1612 } 1787 }
1613 1788
1614 } // namespace dart 1789 } // namespace dart
1615 1790
1616 #endif // defined TARGET_ARCH_ARM 1791 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698