a32_emit_x64: Change ExclusiveWriteMemory64 to require a single U64 argument

This commit is contained in:
MerryMage 2020-06-16 13:32:50 +01:00
parent aa341b7eea
commit 7ea521b8bf
3 changed files with 4 additions and 15 deletions

View file

@ -1063,14 +1063,8 @@ void A32EmitX64::EmitA32WriteMemory64(A32EmitContext& ctx, IR::Inst* inst) {
template <size_t bitsize, auto callback> template <size_t bitsize, auto callback>
void A32EmitX64::ExclusiveWriteMemory(A32EmitContext& ctx, IR::Inst* inst) { void A32EmitX64::ExclusiveWriteMemory(A32EmitContext& ctx, IR::Inst* inst) {
const bool prepend_high_word = bitsize == 64;
auto args = ctx.reg_alloc.GetArgumentInfo(inst); auto args = ctx.reg_alloc.GetArgumentInfo(inst);
if (prepend_high_word) { ctx.reg_alloc.HostCall(nullptr, {}, args[0], args[1]);
ctx.reg_alloc.HostCall(nullptr, {}, args[0], args[1], args[2]);
} else {
ctx.reg_alloc.HostCall(nullptr, {}, args[0], args[1]);
}
const Xbyak::Reg32 passed = ctx.reg_alloc.ScratchGpr().cvt32(); const Xbyak::Reg32 passed = ctx.reg_alloc.ScratchGpr().cvt32();
const Xbyak::Reg32 tmp = code.ABI_RETURN.cvt32(); // Use one of the unused HostCall registers. const Xbyak::Reg32 tmp = code.ABI_RETURN.cvt32(); // Use one of the unused HostCall registers.
@ -1084,11 +1078,6 @@ void A32EmitX64::ExclusiveWriteMemory(A32EmitContext& ctx, IR::Inst* inst) {
code.test(tmp, A32JitState::RESERVATION_GRANULE_MASK); code.test(tmp, A32JitState::RESERVATION_GRANULE_MASK);
code.jne(end); code.jne(end);
code.mov(code.byte[r15 + offsetof(A32JitState, exclusive_state)], u8(0)); code.mov(code.byte[r15 + offsetof(A32JitState, exclusive_state)], u8(0));
if (prepend_high_word) {
code.mov(code.ABI_PARAM3.cvt32(), code.ABI_PARAM3.cvt32()); // zero extend to 64-bits
code.shl(code.ABI_PARAM4, 32);
code.or_(code.ABI_PARAM3, code.ABI_PARAM4);
}
Devirtualize<callback>(config.callbacks).EmitCall(code); Devirtualize<callback>(config.callbacks).EmitCall(code);
code.xor_(passed, passed); code.xor_(passed, passed);
code.L(end); code.L(end);

View file

@ -297,9 +297,9 @@ IR::U32 IREmitter::ExclusiveWriteMemory64(const IR::U32& vaddr, const IR::U32& v
if (current_location.EFlag()) { if (current_location.EFlag()) {
const auto vlo = ByteReverseWord(value_lo); const auto vlo = ByteReverseWord(value_lo);
const auto vhi = ByteReverseWord(value_hi); const auto vhi = ByteReverseWord(value_hi);
return Inst<IR::U32>(Opcode::A32ExclusiveWriteMemory64, vaddr, vlo, vhi); return Inst<IR::U32>(Opcode::A32ExclusiveWriteMemory64, vaddr, Pack2x32To1x64(vlo, vhi));
} else { } else {
return Inst<IR::U32>(Opcode::A32ExclusiveWriteMemory64, vaddr, value_lo, value_hi); return Inst<IR::U32>(Opcode::A32ExclusiveWriteMemory64, vaddr, Pack2x32To1x64(value_lo, value_hi));
} }
} }

View file

@ -653,7 +653,7 @@ A32OPC(WriteMemory64, Void, U32,
A32OPC(ExclusiveWriteMemory8, U32, U32, U8 ) A32OPC(ExclusiveWriteMemory8, U32, U32, U8 )
A32OPC(ExclusiveWriteMemory16, U32, U32, U16 ) A32OPC(ExclusiveWriteMemory16, U32, U32, U16 )
A32OPC(ExclusiveWriteMemory32, U32, U32, U32 ) A32OPC(ExclusiveWriteMemory32, U32, U32, U32 )
A32OPC(ExclusiveWriteMemory64, U32, U32, U32, U32 ) A32OPC(ExclusiveWriteMemory64, U32, U32, U64 )
// A64 Memory access // A64 Memory access
A64OPC(ClearExclusive, Void, ) A64OPC(ClearExclusive, Void, )