[ia32] Add cmpxchg8b instruction

Bug: v8:6532
Change-Id: I0871aaafff2385758449ddde923178d1c9e1ff8a
Reviewed-on: https://chromium-review.googlesource.com/1146998
Reviewed-by: Bill Budge <bbudge@chromium.org>
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54620}
This commit is contained in:
Deepti Gandluri 2018-07-23 10:16:00 -07:00 committed by Commit Bot
parent 00617dd9dc
commit f25848800f
4 changed files with 19 additions and 0 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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;

View File

@ -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.