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

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

Issue 13483018: Introduces a second temporary register for MIPS assembler macros. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | « runtime/vm/assembler_mips.cc ('k') | runtime/vm/constants_mips.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_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 typedef int (*SimpleCode)(); 1040 typedef int (*SimpleCode)();
1041 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry())); 1041 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
1042 } 1042 }
1043 1043
1044 1044
1045 ASSEMBLER_TEST_GENERATE(AddOverflow_detect, assembler) { 1045 ASSEMBLER_TEST_GENERATE(AddOverflow_detect, assembler) {
1046 Register left = T0; 1046 Register left = T0;
1047 Register right = T1; 1047 Register right = T1;
1048 Register result = T2; 1048 Register result = T2;
1049 Register overflow = T3; 1049 Register overflow = T3;
1050 Register scratch = T4;
1051 Label error, done; 1050 Label error, done;
1052 1051
1053 __ LoadImmediate(V0, 1); // Success value. 1052 __ LoadImmediate(V0, 1); // Success value.
1054 1053
1055 __ LoadImmediate(left, 0x7fffffff); 1054 __ LoadImmediate(left, 0x7fffffff);
1056 __ LoadImmediate(right, 1); 1055 __ LoadImmediate(right, 1);
1057 __ AdduDetectOverflow(result, left, right, overflow); 1056 __ AdduDetectOverflow(result, left, right, overflow);
1058 __ bgez(overflow, &error); // INT_MAX + 1 overflows. 1057 __ bgez(overflow, &error); // INT_MAX + 1 overflows.
1059 1058
1060 __ LoadImmediate(left, 0x7fffffff); 1059 __ LoadImmediate(left, 0x7fffffff);
(...skipping 14 matching lines...) Expand all
1075 __ LoadImmediate(right, 654321); 1074 __ LoadImmediate(right, 654321);
1076 __ AdduDetectOverflow(result, left, right, overflow); 1075 __ AdduDetectOverflow(result, left, right, overflow);
1077 __ bltz(overflow, &error); // 123456 + 654321 does not overflow. 1076 __ bltz(overflow, &error); // 123456 + 654321 does not overflow.
1078 1077
1079 __ LoadImmediate(left, 0x80000000); 1078 __ LoadImmediate(left, 0x80000000);
1080 __ LoadImmediate(right, -1); 1079 __ LoadImmediate(right, -1);
1081 __ AdduDetectOverflow(result, left, right, overflow); 1080 __ AdduDetectOverflow(result, left, right, overflow);
1082 __ bgez(overflow, &error); // INT_MIN - 1 overflows. 1081 __ bgez(overflow, &error); // INT_MIN - 1 overflows.
1083 1082
1084 // result has 0x7fffffff. 1083 // result has 0x7fffffff.
1085 __ AdduDetectOverflow(result, result, result, overflow, scratch); 1084 __ AdduDetectOverflow(result, result, result, overflow);
1086 __ bgez(overflow, &error); // INT_MAX + INT_MAX overflows. 1085 __ bgez(overflow, &error); // INT_MAX + INT_MAX overflows.
1087 1086
1088 __ LoadImmediate(left, 0x80000000); 1087 __ LoadImmediate(left, 0x80000000);
1089 __ LoadImmediate(right, 0x80000000); 1088 __ LoadImmediate(right, 0x80000000);
1090 __ AdduDetectOverflow(result, left, right, overflow); 1089 __ AdduDetectOverflow(result, left, right, overflow);
1091 __ bgez(overflow, &error); // INT_MIN + INT_MIN overflows. 1090 __ bgez(overflow, &error); // INT_MIN + INT_MIN overflows.
1092 1091
1093 __ LoadImmediate(left, -123456); 1092 __ LoadImmediate(left, -123456);
1094 __ LoadImmediate(right, -654321); 1093 __ LoadImmediate(right, -654321);
1095 __ AdduDetectOverflow(result, left, right, overflow); 1094 __ AdduDetectOverflow(result, left, right, overflow);
1096 __ bltz(overflow, &error); // -123456 + -654321 does not overflow. 1095 __ bltz(overflow, &error); // -123456 + -654321 does not overflow.
1097 1096
1098 __ b(&done); 1097 __ b(&done);
1099 __ Bind(&error); 1098 __ Bind(&error);
1100 __ mov(V0, ZR); 1099 __ mov(V0, ZR);
1101 __ Bind(&done); 1100 __ Bind(&done);
1102 __ Ret(); 1101 __ Ret();
1103 } 1102 }
1104 1103
1105 1104
1106 ASSEMBLER_TEST_RUN(AddOverflow_detect, test) { 1105 ASSEMBLER_TEST_RUN(AddOverflow_detect, test) {
1107 typedef int (*SimpleCode)(); 1106 typedef int (*SimpleCode)();
1108 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry())); 1107 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
1109 } 1108 }
1110 1109
1111 } // namespace dart 1110 } // namespace dart
1112 1111
1113 #endif // defined TARGET_ARCH_MIPS 1112 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/assembler_mips.cc ('k') | runtime/vm/constants_mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698