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

Unified Diff: runtime/vm/assembler_arm_test.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
Index: runtime/vm/assembler_arm_test.cc
===================================================================
--- runtime/vm/assembler_arm_test.cc (revision 24627)
+++ runtime/vm/assembler_arm_test.cc (working copy)
@@ -1530,6 +1530,42 @@
}
+ASSEMBLER_TEST_GENERATE(IntDiv_supported, assembler) {
+ bool orig = CPUFeatures::integer_division_supported();
+ CPUFeatures::set_integer_division_supported(true);
+ __ mov(R0, ShifterOperand(27));
+ __ mov(R1, ShifterOperand(9));
+ __ IntegerDivide(R0, R0, R1, D0, D1);
+ CPUFeatures::set_integer_division_supported(orig);
+ __ bx(LR);
+}
+
+
+ASSEMBLER_TEST_RUN(IntDiv_supported, test) {
+ EXPECT(test != NULL);
+ typedef int (*Tst)();
+ EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
+}
+
+
+ASSEMBLER_TEST_GENERATE(IntDiv_unsupported, assembler) {
+ bool orig = CPUFeatures::integer_division_supported();
+ CPUFeatures::set_integer_division_supported(false);
+ __ mov(R0, ShifterOperand(27));
+ __ mov(R1, ShifterOperand(9));
+ __ IntegerDivide(R0, R0, R1, D0, D1);
+ CPUFeatures::set_integer_division_supported(orig);
+ __ bx(LR);
+}
+
+
+ASSEMBLER_TEST_RUN(IntDiv_unsupported, test) {
+ EXPECT(test != NULL);
+ typedef int (*Tst)();
+ EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
+}
+
+
ASSEMBLER_TEST_GENERATE(Muls, assembler) {
__ mov(R0, ShifterOperand(3));
__ LoadImmediate(R1, -9);

Powered by Google App Engine
This is Rietveld 408576698