本文整理汇总了C++中PPCEmuAssembler::xchg方法的典型用法代码示例。如果您正苦于以下问题:C++ PPCEmuAssembler::xchg方法的具体用法?C++ PPCEmuAssembler::xchg怎么用?C++ PPCEmuAssembler::xchg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PPCEmuAssembler
的用法示例。
在下文中一共展示了PPCEmuAssembler::xchg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jit_fallback
static bool
storeGeneric(PPCEmuAssembler& a, Instruction instr)
{
if (flags & StoreConditional) {
// Early out for if statement below.
return jit_fallback(a, instr);
}
if ((flags & StoreZeroRA) && instr.rA == 0) {
if (flags & StoreIndexed) {
a.mov(a.ecx, a.ppcgpr[instr.rB]);
} else {
a.mov(a.ecx, sign_extend<16, int32_t>(instr.d));
}
} else {
a.mov(a.ecx, a.ppcgpr[instr.rA]);
if (flags & StoreIndexed) {
a.add(a.ecx, a.ppcgpr[instr.rB]);
} else {
a.add(a.ecx, sign_extend<16, int32_t>(instr.d));
}
}
if (flags & StoreConditional) {
/*
state->cr.cr0 = state->xer.so ? ConditionRegisterFlag::SummaryOverflow : 0;
if (state->reserve) {
// Store is succesful, clear reserve bit and set CR0[EQ]
state->cr.cr0 |= ConditionRegisterFlag::Equal;
state->reserve = false;
} else {
// Reserve bit is not set, do not write.
return;
}
*/
}
a.mov(a.zdx, a.zcx);
a.add(a.zdx, a.membase);
if (flags & StoreFloatAsInteger) {
assert(sizeof(Type) == 4);
a.mov(a.eax, a.ppcfprps[instr.rS][0]);
} else if (std::is_floating_point<Type>::value) {
if (flags & StoreSingle) {
assert(sizeof(Type) == 4);
a.mov(a.eax, a.ppcfprps[instr.rS][0]);
}
else {
assert(sizeof(Type) == 8);
a.mov(a.zax, a.ppcfpr[instr.rS]);
}
} else {
if (sizeof(Type) == 1) {
a.mov(a.eax.r8(), a.ppcgpr[instr.rS]);
} else if (sizeof(Type) == 2) {
a.mov(a.eax.r16(), a.ppcgpr[instr.rS]);
} else if (sizeof(Type) == 4) {
a.mov(a.eax, a.ppcgpr[instr.rS]);
} else {
assert(0);
}
}
if (!(flags & StoreByteReverse)) {
if (sizeof(Type) == 1) {
// Inverted reverse logic means we have
// to check for this but do nothing.
} else if (sizeof(Type) == 2) {
a.xchg(a.eax.r8Hi(), a.eax.r8Lo());
} else if (sizeof(Type) == 4) {
a.bswap(a.eax);
} else if (sizeof(Type) == 8) {
a.bswap(a.zax);
} else {
assert(0);
}
}
if (sizeof(Type) == 1) {
a.mov(asmjit::X86Mem(a.zdx, 0), a.eax.r8());
} else if (sizeof(Type) == 2) {
a.mov(asmjit::X86Mem(a.zdx, 0), a.eax.r16());
} else if (sizeof(Type) == 4) {
a.mov(asmjit::X86Mem(a.zdx, 0), a.eax);
} else if (sizeof(Type) == 8) {
a.mov(asmjit::X86Mem(a.zdx, 0), a.zax);
} else {
assert(0);
}
if (flags & StoreUpdate) {
a.mov(a.ppcgpr[instr.rA], a.ecx);
}
return true;
}
示例2: if
static bool
loadGeneric(PPCEmuAssembler& a, Instruction instr)
{
if ((flags & LoadZeroRA) && instr.rA == 0) {
a.mov(a.ecx, 0u);
}
else {
a.mov(a.ecx, a.ppcgpr[instr.rA]);
}
if (flags & LoadIndexed) {
a.add(a.ecx, a.ppcgpr[instr.rB]);
}
else {
a.add(a.ecx, sign_extend<16, int32_t>(instr.d));
}
a.mov(a.zdx, a.zcx);
a.add(a.zdx, a.membase);
if (sizeof(Type) == 1) {
a.mov(a.eax, 0);
a.mov(a.eax.r8(), asmjit::X86Mem(a.zdx, 0));
} else if (sizeof(Type) == 2) {
a.mov(a.eax, 0);
a.mov(a.eax.r16(), asmjit::X86Mem(a.zdx, 0));
if (!(flags & LoadByteReverse)) {
a.xchg(a.eax.r8Hi(), a.eax.r8Lo());
}
} else if (sizeof(Type) == 4) {
a.mov(a.eax, asmjit::X86Mem(a.zdx, 0));
if (!(flags & LoadByteReverse)) {
a.bswap(a.eax);
}
} else if (sizeof(Type) == 8) {
a.mov(a.zax, asmjit::X86Mem(a.zdx, 0));
if (!(flags & LoadByteReverse)) {
a.bswap(a.zax);
}
} else {
assert(0);
}
if (std::is_floating_point<Type>::value) {
if (flags & LoadPairedSingles) {
a.mov(a.ppcfprps[instr.rD][0], a.eax);
a.mov(a.ppcfprps[instr.rD][1], a.eax);
}
else {
assert(sizeof(Type) == 8);
a.mov(a.ppcfpr[instr.rD], a.zax);
}
}
else {
if (flags & LoadSignExtend) {
assert(sizeof(Type) == 2);
a.movsx(a.eax, a.eax.r16());
}
a.mov(a.ppcgpr[instr.rD], a.eax);
}
if (flags & LoadReserve) {
a.mov(a.ppcreserve, 1u);
a.mov(a.ppcreserveAddress, a.ecx);
}
if (flags & LoadUpdate) {
a.mov(a.ppcgpr[instr.rA], a.ecx);
}
return true;
}