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

Side by Side Diff: runtime/vm/assembler_x64_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 | « runtime/vm/assembler_ia32_test.cc ('k') | no next file » | 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) 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_X64) 6 #if defined(TARGET_ARCH_X64)
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 __ ret(); 290 __ ret();
291 } 291 }
292 292
293 293
294 ASSEMBLER_TEST_RUN(Cmpb, test) { 294 ASSEMBLER_TEST_RUN(Cmpb, test) {
295 typedef int (*CmpbCode)(); 295 typedef int (*CmpbCode)();
296 EXPECT_EQ(1, reinterpret_cast<CmpbCode>(test->entry())()); 296 EXPECT_EQ(1, reinterpret_cast<CmpbCode>(test->entry())());
297 } 297 }
298 298
299 299
300 ASSEMBLER_TEST_GENERATE(Testb, assembler) {
301 Label done;
302 __ movq(RAX, Immediate(1));
303 __ movq(RCX, Immediate(0));
304 __ pushq(Immediate(0xffffff11));
305 __ testb(Address(RSP, 0), Immediate(0x10));
306 // Fail if zero flag set.
307 __ cmoveq(RAX, RCX);
308 __ testb(Address(RSP, 0), Immediate(0x20));
309 // Fail if zero flag not set.
310 __ j(ZERO, &done);
regis 2015/01/09 16:30:39 I guess cmovneq is not implemented :-)
koda 2015/01/09 16:37:07 Exactly :)
311 __ movq(RAX, Immediate(0));
312 __ Bind(&done);
313 __ popq(RCX);
314 __ ret();
315 }
316
317
318 ASSEMBLER_TEST_RUN(Testb, test) {
319 typedef int (*TestbCode)();
320 EXPECT_EQ(1, reinterpret_cast<TestbCode>(test->entry())());
321 }
322
323
300 ASSEMBLER_TEST_GENERATE(Increment, assembler) { 324 ASSEMBLER_TEST_GENERATE(Increment, assembler) {
301 __ movq(RAX, Immediate(0)); 325 __ movq(RAX, Immediate(0));
302 __ pushq(RAX); 326 __ pushq(RAX);
303 __ incl(Address(RSP, 0)); 327 __ incl(Address(RSP, 0));
304 __ incq(Address(RSP, 0)); 328 __ incq(Address(RSP, 0));
305 __ movq(RCX, Address(RSP, 0)); 329 __ movq(RCX, Address(RSP, 0));
306 __ incq(RCX); 330 __ incq(RCX);
307 __ popq(RAX); 331 __ popq(RAX);
308 __ movq(RAX, RCX); 332 __ movq(RAX, RCX);
309 __ ret(); 333 __ ret();
(...skipping 3202 matching lines...) Expand 10 before | Expand all | Expand 10 after
3512 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMaxInt64))); 3536 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMaxInt64)));
3513 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMinInt64))); 3537 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMinInt64)));
3514 3538
3515 EXPECT_EQ(0, range_of(Bool::True().raw())); 3539 EXPECT_EQ(0, range_of(Bool::True().raw()));
3516 } 3540 }
3517 3541
3518 3542
3519 } // namespace dart 3543 } // namespace dart
3520 3544
3521 #endif // defined TARGET_ARCH_X64 3545 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_ia32_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698