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

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 __ ldrd(R0, Address(SP, 0 * kWordSize)); // R0 = this, R1 = neg value.
883 __ ldr(R1, Address(SP, 1 * kWordSize));
884 __ StoreIntoObject(R1, FieldAddress(R1, Bigint::neg_offset()), R0, false); 883 __ StoreIntoObject(R1, FieldAddress(R1, Bigint::neg_offset()), R0, false);
885 __ Ret(); 884 __ Ret();
886 } 885 }
887 886
888 887
889 void Intrinsifier::Bigint_setUsed(Assembler* assembler) { 888 void Intrinsifier::Bigint_setUsed(Assembler* assembler) {
890 __ ldr(R0, Address(SP, 0 * kWordSize)); 889 __ ldrd(R0, Address(SP, 0 * kWordSize)); // R0 = this, R1 = used value.
891 __ ldr(R1, Address(SP, 1 * kWordSize));
892 __ StoreIntoObject(R1, FieldAddress(R1, Bigint::used_offset()), R0); 890 __ StoreIntoObject(R1, FieldAddress(R1, Bigint::used_offset()), R0);
893 __ Ret(); 891 __ Ret();
894 } 892 }
895 893
896 894
897 void Intrinsifier::Bigint_setDigits(Assembler* assembler) { 895 void Intrinsifier::Bigint_setDigits(Assembler* assembler) {
898 __ ldr(R0, Address(SP, 0 * kWordSize)); 896 __ ldrd(R0, Address(SP, 0 * kWordSize)); // R0 = this, R1 = digits value.
899 __ ldr(R1, Address(SP, 1 * kWordSize));
900 __ StoreIntoObject(R1, FieldAddress(R1, Bigint::digits_offset()), R0, false); 897 __ StoreIntoObject(R1, FieldAddress(R1, Bigint::digits_offset()), R0, false);
901 __ Ret(); 898 __ Ret();
902 } 899 }
903 900
904 901
905 void Intrinsifier::Bigint_absAdd(Assembler* assembler) { 902 void Intrinsifier::Bigint_absAdd(Assembler* assembler) {
906 // TODO(regis): Implement. 903 // static void _absAdd(Uint32List digits, int used,
904 // Uint32List a_digits, int a_used,
905 // Uint32List r_digits)
906
907 // R2 = used, R3 = digits
908 __ ldrd(R2, Address(SP, 3 * kWordSize));
909 __ add(R3, R3, Operand(TypedData::data_offset() - kHeapObjectTag));
910
911 // R4 = a_used, R5 = a_digits
912 __ ldrd(R4, Address(SP, 1 * kWordSize));
913 __ add(R5, R5, Operand(TypedData::data_offset() - kHeapObjectTag));
914
915 // R6 = r_digits
916 __ ldr(R6, Address(SP, 0 * kWordSize));
917 __ add(R6, R6, Operand(TypedData::data_offset() - kHeapObjectTag));
918
919 // R7 = &digits[a_used >> 1], a_used is Smi.
920 __ add(R7, R3, Operand(R4, LSL, 1));
921
922 // R8 = &digits[used >> 1], used is Smi.
923 __ add(R8, R3, Operand(R2, LSL, 1));
924
925 __ adds(R0, R0, Operand(0)); // carry flag = 0
926 Label add_loop;
927 __ Bind(&add_loop);
928 __ ldr(R0, Address(R3, kWordSize, Address::PostIndex));
929 __ ldr(R1, Address(R5, kWordSize, Address::PostIndex));
930 __ adcs(R0, R0, Operand(R1));
931 __ teq(R3, Operand(R7)); // Does not affect carry flag.
932 __ str(R0, Address(R6, kWordSize, Address::PostIndex));
933 __ b(&add_loop, NE);
934
935 Label last_carry;
936 __ teq(R3, Operand(R8)); // Does not affect carry flag.
937 __ b(&last_carry, EQ);
938
939 Label carry_loop;
940 __ Bind(&carry_loop);
941 __ ldr(R0, Address(R3, kWordSize, Address::PostIndex));
942 __ adcs(R0, R0, Operand(0));
943 __ teq(R3, Operand(R8)); // Does not affect carry flag.
944 __ str(R0, Address(R6, kWordSize, Address::PostIndex));
945 __ b(&carry_loop, NE);
946
947 __ Bind(&last_carry);
948 __ mov(R0, Operand(0));
949 __ adc(R0, R0, Operand(0));
950 __ str(R0, Address(R6, 0));
951
952 // Returning Object::null() is not required, since this method is private.
953 __ Ret();
907 } 954 }
908 955
909 956
910 void Intrinsifier::Bigint_absSub(Assembler* assembler) { 957 void Intrinsifier::Bigint_absSub(Assembler* assembler) {
911 // TODO(regis): Implement. 958 // static void _absSub(Uint32List digits, int used,
959 // Uint32List a_digits, int a_used,
960 // Uint32List r_digits)
961
962 // R2 = used, R3 = digits
963 __ ldrd(R2, Address(SP, 3 * kWordSize));
964 __ add(R3, R3, Operand(TypedData::data_offset() - kHeapObjectTag));
965
966 // R4 = a_used, R5 = a_digits
967 __ ldrd(R4, Address(SP, 1 * kWordSize));
968 __ add(R5, R5, Operand(TypedData::data_offset() - kHeapObjectTag));
969
970 // R6 = r_digits
971 __ ldr(R6, Address(SP, 0 * kWordSize));
972 __ add(R6, R6, Operand(TypedData::data_offset() - kHeapObjectTag));
973
974 // R7 = &digits[a_used >> 1], a_used is Smi.
975 __ add(R7, R3, Operand(R4, LSL, 1));
976
977 // R8 = &digits[used >> 1], used is Smi.
978 __ add(R8, R3, Operand(R2, LSL, 1));
979
980 __ subs(R0, R0, Operand(0)); // carry flag = 1
981 Label sub_loop;
982 __ Bind(&sub_loop);
983 __ ldr(R0, Address(R3, kWordSize, Address::PostIndex));
984 __ ldr(R1, Address(R5, kWordSize, Address::PostIndex));
985 __ sbcs(R0, R0, Operand(R1));
986 __ teq(R3, Operand(R7)); // Does not affect carry flag.
987 __ str(R0, Address(R6, kWordSize, Address::PostIndex));
988 __ b(&sub_loop, NE);
989
990 Label done;
991 __ teq(R3, Operand(R8)); // Does not affect carry flag.
992 __ b(&done, EQ);
993
994 Label carry_loop;
995 __ Bind(&carry_loop);
996 __ ldr(R0, Address(R3, kWordSize, Address::PostIndex));
997 __ sbcs(R0, R0, Operand(0));
998 __ teq(R3, Operand(R8)); // Does not affect carry flag.
999 __ str(R0, Address(R6, kWordSize, Address::PostIndex));
1000 __ b(&carry_loop, NE);
1001
1002 __ Bind(&done);
1003 // Returning Object::null() is not required, since this method is private.
1004 __ Ret();
912 } 1005 }
913 1006
914 1007
915 void Intrinsifier::Bigint_mulAdd(Assembler* assembler) { 1008 void Intrinsifier::Bigint_mulAdd(Assembler* assembler) {
916 if (TargetCPUFeatures::arm_version() != ARMv7) { 1009 if (TargetCPUFeatures::arm_version() != ARMv7) {
917 return; 1010 return;
918 } 1011 }
919 // Pseudo code: 1012 // Pseudo code:
920 // static void _mulAdd(Uint32List x_digits, int xi, 1013 // static void _mulAdd(Uint32List x_digits, int xi,
921 // Uint32List m_digits, int i, 1014 // Uint32List m_digits, int i,
(...skipping 15 matching lines...) Expand all
937 // } while (--n > 0); 1030 // } while (--n > 0);
938 // while (c != 0) { 1031 // while (c != 0) {
939 // uint64_t t = *ajp + c; 1032 // uint64_t t = *ajp + c;
940 // *ajp++ = low32(t); 1033 // *ajp++ = low32(t);
941 // c = high32(t); // c == 0 or 1. 1034 // c = high32(t); // c == 0 or 1.
942 // } 1035 // }
943 // } 1036 // }
944 1037
945 Label done; 1038 Label done;
946 // R3 = x, no_op if x == 0 1039 // R3 = x, no_op if x == 0
947 __ ldr(R1, Address(SP, 6 * kWordSize)); // x_digits 1040 __ 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)); 1041 __ add(R1, R1, Operand(R0, LSL, 1));
950 __ ldr(R3, FieldAddress(R1, TypedData::data_offset())); 1042 __ ldr(R3, FieldAddress(R1, TypedData::data_offset()));
951 __ tst(R3, Operand(R3)); 1043 __ tst(R3, Operand(R3));
952 __ b(&done, EQ); 1044 __ b(&done, EQ);
953 1045
954 // R6 = SmiUntag(n), no_op if n == 0 1046 // R6 = SmiUntag(n), no_op if n == 0
955 __ ldr(R6, Address(SP, 0 * kWordSize)); 1047 __ ldr(R6, Address(SP, 0 * kWordSize));
956 __ Asrs(R6, R6, Operand(kSmiTagSize)); 1048 __ Asrs(R6, R6, Operand(kSmiTagSize));
957 __ b(&done, EQ); 1049 __ b(&done, EQ);
958 1050
959 // R4 = mip = &m_digits[i >> 1] 1051 // R4 = mip = &m_digits[i >> 1]
960 __ ldr(R1, Address(SP, 4 * kWordSize)); // m_digits 1052 __ 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)); 1053 __ add(R1, R1, Operand(R0, LSL, 1));
963 __ add(R4, R1, Operand(TypedData::data_offset() - kHeapObjectTag)); 1054 __ add(R4, R1, Operand(TypedData::data_offset() - kHeapObjectTag));
964 1055
965 // R5 = ajp = &a_digits[j >> 1] 1056 // R5 = ajp = &a_digits[j >> 1]
966 __ ldr(R1, Address(SP, 2 * kWordSize)); // a_digits 1057 __ 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)); 1058 __ add(R1, R1, Operand(R0, LSL, 1));
969 __ add(R5, R1, Operand(TypedData::data_offset() - kHeapObjectTag)); 1059 __ add(R5, R1, Operand(TypedData::data_offset() - kHeapObjectTag));
970 1060
971 // R1 = c = 0 1061 // R1 = c = 0
972 __ mov(R1, Operand(0)); 1062 __ mov(R1, Operand(0));
973 1063
974 Label muladd_loop; 1064 Label muladd_loop;
975 __ Bind(&muladd_loop); 1065 __ Bind(&muladd_loop);
976 // x: R3 1066 // x: R3
977 // mip: R4 1067 // mip: R4
(...skipping 29 matching lines...) Expand all
1007 __ b(&done, CC); 1097 __ b(&done, CC);
1008 1098
1009 Label propagate_carry_loop; 1099 Label propagate_carry_loop;
1010 __ Bind(&propagate_carry_loop); 1100 __ Bind(&propagate_carry_loop);
1011 __ ldr(R0, Address(R5, 0)); 1101 __ ldr(R0, Address(R5, 0));
1012 __ adds(R0, R0, Operand(1)); 1102 __ adds(R0, R0, Operand(1));
1013 __ str(R0, Address(R5, kWordSize, Address::PostIndex)); 1103 __ str(R0, Address(R5, kWordSize, Address::PostIndex));
1014 __ b(&propagate_carry_loop, CS); 1104 __ b(&propagate_carry_loop, CS);
1015 1105
1016 __ Bind(&done); 1106 __ Bind(&done);
1107 // Returning Object::null() is not required, since this method is private.
1017 __ Ret(); 1108 __ Ret();
1018 } 1109 }
1019 1110
1020 1111
1021 void Intrinsifier::Bigint_sqrAdd(Assembler* assembler) { 1112 void Intrinsifier::Bigint_sqrAdd(Assembler* assembler) {
1022 if (TargetCPUFeatures::arm_version() != ARMv7) { 1113 if (TargetCPUFeatures::arm_version() != ARMv7) {
1023 return; 1114 return;
1024 } 1115 }
1025 // Pseudo code: 1116 // Pseudo code:
1026 // static void _sqrAdd(Uint32List x_digits, int i, 1117 // static void _sqrAdd(Uint32List x_digits, int i,
(...skipping 14 matching lines...) Expand all
1041 // *ajp++ = low32(t); 1132 // *ajp++ = low32(t);
1042 // c = high64(t); // 33-bit. 1133 // c = high64(t); // 33-bit.
1043 // } 1134 // }
1044 // uint32_t aj = *ajp; 1135 // uint32_t aj = *ajp;
1045 // uint64_t t = aj + c; // 32-bit + 33-bit -> 34-bit. 1136 // uint64_t t = aj + c; // 32-bit + 33-bit -> 34-bit.
1046 // *ajp++ = low32(t); 1137 // *ajp++ = low32(t);
1047 // *ajp = high32(t); 1138 // *ajp = high32(t);
1048 // } 1139 // }
1049 1140
1050 // R4 = xip = &x_digits[i >> 1] 1141 // R4 = xip = &x_digits[i >> 1]
1051 __ ldr(R1, Address(SP, 3 * kWordSize)); // x_digits 1142 __ ldrd(R2, Address(SP, 2 * kWordSize)); // R2 = i as Smi, R3 = x_digits
1052 __ ldr(R6, Address(SP, 2 * kWordSize)); // i is Smi 1143 __ add(R3, R3, Operand(R2, LSL, 1));
1053 __ add(R1, R1, Operand(R6, LSL, 1)); 1144 __ add(R4, R3, Operand(TypedData::data_offset() - kHeapObjectTag));
1054 __ add(R4, R1, Operand(TypedData::data_offset() - kHeapObjectTag));
1055 1145
1056 // R3 = x = *xip++, return if x == 0 1146 // R3 = x = *xip++, return if x == 0
1057 Label x_zero; 1147 Label x_zero;
1058 __ ldr(R3, Address(R4, kWordSize, Address::PostIndex)); 1148 __ ldr(R3, Address(R4, kWordSize, Address::PostIndex));
1059 __ tst(R3, Operand(R3)); 1149 __ tst(R3, Operand(R3));
1060 __ b(&x_zero, EQ); 1150 __ b(&x_zero, EQ);
1061 1151
1062 // R5 = ajp = &a_digits[i] 1152 // R5 = ajp = &a_digits[i]
1063 __ ldr(R1, Address(SP, 1 * kWordSize)); // a_digits 1153 __ ldr(R1, Address(SP, 1 * kWordSize)); // a_digits
1064 __ add(R1, R1, Operand(R6, LSL, 2)); // j == 2*i, i is Smi. 1154 __ add(R1, R1, Operand(R2, LSL, 2)); // j == 2*i, i is Smi.
1065 __ add(R5, R1, Operand(TypedData::data_offset() - kHeapObjectTag)); 1155 __ add(R5, R1, Operand(TypedData::data_offset() - kHeapObjectTag));
1066 1156
1067 // R7:R0 = t = x*x + *ajp 1157 // R6:R0 = t = x*x + *ajp
1068 __ ldr(R0, Address(R5, 0)); 1158 __ ldr(R0, Address(R5, 0));
1069 __ mov(R7, Operand(0)); 1159 __ mov(R6, Operand(0));
1070 __ umaal(R0, R7, R3, R3); // R7:R0 = R3*R3 + R7 + R0. 1160 __ umaal(R0, R6, R3, R3); // R6:R0 = R3*R3 + R6 + R0.
1071 1161
1072 // *ajp++ = low32(t) = R0 1162 // *ajp++ = low32(t) = R0
1073 __ str(R0, Address(R5, kWordSize, Address::PostIndex)); 1163 __ str(R0, Address(R5, kWordSize, Address::PostIndex));
1074 1164
1075 // R7 = low32(c) = high32(t) 1165 // R6 = low32(c) = high32(t)
1076 // R8 = high32(c) = 0 1166 // R7 = high32(c) = 0
1077 __ mov(R8, Operand(0)); 1167 __ mov(R7, Operand(0));
1078 1168
1079 // int n = used - i - 1 1169 // int n = used - i - 1
1080 __ ldr(R0, Address(SP, 0 * kWordSize)); // used is Smi 1170 __ ldr(R0, Address(SP, 0 * kWordSize)); // used is Smi
1081 __ sub(R6, R0, Operand(R6)); 1171 __ sub(R8, R0, Operand(R2));
1082 __ mov(R0, Operand(2)); // while (--n >= 0) 1172 __ mov(R0, Operand(2)); // while (--n >= 0)
1083 __ rsbs(R6, R0, Operand(R6, ASR, kSmiTagSize)); 1173 __ rsbs(R8, R0, Operand(R8, ASR, kSmiTagSize));
1084 1174
1085 Label loop, done; 1175 Label loop, done;
1086 __ b(&done, MI); 1176 __ b(&done, MI);
1087 1177
1088 __ Bind(&loop); 1178 __ Bind(&loop);
1089 // x: R3 1179 // x: R3
1090 // xip: R4 1180 // xip: R4
1091 // ajp: R5 1181 // ajp: R5
1092 // c: R8:R7 1182 // c: R7:R6
1093 // t: R2:R1:R0 (not live at loop entry) 1183 // t: R2:R1:R0 (not live at loop entry)
1094 // n: R6 1184 // n: R8
1095 1185
1096 // uint32_t xi = *xip++ 1186 // uint32_t xi = *xip++
1097 __ ldr(R2, Address(R4, kWordSize, Address::PostIndex)); 1187 __ ldr(R2, Address(R4, kWordSize, Address::PostIndex));
1098 1188
1099 // uint32_t aj = *ajp 1189 // uint32_t aj = *ajp
1100 __ ldr(R1, Address(R5, 0)); 1190 __ ldr(R1, Address(R5, 0));
1101 1191
1102 // uint96_t t = R2:R1:R0 = 2*x*xi + aj + c 1192 // uint96_t t = R2:R1:R0 = 2*x*xi + aj + c
1103 __ mov(R0, Operand(0)); 1193 __ mov(R0, Operand(0));
1104 __ umaal(R0, R1, R2, R3); // R1:R0 = R3*R2 + R1 + R0 = x*xi + aj + 0. 1194 __ 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. 1195 __ umlal(R6, R7, R2, R3); // R7:R6 += R3*R2; c += x*xi.
1106 __ adds(R0, R0, Operand(R7)); 1196 __ adds(R0, R0, Operand(R6));
1107 __ adcs(R7, R1, Operand(R8)); 1197 __ adcs(R6, R1, Operand(R7));
1108 __ mov(R8, Operand(0)); 1198 __ mov(R7, Operand(0));
1109 __ adc(R8, R8, Operand(0)); // R8:R7:R0 = R1:R0 + R8:R7 = 2*x*xi + aj + c. 1199 __ adc(R7, R7, Operand(0)); // R7:R6:R0 = R1:R0 + R7:R6 = 2*x*xi + aj + c.
1110 1200
1111 // *ajp++ = low32(t) = R0 1201 // *ajp++ = low32(t) = R0
1112 __ str(R0, Address(R5, kWordSize, Address::PostIndex)); 1202 __ str(R0, Address(R5, kWordSize, Address::PostIndex));
1113 1203
1114 // while (--n >= 0) 1204 // while (--n >= 0)
1115 __ subs(R6, R6, Operand(1)); // --n 1205 __ subs(R8, R8, Operand(1)); // --n
1116 __ b(&loop, PL); 1206 __ b(&loop, PL);
1117 1207
1118 __ Bind(&done); 1208 __ Bind(&done);
1119 // uint32_t aj = *ajp 1209 // uint32_t aj = *ajp
1120 __ ldr(R0, Address(R5, 0)); 1210 __ ldr(R0, Address(R5, 0));
1121 1211
1122 // uint64_t t = aj + c 1212 // uint64_t t = aj + c
1123 __ adds(R7, R7, Operand(R0)); 1213 __ adds(R6, R6, Operand(R0));
1124 __ adc(R8, R8, Operand(0)); 1214 __ adc(R7, R7, Operand(0));
1125 1215
1126 // *ajp++ = low32(t) 1216 // *ajp = low32(t) = R6
1127 // *ajp = high32(t) 1217 // *(ajp + 1) = high32(t) = R7
1128 __ str(R7, Address(R5, 0)); 1218 __ strd(R6, Address(R5, 0));
1129 __ str(R8, Address(R5, kWordSize));
1130 1219
1131 __ Bind(&x_zero); 1220 __ Bind(&x_zero);
1221 // Returning Object::null() is not required, since this method is private.
1132 __ Ret(); 1222 __ Ret();
1133 } 1223 }
1134 1224
1135 1225
1136 void Intrinsifier::Bigint_estQuotientDigit(Assembler* assembler) { 1226 void Intrinsifier::Bigint_estQuotientDigit(Assembler* assembler) {
1137 // TODO(regis): Implement. 1227 // TODO(regis): Implement.
1138 } 1228 }
1139 1229
1140 1230
1141 void Intrinsifier::Montgomery_mulMod(Assembler* assembler) { 1231 void Intrinsifier::Montgomery_mulMod(Assembler* assembler) {
1142 // TODO(regis): Implement. 1232 if (TargetCPUFeatures::arm_version() != ARMv7) {
1233 return;
1234 }
1235 // Pseudo code:
1236 // static void _mulMod(Uint32List args, Uint32List digits, int i) {
1237 // uint32_t rho = args[_RHO]; // _RHO == 0.
1238 // uint32_t d = digits[i >> 1]; // i is Smi.
1239 // uint64_t t = rho*d;
1240 // args[_MU] = t mod DIGIT_BASE; // _MU == 1.
1241 // }
1242
1243 // R4 = args
1244 __ ldr(R4, Address(SP, 2 * kWordSize)); // args
1245
1246 // R3 = rho = args[0]
1247 __ ldr(R3, FieldAddress(R4, TypedData::data_offset()));
1248
1249 // R2 = digits[i >> 1]
1250 __ ldrd(R0, Address(SP, 0 * kWordSize)); // R0 = i as Smi, R1 = digits
1251 __ add(R1, R1, Operand(R0, LSL, 1));
1252 __ ldr(R2, FieldAddress(R1, TypedData::data_offset()));
1253
1254 // R1:R0 = t = rho*d
1255 __ umull(R0, R1, R2, R3);
1256
1257 // args[1] = t mod DIGIT_BASE = low32(t)
1258 __ str(R0, FieldAddress(R4, TypedData::data_offset() + kWordSize));
1259
1260 // Returning Object::null() is not required, since this method is private.
1261 __ Ret();
1143 } 1262 }
1144 1263
1145 1264
1146 // Check if the last argument is a double, jump to label 'is_smi' if smi 1265 // 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', 1266 // (easy to convert to double), otherwise jump to label 'not_double_smi',
1148 // Returns the last argument in R0. 1267 // Returns the last argument in R0.
1149 static void TestLastArgumentIsDouble(Assembler* assembler, 1268 static void TestLastArgumentIsDouble(Assembler* assembler,
1150 Label* is_smi, 1269 Label* is_smi,
1151 Label* not_double_smi) { 1270 Label* not_double_smi) {
1152 __ ldr(R0, Address(SP, 0 * kWordSize)); 1271 __ ldr(R0, Address(SP, 0 * kWordSize));
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 Isolate* isolate = Isolate::Current(); 1999 Isolate* isolate = Isolate::Current();
1881 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); 2000 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate));
1882 // Set return value to Isolate::current_tag_. 2001 // Set return value to Isolate::current_tag_.
1883 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); 2002 __ ldr(R0, Address(R1, Isolate::current_tag_offset()));
1884 __ Ret(); 2003 __ Ret();
1885 } 2004 }
1886 2005
1887 } // namespace dart 2006 } // namespace dart
1888 2007
1889 #endif // defined TARGET_ARCH_ARM 2008 #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