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

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

Issue 713993002: Fix unsigned multiplication in MIPS simulator (add assembler regression test). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 1 month 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 | « runtime/vm/constants_mips.h ('k') | runtime/vm/simulator_mips.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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 __ mov(R6, Operand(0)); 1169 __ mov(R6, Operand(0));
1170 __ umaal(R0, R6, R3, R3); // R6:R0 = R3*R3 + R6 + R0. 1170 __ umaal(R0, R6, R3, R3); // R6:R0 = R3*R3 + R6 + R0.
1171 1171
1172 // *ajp++ = low32(t) = R0 1172 // *ajp++ = low32(t) = R0
1173 __ str(R0, Address(R5, Bigint::kBytesPerDigit, Address::PostIndex)); 1173 __ str(R0, Address(R5, Bigint::kBytesPerDigit, Address::PostIndex));
1174 1174
1175 // R6 = low32(c) = high32(t) 1175 // R6 = low32(c) = high32(t)
1176 // R7 = high32(c) = 0 1176 // R7 = high32(c) = 0
1177 __ mov(R7, Operand(0)); 1177 __ mov(R7, Operand(0));
1178 1178
1179 // int n = used - i - 1 1179 // int n = used - i - 1; while (--n >= 0) ...
1180 __ ldr(R0, Address(SP, 0 * kWordSize)); // used is Smi 1180 __ ldr(R0, Address(SP, 0 * kWordSize)); // used is Smi
1181 __ sub(R8, R0, Operand(R2)); 1181 __ sub(R8, R0, Operand(R2));
1182 __ mov(R0, Operand(2)); // while (--n >= 0) 1182 __ mov(R0, Operand(2)); // n = used - i - 2; if (n >= 0) ... while (--n >= 0)
1183 __ rsbs(R8, R0, Operand(R8, ASR, kSmiTagSize)); 1183 __ rsbs(R8, R0, Operand(R8, ASR, kSmiTagSize));
1184 1184
1185 Label loop, done; 1185 Label loop, done;
1186 __ b(&done, MI); 1186 __ b(&done, MI);
1187 1187
1188 __ Bind(&loop); 1188 __ Bind(&loop);
1189 // x: R3 1189 // x: R3
1190 // xip: R4 1190 // xip: R4
1191 // ajp: R5 1191 // ajp: R5
1192 // c: R7:R6 1192 // c: R7:R6
1193 // t: R2:R1:R0 (not live at loop entry) 1193 // t: R2:R1:R0 (not live at loop entry)
1194 // n: R8 1194 // n: R8
1195 1195
1196 // uint32_t xi = *xip++ 1196 // uint32_t xi = *xip++
1197 __ ldr(R2, Address(R4, Bigint::kBytesPerDigit, Address::PostIndex)); 1197 __ ldr(R2, Address(R4, Bigint::kBytesPerDigit, Address::PostIndex));
1198 1198
1199 // uint32_t aj = *ajp
1200 __ ldr(R1, Address(R5, 0));
1201
1202 // uint96_t t = R7:R6:R0 = 2*x*xi + aj + c 1199 // uint96_t t = R7:R6:R0 = 2*x*xi + aj + c
1203 __ mov(R0, Operand(0)); 1200 __ umull(R0, R1, R2, R3); // R1:R0 = R2*R3.
1204 __ umaal(R0, R1, R2, R3); // R1:R0 = R3*R2 + R1 + R0 = x*xi + aj + 0. 1201 __ adds(R0, R0, Operand(R0));
1205 __ umlal(R6, R7, R2, R3); // R7:R6 += R3*R2; c += x*xi. 1202 __ adcs(R1, R1, Operand(R1));
1203 __ mov(R2, Operand(0));
1204 __ adc(R2, R2, Operand(0)); // R2:R1:R0 = 2*x*xi.
1206 __ adds(R0, R0, Operand(R6)); 1205 __ adds(R0, R0, Operand(R6));
1207 __ adcs(R6, R1, Operand(R7)); 1206 __ adcs(R1, R1, Operand(R7));
1208 __ mov(R7, Operand(0)); 1207 __ adc(R2, R2, Operand(0)); // R2:R1:R0 = 2*x*xi + c.
1209 __ adc(R7, R7, Operand(0)); // R7:R6:R0 = R1:R0 + R7:R6 = 2*x*xi + aj + c. 1208 __ ldr(R6, Address(R5, 0)); // R6 = aj = *ajp.
1209 __ adds(R0, R0, Operand(R6));
1210 __ adcs(R6, R1, Operand(0));
1211 __ adc(R7, R2, Operand(0)); // R7:R6:R0 = 2*x*xi + c + aj.
1210 1212
1211 // *ajp++ = low32(t) = R0 1213 // *ajp++ = low32(t) = R0
1212 __ str(R0, Address(R5, Bigint::kBytesPerDigit, Address::PostIndex)); 1214 __ str(R0, Address(R5, Bigint::kBytesPerDigit, Address::PostIndex));
1213 1215
1214 // while (--n >= 0) 1216 // while (--n >= 0)
1215 __ subs(R8, R8, Operand(1)); // --n 1217 __ subs(R8, R8, Operand(1)); // --n
1216 __ b(&loop, PL); 1218 __ b(&loop, PL);
1217 1219
1218 __ Bind(&done); 1220 __ Bind(&done);
1219 // uint32_t aj = *ajp 1221 // uint32_t aj = *ajp
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 Isolate* isolate = Isolate::Current(); 2012 Isolate* isolate = Isolate::Current();
2011 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); 2013 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate));
2012 // Set return value to Isolate::current_tag_. 2014 // Set return value to Isolate::current_tag_.
2013 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); 2015 __ ldr(R0, Address(R1, Isolate::current_tag_offset()));
2014 __ Ret(); 2016 __ Ret();
2015 } 2017 }
2016 2018
2017 } // namespace dart 2019 } // namespace dart
2018 2020
2019 #endif // defined TARGET_ARCH_ARM 2021 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/constants_mips.h ('k') | runtime/vm/simulator_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698