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

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

Issue 13884017: Adds support for UseDartApi vm test on MIPS. (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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 __ jr(RA); 569 __ jr(RA);
570 } 570 }
571 571
572 572
573 ASSEMBLER_TEST_RUN(Xor, test) { 573 ASSEMBLER_TEST_RUN(Xor, test) {
574 typedef int (*SimpleCode)(); 574 typedef int (*SimpleCode)();
575 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry())); 575 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
576 } 576 }
577 577
578 578
579 ASSEMBLER_TEST_GENERATE(Xori, assembler) {
580 __ LoadImmediate(T0, 51);
581 __ xori(V0, T0, Immediate(25));
582 __ jr(RA);
583 }
584
585
586 ASSEMBLER_TEST_RUN(Xori, test) {
587 typedef int (*SimpleCode)();
588 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
589 }
590
591
579 ASSEMBLER_TEST_GENERATE(Slt, assembler) { 592 ASSEMBLER_TEST_GENERATE(Slt, assembler) {
580 __ LoadImmediate(R1, -1); 593 __ LoadImmediate(R1, -1);
581 __ LoadImmediate(R2, 0); 594 __ LoadImmediate(R2, 0);
582 __ slt(V0, R1, R2); 595 __ slt(V0, R1, R2);
583 __ jr(RA); 596 __ jr(RA);
584 } 597 }
585 598
586 599
587 ASSEMBLER_TEST_RUN(Slt, test) { 600 ASSEMBLER_TEST_RUN(Slt, test) {
588 typedef int (*SimpleCode)(); 601 typedef int (*SimpleCode)();
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 __ Ret(); 1114 __ Ret();
1102 } 1115 }
1103 1116
1104 1117
1105 ASSEMBLER_TEST_RUN(AddOverflow_detect, test) { 1118 ASSEMBLER_TEST_RUN(AddOverflow_detect, test) {
1106 typedef int (*SimpleCode)(); 1119 typedef int (*SimpleCode)();
1107 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry())); 1120 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
1108 } 1121 }
1109 1122
1110 1123
1124 ASSEMBLER_TEST_GENERATE(SubOverflow_detect, assembler) {
1125 Register left = T0;
1126 Register right = T1;
1127 Register result = T2;
1128 Register overflow = T3;
1129 Label error, done;
1130
1131 __ LoadImmediate(V0, 1); // Success value.
1132
1133 __ LoadImmediate(left, 0x80000000);
1134 __ LoadImmediate(right, 1);
1135 __ SubuDetectOverflow(result, left, right, overflow);
1136 __ bgez(overflow, &error); // INT_MIN - 1 overflows.
1137
1138 __ LoadImmediate(left, 0x7fffffff);
1139 __ LoadImmediate(right, 0x8000000);
1140 __ SubuDetectOverflow(result, left, left, overflow);
1141 __ bltz(overflow, &error); // INT_MIN - INT_MAX does not overflow.
1142
1143 __ LoadImmediate(left, 0x80000000);
1144 __ LoadImmediate(right, 0x80000000);
1145 __ SubuDetectOverflow(result, left, right, overflow);
1146 __ bltz(overflow, &error); // INT_MIN - INT_MIN does not overflow.
1147
1148 __ LoadImmediate(left, 0x7fffffff);
1149 __ LoadImmediate(right, 0x80000000);
1150 __ SubuDetectOverflow(result, left, right, overflow);
1151 __ bgez(overflow, &error); // INT_MAX - INT_MIN overflows.
1152
1153 __ LoadImmediate(left, 1);
1154 __ LoadImmediate(right, -1);
1155 __ SubuDetectOverflow(result, left, right, overflow);
1156 __ bltz(overflow, &error); // 1 - -1 does not overflow.
1157
1158 __ b(&done);
1159 __ Bind(&error);
1160 __ mov(V0, ZR);
1161 __ Bind(&done);
1162 __ Ret();
1163 }
1164
1165
1166 ASSEMBLER_TEST_RUN(SubOverflow_detect, test) {
1167 typedef int (*SimpleCode)();
1168 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
1169 }
1170
1171
1111 ASSEMBLER_TEST_GENERATE(Mtc1Mfc1, assembler) { 1172 ASSEMBLER_TEST_GENERATE(Mtc1Mfc1, assembler) {
1112 __ mtc1(ZR, F0); 1173 __ mtc1(ZR, F0);
1113 __ mfc1(V0, F0); 1174 __ mfc1(V0, F0);
1114 __ Ret(); 1175 __ Ret();
1115 } 1176 }
1116 1177
1117 1178
1118 ASSEMBLER_TEST_RUN(Mtc1Mfc1, test) { 1179 ASSEMBLER_TEST_RUN(Mtc1Mfc1, test) {
1119 typedef double (*SimpleCode)(); 1180 typedef double (*SimpleCode)();
1120 EXPECT(test != NULL); 1181 EXPECT(test != NULL);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 ASSEMBLER_TEST_RUN(Adds_Inf, test) { 1322 ASSEMBLER_TEST_RUN(Adds_Inf, test) {
1262 typedef double (*SimpleCode)(); 1323 typedef double (*SimpleCode)();
1263 EXPECT(test != NULL); 1324 EXPECT(test != NULL);
1264 float res = EXECUTE_TEST_CODE_FLOAT(SimpleCode, test->entry()); 1325 float res = EXECUTE_TEST_CODE_FLOAT(SimpleCode, test->entry());
1265 EXPECT_EQ(isfinite(res), false); 1326 EXPECT_EQ(isfinite(res), false);
1266 } 1327 }
1267 1328
1268 } // namespace dart 1329 } // namespace dart
1269 1330
1270 #endif // defined TARGET_ARCH_MIPS 1331 #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