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

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

Issue 638983002: Implement bigint mulAdd and sqrAdd intrinsics on ARM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 if (TargetCPUFeatures::arm_version() == ARMv7) { 913 if (TargetCPUFeatures::arm_version() == ARMv7) {
914 __ Push(R4); 914 __ Push(R4);
915 __ mov(IP, Operand(R0)); 915 __ mov(IP, Operand(R0));
916 __ mul(R4, R2, R1); 916 __ mul(R4, R2, R1);
917 __ umull(R0, R1, R2, IP); 917 __ umull(R0, R1, R2, IP);
918 __ mla(R2, IP, R3, R4); 918 __ mla(R2, IP, R3, R4);
919 __ add(R1, R2, Operand(R1)); 919 __ add(R1, R2, Operand(R1));
920 __ Pop(R4); 920 __ Pop(R4);
921 } else { 921 } else {
922 __ LoadImmediate(R0, 6); 922 __ LoadImmediate(R0, 6);
923 __ LoadImmediate(R1, 0);
923 } 924 }
924 __ bx(LR); 925 __ bx(LR);
925 #if defined(USING_SIMULATOR) 926 #if defined(USING_SIMULATOR)
926 HostCPUFeatures::set_arm_version(version); 927 HostCPUFeatures::set_arm_version(version);
927 #endif 928 #endif
928 } 929 }
929 930
930 931
931 ASSEMBLER_TEST_RUN(Multiply64To64, test) { 932 ASSEMBLER_TEST_RUN(Multiply64To64, test) {
932 EXPECT(test != NULL); 933 EXPECT(test != NULL);
933 typedef int64_t (*Multiply64To64) 934 typedef int64_t (*Multiply64To64)
934 (int64_t operand0, int64_t operand1) DART_UNUSED; 935 (int64_t operand0, int64_t operand1) DART_UNUSED;
935 EXPECT_EQ(6, 936 EXPECT_EQ(6,
936 EXECUTE_TEST_CODE_INT64_LL(Multiply64To64, test->entry(), -3, -2)); 937 EXECUTE_TEST_CODE_INT64_LL(Multiply64To64, test->entry(), -3, -2));
937 } 938 }
938 939
939 940
940 ASSEMBLER_TEST_GENERATE(Multiply32To64, assembler) { 941 ASSEMBLER_TEST_GENERATE(Multiply32To64, assembler) {
941 #if defined(USING_SIMULATOR) 942 #if defined(USING_SIMULATOR)
942 const ARMVersion version = TargetCPUFeatures::arm_version(); 943 const ARMVersion version = TargetCPUFeatures::arm_version();
943 HostCPUFeatures::set_arm_version(ARMv7); 944 HostCPUFeatures::set_arm_version(ARMv7);
944 #endif 945 #endif
945 if (TargetCPUFeatures::arm_version() == ARMv7) { 946 if (TargetCPUFeatures::arm_version() == ARMv7) {
946 __ smull(R0, R1, R0, R2); 947 __ smull(R0, R1, R0, R2);
947 } else { 948 } else {
948 __ LoadImmediate(R0, 6); 949 __ LoadImmediate(R0, 6);
950 __ LoadImmediate(R1, 0);
949 } 951 }
950 __ bx(LR); 952 __ bx(LR);
951 #if defined(USING_SIMULATOR) 953 #if defined(USING_SIMULATOR)
952 HostCPUFeatures::set_arm_version(version); 954 HostCPUFeatures::set_arm_version(version);
953 #endif 955 #endif
954 } 956 }
955 957
956 958
957 ASSEMBLER_TEST_RUN(Multiply32To64, test) { 959 ASSEMBLER_TEST_RUN(Multiply32To64, test) {
958 EXPECT(test != NULL); 960 EXPECT(test != NULL);
959 typedef int64_t (*Multiply32To64) 961 typedef int64_t (*Multiply32To64)
960 (int64_t operand0, int64_t operand1) DART_UNUSED; 962 (int64_t operand0, int64_t operand1) DART_UNUSED;
961 EXPECT_EQ(6, 963 EXPECT_EQ(6,
962 EXECUTE_TEST_CODE_INT64_LL(Multiply32To64, test->entry(), -3, -2)); 964 EXECUTE_TEST_CODE_INT64_LL(Multiply32To64, test->entry(), -3, -2));
963 } 965 }
964 966
965 967
966 ASSEMBLER_TEST_GENERATE(MultiplyAccum32To64, assembler) { 968 ASSEMBLER_TEST_GENERATE(MultiplyAccum32To64, assembler) {
967 #if defined(USING_SIMULATOR) 969 #if defined(USING_SIMULATOR)
968 const ARMVersion version = TargetCPUFeatures::arm_version(); 970 const ARMVersion version = TargetCPUFeatures::arm_version();
969 HostCPUFeatures::set_arm_version(ARMv7); 971 HostCPUFeatures::set_arm_version(ARMv7);
970 #endif 972 #endif
971 if (TargetCPUFeatures::arm_version() == ARMv7) { 973 if (TargetCPUFeatures::arm_version() == ARMv7) {
972 __ smlal(R0, R1, R0, R2); 974 __ smlal(R0, R1, R0, R2);
973 } else { 975 } else {
974 __ LoadImmediate(R0, 3); 976 __ LoadImmediate(R0, 3);
977 __ LoadImmediate(R1, 0);
975 } 978 }
976 __ bx(LR); 979 __ bx(LR);
977 #if defined(USING_SIMULATOR) 980 #if defined(USING_SIMULATOR)
978 HostCPUFeatures::set_arm_version(version); 981 HostCPUFeatures::set_arm_version(version);
979 #endif 982 #endif
980 } 983 }
981 984
982 985
983 ASSEMBLER_TEST_RUN(MultiplyAccum32To64, test) { 986 ASSEMBLER_TEST_RUN(MultiplyAccum32To64, test) {
984 EXPECT(test != NULL); 987 EXPECT(test != NULL);
985 typedef int64_t (*Multiply32To64) 988 typedef int64_t (*MultiplyAccum32To64)
986 (int64_t operand0, int64_t operand1) DART_UNUSED; 989 (int64_t operand0, int64_t operand1) DART_UNUSED;
987 EXPECT_EQ(3, 990 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT64_LL(MultiplyAccum32To64, test->entry(),
988 EXECUTE_TEST_CODE_INT64_LL(Multiply32To64, test->entry(), -3, -2)); 991 -3, -2));
992 }
993
994
995 ASSEMBLER_TEST_GENERATE(MultiplyAccumAccum32To64, assembler) {
996 #if defined(USING_SIMULATOR)
997 const ARMVersion version = TargetCPUFeatures::arm_version();
998 HostCPUFeatures::set_arm_version(ARMv7);
999 #endif
1000 if (TargetCPUFeatures::arm_version() == ARMv7) {
1001 __ umaal(R0, R1, R2, R3);
1002 } else {
1003 __ LoadImmediate(R0, 3 + 7 + 5 * 11);
1004 __ LoadImmediate(R1, 0);
1005 }
1006 __ bx(LR);
1007 #if defined(USING_SIMULATOR)
1008 HostCPUFeatures::set_arm_version(version);
1009 #endif
1010 }
1011
1012
1013 ASSEMBLER_TEST_RUN(MultiplyAccumAccum32To64, test) {
1014 EXPECT(test != NULL);
1015 typedef int64_t (*MultiplyAccumAccum32To64)
1016 (int64_t operand0, int64_t operand1) DART_UNUSED;
1017 EXPECT_EQ((3LL << 32) + 7 + 5 * 11,
1018 EXECUTE_TEST_CODE_INT64_LL(MultiplyAccumAccum32To64, test->entry(),
1019 (3LL << 32) + 7, (5LL << 32) + 11));
989 } 1020 }
990 1021
991 1022
992 ASSEMBLER_TEST_GENERATE(Clz, assembler) { 1023 ASSEMBLER_TEST_GENERATE(Clz, assembler) {
993 Label error; 1024 Label error;
994 1025
995 __ mov(R0, Operand(0)); 1026 __ mov(R0, Operand(0));
996 __ clz(R1, R0); 1027 __ clz(R1, R0);
997 __ cmp(R1, Operand(32)); 1028 __ cmp(R1, Operand(32));
998 __ b(&error, NE); 1029 __ b(&error, NE);
(...skipping 3181 matching lines...) Expand 10 before | Expand all | Expand 10 after
4180 __ StoreIntoObject(R2, 4211 __ StoreIntoObject(R2,
4181 FieldAddress(R2, GrowableObjectArray::data_offset()), 4212 FieldAddress(R2, GrowableObjectArray::data_offset()),
4182 R1); 4213 R1);
4183 __ PopList((1 << CTX) | (1 << LR)); 4214 __ PopList((1 << CTX) | (1 << LR));
4184 __ Ret(); 4215 __ Ret();
4185 } 4216 }
4186 4217
4187 } // namespace dart 4218 } // namespace dart
4188 4219
4189 #endif // defined TARGET_ARCH_ARM 4220 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698