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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 typedef int64_t (*QuotientRemainder) | 837 typedef int64_t (*QuotientRemainder) |
838 (int64_t dividend, int64_t divisor) DART_UNUSED; | 838 (int64_t dividend, int64_t divisor) DART_UNUSED; |
839 EXPECT_EQ(0x1000400000da8LL, | 839 EXPECT_EQ(0x1000400000da8LL, |
840 EXECUTE_TEST_CODE_INT64_LL(QuotientRemainder, test->entry(), | 840 EXECUTE_TEST_CODE_INT64_LL(QuotientRemainder, test->entry(), |
841 0x12345678, 0x1234)); | 841 0x12345678, 0x1234)); |
842 } | 842 } |
843 } | 843 } |
844 | 844 |
845 | 845 |
846 ASSEMBLER_TEST_GENERATE(Multiply64To64, assembler) { | 846 ASSEMBLER_TEST_GENERATE(Multiply64To64, assembler) { |
847 #if defined(USING_SIMULATOR) | 847 __ Push(R4); |
848 const ARMVersion version = TargetCPUFeatures::arm_version(); | 848 __ mov(IP, Operand(R0)); |
849 HostCPUFeatures::set_arm_version(ARMv7); | 849 __ mul(R4, R2, R1); |
850 #endif | 850 __ umull(R0, R1, R2, IP); |
851 if (TargetCPUFeatures::arm_version() == ARMv7) { | 851 __ mla(R2, IP, R3, R4); |
852 __ Push(R4); | 852 __ add(R1, R2, Operand(R1)); |
853 __ mov(IP, Operand(R0)); | 853 __ Pop(R4); |
854 __ mul(R4, R2, R1); | |
855 __ umull(R0, R1, R2, IP); | |
856 __ mla(R2, IP, R3, R4); | |
857 __ add(R1, R2, Operand(R1)); | |
858 __ Pop(R4); | |
859 } else { | |
860 __ LoadImmediate(R0, 6); | |
861 __ LoadImmediate(R1, 0); | |
862 } | |
863 __ bx(LR); | 854 __ bx(LR); |
864 #if defined(USING_SIMULATOR) | |
865 HostCPUFeatures::set_arm_version(version); | |
866 #endif | |
867 } | 855 } |
868 | 856 |
869 | 857 |
870 ASSEMBLER_TEST_RUN(Multiply64To64, test) { | 858 ASSEMBLER_TEST_RUN(Multiply64To64, test) { |
871 EXPECT(test != NULL); | 859 EXPECT(test != NULL); |
872 typedef int64_t (*Multiply64To64) | 860 typedef int64_t (*Multiply64To64) |
873 (int64_t operand0, int64_t operand1) DART_UNUSED; | 861 (int64_t operand0, int64_t operand1) DART_UNUSED; |
874 EXPECT_EQ(6, | 862 EXPECT_EQ(6, |
875 EXECUTE_TEST_CODE_INT64_LL(Multiply64To64, test->entry(), -3, -2)); | 863 EXECUTE_TEST_CODE_INT64_LL(Multiply64To64, test->entry(), -3, -2)); |
876 } | 864 } |
877 | 865 |
878 | 866 |
879 ASSEMBLER_TEST_GENERATE(Multiply32To64, assembler) { | 867 ASSEMBLER_TEST_GENERATE(Multiply32To64, assembler) { |
880 __ smull(R0, R1, R0, R2); | 868 __ smull(R0, R1, R0, R2); |
881 __ bx(LR); | 869 __ bx(LR); |
882 } | 870 } |
883 | 871 |
884 | 872 |
885 ASSEMBLER_TEST_RUN(Multiply32To64, test) { | 873 ASSEMBLER_TEST_RUN(Multiply32To64, test) { |
886 EXPECT(test != NULL); | 874 EXPECT(test != NULL); |
887 typedef int64_t (*Multiply32To64) | 875 typedef int64_t (*Multiply32To64) |
888 (int64_t operand0, int64_t operand1) DART_UNUSED; | 876 (int64_t operand0, int64_t operand1) DART_UNUSED; |
889 EXPECT_EQ(6, | 877 EXPECT_EQ(6, |
890 EXECUTE_TEST_CODE_INT64_LL(Multiply32To64, test->entry(), -3, -2)); | 878 EXECUTE_TEST_CODE_INT64_LL(Multiply32To64, test->entry(), -3, -2)); |
891 } | 879 } |
892 | 880 |
893 | 881 |
894 ASSEMBLER_TEST_GENERATE(MultiplyAccum32To64, assembler) { | |
895 #if defined(USING_SIMULATOR) | |
896 const ARMVersion version = TargetCPUFeatures::arm_version(); | |
897 HostCPUFeatures::set_arm_version(ARMv7); | |
898 #endif | |
899 if (TargetCPUFeatures::arm_version() == ARMv7) { | |
900 __ smlal(R0, R1, R0, R2); | |
901 } else { | |
902 __ LoadImmediate(R0, 3); | |
903 __ LoadImmediate(R1, 0); | |
904 } | |
905 __ bx(LR); | |
906 #if defined(USING_SIMULATOR) | |
907 HostCPUFeatures::set_arm_version(version); | |
908 #endif | |
909 } | |
910 | |
911 | |
912 ASSEMBLER_TEST_RUN(MultiplyAccum32To64, test) { | |
913 EXPECT(test != NULL); | |
914 typedef int64_t (*MultiplyAccum32To64) | |
915 (int64_t operand0, int64_t operand1) DART_UNUSED; | |
916 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT64_LL(MultiplyAccum32To64, test->entry(), | |
917 -3, -2)); | |
918 } | |
919 | |
920 | |
921 ASSEMBLER_TEST_GENERATE(MultiplyAccumAccum32To64, assembler) { | 882 ASSEMBLER_TEST_GENERATE(MultiplyAccumAccum32To64, assembler) { |
922 #if defined(USING_SIMULATOR) | 883 __ umaal(R0, R1, R2, R3); |
923 const ARMVersion version = TargetCPUFeatures::arm_version(); | |
924 HostCPUFeatures::set_arm_version(ARMv7); | |
925 #endif | |
926 if (TargetCPUFeatures::arm_version() == ARMv7) { | |
927 __ umaal(R0, R1, R2, R3); | |
928 } else { | |
929 __ LoadImmediate(R0, 3 + 7 + 5 * 11); | |
930 __ LoadImmediate(R1, 0); | |
931 } | |
932 __ bx(LR); | 884 __ bx(LR); |
933 #if defined(USING_SIMULATOR) | |
934 HostCPUFeatures::set_arm_version(version); | |
935 #endif | |
936 } | 885 } |
937 | 886 |
938 | 887 |
939 ASSEMBLER_TEST_RUN(MultiplyAccumAccum32To64, test) { | 888 ASSEMBLER_TEST_RUN(MultiplyAccumAccum32To64, test) { |
940 EXPECT(test != NULL); | 889 EXPECT(test != NULL); |
941 typedef int64_t (*MultiplyAccumAccum32To64) | 890 typedef int64_t (*MultiplyAccumAccum32To64) |
942 (int64_t operand0, int64_t operand1) DART_UNUSED; | 891 (int64_t operand0, int64_t operand1) DART_UNUSED; |
943 EXPECT_EQ(3 + 7 + 5 * 11, | 892 EXPECT_EQ(3 + 7 + 5 * 11, |
944 EXECUTE_TEST_CODE_INT64_LL(MultiplyAccumAccum32To64, test->entry(), | 893 EXECUTE_TEST_CODE_INT64_LL(MultiplyAccumAccum32To64, test->entry(), |
945 (3LL << 32) + 7, (5LL << 32) + 11)); | 894 (3LL << 32) + 7, (5LL << 32) + 11)); |
(...skipping 3092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4038 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMinInt64))); | 3987 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMinInt64))); |
4039 | 3988 |
4040 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw())); | 3989 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw())); |
4041 | 3990 |
4042 #undef RANGE_OF | 3991 #undef RANGE_OF |
4043 } | 3992 } |
4044 | 3993 |
4045 } // namespace dart | 3994 } // namespace dart |
4046 | 3995 |
4047 #endif // defined TARGET_ARCH_ARM | 3996 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |