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

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

Issue 832173009: Unit tests for 'testb' instruction on ia32 and x64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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/assembler_x64_test.cc » ('j') | runtime/vm/assembler_x64_test.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 __ ret(); 191 __ ret();
192 } 192 }
193 193
194 194
195 ASSEMBLER_TEST_RUN(Cmpb, test) { 195 ASSEMBLER_TEST_RUN(Cmpb, test) {
196 typedef int (*CmpbCode)(); 196 typedef int (*CmpbCode)();
197 EXPECT_EQ(1, reinterpret_cast<CmpbCode>(test->entry())()); 197 EXPECT_EQ(1, reinterpret_cast<CmpbCode>(test->entry())());
198 } 198 }
199 199
200 200
201 ASSEMBLER_TEST_GENERATE(Testb, assembler) {
202 __ movl(EAX, Immediate(1));
203 __ movl(ECX, Immediate(0));
204 __ pushl(Immediate(0xffffff11));
205 __ testb(Address(ESP, 0), Immediate(0x10));
206 // Fail if zero flag set.
207 __ cmove(EAX, ECX);
208 __ testb(Address(ESP, 0), Immediate(0x20));
209 // Fail if zero flag not set.
210 __ cmovne(EAX, ECX);
211 __ popl(ECX);
212 __ ret();
213 }
214
215
216 ASSEMBLER_TEST_RUN(Testb, test) {
217 typedef int (*TestbCode)();
218 EXPECT_EQ(1, reinterpret_cast<TestbCode>(test->entry())());
219 }
220
221
201 ASSEMBLER_TEST_GENERATE(Increment, assembler) { 222 ASSEMBLER_TEST_GENERATE(Increment, assembler) {
202 __ movl(EAX, Immediate(0)); 223 __ movl(EAX, Immediate(0));
203 __ pushl(EAX); 224 __ pushl(EAX);
204 __ incl(Address(ESP, 0)); 225 __ incl(Address(ESP, 0));
205 __ movl(ECX, Address(ESP, 0)); 226 __ movl(ECX, Address(ESP, 0));
206 __ incl(ECX); 227 __ incl(ECX);
207 __ popl(EAX); 228 __ popl(EAX);
208 __ movl(EAX, ECX); 229 __ movl(EAX, ECX);
209 __ ret(); 230 __ ret();
210 } 231 }
(...skipping 3241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3452 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMaxInt64))); 3473 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMaxInt64)));
3453 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMinInt64))); 3474 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMinInt64)));
3454 3475
3455 EXPECT_EQ(-1, range_of(Bool::True().raw())); 3476 EXPECT_EQ(-1, range_of(Bool::True().raw()));
3456 } 3477 }
3457 3478
3458 3479
3459 } // namespace dart 3480 } // namespace dart
3460 3481
3461 #endif // defined TARGET_ARCH_IA32 3482 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/assembler_x64_test.cc » ('j') | runtime/vm/assembler_x64_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698