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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_x64_test.cc
===================================================================
--- runtime/vm/assembler_x64_test.cc (revision 17083)
+++ runtime/vm/assembler_x64_test.cc (working copy)
@@ -535,6 +535,43 @@
}
+ASSEMBLER_TEST_GENERATE(MoveWord, assembler) {
+ __ xorq(RAX, RAX);
+ __ pushq(Immediate(0));
+ __ movq(RAX, RSP);
+ __ movq(RCX, Immediate(-1));
+ __ movw(Address(RAX, 0), RCX);
+ __ movzxw(RAX, Address(RAX, 0)); // RAX = 0xffff
+ __ addq(RSP, Immediate(kWordSize));
+ __ ret();
+}
+
+
+ASSEMBLER_TEST_RUN(MoveWord, entry) {
+ typedef int (*MoveWord)();
+ EXPECT_EQ(0xffff, reinterpret_cast<MoveWord>(entry)());
+}
+
+
+ASSEMBLER_TEST_GENERATE(MoveWordRex, assembler) {
+ __ pushq(Immediate(0));
+ __ movq(R8, RSP);
+ __ movq(R9, Immediate(-1));
+ __ movw(Address(R8, 0), R9);
+ __ movzxw(R8, Address(R8, 0)); // 0xffff
+ __ xorq(RAX, RAX);
+ __ addq(RAX, R8); // RAX = 0xffff
+ __ addq(RSP, Immediate(kWordSize));
+ __ ret();
+}
+
+
+ASSEMBLER_TEST_RUN(MoveWordRex, entry) {
+ typedef int (*MoveWordRex)();
+ EXPECT_EQ(0xffff, reinterpret_cast<MoveWordRex>(entry)());
+}
+
+
ASSEMBLER_TEST_GENERATE(Bitwise, assembler) {
__ movl(RCX, Immediate(42));
__ xorl(RCX, RCX);
« 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