OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_DBC) | 6 #if defined(TARGET_ARCH_DBC) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/stack_frame.h" | 9 #include "vm/stack_frame.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 __ IfNeNull(0); | 1785 __ IfNeNull(0); |
1786 __ LoadConstant(1, Smi::Handle(Smi::New(42))); | 1786 __ LoadConstant(1, Smi::Handle(Smi::New(42))); |
1787 __ Return(1); | 1787 __ Return(1); |
1788 } | 1788 } |
1789 | 1789 |
1790 | 1790 |
1791 ASSEMBLER_TEST_RUN(IfNeNullNotNull, test) { | 1791 ASSEMBLER_TEST_RUN(IfNeNullNotNull, test) { |
1792 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); | 1792 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
1793 } | 1793 } |
1794 | 1794 |
| 1795 // - If<Cond> rA, rD |
| 1796 // |
| 1797 // Cond is Le, Lt, Ge, Gt. Skips the next instruction unless |
| 1798 // FP[rA] <Cond> FP[rD]. Assumes that FP[rA] and FP[rD] are Smis. |
| 1799 ASSEMBLER_TEST_GENERATE(IfLeTrue, assembler) { |
| 1800 __ Frame(3); |
| 1801 __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
| 1802 __ LoadConstant(1, Smi::Handle(Smi::New(-5))); |
| 1803 __ LoadConstant(2, Smi::Handle(Smi::New(100))); |
| 1804 __ IfLe(1, 2); |
| 1805 __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
| 1806 __ Return(0); |
| 1807 } |
| 1808 |
| 1809 |
| 1810 ASSEMBLER_TEST_RUN(IfLeTrue, test) { |
| 1811 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 1812 } |
| 1813 |
| 1814 |
| 1815 ASSEMBLER_TEST_GENERATE(IfLeFalse, assembler) { |
| 1816 __ Frame(3); |
| 1817 __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
| 1818 __ LoadConstant(1, Smi::Handle(Smi::New(100))); |
| 1819 __ LoadConstant(2, Smi::Handle(Smi::New(-5))); |
| 1820 __ IfLe(1, 2); |
| 1821 __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
| 1822 __ Return(0); |
| 1823 } |
| 1824 |
| 1825 |
| 1826 ASSEMBLER_TEST_RUN(IfLeFalse, test) { |
| 1827 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 1828 } |
| 1829 |
| 1830 |
| 1831 ASSEMBLER_TEST_GENERATE(IfLtTrue, assembler) { |
| 1832 __ Frame(3); |
| 1833 __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
| 1834 __ LoadConstant(1, Smi::Handle(Smi::New(-5))); |
| 1835 __ LoadConstant(2, Smi::Handle(Smi::New(100))); |
| 1836 __ IfLt(1, 2); |
| 1837 __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
| 1838 __ Return(0); |
| 1839 } |
| 1840 |
| 1841 |
| 1842 ASSEMBLER_TEST_RUN(IfLtTrue, test) { |
| 1843 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 1844 } |
| 1845 |
| 1846 |
| 1847 ASSEMBLER_TEST_GENERATE(IfLtFalse, assembler) { |
| 1848 __ Frame(3); |
| 1849 __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
| 1850 __ LoadConstant(1, Smi::Handle(Smi::New(100))); |
| 1851 __ LoadConstant(2, Smi::Handle(Smi::New(-5))); |
| 1852 __ IfLt(1, 2); |
| 1853 __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
| 1854 __ Return(0); |
| 1855 } |
| 1856 |
| 1857 |
| 1858 ASSEMBLER_TEST_RUN(IfLtFalse, test) { |
| 1859 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 1860 } |
| 1861 |
| 1862 |
| 1863 ASSEMBLER_TEST_GENERATE(IfGeTrue, assembler) { |
| 1864 __ Frame(3); |
| 1865 __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
| 1866 __ LoadConstant(1, Smi::Handle(Smi::New(100))); |
| 1867 __ LoadConstant(2, Smi::Handle(Smi::New(-5))); |
| 1868 __ IfGe(1, 2); |
| 1869 __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
| 1870 __ Return(0); |
| 1871 } |
| 1872 |
| 1873 |
| 1874 ASSEMBLER_TEST_RUN(IfGeTrue, test) { |
| 1875 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 1876 } |
| 1877 |
| 1878 |
| 1879 ASSEMBLER_TEST_GENERATE(IfGeFalse, assembler) { |
| 1880 __ Frame(3); |
| 1881 __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
| 1882 __ LoadConstant(1, Smi::Handle(Smi::New(-5))); |
| 1883 __ LoadConstant(2, Smi::Handle(Smi::New(100))); |
| 1884 __ IfGe(1, 2); |
| 1885 __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
| 1886 __ Return(0); |
| 1887 } |
| 1888 |
| 1889 |
| 1890 ASSEMBLER_TEST_RUN(IfGeFalse, test) { |
| 1891 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 1892 } |
| 1893 |
| 1894 |
| 1895 ASSEMBLER_TEST_GENERATE(IfGtTrue, assembler) { |
| 1896 __ Frame(3); |
| 1897 __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
| 1898 __ LoadConstant(1, Smi::Handle(Smi::New(100))); |
| 1899 __ LoadConstant(2, Smi::Handle(Smi::New(-5))); |
| 1900 __ IfGt(1, 2); |
| 1901 __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
| 1902 __ Return(0); |
| 1903 } |
| 1904 |
| 1905 |
| 1906 ASSEMBLER_TEST_RUN(IfGtTrue, test) { |
| 1907 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 1908 } |
| 1909 |
| 1910 |
| 1911 ASSEMBLER_TEST_GENERATE(IfGtFalse, assembler) { |
| 1912 __ Frame(3); |
| 1913 __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
| 1914 __ LoadConstant(1, Smi::Handle(Smi::New(-5))); |
| 1915 __ LoadConstant(2, Smi::Handle(Smi::New(100))); |
| 1916 __ IfGt(1, 2); |
| 1917 __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
| 1918 __ Return(0); |
| 1919 } |
| 1920 |
| 1921 |
| 1922 ASSEMBLER_TEST_RUN(IfGtFalse, test) { |
| 1923 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 1924 } |
| 1925 |
1795 } // namespace dart | 1926 } // namespace dart |
1796 | 1927 |
1797 #endif // defined(TARGET_ARCH_DBC) | 1928 #endif // defined(TARGET_ARCH_DBC) |
OLD | NEW |