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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/simulator_arm.h » ('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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 } 745 }
746 746
747 747
748 ASSEMBLER_TEST_RUN(AddCarry, test) { 748 ASSEMBLER_TEST_RUN(AddCarry, test) {
749 EXPECT(test != NULL); 749 EXPECT(test != NULL);
750 typedef int (*AddCarry)() DART_UNUSED; 750 typedef int (*AddCarry)() DART_UNUSED;
751 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(AddCarry, test->entry())); 751 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(AddCarry, test->entry()));
752 } 752 }
753 753
754 754
755 ASSEMBLER_TEST_GENERATE(AddCarryInOut, assembler) {
756 __ LoadImmediate(R2, 0xFFFFFFFF);
757 __ mov(R1, Operand(1));
758 __ mov(R0, Operand(0));
759 __ adds(IP, R2, Operand(R1)); // c_out = 1.
760 __ adcs(IP, R2, Operand(R0)); // c_in = 1, c_out = 1.
761 __ adc(R0, R0, Operand(R0)); // c_in = 1.
762 __ bx(LR);
763 }
764
765
766 ASSEMBLER_TEST_RUN(AddCarryInOut, test) {
767 EXPECT(test != NULL);
768 typedef int (*AddCarryInOut)() DART_UNUSED;
769 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(AddCarryInOut, test->entry()));
770 }
771
772
755 ASSEMBLER_TEST_GENERATE(SubCarry, assembler) { 773 ASSEMBLER_TEST_GENERATE(SubCarry, assembler) {
756 __ LoadImmediate(R2, 0x0); 774 __ LoadImmediate(R2, 0x0);
757 __ mov(R1, Operand(1)); 775 __ mov(R1, Operand(1));
758 __ mov(R0, Operand(0)); 776 __ mov(R0, Operand(0));
759 __ subs(R2, R2, Operand(R1)); 777 __ subs(R2, R2, Operand(R1));
760 __ sbcs(R0, R0, Operand(R0)); 778 __ sbcs(R0, R0, Operand(R0));
761 __ bx(LR); 779 __ bx(LR);
762 } 780 }
763 781
764 782
765 ASSEMBLER_TEST_RUN(SubCarry, test) { 783 ASSEMBLER_TEST_RUN(SubCarry, test) {
766 EXPECT(test != NULL); 784 EXPECT(test != NULL);
767 typedef int (*SubCarry)() DART_UNUSED; 785 typedef int (*SubCarry)() DART_UNUSED;
768 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT32(SubCarry, test->entry())); 786 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT32(SubCarry, test->entry()));
769 } 787 }
770 788
771 789
790 ASSEMBLER_TEST_GENERATE(SubCarryInOut, assembler) {
791 __ mov(R1, Operand(1));
792 __ mov(R0, Operand(0));
793 __ subs(IP, R0, Operand(R1)); // c_out = 1.
794 __ sbcs(IP, R0, Operand(R0)); // c_in = 1, c_out = 1.
795 __ sbc(R0, R0, Operand(R0)); // c_in = 1.
796 __ bx(LR);
797 }
798
799
800 ASSEMBLER_TEST_RUN(SubCarryInOut, test) {
801 EXPECT(test != NULL);
802 typedef int (*SubCarryInOut)() DART_UNUSED;
803 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT32(SubCarryInOut, test->entry()));
804 }
805
806
807 ASSEMBLER_TEST_GENERATE(Overflow, assembler) {
808 __ LoadImmediate(R0, 0xFFFFFFFF);
809 __ LoadImmediate(R1, 0x7FFFFFFF);
810 __ adds(IP, R0, Operand(1)); // c_out = 1.
811 __ adcs(IP, R1, Operand(0)); // c_in = 1, c_out = 1, v = 1.
812 __ mov(R0, Operand(1), VS);
813 __ bx(LR);
814 }
815
816
817 ASSEMBLER_TEST_RUN(Overflow, test) {
818 EXPECT(test != NULL);
819 typedef int (*Overflow)() DART_UNUSED;
820 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(Overflow, test->entry()));
821 }
822
823
772 ASSEMBLER_TEST_GENERATE(AndOrr, assembler) { 824 ASSEMBLER_TEST_GENERATE(AndOrr, assembler) {
773 __ mov(R1, Operand(40)); 825 __ mov(R1, Operand(40));
774 __ mov(R2, Operand(0)); 826 __ mov(R2, Operand(0));
775 __ and_(R1, R2, Operand(R1)); 827 __ and_(R1, R2, Operand(R1));
776 __ mov(R3, Operand(42)); 828 __ mov(R3, Operand(42));
777 __ orr(R0, R1, Operand(R3)); 829 __ orr(R0, R1, Operand(R3));
778 __ bx(LR); 830 __ bx(LR);
779 } 831 }
780 832
781 833
(...skipping 3346 matching lines...) Expand 10 before | Expand all | Expand 10 after
4128 __ StoreIntoObject(R2, 4180 __ StoreIntoObject(R2,
4129 FieldAddress(R2, GrowableObjectArray::data_offset()), 4181 FieldAddress(R2, GrowableObjectArray::data_offset()),
4130 R1); 4182 R1);
4131 __ PopList((1 << CTX) | (1 << LR)); 4183 __ PopList((1 << CTX) | (1 << LR));
4132 __ Ret(); 4184 __ Ret();
4133 } 4185 }
4134 4186
4135 } // namespace dart 4187 } // namespace dart
4136 4188
4137 #endif // defined TARGET_ARCH_ARM 4189 #endif // defined TARGET_ARCH_ARM
OLDNEW
« 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