Optimize
This commit is contained in:
parent
48b0f6369b
commit
ef2851d595
2 changed files with 8 additions and 16 deletions
|
@ -256,8 +256,8 @@ void EmitIR<IR::Opcode::A64SetW>(oaknut::CodeGenerator& code, EmitContext& ctx,
|
||||||
RegAlloc::Realize(Wvalue);
|
RegAlloc::Realize(Wvalue);
|
||||||
|
|
||||||
// TODO: Detect if Gpr vs Fpr is more appropriate
|
// TODO: Detect if Gpr vs Fpr is more appropriate
|
||||||
code.MOV(Wscratch0, Wvalue);
|
code.MOV(*Wvalue, Wvalue);
|
||||||
code.STR(Xscratch0, Xstate, offsetof(A64JitState, reg) + sizeof(u64) * static_cast<size_t>(reg));
|
code.STR(Wvalue->toX(), Xstate, offsetof(A64JitState, reg) + sizeof(u64) * static_cast<size_t>(reg));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
@ -281,11 +281,7 @@ void EmitIR<IR::Opcode::A64SetS>(oaknut::CodeGenerator& code, EmitContext& ctx,
|
||||||
auto Svalue = ctx.reg_alloc.ReadS(args[1]);
|
auto Svalue = ctx.reg_alloc.ReadS(args[1]);
|
||||||
RegAlloc::Realize(Svalue);
|
RegAlloc::Realize(Svalue);
|
||||||
|
|
||||||
// TODO: Optimize
|
code.FMOV(Svalue, Svalue);
|
||||||
auto Qvalue = Svalue->toQ().B16();
|
|
||||||
code.FMOV(Wscratch0, Svalue);
|
|
||||||
code.EOR(Qvalue, Qvalue, Qvalue);
|
|
||||||
code.FMOV(Svalue, Wscratch0);
|
|
||||||
code.STR(Svalue->toQ(), Xstate, offsetof(A64JitState, vec) + sizeof(u64) * 2 * static_cast<size_t>(vec));
|
code.STR(Svalue->toQ(), Xstate, offsetof(A64JitState, vec) + sizeof(u64) * 2 * static_cast<size_t>(vec));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,11 +292,7 @@ void EmitIR<IR::Opcode::A64SetD>(oaknut::CodeGenerator& code, EmitContext& ctx,
|
||||||
auto Dvalue = ctx.reg_alloc.ReadD(args[1]);
|
auto Dvalue = ctx.reg_alloc.ReadD(args[1]);
|
||||||
RegAlloc::Realize(Dvalue);
|
RegAlloc::Realize(Dvalue);
|
||||||
|
|
||||||
// TODO: Optimize
|
code.FMOV(Dvalue, Dvalue);
|
||||||
auto Qvalue = Dvalue->toQ().B16();
|
|
||||||
code.FMOV(Xscratch0, Dvalue);
|
|
||||||
code.EOR(Qvalue, Qvalue, Qvalue);
|
|
||||||
code.FMOV(Dvalue, Xscratch0);
|
|
||||||
code.STR(Dvalue->toQ(), Xstate, offsetof(A64JitState, vec) + sizeof(u64) * 2 * static_cast<size_t>(vec));
|
code.STR(Dvalue->toQ(), Xstate, offsetof(A64JitState, vec) + sizeof(u64) * 2 * static_cast<size_t>(vec));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1431,8 +1431,8 @@ void EmitIR<IR::Opcode::ReplicateBit32>(oaknut::CodeGenerator& code, EmitContext
|
||||||
const u8 bit = args[1].GetImmediateU8();
|
const u8 bit = args[1].GetImmediateU8();
|
||||||
RegAlloc::Realize(Wresult, Wvalue);
|
RegAlloc::Realize(Wresult, Wvalue);
|
||||||
|
|
||||||
code.UBFX(Wscratch0, Wvalue, bit, 1);
|
code.LSL(Wresult, Wvalue, 31 - bit);
|
||||||
code.SUB(Wresult, WZR, Wscratch0);
|
code.ASR(Wresult, Wresult, 31);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
@ -1445,8 +1445,8 @@ void EmitIR<IR::Opcode::ReplicateBit64>(oaknut::CodeGenerator& code, EmitContext
|
||||||
const u8 bit = args[1].GetImmediateU8();
|
const u8 bit = args[1].GetImmediateU8();
|
||||||
RegAlloc::Realize(Xresult, Xvalue);
|
RegAlloc::Realize(Xresult, Xvalue);
|
||||||
|
|
||||||
code.UBFX(Xscratch0, Xvalue, bit, 1);
|
code.LSL(Xresult, Xvalue, 63 - bit);
|
||||||
code.SUB(Xresult, XZR, Xscratch0);
|
code.ASR(Xresult, Xresult, 63);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void EmitMaxMin32(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst, oaknut::Cond cond) {
|
static void EmitMaxMin32(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst, oaknut::Cond cond) {
|
||||||
|
|
Loading…
Reference in a new issue