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

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

Issue 16272004: Implements intrinsics for MIPS. (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 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 __ jr(RA); 127 __ jr(RA);
128 } 128 }
129 129
130 130
131 ASSEMBLER_TEST_RUN(Clz, test) { 131 ASSEMBLER_TEST_RUN(Clz, test) {
132 typedef int (*SimpleCode)(); 132 typedef int (*SimpleCode)();
133 EXPECT_EQ(17, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry())); 133 EXPECT_EQ(17, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
134 } 134 }
135 135
136 136
137 ASSEMBLER_TEST_GENERATE(MtloMflo, assembler) {
138 __ LoadImmediate(T0, 42);
139 __ mtlo(T0);
140 __ mflo(V0);
141 __ jr(RA);
142 }
143
144
145 ASSEMBLER_TEST_RUN(MtloMflo, test) {
146 typedef int (*SimpleCode)();
147 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
148 }
149
150
151 ASSEMBLER_TEST_GENERATE(MthiMfhi, assembler) {
152 __ LoadImmediate(T0, 42);
153 __ mthi(T0);
154 __ mfhi(V0);
155 __ jr(RA);
156 }
157
158
159 ASSEMBLER_TEST_RUN(MthiMfhi, test) {
160 typedef int (*SimpleCode)();
161 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
162 }
163
164
137 ASSEMBLER_TEST_GENERATE(Divu, assembler) { 165 ASSEMBLER_TEST_GENERATE(Divu, assembler) {
138 __ addiu(R1, ZR, Immediate(27)); 166 __ addiu(R1, ZR, Immediate(27));
139 __ addiu(R2, ZR, Immediate(9)); 167 __ addiu(R2, ZR, Immediate(9));
140 __ divu(R1, R2); 168 __ divu(R1, R2);
141 __ mflo(V0); 169 __ mflo(V0);
142 __ jr(RA); 170 __ jr(RA);
143 } 171 }
144 172
145 173
146 ASSEMBLER_TEST_RUN(Divu, test) { 174 ASSEMBLER_TEST_RUN(Divu, test) {
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 __ jr(RA); 541 __ jr(RA);
514 } 542 }
515 543
516 544
517 ASSEMBLER_TEST_RUN(Multu_hi, test) { 545 ASSEMBLER_TEST_RUN(Multu_hi, test) {
518 typedef int (*SimpleCode)(); 546 typedef int (*SimpleCode)();
519 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry())); 547 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
520 } 548 }
521 549
522 550
551 ASSEMBLER_TEST_GENERATE(Madd_neg, assembler) {
552 __ LoadImmediate(R1, -6);
553 __ LoadImmediate(R2, 7);
554 __ mult(R1, R2);
555 __ madd(R1, R2);
556 __ mflo(V0);
557 __ mfhi(V1);
558 __ jr(RA);
559 }
560
561
562 ASSEMBLER_TEST_RUN(Madd_neg, test) {
563 typedef int (*SimpleCode)();
564 EXPECT_EQ(-84, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
565 }
566
567
523 ASSEMBLER_TEST_GENERATE(Subu, assembler) { 568 ASSEMBLER_TEST_GENERATE(Subu, assembler) {
524 __ LoadImmediate(R1, 737); 569 __ LoadImmediate(R1, 737);
525 __ LoadImmediate(R2, 695); 570 __ LoadImmediate(R2, 695);
526 __ subu(V0, R1, R2); 571 __ subu(V0, R1, R2);
527 __ jr(RA); 572 __ jr(RA);
528 } 573 }
529 574
530 575
531 ASSEMBLER_TEST_RUN(Subu, test) { 576 ASSEMBLER_TEST_RUN(Subu, test) {
532 typedef int (*SimpleCode)(); 577 typedef int (*SimpleCode)();
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 A1); 1720 A1);
1676 __ lw(RA, Address(SP, 0 * kWordSize)); 1721 __ lw(RA, Address(SP, 0 * kWordSize));
1677 __ lw(CTX, Address(SP, 1 * kWordSize)); 1722 __ lw(CTX, Address(SP, 1 * kWordSize));
1678 __ addiu(SP, SP, Immediate(2 * kWordSize)); 1723 __ addiu(SP, SP, Immediate(2 * kWordSize));
1679 __ Ret(); 1724 __ Ret();
1680 } 1725 }
1681 1726
1682 } // namespace dart 1727 } // namespace dart
1683 1728
1684 #endif // defined TARGET_ARCH_MIPS 1729 #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