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

Unified Diff: runtime/vm/intrinsifier_arm.cc

Issue 18331006: Adds support for integer division for ARM chips without the sdiv instruction. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_arm.cc
===================================================================
--- runtime/vm/intrinsifier_arm.cc (revision 24627)
+++ runtime/vm/intrinsifier_arm.cc (working copy)
@@ -671,6 +671,7 @@
const Register left = R1;
const Register right = R0;
const Register result = R1;
+ const Register tmp = R2;
ASSERT(left == result);
// Check for quick zero results.
@@ -694,8 +695,10 @@
// result <- left - right * (left / right)
__ SmiUntag(left);
__ SmiUntag(right);
- __ sdiv(TMP, left, right); // TMP <- left / right
- __ mls(result, right, TMP, left); // result <- left - right * TMP
+
+ __ IntegerDivide(tmp, left, right, D1, D0);
+
+ __ mls(result, right, tmp, left); // result <- left - right * TMP
return;
}
@@ -711,9 +714,6 @@
// }
bool Intrinsifier::Integer_modulo(Assembler* assembler) {
// Check to see if we have integer division
- if (!CPUFeatures::integer_division_supported())
- return false;
-
Label fall_through, subtract;
TestBothArgumentsSmis(assembler, &fall_through);
// R1: Tagged left (dividend).
@@ -742,9 +742,6 @@
bool Intrinsifier::Integer_remainder(Assembler* assembler) {
// Check to see if we have integer division
- if (!CPUFeatures::integer_division_supported())
- return false;
-
Label fall_through;
TestBothArgumentsSmis(assembler, &fall_through);
// R1: Tagged left (dividend).
@@ -764,9 +761,6 @@
bool Intrinsifier::Integer_truncDivide(Assembler* assembler) {
// Check to see if we have integer division
- if (!CPUFeatures::integer_division_supported())
- return false;
-
Label fall_through;
TestBothArgumentsSmis(assembler, &fall_through);
@@ -775,7 +769,9 @@
__ SmiUntag(R0);
__ SmiUntag(R1);
- __ sdiv(R0, R1, R0);
+
+ __ IntegerDivide(R0, R1, R0, D1, D0);
+
// Check the corner case of dividing the 'MIN_SMI' with -1, in which case we
// cannot tag the result.
__ CompareImmediate(R0, 0x40000000);
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698