Commit c9c4b931 authored by dcarney@chromium.org's avatar dcarney@chromium.org

fix imul(reg, op, imm) emission on x64

R=bmeurer@chromium.org

BUG=

Review URL: https://codereview.chromium.org/619903005

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24395 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 08c40baa
......@@ -974,11 +974,13 @@ void Assembler::emit_imul(Register dst, const Operand& src, Immediate imm,
emit_rex(dst, src, size);
if (is_int8(imm.value_)) {
emit(0x6B);
emit_operand(dst, src);
emit(imm.value_);
} else {
emit(0x69);
emit_operand(dst, src);
emitl(imm.value_);
}
emit_operand(dst, src);
emit(imm.value_);
}
......
......@@ -1486,15 +1486,15 @@ int DisassemblerX64::InstructionDecode(v8::internal::Vector<char> out_buffer,
case 0x69: // fall through
case 0x6B: {
int mod, regop, rm;
get_modrm(*(data + 1), &mod, &regop, &rm);
int32_t imm = *data == 0x6B ? *(data + 2)
: *reinterpret_cast<int32_t*>(data + 2);
AppendToBuffer("imul%c %s,%s,0x%x",
operand_size_code(),
NameOfCPURegister(regop),
NameOfCPURegister(rm), imm);
data += 2 + (*data == 0x6B ? 1 : 4);
int count = 1;
count += PrintOperands("imul", REG_OPER_OP_ORDER, data + count);
AppendToBuffer(",0x");
if (*data == 0x69) {
count += PrintImmediate(data + count, operand_size());
} else {
count += PrintImmediate(data + count, OPERAND_BYTE_SIZE);
}
data += count;
break;
}
......
......@@ -184,10 +184,16 @@ TEST(DisasmX64) {
__ notq(rdx);
__ testq(Operand(rbx, rcx, times_4, 10000), rdx);
__ imulq(rdx, Operand(rbx, rcx, times_4, 10000));
__ 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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment