Commit f2584880 authored by Deepti Gandluri's avatar Deepti Gandluri Committed by Commit Bot

[ia32] Add cmpxchg8b instruction

Bug: v8:6532
Change-Id: I0871aaafff2385758449ddde923178d1c9e1ff8a
Reviewed-on: https://chromium-review.googlesource.com/1146998Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54620}
parent 00617dd9
......@@ -785,6 +785,13 @@ void Assembler::cmpxchg_w(Operand dst, Register src) {
emit_operand(src, dst);
}
void Assembler::cmpxchg8b(Operand dst) {
EnsureSpace enure_space(this);
EMIT(0x0F);
EMIT(0xC7);
emit_operand(ecx, dst);
}
void Assembler::lfence() {
EnsureSpace ensure_space(this);
EMIT(0x0F);
......
......@@ -667,6 +667,7 @@ class Assembler : public AssemblerBase {
void cmpxchg(Operand dst, Register src);
void cmpxchg_b(Operand dst, Register src);
void cmpxchg_w(Operand dst, Register src);
void cmpxchg8b(Operand dst);
// Memory Fence
void lfence();
......
......@@ -1500,6 +1500,8 @@ static const char* F0Mnem(byte f0byte) {
return "bsf";
case 0xBD:
return "bsr";
case 0xC7:
return "cmpxchg8b";
default:
return nullptr;
}
......@@ -1801,6 +1803,13 @@ int DisassemblerIA32::InstructionDecode(v8::internal::Vector<char> out_buffer,
get_modrm(*data, &mod, &regop, &rm);
AppendToBuffer("%s %s,", f0mnem, NameOfCPURegister(regop));
data += PrintRightOperand(data);
} else if (f0byte == 0xC7) {
// cmpxchg8b
data += 2;
AppendToBuffer("%s ", f0mnem);
int mod, regop, rm;
get_modrm(*data, &mod, &regop, &rm);
data += PrintRightOperand(data);
} else if (f0byte == 0xAE && (data[2] & 0xF8) == 0xE8) {
AppendToBuffer("lfence");
data += 3;
......
......@@ -871,6 +871,8 @@ TEST(DisasmIa320) {
__ cmpxchg_b(Operand(esp, 12), eax);
__ cmpxchg_w(Operand(ebx, ecx, times_4, 10000), eax);
__ cmpxchg(Operand(ebx, ecx, times_4, 10000), eax);
__ cmpxchg(Operand(ebx, ecx, times_4, 10000), eax);
__ cmpxchg8b(Operand(ebx, ecx, times_8, 10000));
}
// lock prefix.
......
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