OLD | NEW |
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/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/os.h" | 10 #include "vm/os.h" |
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1791 __ mov(R1, Operand(9)); | 1791 __ mov(R1, Operand(9)); |
1792 __ IntegerDivide(R0, R0, R1, D0, D1); | 1792 __ IntegerDivide(R0, R0, R1, D0, D1); |
1793 } | 1793 } |
1794 __ bx(LR); | 1794 __ bx(LR); |
1795 #endif | 1795 #endif |
1796 } | 1796 } |
1797 | 1797 |
1798 | 1798 |
1799 ASSEMBLER_TEST_RUN(IntDiv_supported, test) { | 1799 ASSEMBLER_TEST_RUN(IntDiv_supported, test) { |
1800 EXPECT(test != NULL); | 1800 EXPECT(test != NULL); |
| 1801 #if defined(USING_SIMULATOR) |
| 1802 bool orig = TargetCPUFeatures::integer_division_supported(); |
| 1803 HostCPUFeatures::set_integer_division_supported(true); |
1801 if (TargetCPUFeatures::can_divide()) { | 1804 if (TargetCPUFeatures::can_divide()) { |
1802 typedef int (*Tst)() DART_UNUSED; | 1805 typedef int (*Tst)() DART_UNUSED; |
1803 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); | 1806 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); |
1804 } | 1807 } |
| 1808 HostCPUFeatures::set_integer_division_supported(orig); |
| 1809 #else |
| 1810 if (TargetCPUFeatures::can_divide()) { |
| 1811 typedef int (*Tst)() DART_UNUSED; |
| 1812 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); |
| 1813 } |
| 1814 #endif |
1805 } | 1815 } |
1806 | 1816 |
1807 | 1817 |
1808 ASSEMBLER_TEST_GENERATE(IntDiv_unsupported, assembler) { | 1818 ASSEMBLER_TEST_GENERATE(IntDiv_unsupported, assembler) { |
1809 #if defined(USING_SIMULATOR) | 1819 #if defined(USING_SIMULATOR) |
1810 if (TargetCPUFeatures::can_divide()) { | 1820 if (TargetCPUFeatures::can_divide()) { |
1811 bool orig = TargetCPUFeatures::integer_division_supported(); | 1821 bool orig = TargetCPUFeatures::integer_division_supported(); |
1812 HostCPUFeatures::set_integer_division_supported(false); | 1822 HostCPUFeatures::set_integer_division_supported(false); |
1813 __ mov(R0, Operand(27)); | 1823 __ mov(R0, Operand(27)); |
1814 __ mov(R1, Operand(9)); | 1824 __ mov(R1, Operand(9)); |
1815 __ IntegerDivide(R0, R0, R1, D0, D1); | 1825 __ IntegerDivide(R0, R0, R1, D0, D1); |
1816 HostCPUFeatures::set_integer_division_supported(orig); | 1826 HostCPUFeatures::set_integer_division_supported(orig); |
1817 } | 1827 } |
1818 __ bx(LR); | 1828 __ bx(LR); |
1819 #else | 1829 #else |
1820 if (TargetCPUFeatures::can_divide()) { | 1830 if (TargetCPUFeatures::can_divide()) { |
1821 __ mov(R0, Operand(27)); | 1831 __ mov(R0, Operand(27)); |
1822 __ mov(R1, Operand(9)); | 1832 __ mov(R1, Operand(9)); |
1823 __ IntegerDivide(R0, R0, R1, D0, D1); | 1833 __ IntegerDivide(R0, R0, R1, D0, D1); |
1824 } | 1834 } |
1825 __ bx(LR); | 1835 __ bx(LR); |
1826 #endif | 1836 #endif |
1827 } | 1837 } |
1828 | 1838 |
1829 | 1839 |
1830 ASSEMBLER_TEST_RUN(IntDiv_unsupported, test) { | 1840 ASSEMBLER_TEST_RUN(IntDiv_unsupported, test) { |
1831 EXPECT(test != NULL); | 1841 EXPECT(test != NULL); |
| 1842 #if defined(USING_SIMULATOR) |
| 1843 bool orig = TargetCPUFeatures::integer_division_supported(); |
| 1844 HostCPUFeatures::set_integer_division_supported(false); |
1832 if (TargetCPUFeatures::can_divide()) { | 1845 if (TargetCPUFeatures::can_divide()) { |
1833 typedef int (*Tst)() DART_UNUSED; | 1846 typedef int (*Tst)() DART_UNUSED; |
1834 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); | 1847 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); |
1835 } | 1848 } |
| 1849 HostCPUFeatures::set_integer_division_supported(orig); |
| 1850 #else |
| 1851 if (TargetCPUFeatures::can_divide()) { |
| 1852 typedef int (*Tst)() DART_UNUSED; |
| 1853 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); |
| 1854 } |
| 1855 #endif |
1836 } | 1856 } |
1837 | 1857 |
1838 | 1858 |
1839 ASSEMBLER_TEST_GENERATE(Muls, assembler) { | 1859 ASSEMBLER_TEST_GENERATE(Muls, assembler) { |
1840 __ mov(R0, Operand(3)); | 1860 __ mov(R0, Operand(3)); |
1841 __ LoadImmediate(R1, -9); | 1861 __ LoadImmediate(R1, -9); |
1842 __ muls(R2, R0, R1); | 1862 __ muls(R2, R0, R1); |
1843 __ mov(R0, Operand(42), MI); | 1863 __ mov(R0, Operand(42), MI); |
1844 __ bx(LR); | 1864 __ bx(LR); |
1845 } | 1865 } |
(...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3989 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMinInt64))); | 4009 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMinInt64))); |
3990 | 4010 |
3991 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw())); | 4011 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw())); |
3992 | 4012 |
3993 #undef RANGE_OF | 4013 #undef RANGE_OF |
3994 } | 4014 } |
3995 | 4015 |
3996 } // namespace dart | 4016 } // namespace dart |
3997 | 4017 |
3998 #endif // defined TARGET_ARCH_ARM | 4018 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |