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

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

Issue 646493003: Implement bigint absAdd, bigint absSub, and Montgomery mulMod 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
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_ia32.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 (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" // Needed here to get TARGET_ARCH_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 __ Ret(); 872 __ Ret();
873 } 873 }
874 874
875 875
876 void Intrinsifier::Smi_bitLength(Assembler* assembler) { 876 void Intrinsifier::Smi_bitLength(Assembler* assembler) {
877 // TODO(sra): Implement as word-length - CLZ. 877 // TODO(sra): Implement as word-length - CLZ.
878 } 878 }
879 879
880 880
881 void Intrinsifier::Bigint_setNeg(Assembler* assembler) { 881 void Intrinsifier::Bigint_setNeg(Assembler* assembler) {
882 __ ldr(R0, Address(SP, 0 * kWordSize)); 882 if (TargetCPUFeatures::arm_version() == ARMv7) {
zra 2014/10/09 15:39:29 ldrd is okay on all versions of arm we support. He
regis 2014/10/10 07:42:38 Test removed. Thanks! I remember checking TEQ and
883 __ ldr(R1, Address(SP, 1 * kWordSize)); 883 __ ldrd(R0, Address(SP, 0 * kWordSize)); // R0 = this, R1 = neg value.
884 } else {
885 __ ldr(R0, Address(SP, 0 * kWordSize));
886 __ ldr(R1, Address(SP, 1 * kWordSize));
887 }
884 __ StoreIntoObject(R1, FieldAddress(R1, Bigint::neg_offset()), R0, false); 888 __ StoreIntoObject(R1, FieldAddress(R1, Bigint::neg_offset()), R0, false);
885 __ Ret(); 889 __ Ret();
886 } 890 }
887 891
888 892
889 void Intrinsifier::Bigint_setUsed(Assembler* assembler) { 893 void Intrinsifier::Bigint_setUsed(Assembler* assembler) {
890 __ ldr(R0, Address(SP, 0 * kWordSize)); 894 if (TargetCPUFeatures::arm_version() == ARMv7) {
891 __ ldr(R1, Address(SP, 1 * kWordSize)); 895 __ ldrd(R0, Address(SP, 0 * kWordSize)); // R0 = this, R1 = used value.
896 } else {
897 __ ldr(R0, Address(SP, 0 * kWordSize));
898 __ ldr(R1, Address(SP, 1 * kWordSize));
899 }
892 __ StoreIntoObject(R1, FieldAddress(R1, Bigint::used_offset()), R0); 900 __ StoreIntoObject(R1, FieldAddress(R1, Bigint::used_offset()), R0);
893 __ Ret(); 901 __ Ret();
894 } 902 }
895 903
896 904
897 void Intrinsifier::Bigint_setDigits(Assembler* assembler) { 905 void Intrinsifier::Bigint_setDigits(Assembler* assembler) {
898 __ ldr(R0, Address(SP, 0 * kWordSize)); 906 if (TargetCPUFeatures::arm_version() == ARMv7) {
899 __ ldr(R1, Address(SP, 1 * kWordSize)); 907 __ ldrd(R0, Address(SP, 0 * kWordSize)); // R0 = this, R1 = digits value.
908 } else {
909 __ ldr(R0, Address(SP, 0 * kWordSize));
910 __ ldr(R1, Address(SP, 1 * kWordSize));
911 }
900 __ StoreIntoObject(R1, FieldAddress(R1, Bigint::digits_offset()), R0, false); 912 __ StoreIntoObject(R1, FieldAddress(R1, Bigint::digits_offset()), R0, false);
901 __ Ret(); 913 __ Ret();
902 } 914 }
903 915
904 916
905 void Intrinsifier::Bigint_absAdd(Assembler* assembler) { 917 void Intrinsifier::Bigint_absAdd(Assembler* assembler) {
906 // TODO(regis): Implement. 918 if (TargetCPUFeatures::arm_version() != ARMv7) {
zra 2014/10/09 15:39:28 This looks safe to enable on ARMv5TE and ARMv6.
regis 2014/10/10 07:42:38 You are right. Test removed. TEQ is ARMv6 with Thu
919 return;
920 }
921 // static void _absAdd(Uint32List digits, int used,
922 // Uint32List a_digits, int a_used,
923 // Uint32List r_digits)
924
925 // R2 = used, R3 = digits
926 __ ldrd(R2, Address(SP, 3 * kWordSize));
927 __ add(R3, R3, Operand(TypedData::data_offset() - kHeapObjectTag));
928
929 // R4 = a_used, R5 = a_digits
930 __ ldrd(R4, Address(SP, 1 * kWordSize));
931 __ add(R5, R5, Operand(TypedData::data_offset() - kHeapObjectTag));
932
933 // R6 = r_digits
934 __ ldr(R6, Address(SP, 0 * kWordSize));
935 __ add(R6, R6, Operand(TypedData::data_offset() - kHeapObjectTag));
936
937 // R7 = &digits[a_used >> 1], a_used is Smi.
938 __ add(R7, R3, Operand(R4, LSL, 1));
939
940 // R8 = &digits[used >> 1], used is Smi.
941 __ add(R8, R3, Operand(R2, LSL, 1));
942
943 __ adds(R0, R0, Operand(0)); // carry flag = 0
944 Label add_loop;
945 __ Bind(&add_loop);
946 __ ldr(R0, Address(R3, kWordSize, Address::PostIndex));
947 __ ldr(R1, Address(R5, kWordSize, Address::PostIndex));
948 __ adcs(R0, R0, Operand(R1));
949 __ str(R0, Address(R6, kWordSize, Address::PostIndex));
950 __ teq(R3, Operand(R7)); // Does not affect carry flag.
zra 2014/10/09 15:39:28 It probably won't make a difference, but you can s
regis 2014/10/10 07:42:38 Done.
951 __ b(&add_loop, NE);
952
953 Label last_carry;
954 __ teq(R3, Operand(R8)); // Does not affect carry flag.
955 __ b(&last_carry, EQ);
956
957 Label carry_loop;
958 __ Bind(&carry_loop);
959 __ ldr(R0, Address(R3, kWordSize, Address::PostIndex));
960 __ adcs(R0, R0, Operand(0));
961 __ str(R0, Address(R6, kWordSize, Address::PostIndex));
962 __ teq(R3, Operand(R8)); // Does not affect carry flag.
963 __ b(&carry_loop, NE);
964
965 __ Bind(&last_carry);
966 __ mov(R0, Operand(0));
967 __ adc(R0, R0, Operand(0));
968 __ str(R0, Address(R6, 0));
969 __ Ret();
907 } 970 }
908 971
909 972
910 void Intrinsifier::Bigint_absSub(Assembler* assembler) { 973 void Intrinsifier::Bigint_absSub(Assembler* assembler) {
911 // TODO(regis): Implement. 974 if (TargetCPUFeatures::arm_version() != ARMv7) {
zra 2014/10/09 15:39:28 This looks safe to enable on ARMv5TE and ARMv6.
regis 2014/10/10 07:42:38 Done.
975 return;
976 }
977 // static void _absSub(Uint32List digits, int used,
978 // Uint32List a_digits, int a_used,
979 // Uint32List r_digits)
980
981 // R2 = used, R3 = digits
982 __ ldrd(R2, Address(SP, 3 * kWordSize));
983 __ add(R3, R3, Operand(TypedData::data_offset() - kHeapObjectTag));
984
985 // R4 = a_used, R5 = a_digits
986 __ ldrd(R4, Address(SP, 1 * kWordSize));
987 __ add(R5, R5, Operand(TypedData::data_offset() - kHeapObjectTag));
988
989 // R6 = r_digits
990 __ ldr(R6, Address(SP, 0 * kWordSize));
991 __ add(R6, R6, Operand(TypedData::data_offset() - kHeapObjectTag));
992
993 // R7 = &digits[a_used >> 1], a_used is Smi.
994 __ add(R7, R3, Operand(R4, LSL, 1));
995
996 // R8 = &digits[used >> 1], used is Smi.
997 __ add(R8, R3, Operand(R2, LSL, 1));
998
999 __ subs(R0, R0, Operand(0)); // carry flag = 1
1000 Label add_loop;
1001 __ Bind(&add_loop);
1002 __ ldr(R0, Address(R3, kWordSize, Address::PostIndex));
1003 __ ldr(R1, Address(R5, kWordSize, Address::PostIndex));
1004 __ sbcs(R0, R0, Operand(R1));
1005 __ str(R0, Address(R6, kWordSize, Address::PostIndex));
1006 __ teq(R3, Operand(R7)); // Does not affect carry flag.
zra 2014/10/09 15:39:28 Same comment as loop in absAdd.
regis 2014/10/10 07:42:39 Done.
1007 __ b(&add_loop, NE);
1008
1009 Label done;
1010 __ teq(R3, Operand(R8)); // Does not affect carry flag.
1011 __ b(&done, EQ);
1012
1013 Label carry_loop;
1014 __ Bind(&carry_loop);
1015 __ ldr(R0, Address(R3, kWordSize, Address::PostIndex));
1016 __ sbcs(R0, R0, Operand(0));
1017 __ str(R0, Address(R6, kWordSize, Address::PostIndex));
1018 __ teq(R3, Operand(R8)); // Does not affect carry flag.
1019 __ b(&carry_loop, NE);
1020
1021 __ Bind(&done);
1022 __ Ret();
912 } 1023 }
913 1024
914 1025
915 void Intrinsifier::Bigint_mulAdd(Assembler* assembler) { 1026 void Intrinsifier::Bigint_mulAdd(Assembler* assembler) {
916 if (TargetCPUFeatures::arm_version() != ARMv7) { 1027 if (TargetCPUFeatures::arm_version() != ARMv7) {
917 return; 1028 return;
918 } 1029 }
919 // Pseudo code: 1030 // Pseudo code:
920 // static void _mulAdd(Uint32List x_digits, int xi, 1031 // static void _mulAdd(Uint32List x_digits, int xi,
921 // Uint32List m_digits, int i, 1032 // Uint32List m_digits, int i,
(...skipping 15 matching lines...) Expand all
937 // } while (--n > 0); 1048 // } while (--n > 0);
938 // while (c != 0) { 1049 // while (c != 0) {
939 // uint64_t t = *ajp + c; 1050 // uint64_t t = *ajp + c;
940 // *ajp++ = low32(t); 1051 // *ajp++ = low32(t);
941 // c = high32(t); // c == 0 or 1. 1052 // c = high32(t); // c == 0 or 1.
942 // } 1053 // }
943 // } 1054 // }
944 1055
945 Label done; 1056 Label done;
946 // R3 = x, no_op if x == 0 1057 // R3 = x, no_op if x == 0
947 __ ldr(R1, Address(SP, 6 * kWordSize)); // x_digits 1058 __ ldrd(R0, Address(SP, 5 * kWordSize)); // R0 = xi as Smi, R1 = x_digits.
948 __ ldr(R0, Address(SP, 5 * kWordSize)); // xi is Smi
949 __ add(R1, R1, Operand(R0, LSL, 1)); 1059 __ add(R1, R1, Operand(R0, LSL, 1));
950 __ ldr(R3, FieldAddress(R1, TypedData::data_offset())); 1060 __ ldr(R3, FieldAddress(R1, TypedData::data_offset()));
951 __ tst(R3, Operand(R3)); 1061 __ tst(R3, Operand(R3));
952 __ b(&done, EQ); 1062 __ b(&done, EQ);
953 1063
954 // R6 = SmiUntag(n), no_op if n == 0 1064 // R6 = SmiUntag(n), no_op if n == 0
955 __ ldr(R6, Address(SP, 0 * kWordSize)); 1065 __ ldr(R6, Address(SP, 0 * kWordSize));
956 __ Asrs(R6, R6, Operand(kSmiTagSize)); 1066 __ Asrs(R6, R6, Operand(kSmiTagSize));
957 __ b(&done, EQ); 1067 __ b(&done, EQ);
958 1068
959 // R4 = mip = &m_digits[i >> 1] 1069 // R4 = mip = &m_digits[i >> 1]
960 __ ldr(R1, Address(SP, 4 * kWordSize)); // m_digits 1070 __ ldrd(R0, Address(SP, 3 * kWordSize)); // R0 = i as Smi, R1 = m_digits.
961 __ ldr(R0, Address(SP, 3 * kWordSize)); // i is Smi
962 __ add(R1, R1, Operand(R0, LSL, 1)); 1071 __ add(R1, R1, Operand(R0, LSL, 1));
963 __ add(R4, R1, Operand(TypedData::data_offset() - kHeapObjectTag)); 1072 __ add(R4, R1, Operand(TypedData::data_offset() - kHeapObjectTag));
964 1073
965 // R5 = ajp = &a_digits[j >> 1] 1074 // R5 = ajp = &a_digits[j >> 1]
966 __ ldr(R1, Address(SP, 2 * kWordSize)); // a_digits 1075 __ ldrd(R0, Address(SP, 1 * kWordSize)); // R0 = j as Smi, R1 = a_digits.
967 __ ldr(R0, Address(SP, 1 * kWordSize)); // j is Smi
968 __ add(R1, R1, Operand(R0, LSL, 1)); 1076 __ add(R1, R1, Operand(R0, LSL, 1));
969 __ add(R5, R1, Operand(TypedData::data_offset() - kHeapObjectTag)); 1077 __ add(R5, R1, Operand(TypedData::data_offset() - kHeapObjectTag));
970 1078
971 // R1 = c = 0 1079 // R1 = c = 0
972 __ mov(R1, Operand(0)); 1080 __ mov(R1, Operand(0));
973 1081
974 Label muladd_loop; 1082 Label muladd_loop;
975 __ Bind(&muladd_loop); 1083 __ Bind(&muladd_loop);
976 // x: R3 1084 // x: R3
977 // mip: R4 1085 // mip: R4
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 // *ajp++ = low32(t); 1149 // *ajp++ = low32(t);
1042 // c = high64(t); // 33-bit. 1150 // c = high64(t); // 33-bit.
1043 // } 1151 // }
1044 // uint32_t aj = *ajp; 1152 // uint32_t aj = *ajp;
1045 // uint64_t t = aj + c; // 32-bit + 33-bit -> 34-bit. 1153 // uint64_t t = aj + c; // 32-bit + 33-bit -> 34-bit.
1046 // *ajp++ = low32(t); 1154 // *ajp++ = low32(t);
1047 // *ajp = high32(t); 1155 // *ajp = high32(t);
1048 // } 1156 // }
1049 1157
1050 // R4 = xip = &x_digits[i >> 1] 1158 // R4 = xip = &x_digits[i >> 1]
1051 __ ldr(R1, Address(SP, 3 * kWordSize)); // x_digits 1159 __ ldrd(R2, Address(SP, 2 * kWordSize)); // R2 = i as Smi, R3 = x_digits
1052 __ ldr(R6, Address(SP, 2 * kWordSize)); // i is Smi 1160 __ add(R3, R3, Operand(R2, LSL, 1));
1053 __ add(R1, R1, Operand(R6, LSL, 1)); 1161 __ add(R4, R3, Operand(TypedData::data_offset() - kHeapObjectTag));
1054 __ add(R4, R1, Operand(TypedData::data_offset() - kHeapObjectTag));
1055 1162
1056 // R3 = x = *xip++, return if x == 0 1163 // R3 = x = *xip++, return if x == 0
1057 Label x_zero; 1164 Label x_zero;
1058 __ ldr(R3, Address(R4, kWordSize, Address::PostIndex)); 1165 __ ldr(R3, Address(R4, kWordSize, Address::PostIndex));
1059 __ tst(R3, Operand(R3)); 1166 __ tst(R3, Operand(R3));
1060 __ b(&x_zero, EQ); 1167 __ b(&x_zero, EQ);
1061 1168
1062 // R5 = ajp = &a_digits[i] 1169 // R5 = ajp = &a_digits[i]
1063 __ ldr(R1, Address(SP, 1 * kWordSize)); // a_digits 1170 __ ldr(R1, Address(SP, 1 * kWordSize)); // a_digits
1064 __ add(R1, R1, Operand(R6, LSL, 2)); // j == 2*i, i is Smi. 1171 __ add(R1, R1, Operand(R2, LSL, 2)); // j == 2*i, i is Smi.
1065 __ add(R5, R1, Operand(TypedData::data_offset() - kHeapObjectTag)); 1172 __ add(R5, R1, Operand(TypedData::data_offset() - kHeapObjectTag));
1066 1173
1067 // R7:R0 = t = x*x + *ajp 1174 // R6:R0 = t = x*x + *ajp
1068 __ ldr(R0, Address(R5, 0)); 1175 __ ldr(R0, Address(R5, 0));
1069 __ mov(R7, Operand(0)); 1176 __ mov(R6, Operand(0));
1070 __ umaal(R0, R7, R3, R3); // R7:R0 = R3*R3 + R7 + R0. 1177 __ umaal(R0, R6, R3, R3); // R6:R0 = R3*R3 + R6 + R0.
1071 1178
1072 // *ajp++ = low32(t) = R0 1179 // *ajp++ = low32(t) = R0
1073 __ str(R0, Address(R5, kWordSize, Address::PostIndex)); 1180 __ str(R0, Address(R5, kWordSize, Address::PostIndex));
1074 1181
1075 // R7 = low32(c) = high32(t) 1182 // R6 = low32(c) = high32(t)
1076 // R8 = high32(c) = 0 1183 // R7 = high32(c) = 0
1077 __ mov(R8, Operand(0)); 1184 __ mov(R7, Operand(0));
1078 1185
1079 // int n = used - i - 1 1186 // int n = used - i - 1
1080 __ ldr(R0, Address(SP, 0 * kWordSize)); // used is Smi 1187 __ ldr(R0, Address(SP, 0 * kWordSize)); // used is Smi
1081 __ sub(R6, R0, Operand(R6)); 1188 __ sub(R8, R0, Operand(R2));
1082 __ mov(R0, Operand(2)); // while (--n >= 0) 1189 __ mov(R0, Operand(2)); // while (--n >= 0)
1083 __ rsbs(R6, R0, Operand(R6, ASR, kSmiTagSize)); 1190 __ rsbs(R8, R0, Operand(R8, ASR, kSmiTagSize));
1084 1191
1085 Label loop, done; 1192 Label loop, done;
1086 __ b(&done, MI); 1193 __ b(&done, MI);
1087 1194
1088 __ Bind(&loop); 1195 __ Bind(&loop);
1089 // x: R3 1196 // x: R3
1090 // xip: R4 1197 // xip: R4
1091 // ajp: R5 1198 // ajp: R5
1092 // c: R8:R7 1199 // c: R7:R6
1093 // t: R2:R1:R0 (not live at loop entry) 1200 // t: R2:R1:R0 (not live at loop entry)
1094 // n: R6 1201 // n: R8
1095 1202
1096 // uint32_t xi = *xip++ 1203 // uint32_t xi = *xip++
1097 __ ldr(R2, Address(R4, kWordSize, Address::PostIndex)); 1204 __ ldr(R2, Address(R4, kWordSize, Address::PostIndex));
1098 1205
1099 // uint32_t aj = *ajp 1206 // uint32_t aj = *ajp
1100 __ ldr(R1, Address(R5, 0)); 1207 __ ldr(R1, Address(R5, 0));
1101 1208
1102 // uint96_t t = R2:R1:R0 = 2*x*xi + aj + c 1209 // uint96_t t = R2:R1:R0 = 2*x*xi + aj + c
1103 __ mov(R0, Operand(0)); 1210 __ mov(R0, Operand(0));
1104 __ umaal(R0, R1, R2, R3); // R1:R0 = R3*R2 + R1 + R0 = x*xi + aj + 0. 1211 __ umaal(R0, R1, R2, R3); // R1:R0 = R3*R2 + R1 + R0 = x*xi + aj + 0.
1105 __ umlal(R7, R8, R2, R3); // R8:R7 += R3*R2; c += x*xi. 1212 __ umlal(R6, R7, R2, R3); // R7:R6 += R3*R2; c += x*xi.
1106 __ adds(R0, R0, Operand(R7)); 1213 __ adds(R0, R0, Operand(R6));
1107 __ adcs(R7, R1, Operand(R8)); 1214 __ adcs(R6, R1, Operand(R7));
1108 __ mov(R8, Operand(0)); 1215 __ mov(R7, Operand(0));
1109 __ adc(R8, R8, Operand(0)); // R8:R7:R0 = R1:R0 + R8:R7 = 2*x*xi + aj + c. 1216 __ adc(R7, R7, Operand(0)); // R7:R6:R0 = R1:R0 + R7:R6 = 2*x*xi + aj + c.
1110 1217
1111 // *ajp++ = low32(t) = R0 1218 // *ajp++ = low32(t) = R0
1112 __ str(R0, Address(R5, kWordSize, Address::PostIndex)); 1219 __ str(R0, Address(R5, kWordSize, Address::PostIndex));
1113 1220
1114 // while (--n >= 0) 1221 // while (--n >= 0)
1115 __ subs(R6, R6, Operand(1)); // --n 1222 __ subs(R8, R8, Operand(1)); // --n
1116 __ b(&loop, PL); 1223 __ b(&loop, PL);
1117 1224
1118 __ Bind(&done); 1225 __ Bind(&done);
1119 // uint32_t aj = *ajp 1226 // uint32_t aj = *ajp
1120 __ ldr(R0, Address(R5, 0)); 1227 __ ldr(R0, Address(R5, 0));
1121 1228
1122 // uint64_t t = aj + c 1229 // uint64_t t = aj + c
1123 __ adds(R7, R7, Operand(R0)); 1230 __ adds(R6, R6, Operand(R0));
1124 __ adc(R8, R8, Operand(0)); 1231 __ adc(R7, R7, Operand(0));
1125 1232
1126 // *ajp++ = low32(t) 1233 // *ajp = low32(t) = R6
1127 // *ajp = high32(t) 1234 // *(ajp + 1) = high32(t) = R7
1128 __ str(R7, Address(R5, 0)); 1235 __ strd(R6, Address(R5, 0));
1129 __ str(R8, Address(R5, kWordSize));
1130 1236
1131 __ Bind(&x_zero); 1237 __ Bind(&x_zero);
1132 __ Ret(); 1238 __ Ret();
1133 } 1239 }
1134 1240
1135 1241
1136 void Intrinsifier::Bigint_estQuotientDigit(Assembler* assembler) { 1242 void Intrinsifier::Bigint_estQuotientDigit(Assembler* assembler) {
1137 // TODO(regis): Implement. 1243 // TODO(regis): Implement.
1138 } 1244 }
1139 1245
1140 1246
1141 void Intrinsifier::Montgomery_mulMod(Assembler* assembler) { 1247 void Intrinsifier::Montgomery_mulMod(Assembler* assembler) {
1142 // TODO(regis): Implement. 1248 if (TargetCPUFeatures::arm_version() != ARMv7) {
1249 return;
1250 }
1251 // Pseudo code:
1252 // static void _mulMod(Uint32List args, Uint32List digits, int i) {
1253 // uint32_t rho = args[_RHO]; // _RHO == 0.
1254 // uint32_t d = digits[i >> 1]; // i is Smi.
1255 // uint64_t t = rho*d;
1256 // args[_MU] = t mod DIGIT_BASE; // _MU == 1.
1257 // }
1258
1259 // R4 = args
1260 __ ldr(R4, Address(SP, 2 * kWordSize)); // args
1261
1262 // R3 = rho = args[0]
1263 __ ldr(R3, FieldAddress(R4, TypedData::data_offset()));
1264
1265 // R2 = digits[i >> 1]
1266 __ ldrd(R0, Address(SP, 0 * kWordSize)); // R0 = i as Smi, R1 = digits
1267 __ add(R1, R1, Operand(R0, LSL, 1));
1268 __ ldr(R2, FieldAddress(R1, TypedData::data_offset()));
1269
1270 // R1:R0 = t = rho*d
1271 __ umull(R0, R1, R2, R3);
1272
1273 // args[1] = t mod DIGIT_BASE = low32(t)
1274 __ str(R0, FieldAddress(R4, TypedData::data_offset() + kWordSize));
1275 __ Ret();
1143 } 1276 }
1144 1277
1145 1278
1146 // Check if the last argument is a double, jump to label 'is_smi' if smi 1279 // Check if the last argument is a double, jump to label 'is_smi' if smi
1147 // (easy to convert to double), otherwise jump to label 'not_double_smi', 1280 // (easy to convert to double), otherwise jump to label 'not_double_smi',
1148 // Returns the last argument in R0. 1281 // Returns the last argument in R0.
1149 static void TestLastArgumentIsDouble(Assembler* assembler, 1282 static void TestLastArgumentIsDouble(Assembler* assembler,
1150 Label* is_smi, 1283 Label* is_smi,
1151 Label* not_double_smi) { 1284 Label* not_double_smi) {
1152 __ ldr(R0, Address(SP, 0 * kWordSize)); 1285 __ ldr(R0, Address(SP, 0 * kWordSize));
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 Isolate* isolate = Isolate::Current(); 2013 Isolate* isolate = Isolate::Current();
1881 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); 2014 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate));
1882 // Set return value to Isolate::current_tag_. 2015 // Set return value to Isolate::current_tag_.
1883 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); 2016 __ ldr(R0, Address(R1, Isolate::current_tag_offset()));
1884 __ Ret(); 2017 __ Ret();
1885 } 2018 }
1886 2019
1887 } // namespace dart 2020 } // namespace dart
1888 2021
1889 #endif // defined TARGET_ARCH_ARM 2022 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698