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

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

Issue 11961013: Fix bug in the x64 assembler's movw instruction. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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_x64.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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 __ ret(); 528 __ ret();
529 } 529 }
530 530
531 531
532 ASSEMBLER_TEST_RUN(MoveExtendMemory, entry) { 532 ASSEMBLER_TEST_RUN(MoveExtendMemory, entry) {
533 typedef int (*MoveExtendMemory)(); 533 typedef int (*MoveExtendMemory)();
534 EXPECT_EQ(0xff - 1 + 0xffff, reinterpret_cast<MoveExtendMemory>(entry)()); 534 EXPECT_EQ(0xff - 1 + 0xffff, reinterpret_cast<MoveExtendMemory>(entry)());
535 } 535 }
536 536
537 537
538 ASSEMBLER_TEST_GENERATE(MoveWord, assembler) {
539 __ xorq(RAX, RAX);
540 __ pushq(Immediate(0));
541 __ movq(RAX, RSP);
542 __ movq(RCX, Immediate(-1));
543 __ movw(Address(RAX, 0), RCX);
544 __ movzxw(RAX, Address(RAX, 0)); // RAX = 0xffff
545 __ addq(RSP, Immediate(kWordSize));
546 __ ret();
547 }
548
549
550 ASSEMBLER_TEST_RUN(MoveWord, entry) {
551 typedef int (*MoveWord)();
552 EXPECT_EQ(0xffff, reinterpret_cast<MoveWord>(entry)());
553 }
554
555
556 ASSEMBLER_TEST_GENERATE(MoveWordRex, assembler) {
557 __ pushq(Immediate(0));
558 __ movq(R8, RSP);
559 __ movq(R9, Immediate(-1));
560 __ movw(Address(R8, 0), R9);
561 __ movzxw(R8, Address(R8, 0)); // 0xffff
562 __ xorq(RAX, RAX);
563 __ addq(RAX, R8); // RAX = 0xffff
564 __ addq(RSP, Immediate(kWordSize));
565 __ ret();
566 }
567
568
569 ASSEMBLER_TEST_RUN(MoveWordRex, entry) {
570 typedef int (*MoveWordRex)();
571 EXPECT_EQ(0xffff, reinterpret_cast<MoveWordRex>(entry)());
572 }
573
574
538 ASSEMBLER_TEST_GENERATE(Bitwise, assembler) { 575 ASSEMBLER_TEST_GENERATE(Bitwise, assembler) {
539 __ movl(RCX, Immediate(42)); 576 __ movl(RCX, Immediate(42));
540 __ xorl(RCX, RCX); 577 __ xorl(RCX, RCX);
541 __ orl(RCX, Immediate(256)); 578 __ orl(RCX, Immediate(256));
542 __ movl(RAX, Immediate(4)); 579 __ movl(RAX, Immediate(4));
543 __ orl(RCX, RAX); 580 __ orl(RCX, RAX);
544 __ movl(RAX, Immediate(0xfff0)); 581 __ movl(RAX, Immediate(0xfff0));
545 __ andl(RCX, RAX); 582 __ andl(RCX, RAX);
546 __ movl(RAX, Immediate(1)); 583 __ movl(RAX, Immediate(1));
547 __ orl(RCX, RAX); 584 __ orl(RCX, RAX);
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 EXPECT_EQ(0, res); 1941 EXPECT_EQ(0, res);
1905 res = reinterpret_cast<ExtractSignBits>(entry)(-1.0); 1942 res = reinterpret_cast<ExtractSignBits>(entry)(-1.0);
1906 EXPECT_EQ(1, res); 1943 EXPECT_EQ(1, res);
1907 res = reinterpret_cast<ExtractSignBits>(entry)(-0.0); 1944 res = reinterpret_cast<ExtractSignBits>(entry)(-0.0);
1908 EXPECT_EQ(1, res); 1945 EXPECT_EQ(1, res);
1909 } 1946 }
1910 1947
1911 } // namespace dart 1948 } // namespace dart
1912 1949
1913 #endif // defined TARGET_ARCH_X64 1950 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698