[x64] Check expected disassembly output for some instructions

We move some instructions from the test that just disassembles them, to
the test that checks for expected output.

Bug: v8:12207
Change-Id: I913237427d795ed44539c7294ebbe69330c41dfa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3163278
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76944}
This commit is contained in:
Ng Zhi An 2021-09-15 10:44:42 -07:00 committed by V8 LUCI CQ
parent 32253e897c
commit dd06c11ee0

View File

@ -50,238 +50,7 @@ TEST(DisasmX64) {
v8::internal::byte buffer[8192]; v8::internal::byte buffer[8192];
Assembler assm(AssemblerOptions{}, Assembler assm(AssemblerOptions{},
ExternalAssemblerBuffer(buffer, sizeof buffer)); ExternalAssemblerBuffer(buffer, sizeof buffer));
// Some instructions are tested in DisasmX64CheckOutput.
// Short immediate instructions
__ addq(rax, Immediate(12345678));
__ orq(rax, Immediate(12345678));
__ subq(rax, Immediate(12345678));
__ xorq(rax, Immediate(12345678));
__ andq(rax, Immediate(12345678));
// ---- This one caused crash
__ movq(rbx, Operand(rsp, rcx, times_2, 0)); // [rsp+rcx*4]
// ---- All instructions that I can think of
__ addq(rdx, rbx);
__ addq(rdx, Operand(rbx, 0));
__ addq(rdx, Operand(rbx, 16));
__ addq(rdx, Operand(rbx, 1999));
__ addq(rdx, Operand(rbx, -4));
__ addq(rdx, Operand(rbx, -1999));
__ addq(rdx, Operand(rsp, 0));
__ addq(rdx, Operand(rsp, 16));
__ addq(rdx, Operand(rsp, 1999));
__ addq(rdx, Operand(rsp, -4));
__ addq(rdx, Operand(rsp, -1999));
__ nop();
__ addq(rsi, Operand(rcx, times_4, 0));
__ addq(rsi, Operand(rcx, times_4, 24));
__ addq(rsi, Operand(rcx, times_4, -4));
__ addq(rsi, Operand(rcx, times_4, -1999));
__ nop();
__ addq(rdi, Operand(rbp, rcx, times_4, 0));
__ addq(rdi, Operand(rbp, rcx, times_4, 12));
__ addq(rdi, Operand(rbp, rcx, times_4, -8));
__ addq(rdi, Operand(rbp, rcx, times_4, -3999));
__ addq(Operand(rbp, rcx, times_4, 12), Immediate(12));
__ bswapl(rax);
__ bswapq(rdi);
__ bsrl(rax, r15);
__ bsrl(r9, Operand(rcx, times_8, 91919));
__ nop();
__ addq(rbx, Immediate(12));
__ nop();
__ nop();
__ andq(rdx, Immediate(3));
__ andq(rdx, Operand(rsp, 4));
__ cmpq(rdx, Immediate(3));
__ cmpq(rdx, Operand(rsp, 4));
__ cmpq(Operand(rbp, rcx, times_4, 0), Immediate(1000));
__ cmpb(rbx, Operand(rbp, rcx, times_2, 0));
__ cmpb(Operand(rbp, rcx, times_2, 0), rbx);
__ orq(rdx, Immediate(3));
__ xorq(rdx, Immediate(3));
__ nop();
__ cpuid();
__ movsxbl(rdx, Operand(rcx, 0));
__ movsxbq(rdx, Operand(rcx, 0));
__ movsxwl(rdx, Operand(rcx, 0));
__ movsxwq(rdx, Operand(rcx, 0));
__ movzxbl(rdx, Operand(rcx, 0));
__ movzxwl(rdx, Operand(rcx, 0));
__ movzxbq(rdx, Operand(rcx, 0));
__ movzxwq(rdx, Operand(rcx, 0));
__ nop();
__ imulq(rdx, rcx);
__ shld(rdx, rcx);
__ shrd(rdx, rcx);
__ shlq(Operand(rdi, rax, times_4, 100), Immediate(1));
__ shlq(Operand(rdi, rax, times_4, 100), Immediate(6));
__ shlq(Operand(r15, 0), Immediate(1));
__ shlq(Operand(r15, 0), Immediate(6));
__ shlq_cl(Operand(r15, 0));
__ shlq_cl(Operand(r15, 0));
__ shlq_cl(Operand(rdi, rax, times_4, 100));
__ shlq_cl(Operand(rdi, rax, times_4, 100));
__ shlq(rdx, Immediate(1));
__ shlq(rdx, Immediate(6));
__ shll(Operand(rdi, rax, times_4, 100), Immediate(1));
__ shll(Operand(rdi, rax, times_4, 100), Immediate(6));
__ shll(Operand(r15, 0), Immediate(1));
__ shll(Operand(r15, 0), Immediate(6));
__ shll_cl(Operand(r15, 0));
__ shll_cl(Operand(r15, 0));
__ shll_cl(Operand(rdi, rax, times_4, 100));
__ shll_cl(Operand(rdi, rax, times_4, 100));
__ shll(rdx, Immediate(1));
__ shll(rdx, Immediate(6));
__ btq(Operand(rdx, 0), rcx);
__ btsq(Operand(rdx, 0), rcx);
__ btsq(Operand(rbx, rcx, times_4, 0), rcx);
__ btsq(rcx, Immediate(13));
__ btrq(rcx, Immediate(13));
__ nop();
__ pushq(Immediate(12));
__ pushq(Immediate(23456));
__ pushq(rcx);
__ pushq(rsi);
__ pushq(Operand(rbp, StandardFrameConstants::kFunctionOffset));
__ pushq(Operand(rbx, rcx, times_4, 0));
__ pushq(Operand(rbx, rcx, times_4, 0));
__ pushq(Operand(rbx, rcx, times_4, 10000));
__ popq(rdx);
__ popq(rax);
__ popq(Operand(rbx, rcx, times_4, 0));
__ nop();
__ addq(rdx, Operand(rsp, 16));
__ addq(rdx, rcx);
__ movb(rdx, Operand(rcx, 0));
__ movb(rcx, Immediate(6));
__ movb(Operand(rsp, 16), rdx);
__ movw(Operand(rsp, 16), rdx);
__ nop();
__ movsxwq(rdx, Operand(rsp, 12));
__ movsxbq(rdx, Operand(rsp, 12));
__ movsxlq(rdx, Operand(rsp, 12));
__ movzxwq(rdx, Operand(rsp, 12));
__ movzxbq(rdx, Operand(rsp, 12));
__ nop();
__ movq(rdx, Immediate(1234567));
__ movq(rdx, Operand(rsp, 12));
__ movq(Operand(rbx, rcx, times_4, 10000), Immediate(12345));
__ movq(Operand(rbx, rcx, times_4, 10000), rdx);
__ nop();
__ decb(rdx);
__ decb(Operand(rax, 10));
__ decb(Operand(rbx, rcx, times_4, 10000));
__ decq(rdx);
__ cdq();
__ repstosl();
__ repstosq();
__ nop();
__ idivq(rdx);
__ mull(rdx);
__ mulq(rdx);
__ negb(rdx);
__ negb(r10);
__ negw(rdx);
__ negl(rdx);
__ negq(rdx);
__ negb(Operand(rsp, 12));
__ negw(Operand(rsp, 12));
__ negl(Operand(rsp, 12));
__ negb(Operand(rsp, 12));
__ notq(rdx);
__ testq(Operand(rbx, rcx, times_4, 10000), rdx);
__ imulq(rdx, rcx, Immediate(12));
__ imulq(rdx, rcx, Immediate(1000));
__ imulq(rdx, Operand(rbx, rcx, times_4, 10000));
__ imulq(rdx, Operand(rbx, rcx, times_4, 10000), Immediate(12));
__ imulq(rdx, Operand(rbx, rcx, times_4, 10000), Immediate(1000));
__ imull(r15, rcx, Immediate(12));
__ imull(r15, rcx, Immediate(1000));
__ imull(r15, Operand(rbx, rcx, times_4, 10000));
__ imull(r15, Operand(rbx, rcx, times_4, 10000), Immediate(12));
__ imull(r15, Operand(rbx, rcx, times_4, 10000), Immediate(1000));
__ incq(rdx);
__ incq(Operand(rbx, rcx, times_4, 10000));
__ pushq(Operand(rbx, rcx, times_4, 10000));
__ popq(Operand(rbx, rcx, times_4, 10000));
__ jmp(Operand(rbx, rcx, times_4, 10000));
__ leaq(rdx, Operand(rbx, rcx, times_4, 10000));
__ orq(rdx, Immediate(12345));
__ orq(rdx, Operand(rbx, rcx, times_4, 10000));
__ nop();
__ rclq(rdx, Immediate(1));
__ rclq(rdx, Immediate(7));
__ rcrq(rdx, Immediate(1));
__ rcrq(rdx, Immediate(7));
__ sarq(rdx, Immediate(1));
__ sarq(rdx, Immediate(6));
__ sarq_cl(rdx);
__ sbbq(rdx, rbx);
__ shld(rdx, rbx);
__ shlq(rdx, Immediate(1));
__ shlq(rdx, Immediate(6));
__ shlq_cl(rdx);
__ shrd(rdx, rbx);
__ shrq(rdx, Immediate(1));
__ shrq(rdx, Immediate(7));
__ shrq_cl(rdx);
// Immediates
__ addq(rbx, Immediate(12));
__ addq(Operand(rdx, rcx, times_4, 10000), Immediate(12));
__ andq(rbx, Immediate(12345));
__ cmpq(rbx, Immediate(12345));
__ cmpq(rbx, Immediate(12));
__ cmpq(Operand(rdx, rcx, times_4, 10000), Immediate(12));
__ cmpb(rax, Immediate(100));
__ orq(rbx, Immediate(12345));
__ subq(rbx, Immediate(12));
__ subq(Operand(rdx, rcx, times_4, 10000), Immediate(12));
__ xorq(rbx, Immediate(12345));
__ imulq(rdx, rcx, Immediate(12));
__ imulq(rdx, rcx, Immediate(1000));
__ cld();
__ subq(rdx, Operand(rbx, rcx, times_4, 10000));
__ subq(rdx, rbx);
__ testq(rdx, Immediate(12345));
__ testq(Operand(rbx, rcx, times_8, 10000), rdx);
__ testb(Operand(rcx, rbx, times_2, 1000), rdx);
__ testb(Operand(rax, -20), Immediate(0x9A));
__ nop();
__ xorq(rdx, Immediate(12345));
__ xorq(rdx, Operand(rbx, rcx, times_8, 10000));
__ hlt();
__ int3();
__ ret(0);
__ ret(8);
// Calls // Calls
@ -1080,8 +849,318 @@ UNINITIALIZED_TEST(DisasmX64CheckOutput) {
expected = str; \ expected = str; \
CHECK_EQ(expected, actual); CHECK_EQ(expected, actual);
// Short immediate instructions
COMPARE("48054e61bc00 REX.W add rax,0xbc614e", COMPARE("48054e61bc00 REX.W add rax,0xbc614e",
addq(rax, Immediate(12345678))); addq(rax, Immediate(12345678)));
COMPARE("480d4e61bc00 REX.W or rax,0xbc614e",
orq(rax, Immediate(12345678)));
COMPARE("482d4e61bc00 REX.W sub rax,0xbc614e",
subq(rax, Immediate(12345678)));
COMPARE("48354e61bc00 REX.W xor rax,0xbc614e",
xorq(rax, Immediate(12345678)));
COMPARE("48254e61bc00 REX.W and rax,0xbc614e",
andq(rax, Immediate(12345678)));
COMPARE("488b1c4c REX.W movq rbx,[rsp+rcx*2]",
movq(rbx, Operand(rsp, rcx, times_2, 0))); // [rsp+rcx*2);
COMPARE("4803d3 REX.W addq rdx,rbx", addq(rdx, rbx));
COMPARE("480313 REX.W addq rdx,[rbx]",
addq(rdx, Operand(rbx, 0)));
COMPARE("48035310 REX.W addq rdx,[rbx+0x10]",
addq(rdx, Operand(rbx, 16)));
COMPARE("480393cf070000 REX.W addq rdx,[rbx+0x7cf]",
addq(rdx, Operand(rbx, 1999)));
COMPARE("480353fc REX.W addq rdx,[rbx-0x4]",
addq(rdx, Operand(rbx, -4)));
COMPARE("48039331f8ffff REX.W addq rdx,[rbx-0x7cf]",
addq(rdx, Operand(rbx, -1999)));
COMPARE("48031424 REX.W addq rdx,[rsp]",
addq(rdx, Operand(rsp, 0)));
COMPARE("4803542410 REX.W addq rdx,[rsp+0x10]",
addq(rdx, Operand(rsp, 16)));
COMPARE("48039424cf070000 REX.W addq rdx,[rsp+0x7cf]",
addq(rdx, Operand(rsp, 1999)));
COMPARE("48035424fc REX.W addq rdx,[rsp-0x4]",
addq(rdx, Operand(rsp, -4)));
COMPARE("4803942431f8ffff REX.W addq rdx,[rsp-0x7cf]",
addq(rdx, Operand(rsp, -1999)));
COMPARE("4803348d00000000 REX.W addq rsi,[rcx*4+0x0]",
addq(rsi, Operand(rcx, times_4, 0)));
COMPARE("4803348d18000000 REX.W addq rsi,[rcx*4+0x18]",
addq(rsi, Operand(rcx, times_4, 24)));
COMPARE("4803348dfcffffff REX.W addq rsi,[rcx*4-0x4]",
addq(rsi, Operand(rcx, times_4, -4)));
COMPARE("4803348d31f8ffff REX.W addq rsi,[rcx*4-0x7cf]",
addq(rsi, Operand(rcx, times_4, -1999)));
COMPARE("48037c8d00 REX.W addq rdi,[rbp+rcx*4+0x0]",
addq(rdi, Operand(rbp, rcx, times_4, 0)));
COMPARE("48037c8d0c REX.W addq rdi,[rbp+rcx*4+0xc]",
addq(rdi, Operand(rbp, rcx, times_4, 12)));
COMPARE("48037c8df8 REX.W addq rdi,[rbp+rcx*4-0x8]",
addq(rdi, Operand(rbp, rcx, times_4, -8)));
COMPARE("4803bc8d61f0ffff REX.W addq rdi,[rbp+rcx*4-0xf9f]",
addq(rdi, Operand(rbp, rcx, times_4, -3999)));
COMPARE("4883448d0c0c REX.W addq [rbp+rcx*4+0xc],0xc",
addq(Operand(rbp, rcx, times_4, 12), Immediate(12)));
COMPARE("400fc8 bswapl rax", bswapl(rax));
COMPARE("480fcf REX.W bswapq rdi", bswapq(rdi));
COMPARE("410fbdc7 bsrl rax,r15", bsrl(rax, r15));
COMPARE("440fbd0ccd0f670100 bsrl r9,[rcx*8+0x1670f]",
bsrl(r9, Operand(rcx, times_8, 91919)));
COMPARE("90 nop", nop());
COMPARE("4883c30c REX.W addq rbx,0xc", addq(rbx, Immediate(12)));
COMPARE("4883e203 REX.W andq rdx,0x3", andq(rdx, Immediate(3)));
COMPARE("4823542404 REX.W andq rdx,[rsp+0x4]",
andq(rdx, Operand(rsp, 4)));
COMPARE("4883fa03 REX.W cmpq rdx,0x3", cmpq(rdx, Immediate(3)));
COMPARE("483b542404 REX.W cmpq rdx,[rsp+0x4]",
cmpq(rdx, Operand(rsp, 4)));
COMPARE("48817c8d00e8030000 REX.W cmpq [rbp+rcx*4+0x0],0x3e8",
cmpq(Operand(rbp, rcx, times_4, 0), Immediate(1000)));
COMPARE("3a5c4d00 cmpb bl,[rbp+rcx*2+0x0]",
cmpb(rbx, Operand(rbp, rcx, times_2, 0)));
COMPARE("385c4d00 cmpb [rbp+rcx*2+0x0],bl",
cmpb(Operand(rbp, rcx, times_2, 0), rbx));
COMPARE("4883ca03 REX.W orq rdx,0x3", orq(rdx, Immediate(3)));
COMPARE("4883f203 REX.W xorq rdx,0x3", xorq(rdx, Immediate(3)));
COMPARE("90 nop", nop());
COMPARE("0fa2 cpuid", cpuid());
COMPARE("0fbe11 movsxbl rdx,[rcx]",
movsxbl(rdx, Operand(rcx, 0)));
COMPARE("480fbe11 REX.W movsxbq rdx,[rcx]",
movsxbq(rdx, Operand(rcx, 0)));
COMPARE("0fbf11 movsxwl rdx,[rcx]",
movsxwl(rdx, Operand(rcx, 0)));
COMPARE("480fbf11 REX.W movsxwq rdx,[rcx]",
movsxwq(rdx, Operand(rcx, 0)));
COMPARE("0fb611 movzxbl rdx,[rcx]",
movzxbl(rdx, Operand(rcx, 0)));
COMPARE("0fb711 movzxwl rdx,[rcx]",
movzxwl(rdx, Operand(rcx, 0)));
COMPARE("0fb611 movzxbl rdx,[rcx]",
movzxbq(rdx, Operand(rcx, 0)));
COMPARE("0fb711 movzxwl rdx,[rcx]",
movzxwq(rdx, Operand(rcx, 0)));
COMPARE("480fafd1 REX.W imulq rdx,rcx", imulq(rdx, rcx));
COMPARE("480fa5ca REX.W shld rdx,rcx,cl", shld(rdx, rcx));
COMPARE("480fadca REX.W shrd rdx,rcx,cl", shrd(rdx, rcx));
COMPARE("48d1648764 REX.W shlq [rdi+rax*4+0x64], 1",
shlq(Operand(rdi, rax, times_4, 100), Immediate(1)));
COMPARE("48c164876406 REX.W shlq [rdi+rax*4+0x64], 6",
shlq(Operand(rdi, rax, times_4, 100), Immediate(6)));
COMPARE("49d127 REX.W shlq [r15], 1",
shlq(Operand(r15, 0), Immediate(1)));
COMPARE("49c12706 REX.W shlq [r15], 6",
shlq(Operand(r15, 0), Immediate(6)));
COMPARE("49d327 REX.W shlq [r15], cl", shlq_cl(Operand(r15, 0)));
COMPARE("49d327 REX.W shlq [r15], cl", shlq_cl(Operand(r15, 0)));
COMPARE("48d3648764 REX.W shlq [rdi+rax*4+0x64], cl",
shlq_cl(Operand(rdi, rax, times_4, 100)));
COMPARE("48d3648764 REX.W shlq [rdi+rax*4+0x64], cl",
shlq_cl(Operand(rdi, rax, times_4, 100)));
COMPARE("48d1e2 REX.W shlq rdx, 1", shlq(rdx, Immediate(1)));
COMPARE("48c1e206 REX.W shlq rdx, 6", shlq(rdx, Immediate(6)));
COMPARE("d1648764 shll [rdi+rax*4+0x64], 1",
shll(Operand(rdi, rax, times_4, 100), Immediate(1)));
COMPARE("c164876406 shll [rdi+rax*4+0x64], 6",
shll(Operand(rdi, rax, times_4, 100), Immediate(6)));
COMPARE("41d127 shll [r15], 1",
shll(Operand(r15, 0), Immediate(1)));
COMPARE("41c12706 shll [r15], 6",
shll(Operand(r15, 0), Immediate(6)));
COMPARE("41d327 shll [r15], cl", shll_cl(Operand(r15, 0)));
COMPARE("41d327 shll [r15], cl", shll_cl(Operand(r15, 0)));
COMPARE("d3648764 shll [rdi+rax*4+0x64], cl",
shll_cl(Operand(rdi, rax, times_4, 100)));
COMPARE("d3648764 shll [rdi+rax*4+0x64], cl",
shll_cl(Operand(rdi, rax, times_4, 100)));
COMPARE("d1e2 shll rdx, 1", shll(rdx, Immediate(1)));
COMPARE("c1e206 shll rdx, 6", shll(rdx, Immediate(6)));
COMPARE("480fa30a REX.W bt [rdx],rcx,cl",
btq(Operand(rdx, 0), rcx));
COMPARE("480fab0a REX.W bts [rdx],rcx", btsq(Operand(rdx, 0), rcx));
COMPARE("480fab0c8b REX.W bts [rbx+rcx*4],rcx",
btsq(Operand(rbx, rcx, times_4, 0), rcx));
COMPARE("480fbae90d REX.W bts rcx,13", btsq(rcx, Immediate(13)));
COMPARE("480fbaf10d REX.W btr rcx,13", btrq(rcx, Immediate(13)));
COMPARE("6a0c push 0xc", pushq(Immediate(12)));
COMPARE("68a05b0000 push 0x5ba0", pushq(Immediate(23456)));
COMPARE("51 push rcx", pushq(rcx));
COMPARE("56 push rsi", pushq(rsi));
COMPARE("ff75f0 push [rbp-0x10]",
pushq(Operand(rbp, StandardFrameConstants::kFunctionOffset)));
COMPARE("ff348b push [rbx+rcx*4]",
pushq(Operand(rbx, rcx, times_4, 0)));
COMPARE("ff348b push [rbx+rcx*4]",
pushq(Operand(rbx, rcx, times_4, 0)));
COMPARE("ffb48b10270000 push [rbx+rcx*4+0x2710]",
pushq(Operand(rbx, rcx, times_4, 10000)));
COMPARE("5a pop rdx", popq(rdx));
COMPARE("58 pop rax", popq(rax));
COMPARE("8f048b pop [rbx+rcx*4]",
popq(Operand(rbx, rcx, times_4, 0)));
COMPARE("4803542410 REX.W addq rdx,[rsp+0x10]",
addq(rdx, Operand(rsp, 16)));
COMPARE("4803d1 REX.W addq rdx,rcx", addq(rdx, rcx));
COMPARE("8a11 movb dl,[rcx]", movb(rdx, Operand(rcx, 0)));
COMPARE("b106 movb cl,6", movb(rcx, Immediate(6)));
COMPARE("88542410 movb [rsp+0x10],dl", movb(Operand(rsp, 16), rdx));
COMPARE("6689542410 movw [rsp+0x10],rdx",
movw(Operand(rsp, 16), rdx));
COMPARE("90 nop", nop());
COMPARE("480fbf54240c REX.W movsxwq rdx,[rsp+0xc]",
movsxwq(rdx, Operand(rsp, 12)));
COMPARE("480fbe54240c REX.W movsxbq rdx,[rsp+0xc]",
movsxbq(rdx, Operand(rsp, 12)));
COMPARE("486354240c REX.W movsxlq rdx,[rsp+0xc]",
movsxlq(rdx, Operand(rsp, 12)));
COMPARE("0fb754240c movzxwl rdx,[rsp+0xc]",
movzxwq(rdx, Operand(rsp, 12)));
COMPARE("0fb654240c movzxbl rdx,[rsp+0xc]",
movzxbq(rdx, Operand(rsp, 12)));
COMPARE("90 nop", nop());
COMPARE("48c7c287d61200 REX.W movq rdx,0x12d687",
movq(rdx, Immediate(1234567)));
COMPARE("488b54240c REX.W movq rdx,[rsp+0xc]",
movq(rdx, Operand(rsp, 12)));
COMPARE("48c7848b1027000039300000 REX.W movq [rbx+rcx*4+0x2710],0x3039",
movq(Operand(rbx, rcx, times_4, 10000), Immediate(12345)));
COMPARE("4889948b10270000 REX.W movq [rbx+rcx*4+0x2710],rdx",
movq(Operand(rbx, rcx, times_4, 10000), rdx));
COMPARE("90 nop", nop());
COMPARE("feca decb dl", decb(rdx));
COMPARE("fe480a decb [rax+0xa]", decb(Operand(rax, 10)));
COMPARE("fe8c8b10270000 decb [rbx+rcx*4+0x2710]",
decb(Operand(rbx, rcx, times_4, 10000)));
COMPARE("48ffca REX.W decq rdx", decq(rdx));
COMPARE("99 cdql", cdq());
COMPARE("f3ab rep stosl", repstosl());
COMPARE("f348ab REX.W rep stosq", repstosq());
COMPARE("48f7fa REX.W idivq rdx", idivq(rdx));
COMPARE("f7e2 mull rdx", mull(rdx));
COMPARE("48f7e2 REX.W mulq rdx", mulq(rdx));
COMPARE("f6da negb rdx", negb(rdx));
COMPARE("41f6da negb r10", negb(r10));
COMPARE("66f7da negw rdx", negw(rdx));
COMPARE("f7da negl rdx", negl(rdx));
COMPARE("48f7da REX.W negq rdx", negq(rdx));
COMPARE("f65c240c negb [rsp+0xc]", negb(Operand(rsp, 12)));
COMPARE("66f75c240c negw [rsp+0xc]", negw(Operand(rsp, 12)));
COMPARE("f75c240c negl [rsp+0xc]", negl(Operand(rsp, 12)));
COMPARE("f65c240c negb [rsp+0xc]", negb(Operand(rsp, 12)));
COMPARE("48f7d2 REX.W notq rdx", notq(rdx));
COMPARE("4885948b10270000 REX.W testq rdx,[rbx+rcx*4+0x2710]",
testq(Operand(rbx, rcx, times_4, 10000), rdx));
COMPARE("486bd10c REX.W imulq rdx,rcx,0xc",
imulq(rdx, rcx, Immediate(12)));
COMPARE("4869d1e8030000 REX.W imulq rdx,rcx,0x3e8",
imulq(rdx, rcx, Immediate(1000)));
COMPARE("480faf948b10270000 REX.W imulq rdx,[rbx+rcx*4+0x2710]",
imulq(rdx, Operand(rbx, rcx, times_4, 10000)));
COMPARE("486b948b102700000c REX.W imulq rdx,[rbx+rcx*4+0x2710],0xc",
imulq(rdx, Operand(rbx, rcx, times_4, 10000), Immediate(12)));
COMPARE("4869948b10270000e8030000 REX.W imulq rdx,[rbx+rcx*4+0x2710],0x3e8",
imulq(rdx, Operand(rbx, rcx, times_4, 10000), Immediate(1000)));
COMPARE("446bf90c imull r15,rcx,0xc",
imull(r15, rcx, Immediate(12)));
COMPARE("4469f9e8030000 imull r15,rcx,0x3e8",
imull(r15, rcx, Immediate(1000)));
COMPARE("440fafbc8b10270000 imull r15,[rbx+rcx*4+0x2710]",
imull(r15, Operand(rbx, rcx, times_4, 10000)));
COMPARE("446bbc8b102700000c imull r15,[rbx+rcx*4+0x2710],0xc",
imull(r15, Operand(rbx, rcx, times_4, 10000), Immediate(12)));
COMPARE("4469bc8b10270000e8030000 imull r15,[rbx+rcx*4+0x2710],0x3e8",
imull(r15, Operand(rbx, rcx, times_4, 10000), Immediate(1000)));
COMPARE("48ffc2 REX.W incq rdx", incq(rdx));
COMPARE("48ff848b10270000 REX.W incq [rbx+rcx*4+0x2710]",
incq(Operand(rbx, rcx, times_4, 10000)));
COMPARE("ffb48b10270000 push [rbx+rcx*4+0x2710]",
pushq(Operand(rbx, rcx, times_4, 10000)));
COMPARE("8f848b10270000 pop [rbx+rcx*4+0x2710]",
popq(Operand(rbx, rcx, times_4, 10000)));
COMPARE("ffa48b10270000 jmp [rbx+rcx*4+0x2710]",
jmp(Operand(rbx, rcx, times_4, 10000)));
COMPARE("488d948b10270000 REX.W leaq rdx,[rbx+rcx*4+0x2710]",
leaq(rdx, Operand(rbx, rcx, times_4, 10000)));
COMPARE("4881ca39300000 REX.W orq rdx,0x3039",
orq(rdx, Immediate(12345)));
COMPARE("480b948b10270000 REX.W orq rdx,[rbx+rcx*4+0x2710]",
orq(rdx, Operand(rbx, rcx, times_4, 10000)));
COMPARE("48d1d2 REX.W rclq rdx, 1", rclq(rdx, Immediate(1)));
COMPARE("48c1d207 REX.W rclq rdx, 7", rclq(rdx, Immediate(7)));
COMPARE("48d1da REX.W rcrq rdx, 1", rcrq(rdx, Immediate(1)));
COMPARE("48c1da07 REX.W rcrq rdx, 7", rcrq(rdx, Immediate(7)));
COMPARE("48d1fa REX.W sarq rdx, 1", sarq(rdx, Immediate(1)));
COMPARE("48c1fa06 REX.W sarq rdx, 6", sarq(rdx, Immediate(6)));
COMPARE("48d3fa REX.W sarq rdx, cl", sarq_cl(rdx));
COMPARE("481bd3 REX.W sbbq rdx,rbx", sbbq(rdx, rbx));
COMPARE("480fa5da REX.W shld rdx,rbx,cl", shld(rdx, rbx));
COMPARE("48d1e2 REX.W shlq rdx, 1", shlq(rdx, Immediate(1)));
COMPARE("48c1e206 REX.W shlq rdx, 6", shlq(rdx, Immediate(6)));
COMPARE("48d3e2 REX.W shlq rdx, cl", shlq_cl(rdx));
COMPARE("480fadda REX.W shrd rdx,rbx,cl", shrd(rdx, rbx));
COMPARE("48d1ea REX.W shrq rdx, 1", shrq(rdx, Immediate(1)));
COMPARE("48c1ea07 REX.W shrq rdx, 7", shrq(rdx, Immediate(7)));
COMPARE("48d3ea REX.W shrq rdx, cl", shrq_cl(rdx));
COMPARE("4883c30c REX.W addq rbx,0xc", addq(rbx, Immediate(12)));
COMPARE("4883848a102700000c REX.W addq [rdx+rcx*4+0x2710],0xc",
addq(Operand(rdx, rcx, times_4, 10000), Immediate(12)));
COMPARE("4881e339300000 REX.W andq rbx,0x3039",
andq(rbx, Immediate(12345)));
COMPARE("4881fb39300000 REX.W cmpq rbx,0x3039",
cmpq(rbx, Immediate(12345)));
COMPARE("4883fb0c REX.W cmpq rbx,0xc", cmpq(rbx, Immediate(12)));
COMPARE("4883bc8a102700000c REX.W cmpq [rdx+rcx*4+0x2710],0xc",
cmpq(Operand(rdx, rcx, times_4, 10000), Immediate(12)));
COMPARE("80f864 cmpb al,0x64", cmpb(rax, Immediate(100)));
COMPARE("4881cb39300000 REX.W orq rbx,0x3039",
orq(rbx, Immediate(12345)));
COMPARE("4883eb0c REX.W subq rbx,0xc", subq(rbx, Immediate(12)));
COMPARE("4883ac8a102700000c REX.W subq [rdx+rcx*4+0x2710],0xc",
subq(Operand(rdx, rcx, times_4, 10000), Immediate(12)));
COMPARE("4881f339300000 REX.W xorq rbx,0x3039",
xorq(rbx, Immediate(12345)));
COMPARE("486bd10c REX.W imulq rdx,rcx,0xc",
imulq(rdx, rcx, Immediate(12)));
COMPARE("4869d1e8030000 REX.W imulq rdx,rcx,0x3e8",
imulq(rdx, rcx, Immediate(1000)));
COMPARE("fc cldl", cld());
COMPARE("482b948b10270000 REX.W subq rdx,[rbx+rcx*4+0x2710]",
subq(rdx, Operand(rbx, rcx, times_4, 10000)));
COMPARE("482bd3 REX.W subq rdx,rbx", subq(rdx, rbx));
COMPARE("66f7c23930 testw rdx,0x3039", testq(rdx, Immediate(12345)));
COMPARE("488594cb10270000 REX.W testq rdx,[rbx+rcx*8+0x2710]",
testq(Operand(rbx, rcx, times_8, 10000), rdx));
COMPARE("849459e8030000 testb dl,[rcx+rbx*2+0x3e8]",
testb(Operand(rcx, rbx, times_2, 1000), rdx));
COMPARE("f640ec9a testb [rax-0x14],0x9a",
testb(Operand(rax, -20), Immediate(0x9A)));
COMPARE("4881f239300000 REX.W xorq rdx,0x3039",
xorq(rdx, Immediate(12345)));
COMPARE("483394cb10270000 REX.W xorq rdx,[rbx+rcx*8+0x2710]",
xorq(rdx, Operand(rbx, rcx, times_8, 10000)));
COMPARE("f4 hltl", hlt());
COMPARE("cc int3l", int3());
COMPARE("c3 retl", ret(0));
COMPARE("c20800 ret 0x8", ret(8));
} }
UNINITIALIZED_TEST(DisasmX64YMMRegister) { UNINITIALIZED_TEST(DisasmX64YMMRegister) {