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

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

Issue 12545067: On x64 use 32bit idiv when possible instead of 64bit one. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rename movsxl to movsxd 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_x64.cc ('k') | runtime/vm/disassembler_x64.cc » ('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) 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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 __ ret(); 508 __ ret();
509 } 509 }
510 510
511 511
512 ASSEMBLER_TEST_RUN(MoveExtend, test) { 512 ASSEMBLER_TEST_RUN(MoveExtend, test) {
513 typedef int (*MoveExtend)(); 513 typedef int (*MoveExtend)();
514 EXPECT_EQ(0xff - 1 + 0xffff, reinterpret_cast<MoveExtend>(test->entry())()); 514 EXPECT_EQ(0xff - 1 + 0xffff, reinterpret_cast<MoveExtend>(test->entry())());
515 } 515 }
516 516
517 517
518 ASSEMBLER_TEST_GENERATE(MoveExtend32, assembler) {
519 __ movq(RDX, Immediate(0xffffffff));
520 __ movsxd(RDX, RDX);
521 __ movq(RAX, Immediate(0x7fffffff));
522 __ movsxd(RAX, RAX);
523 __ addq(RAX, RDX);
524 __ ret();
525 }
526
527
528 ASSEMBLER_TEST_RUN(MoveExtend32, test) {
529 typedef intptr_t (*MoveExtend)();
530 EXPECT_EQ(0x7ffffffe, reinterpret_cast<MoveExtend>(test->entry())());
531 }
532
533
518 ASSEMBLER_TEST_GENERATE(MoveExtendMemory, assembler) { 534 ASSEMBLER_TEST_GENERATE(MoveExtendMemory, assembler) {
519 __ movq(RDX, Immediate(0x123456781234ffff)); 535 __ movq(RDX, Immediate(0x123456781234ffff));
520 536
521 __ pushq(RDX); 537 __ pushq(RDX);
522 __ movzxb(RAX, Address(RSP, 0)); // RAX = 0xff 538 __ movzxb(RAX, Address(RSP, 0)); // RAX = 0xff
523 __ movsxw(R8, Address(RSP, 0)); // R8 = -1 539 __ movsxw(R8, Address(RSP, 0)); // R8 = -1
524 __ movzxw(RCX, Address(RSP, 0)); // RCX = 0xffff 540 __ movzxw(RCX, Address(RSP, 0)); // RCX = 0xffff
525 __ addq(RSP, Immediate(kWordSize)); 541 __ addq(RSP, Immediate(kWordSize));
526 542
527 __ addq(R8, RCX); 543 __ addq(R8, RCX);
528 __ addq(RAX, R8); 544 __ addq(RAX, R8);
529 __ ret(); 545 __ ret();
530 } 546 }
531 547
532 548
533 ASSEMBLER_TEST_RUN(MoveExtendMemory, test) { 549 ASSEMBLER_TEST_RUN(MoveExtendMemory, test) {
534 typedef int (*MoveExtendMemory)(); 550 typedef int (*MoveExtendMemory)();
535 EXPECT_EQ(0xff - 1 + 0xffff, 551 EXPECT_EQ(0xff - 1 + 0xffff,
536 reinterpret_cast<MoveExtendMemory>(test->entry())()); 552 reinterpret_cast<MoveExtendMemory>(test->entry())());
537 } 553 }
538 554
539 555
556 ASSEMBLER_TEST_GENERATE(MoveExtend32Memory, assembler) {
557 __ pushq(Immediate(0xffffffff));
558 __ pushq(Immediate(0x7fffffff));
559 __ movsxd(RDX, Address(RSP, kWordSize));
560 __ movsxd(RAX, Address(RSP, 0));
561 __ addq(RSP, Immediate(kWordSize * 2));
562
563 __ addq(RAX, RDX);
564 __ ret();
565 }
566
567
568 ASSEMBLER_TEST_RUN(MoveExtend32Memory, test) {
569 typedef intptr_t (*MoveExtend)();
570 EXPECT_EQ(0x7ffffffe, reinterpret_cast<MoveExtend>(test->entry())());
571 }
572
573
540 ASSEMBLER_TEST_GENERATE(MoveWord, assembler) { 574 ASSEMBLER_TEST_GENERATE(MoveWord, assembler) {
541 __ xorq(RAX, RAX); 575 __ xorq(RAX, RAX);
542 __ pushq(Immediate(0)); 576 __ pushq(Immediate(0));
543 __ movq(RAX, RSP); 577 __ movq(RAX, RSP);
544 __ movq(RCX, Immediate(-1)); 578 __ movq(RCX, Immediate(-1));
545 __ movw(Address(RAX, 0), RCX); 579 __ movw(Address(RAX, 0), RCX);
546 __ movzxw(RAX, Address(RAX, 0)); // RAX = 0xffff 580 __ movzxw(RAX, Address(RAX, 0)); // RAX = 0xffff
547 __ addq(RSP, Immediate(kWordSize)); 581 __ addq(RSP, Immediate(kWordSize));
548 __ ret(); 582 __ ret();
549 } 583 }
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after
2253 EXPECT_EQ(0, res); 2287 EXPECT_EQ(0, res);
2254 res = reinterpret_cast<ExtractSignBits>(test->entry())(-1.0); 2288 res = reinterpret_cast<ExtractSignBits>(test->entry())(-1.0);
2255 EXPECT_EQ(1, res); 2289 EXPECT_EQ(1, res);
2256 res = reinterpret_cast<ExtractSignBits>(test->entry())(-0.0); 2290 res = reinterpret_cast<ExtractSignBits>(test->entry())(-0.0);
2257 EXPECT_EQ(1, res); 2291 EXPECT_EQ(1, res);
2258 } 2292 }
2259 2293
2260 } // namespace dart 2294 } // namespace dart
2261 2295
2262 #endif // defined TARGET_ARCH_X64 2296 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/disassembler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698