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

Side by Side Diff: test/cctest/test-assembler-arm.cc

Issue 322423003: ARM: add AArch32 support and new vcvt instructions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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
« no previous file with comments | « src/globals.h ('k') | test/cctest/test-disasm-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 CodeDesc desc; 1536 CodeDesc desc;
1537 assm.GetCode(&desc); 1537 assm.GetCode(&desc);
1538 Handle<Code> code = isolate->factory()->NewCode( 1538 Handle<Code> code = isolate->factory()->NewCode(
1539 desc, Code::ComputeFlags(Code::STUB), code_object); 1539 desc, Code::ComputeFlags(Code::STUB), code_object);
1540 F1 f = FUNCTION_CAST<F1>(code->entry()); 1540 F1 f = FUNCTION_CAST<F1>(code->entry());
1541 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0)); 1541 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0));
1542 ::printf("f() = %d\n", res); 1542 ::printf("f() = %d\n", res);
1543 CHECK_EQ(42, res); 1543 CHECK_EQ(42, res);
1544 } 1544 }
1545 1545
1546
1547 #define TEST_VCVT(expected_, value_) \
1548 t.value = value_; \
1549 t.result = 0; \
1550 dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); \
1551 CHECK_EQ(static_cast<int32_t>(expected_), static_cast<int32_t>(t.result));
1552
1553
1554 TEST(vcvta_s32_f64) {
1555 // Test the vcvta_s32_f64 instruction.
1556 CcTest::InitializeVM();
1557 Isolate* isolate = CcTest::i_isolate();
1558 HandleScope scope(isolate);
1559 if (CpuFeatures::IsSupported(ARMv8)) {
1560 typedef struct {
1561 double value;
1562 int32_t result;
1563 } T;
1564 T t;
1565
1566 Assembler assm(isolate, NULL, 0);
1567
1568 __ vldr(d0, MemOperand(r0, OFFSET_OF(T, value)));
1569 __ vcvta_s32_f64(s0, d0);
1570 __ vmov(r1, s0);
1571 __ str(r1, MemOperand(r0, OFFSET_OF(T, result)));
1572 __ bx(lr);
1573
1574 CodeDesc desc;
1575 assm.GetCode(&desc);
1576 Handle<Code> code = isolate->factory()->NewCode(
1577 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1578 #ifdef DEBUG
1579 code->Print();
1580 #endif
1581 F3 f = FUNCTION_CAST<F3>(code->entry());
1582 Object* dummy;
1583 TEST_VCVT(0, 0.0);
1584 TEST_VCVT(1, 0.5);
1585 TEST_VCVT(1, 1.0);
1586 TEST_VCVT(1, 1.1);
1587 TEST_VCVT(2, 1.5);
1588 TEST_VCVT(2, 1.9);
1589 TEST_VCVT(3, 2.5);
1590 TEST_VCVT(-1, -0.5);
1591 TEST_VCVT(-1, -1.0);
1592 TEST_VCVT(-1, -1.1);
1593 TEST_VCVT(-2, -1.5);
1594 TEST_VCVT(-2, -1.9);
1595 TEST_VCVT(-3, -2.5);
1596 TEST_VCVT(2147483646, 2147483646.0);
1597 TEST_VCVT(kMaxInt, 2147483646.5);
1598 TEST_VCVT(kMaxInt, 2147483647.0);
1599 TEST_VCVT(kMaxInt, 2147483648.0);
1600 TEST_VCVT(-2147483647, -2147483647.0);
1601 TEST_VCVT(kMinInt, -2147483647.5);
1602 TEST_VCVT(kMinInt, -2147483648.0);
1603 TEST_VCVT(kMinInt, -2147483649.0);
1604 TEST_VCVT(0, OS::nan_value());
1605 USE(dummy);
1606 }
1607 }
1608
1609
1610 TEST(vcvta_u32_f64) {
1611 // Test the vcvta_u32_f64 instruction.
1612 CcTest::InitializeVM();
1613 Isolate* isolate = CcTest::i_isolate();
1614 HandleScope scope(isolate);
1615 if (CpuFeatures::IsSupported(ARMv8)) {
1616 typedef struct {
1617 double value;
1618 uint32_t result;
1619 } T;
1620 T t;
1621
1622 Assembler assm(isolate, NULL, 0);
1623
1624 __ vldr(d0, MemOperand(r0, OFFSET_OF(T, value)));
1625 __ vcvta_u32_f64(s0, d0);
1626 __ vmov(r1, s0);
1627 __ str(r1, MemOperand(r0, OFFSET_OF(T, result)));
1628 __ bx(lr);
1629
1630 CodeDesc desc;
1631 assm.GetCode(&desc);
1632 Handle<Code> code = isolate->factory()->NewCode(
1633 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1634 #ifdef DEBUG
1635 code->Print();
1636 #endif
1637 F3 f = FUNCTION_CAST<F3>(code->entry());
1638 Object* dummy;
1639 TEST_VCVT(0, 0.0);
1640 TEST_VCVT(1, 0.5);
1641 TEST_VCVT(1, 1.0);
1642 TEST_VCVT(1, 1.1);
1643 TEST_VCVT(2, 1.5);
1644 TEST_VCVT(2, 1.9);
1645 TEST_VCVT(3, 2.5);
1646 TEST_VCVT(0, -1.0);
1647 TEST_VCVT(0, -1.1);
1648 TEST_VCVT(4294967294U, 4294967294.0);
1649 TEST_VCVT(kMaxUInt32, 4294967294.5);
1650 TEST_VCVT(kMaxUInt32, 4294967295.0);
1651 TEST_VCVT(kMaxUInt32, 4294967296.0);
1652 TEST_VCVT(0, OS::nan_value());
1653 USE(dummy);
1654 }
1655 }
1656
1657
1658 TEST(vcvtn_s32_f64) {
1659 // Test the vcvtn_s32_f64 instruction.
1660 CcTest::InitializeVM();
1661 Isolate* isolate = CcTest::i_isolate();
1662 HandleScope scope(isolate);
1663 if (CpuFeatures::IsSupported(ARMv8)) {
1664 typedef struct {
1665 double value;
1666 int32_t result;
1667 } T;
1668 T t;
1669
1670 Assembler assm(isolate, NULL, 0);
1671
1672 __ vldr(d0, MemOperand(r0, OFFSET_OF(T, value)));
1673 __ vcvtn_s32_f64(s0, d0);
1674 __ vmov(r1, s0);
1675 __ str(r1, MemOperand(r0, OFFSET_OF(T, result)));
1676 __ bx(lr);
1677
1678 CodeDesc desc;
1679 assm.GetCode(&desc);
1680 Handle<Code> code = isolate->factory()->NewCode(
1681 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1682 #ifdef DEBUG
1683 code->Print();
1684 #endif
1685 F3 f = FUNCTION_CAST<F3>(code->entry());
1686 Object* dummy;
1687 TEST_VCVT(0, 0.0);
1688 TEST_VCVT(0, 0.5);
1689 TEST_VCVT(1, 1.0);
1690 TEST_VCVT(1, 1.1);
1691 TEST_VCVT(2, 1.5);
1692 TEST_VCVT(2, 1.9);
1693 TEST_VCVT(2, 2.5);
1694 TEST_VCVT(0, -0.5);
1695 TEST_VCVT(-1, -1.0);
1696 TEST_VCVT(-1, -1.1);
1697 TEST_VCVT(-2, -1.5);
1698 TEST_VCVT(-2, -1.9);
1699 TEST_VCVT(-2, -2.5);
1700 TEST_VCVT(2147483646, 2147483645.5);
1701 TEST_VCVT(2147483646, 2147483646.0);
1702 TEST_VCVT(2147483646, 2147483646.5);
1703 TEST_VCVT(kMaxInt, 2147483647.0);
1704 TEST_VCVT(kMaxInt, 2147483648.0);
1705 TEST_VCVT(-2147483647, -2147483647.0);
1706 TEST_VCVT(kMinInt, -2147483647.5);
1707 TEST_VCVT(kMinInt, -2147483648.0);
1708 TEST_VCVT(kMinInt, -2147483649.0);
1709 TEST_VCVT(0, OS::nan_value());
1710 USE(dummy);
1711 }
1712 }
1713
1714
1715 TEST(vcvtn_u32_f64) {
1716 // Test the vcvtn_u32_f64 instruction.
1717 CcTest::InitializeVM();
1718 Isolate* isolate = CcTest::i_isolate();
1719 HandleScope scope(isolate);
1720 if (CpuFeatures::IsSupported(ARMv8)) {
1721 typedef struct {
1722 double value;
1723 uint32_t result;
1724 } T;
1725 T t;
1726
1727 Assembler assm(isolate, NULL, 0);
1728
1729 __ vldr(d0, MemOperand(r0, OFFSET_OF(T, value)));
1730 __ vcvtn_u32_f64(s0, d0);
1731 __ vmov(r1, s0);
1732 __ str(r1, MemOperand(r0, OFFSET_OF(T, result)));
1733 __ bx(lr);
1734
1735 CodeDesc desc;
1736 assm.GetCode(&desc);
1737 Handle<Code> code = isolate->factory()->NewCode(
1738 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1739 #ifdef DEBUG
1740 code->Print();
1741 #endif
1742 F3 f = FUNCTION_CAST<F3>(code->entry());
1743 Object* dummy;
1744 TEST_VCVT(0, 0.0);
1745 TEST_VCVT(0, 0.5);
1746 TEST_VCVT(1, 1.0);
1747 TEST_VCVT(1, 1.1);
1748 TEST_VCVT(2, 1.5);
1749 TEST_VCVT(2, 1.9);
1750 TEST_VCVT(2, 2.5);
1751 TEST_VCVT(0, -1.0);
1752 TEST_VCVT(0, -1.1);
1753 TEST_VCVT(4294967294U, 4294967294.0);
1754 TEST_VCVT(4294967294U, 4294967294.5);
1755 TEST_VCVT(kMaxUInt32, 4294967295.0);
1756 TEST_VCVT(kMaxUInt32, 4294967296.0);
1757 TEST_VCVT(0, OS::nan_value());
1758 USE(dummy);
1759 }
1760 }
1761
1762
1763 TEST(vcvtp_s32_f64) {
1764 // Test the vcvtp_s32_f64 instruction.
1765 CcTest::InitializeVM();
1766 Isolate* isolate = CcTest::i_isolate();
1767 HandleScope scope(isolate);
1768 if (CpuFeatures::IsSupported(ARMv8)) {
1769 typedef struct {
1770 double value;
1771 int32_t result;
1772 } T;
1773 T t;
1774
1775 Assembler assm(isolate, NULL, 0);
1776
1777 __ vldr(d0, MemOperand(r0, OFFSET_OF(T, value)));
1778 __ vcvtp_s32_f64(s0, d0);
1779 __ vmov(r1, s0);
1780 __ str(r1, MemOperand(r0, OFFSET_OF(T, result)));
1781 __ bx(lr);
1782
1783 CodeDesc desc;
1784 assm.GetCode(&desc);
1785 Handle<Code> code = isolate->factory()->NewCode(
1786 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1787 #ifdef DEBUG
1788 code->Print();
1789 #endif
1790 F3 f = FUNCTION_CAST<F3>(code->entry());
1791 Object* dummy;
1792 TEST_VCVT(0, 0.0);
1793 TEST_VCVT(1, 0.1);
1794 TEST_VCVT(1, 0.5);
1795 TEST_VCVT(1, 1.0);
1796 TEST_VCVT(2, 1.1);
1797 TEST_VCVT(2, 1.5);
1798 TEST_VCVT(2, 1.9);
1799 TEST_VCVT(3, 2.5);
1800 TEST_VCVT(0, -0.5);
1801 TEST_VCVT(-1, -1.0);
1802 TEST_VCVT(-1, -1.1);
1803 TEST_VCVT(-1, -1.5);
1804 TEST_VCVT(-1, -1.9);
1805 TEST_VCVT(-2, -2.5);
1806 TEST_VCVT(2147483646, 2147483646.0);
1807 TEST_VCVT(kMaxInt, 2147483646.5);
1808 TEST_VCVT(kMaxInt, 2147483647.0);
1809 TEST_VCVT(kMaxInt, 2147483648.0);
1810 TEST_VCVT(-2147483647, -2147483647.0);
1811 TEST_VCVT(-2147483647, -2147483647.5);
1812 TEST_VCVT(kMinInt, -2147483648.0);
1813 TEST_VCVT(kMinInt, -2147483649.0);
1814 TEST_VCVT(0, OS::nan_value());
1815 USE(dummy);
1816 }
1817 }
1818
1819
1820 TEST(vcvtp_u32_f64) {
1821 // Test the vcvtp_u32_f64 instruction.
1822 CcTest::InitializeVM();
1823 Isolate* isolate = CcTest::i_isolate();
1824 HandleScope scope(isolate);
1825 if (CpuFeatures::IsSupported(ARMv8)) {
1826 typedef struct {
1827 double value;
1828 uint32_t result;
1829 } T;
1830 T t;
1831
1832 Assembler assm(isolate, NULL, 0);
1833
1834 __ vldr(d0, MemOperand(r0, OFFSET_OF(T, value)));
1835 __ vcvtp_u32_f64(s0, d0);
1836 __ vmov(r1, s0);
1837 __ str(r1, MemOperand(r0, OFFSET_OF(T, result)));
1838 __ bx(lr);
1839
1840 CodeDesc desc;
1841 assm.GetCode(&desc);
1842 Handle<Code> code = isolate->factory()->NewCode(
1843 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1844 #ifdef DEBUG
1845 code->Print();
1846 #endif
1847 F3 f = FUNCTION_CAST<F3>(code->entry());
1848 Object* dummy;
1849 TEST_VCVT(0, 0.0);
1850 TEST_VCVT(1, 0.1);
1851 TEST_VCVT(1, 0.5);
1852 TEST_VCVT(1, 1.0);
1853 TEST_VCVT(2, 1.1);
1854 TEST_VCVT(2, 1.5);
1855 TEST_VCVT(2, 1.9);
1856 TEST_VCVT(3, 2.5);
1857 TEST_VCVT(0, -1.0);
1858 TEST_VCVT(0, -1.1);
1859 TEST_VCVT(4294967294U, 4294967294.0);
1860 TEST_VCVT(kMaxUInt32, 4294967294.5);
1861 TEST_VCVT(kMaxUInt32, 4294967295.0);
1862 TEST_VCVT(kMaxUInt32, 4294967296.0);
1863 TEST_VCVT(0, OS::nan_value());
1864 USE(dummy);
1865 }
1866 }
1867
1868
1869 TEST(vcvtm_s32_f64) {
1870 // Test the vcvtm_s32_f64 instruction.
1871 CcTest::InitializeVM();
1872 Isolate* isolate = CcTest::i_isolate();
1873 HandleScope scope(isolate);
1874 if (CpuFeatures::IsSupported(ARMv8)) {
1875 typedef struct {
1876 double value;
1877 int32_t result;
1878 } T;
1879 T t;
1880
1881 Assembler assm(isolate, NULL, 0);
1882
1883 __ vldr(d0, MemOperand(r0, OFFSET_OF(T, value)));
1884 __ vcvtm_s32_f64(s0, d0);
1885 __ vmov(r1, s0);
1886 __ str(r1, MemOperand(r0, OFFSET_OF(T, result)));
1887 __ bx(lr);
1888
1889 CodeDesc desc;
1890 assm.GetCode(&desc);
1891 Handle<Code> code = isolate->factory()->NewCode(
1892 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1893 #ifdef DEBUG
1894 code->Print();
1895 #endif
1896 F3 f = FUNCTION_CAST<F3>(code->entry());
1897 Object* dummy;
1898 TEST_VCVT(0, 0.0);
1899 TEST_VCVT(0, 0.1);
1900 TEST_VCVT(0, 0.5);
1901 TEST_VCVT(0, 0.9);
1902 TEST_VCVT(1, 1.0);
1903 TEST_VCVT(1, 1.1);
1904 TEST_VCVT(1, 1.5);
1905 TEST_VCVT(1, 1.9);
1906 TEST_VCVT(2, 2.5);
1907 TEST_VCVT(-1, -0.1);
1908 TEST_VCVT(-1, -0.5);
1909 TEST_VCVT(-1, -0.9);
1910 TEST_VCVT(-1, -1.0);
1911 TEST_VCVT(-2, -1.1);
1912 TEST_VCVT(-2, -1.5);
1913 TEST_VCVT(-2, -1.9);
1914 TEST_VCVT(-3, -2.5);
1915 TEST_VCVT(2147483646, 2147483646.0);
1916 TEST_VCVT(2147483646, 2147483646.5);
1917 TEST_VCVT(kMaxInt, 2147483647.0);
1918 TEST_VCVT(kMaxInt, 2147483648.0);
1919 TEST_VCVT(-2147483647, -2147483647.0);
1920 TEST_VCVT(kMinInt, -2147483647.5);
1921 TEST_VCVT(kMinInt, -2147483648.0);
1922 TEST_VCVT(kMinInt, -2147483649.0);
1923 TEST_VCVT(0, OS::nan_value());
1924 USE(dummy);
1925 }
1926 }
1927
1928
1929 TEST(vcvtm_u32_f64) {
1930 // Test the vcvtm_u32_f64 instruction.
1931 CcTest::InitializeVM();
1932 Isolate* isolate = CcTest::i_isolate();
1933 HandleScope scope(isolate);
1934 if (CpuFeatures::IsSupported(ARMv8)) {
1935 typedef struct {
1936 double value;
1937 uint32_t result;
1938 } T;
1939 T t;
1940
1941 Assembler assm(isolate, NULL, 0);
1942
1943 __ vldr(d0, MemOperand(r0, OFFSET_OF(T, value)));
1944 __ vcvtm_u32_f64(s0, d0);
1945 __ vmov(r1, s0);
1946 __ str(r1, MemOperand(r0, OFFSET_OF(T, result)));
1947 __ bx(lr);
1948
1949 CodeDesc desc;
1950 assm.GetCode(&desc);
1951 Handle<Code> code = isolate->factory()->NewCode(
1952 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1953 #ifdef DEBUG
1954 code->Print();
1955 #endif
1956 F3 f = FUNCTION_CAST<F3>(code->entry());
1957 Object* dummy;
1958 TEST_VCVT(0, 0.0);
1959 TEST_VCVT(0, 0.1);
1960 TEST_VCVT(0, 0.5);
1961 TEST_VCVT(0, 0.9);
1962 TEST_VCVT(1, 1.0);
1963 TEST_VCVT(1, 1.1);
1964 TEST_VCVT(1, 1.5);
1965 TEST_VCVT(1, 1.9);
1966 TEST_VCVT(2, 2.5);
1967 TEST_VCVT(0, -1.0);
1968 TEST_VCVT(0, -1.1);
1969 TEST_VCVT(4294967294U, 4294967294.0);
1970 TEST_VCVT(4294967294U, 4294967294.5);
1971 TEST_VCVT(kMaxUInt32, 4294967295.0);
1972 TEST_VCVT(kMaxUInt32, 4294967296.0);
1973 TEST_VCVT(0, OS::nan_value());
1974 USE(dummy);
1975 }
1976 }
1977
1978
1979 #undef TEST_VCVT
1980
1546 #undef __ 1981 #undef __
OLDNEW
« no previous file with comments | « src/globals.h ('k') | test/cctest/test-disasm-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698