Permalink
Browse files

x64EmitterTest: test MOV with 64-bit immediates

  • Loading branch information...
Sintendo committed Sep 14, 2018
1 parent 53a9477 commit 58a0d0f117caff819177053b5b9bdf1774a91929
Showing with 18 additions and 0 deletions.
  1. +18 −0 Source/UnitTests/Common/x64EmitterTest.cpp
@@ -547,6 +547,24 @@ TWO_OP_ARITH_TEST(OR)
TWO_OP_ARITH_TEST(XOR)
TWO_OP_ARITH_TEST(MOV)
TEST_F(x64EmitterTest, MOV_Imm64)
{
for (size_t i = 0; i < reg64names.size(); i++)
{
emitter->MOV(64, R(reg64names[i].reg), Imm64(0xDEADBEEFDEADBEEF));
EXPECT_EQ(emitter->GetCodePtr(), code_buffer + 10);
ExpectDisassembly("mov " + reg64names[i].name + ", 0xdeadbeefdeadbeef");
emitter->MOV(64, R(reg64names[i].reg), Imm64(0xFFFFFFFFDEADBEEF));
EXPECT_EQ(emitter->GetCodePtr(), code_buffer + 7);
ExpectDisassembly("mov " + reg64names[i].name + ", 0xffffffffdeadbeef");
emitter->MOV(64, R(reg64names[i].reg), Imm64(0xDEADBEEF));
EXPECT_EQ(emitter->GetCodePtr(), code_buffer + 5 + (i > 7));
ExpectDisassembly("mov " + reg32names[i].name + ", 0xdeadbeef");
}
}
// TODO: Disassembler inverts operands here.
// TWO_OP_ARITH_TEST(XCHG)
// TWO_OP_ARITH_TEST(TEST)

0 comments on commit 58a0d0f

Please sign in to comment.