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

Unified Diff: runtime/vm/assembler_arm_test.cc

Issue 623823003: Fix carry out calculation in ARM simulator. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/simulator_arm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_arm_test.cc
===================================================================
--- runtime/vm/assembler_arm_test.cc (revision 40889)
+++ runtime/vm/assembler_arm_test.cc (working copy)
@@ -752,6 +752,24 @@
}
+ASSEMBLER_TEST_GENERATE(AddCarryInOut, assembler) {
+ __ LoadImmediate(R2, 0xFFFFFFFF);
+ __ mov(R1, Operand(1));
+ __ mov(R0, Operand(0));
+ __ adds(IP, R2, Operand(R1)); // c_out = 1.
+ __ adcs(IP, R2, Operand(R0)); // c_in = 1, c_out = 1.
+ __ adc(R0, R0, Operand(R0)); // c_in = 1.
+ __ bx(LR);
+}
+
+
+ASSEMBLER_TEST_RUN(AddCarryInOut, test) {
+ EXPECT(test != NULL);
+ typedef int (*AddCarryInOut)() DART_UNUSED;
+ EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(AddCarryInOut, test->entry()));
+}
+
+
ASSEMBLER_TEST_GENERATE(SubCarry, assembler) {
__ LoadImmediate(R2, 0x0);
__ mov(R1, Operand(1));
@@ -769,6 +787,40 @@
}
+ASSEMBLER_TEST_GENERATE(SubCarryInOut, assembler) {
+ __ mov(R1, Operand(1));
+ __ mov(R0, Operand(0));
+ __ subs(IP, R0, Operand(R1)); // c_out = 1.
+ __ sbcs(IP, R0, Operand(R0)); // c_in = 1, c_out = 1.
+ __ sbc(R0, R0, Operand(R0)); // c_in = 1.
+ __ bx(LR);
+}
+
+
+ASSEMBLER_TEST_RUN(SubCarryInOut, test) {
+ EXPECT(test != NULL);
+ typedef int (*SubCarryInOut)() DART_UNUSED;
+ EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT32(SubCarryInOut, test->entry()));
+}
+
+
+ASSEMBLER_TEST_GENERATE(Overflow, assembler) {
+ __ LoadImmediate(R0, 0xFFFFFFFF);
+ __ LoadImmediate(R1, 0x7FFFFFFF);
+ __ adds(IP, R0, Operand(1)); // c_out = 1.
+ __ adcs(IP, R1, Operand(0)); // c_in = 1, c_out = 1, v = 1.
+ __ mov(R0, Operand(1), VS);
+ __ bx(LR);
+}
+
+
+ASSEMBLER_TEST_RUN(Overflow, test) {
+ EXPECT(test != NULL);
+ typedef int (*Overflow)() DART_UNUSED;
+ EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(Overflow, test->entry()));
+}
+
+
ASSEMBLER_TEST_GENERATE(AndOrr, assembler) {
__ mov(R1, Operand(40));
__ mov(R2, Operand(0));
« no previous file with comments | « no previous file | runtime/vm/simulator_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698