EmitTwoOpFallbackWithoutRegAlloc: Simplify

This commit is contained in:
Merry 2022-11-29 14:14:00 +00:00 committed by Liam
parent 6965095cb9
commit cf704a460d
2 changed files with 7 additions and 18 deletions

View file

@ -20,7 +20,7 @@ struct A64JitState {
u32 cpsr_nzcv = 0;
alignas(16) std::array<u64, 64> vec{}; // Extension registers.
alignas(16) std::array<u64, 64> vec{};
u32 exclusive_state = 0;

View file

@ -264,29 +264,19 @@ static void EmitTwoOpFallbackWithoutRegAlloc(oaknut::CodeGenerator& code, EmitCo
const u32 fpcr = ctx.FPCR(fpcr_controlled).Value();
constexpr u64 stack_size = sizeof(u64) * 4; // sizeof(u128) * 2
oaknut::Label fn_ptr, end;
ABI_PushRegisters(code, ABI_CALLER_SAVE & ~(1ull << Qresult.index()), stack_size);
code.MOV(Xscratch0, SP);
code.LDR(Xscratch1, fn_ptr);
// Call lambda(Vec&, Vec&, fpcr, fpsr&)
code.ADD(X0, Xscratch0, 0 * 16);
code.ADD(X1, Xscratch0, 1 * 16);
code.MOV(Xscratch0, mcl::bit_cast<u64>(fn));
code.ADD(X0, SP, 0 * 16);
code.ADD(X1, SP, 1 * 16);
code.MOV(X2, fpcr);
code.ADD(X3, Xstate, ctx.conf.state_fpsr_offset);
code.STR(Qarg1, X1);
code.BLR(Xscratch1);
// Reload result
code.BLR(Xscratch0);
code.LDR(Qresult, SP);
ABI_PopRegisters(code, ABI_CALLER_SAVE & ~(1ull << Qresult.index()), stack_size);
code.B(end);
code.align(8);
code.l(fn_ptr);
code.dx(mcl::bit_cast<u64>(fn));
code.l(end);
ABI_PopRegisters(code, ABI_CALLER_SAVE & ~(1ull << Qresult.index()), stack_size);
}
template<size_t fpcr_controlled_arg_index = 1, typename Lambda>
@ -295,7 +285,6 @@ static void EmitTwoOpFallback(oaknut::CodeGenerator& code, EmitContext& ctx, IR:
auto Qarg1 = ctx.reg_alloc.ReadQ(args[0]);
auto Qresult = ctx.reg_alloc.WriteQ(inst);
RegAlloc::Realize(Qarg1, Qresult);
ctx.reg_alloc.SpillFlags();
ctx.fpsr.Spill();