[CPU] Remove ATOMIC_EXCHANGE opcode (dead code)
This commit is contained in:
@@ -867,101 +867,6 @@ struct MEMSET_I64
|
||||
EMITTER_OPCODE_TABLE(OPCODE_MEMSET, MEMSET_I64);
|
||||
|
||||
// ============================================================================
|
||||
// OPCODE_ATOMIC_EXCHANGE
|
||||
// ============================================================================
|
||||
// Note: src1 is a HOST address (not guest), matching the x64 backend.
|
||||
struct ATOMIC_EXCHANGE_I8
|
||||
: Sequence<ATOMIC_EXCHANGE_I8,
|
||||
I<OPCODE_ATOMIC_EXCHANGE, I8Op, I64Op, I8Op>> {
|
||||
static void Emit(A64Emitter& e, const EmitArgType& i) {
|
||||
// src1 is already a host address.
|
||||
if (i.src1.is_constant) {
|
||||
e.mov(e.x4, i.src1.constant());
|
||||
} else {
|
||||
e.mov(e.x4, i.src1);
|
||||
}
|
||||
if (i.src2.is_constant) {
|
||||
e.mov(e.w0, static_cast<uint64_t>(
|
||||
static_cast<uint32_t>(i.src2.constant()) & 0xFF));
|
||||
} else {
|
||||
e.and_(e.w0, i.src2, 0xFF);
|
||||
}
|
||||
|
||||
if (e.IsFeatureEnabled(kA64EmitLSE)) {
|
||||
e.swpalb(e.w0, i.dest, ptr(e.x4));
|
||||
return;
|
||||
}
|
||||
|
||||
auto& retry = e.NewCachedLabel();
|
||||
e.L(retry);
|
||||
e.ldaxrb(e.w1, ptr(e.x4));
|
||||
e.stlxrb(e.w2, e.w0, ptr(e.x4));
|
||||
e.cbnz(e.w2, retry);
|
||||
e.mov(i.dest, e.w1);
|
||||
}
|
||||
};
|
||||
struct ATOMIC_EXCHANGE_I16
|
||||
: Sequence<ATOMIC_EXCHANGE_I16,
|
||||
I<OPCODE_ATOMIC_EXCHANGE, I16Op, I64Op, I16Op>> {
|
||||
static void Emit(A64Emitter& e, const EmitArgType& i) {
|
||||
if (i.src1.is_constant) {
|
||||
e.mov(e.x4, i.src1.constant());
|
||||
} else {
|
||||
e.mov(e.x4, i.src1);
|
||||
}
|
||||
if (i.src2.is_constant) {
|
||||
e.mov(e.w0, static_cast<uint64_t>(
|
||||
static_cast<uint32_t>(i.src2.constant()) & 0xFFFF));
|
||||
} else {
|
||||
e.and_(e.w0, i.src2, 0xFFFF);
|
||||
}
|
||||
|
||||
if (e.IsFeatureEnabled(kA64EmitLSE)) {
|
||||
e.swpalh(e.w0, i.dest, ptr(e.x4));
|
||||
return;
|
||||
}
|
||||
|
||||
auto& retry = e.NewCachedLabel();
|
||||
e.L(retry);
|
||||
e.ldaxrh(e.w1, ptr(e.x4));
|
||||
e.stlxrh(e.w2, e.w0, ptr(e.x4));
|
||||
e.cbnz(e.w2, retry);
|
||||
e.mov(i.dest, e.w1);
|
||||
}
|
||||
};
|
||||
struct ATOMIC_EXCHANGE_I32
|
||||
: Sequence<ATOMIC_EXCHANGE_I32,
|
||||
I<OPCODE_ATOMIC_EXCHANGE, I32Op, I64Op, I32Op>> {
|
||||
static void Emit(A64Emitter& e, const EmitArgType& i) {
|
||||
// src1 is a host address (not guest).
|
||||
if (i.src1.is_constant) {
|
||||
e.mov(e.x4, i.src1.constant());
|
||||
} else {
|
||||
e.mov(e.x4, i.src1);
|
||||
}
|
||||
if (i.src2.is_constant) {
|
||||
e.mov(e.w0,
|
||||
static_cast<uint64_t>(static_cast<uint32_t>(i.src2.constant())));
|
||||
} else {
|
||||
e.mov(e.w0, i.src2);
|
||||
}
|
||||
|
||||
if (e.IsFeatureEnabled(kA64EmitLSE)) {
|
||||
e.swpal(e.w0, i.dest, ptr(e.x4));
|
||||
return;
|
||||
}
|
||||
|
||||
auto& retry = e.NewCachedLabel();
|
||||
e.L(retry);
|
||||
e.ldaxr(e.w1, ptr(e.x4));
|
||||
e.stlxr(e.w2, e.w0, ptr(e.x4));
|
||||
e.cbnz(e.w2, retry);
|
||||
e.mov(i.dest, e.w1);
|
||||
}
|
||||
};
|
||||
EMITTER_OPCODE_TABLE(OPCODE_ATOMIC_EXCHANGE, ATOMIC_EXCHANGE_I8,
|
||||
ATOMIC_EXCHANGE_I16, ATOMIC_EXCHANGE_I32);
|
||||
|
||||
// ============================================================================
|
||||
// OPCODE_ATOMIC_COMPARE_EXCHANGE
|
||||
// ============================================================================
|
||||
|
||||
@@ -295,68 +295,6 @@ RegExp ComputeMemoryAddressOffset(X64Emitter& e, const T& guest,
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// OPCODE_ATOMIC_EXCHANGE
|
||||
// ============================================================================
|
||||
// Note that the address we use here is a real, host address!
|
||||
// This is weird, and should be fixed.
|
||||
template <typename SEQ, typename REG, typename ARGS>
|
||||
void EmitAtomicExchangeXX(X64Emitter& e, const ARGS& i) {
|
||||
if (i.dest == i.src1) {
|
||||
e.mov(e.rax, i.src1);
|
||||
if (i.dest != i.src2) {
|
||||
if (i.src2.is_constant) {
|
||||
e.mov(i.dest, i.src2.constant());
|
||||
} else {
|
||||
e.mov(i.dest, i.src2);
|
||||
}
|
||||
}
|
||||
e.lock();
|
||||
e.xchg(e.dword[e.rax], i.dest);
|
||||
} else {
|
||||
if (i.dest != i.src2) {
|
||||
if (i.src2.is_constant) {
|
||||
e.mov(i.dest, i.src2.constant());
|
||||
} else {
|
||||
e.mov(i.dest, i.src2);
|
||||
}
|
||||
}
|
||||
e.lock();
|
||||
e.xchg(e.dword[i.src1.reg()], i.dest);
|
||||
}
|
||||
}
|
||||
struct ATOMIC_EXCHANGE_I8
|
||||
: Sequence<ATOMIC_EXCHANGE_I8,
|
||||
I<OPCODE_ATOMIC_EXCHANGE, I8Op, I64Op, I8Op>> {
|
||||
static void Emit(X64Emitter& e, const EmitArgType& i) {
|
||||
EmitAtomicExchangeXX<ATOMIC_EXCHANGE_I8, Reg8>(e, i);
|
||||
}
|
||||
};
|
||||
struct ATOMIC_EXCHANGE_I16
|
||||
: Sequence<ATOMIC_EXCHANGE_I16,
|
||||
I<OPCODE_ATOMIC_EXCHANGE, I16Op, I64Op, I16Op>> {
|
||||
static void Emit(X64Emitter& e, const EmitArgType& i) {
|
||||
EmitAtomicExchangeXX<ATOMIC_EXCHANGE_I16, Reg16>(e, i);
|
||||
}
|
||||
};
|
||||
struct ATOMIC_EXCHANGE_I32
|
||||
: Sequence<ATOMIC_EXCHANGE_I32,
|
||||
I<OPCODE_ATOMIC_EXCHANGE, I32Op, I64Op, I32Op>> {
|
||||
static void Emit(X64Emitter& e, const EmitArgType& i) {
|
||||
EmitAtomicExchangeXX<ATOMIC_EXCHANGE_I32, Reg32>(e, i);
|
||||
}
|
||||
};
|
||||
struct ATOMIC_EXCHANGE_I64
|
||||
: Sequence<ATOMIC_EXCHANGE_I64,
|
||||
I<OPCODE_ATOMIC_EXCHANGE, I64Op, I64Op, I64Op>> {
|
||||
static void Emit(X64Emitter& e, const EmitArgType& i) {
|
||||
EmitAtomicExchangeXX<ATOMIC_EXCHANGE_I64, Reg64>(e, i);
|
||||
}
|
||||
};
|
||||
EMITTER_OPCODE_TABLE(OPCODE_ATOMIC_EXCHANGE, ATOMIC_EXCHANGE_I8,
|
||||
ATOMIC_EXCHANGE_I16, ATOMIC_EXCHANGE_I32,
|
||||
ATOMIC_EXCHANGE_I64);
|
||||
|
||||
struct LVL_V128 : Sequence<LVL_V128, I<OPCODE_LVL, V128Op, I64Op>> {
|
||||
static void Emit(X64Emitter& e, const EmitArgType& i) {
|
||||
e.mov(e.edx, 0xf);
|
||||
|
||||
Reference in New Issue
Block a user