emit_arm64_data_processing: Implement ConditionalSelect
This commit is contained in:
parent
a4a665148c
commit
2cc5b09bdf
1 changed files with 27 additions and 12 deletions
|
@ -197,26 +197,41 @@ void EmitIR<IR::Opcode::TestBit>(oaknut::CodeGenerator& code, EmitContext& ctx,
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void EmitIR<IR::Opcode::ConditionalSelect32>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
void EmitIR<IR::Opcode::ConditionalSelect32>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
||||||
(void)code;
|
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||||
(void)ctx;
|
const IR::Cond cond = args[0].GetImmediateCond();
|
||||||
(void)inst;
|
auto Wresult = ctx.reg_alloc.WriteW(inst);
|
||||||
ASSERT_FALSE("Unimplemented");
|
auto Wthen = ctx.reg_alloc.ReadW(args[1]);
|
||||||
|
auto Welse = ctx.reg_alloc.ReadW(args[2]);
|
||||||
|
RegAlloc::Realize(Wresult, Wthen, Welse);
|
||||||
|
ctx.reg_alloc.SpillFlags();
|
||||||
|
|
||||||
|
// TODO: FSEL for fprs
|
||||||
|
|
||||||
|
code.LDR(Wscratch0, Xstate, ctx.conf.state_nzcv_offset);
|
||||||
|
code.MSR(oaknut::SystemReg::NZCV, Xscratch0);
|
||||||
|
code.CSEL(Wresult, Wthen, Welse, static_cast<oaknut::Cond>(cond));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void EmitIR<IR::Opcode::ConditionalSelect64>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
void EmitIR<IR::Opcode::ConditionalSelect64>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
||||||
(void)code;
|
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||||
(void)ctx;
|
const IR::Cond cond = args[0].GetImmediateCond();
|
||||||
(void)inst;
|
auto Xresult = ctx.reg_alloc.WriteX(inst);
|
||||||
ASSERT_FALSE("Unimplemented");
|
auto Xthen = ctx.reg_alloc.ReadX(args[1]);
|
||||||
|
auto Xelse = ctx.reg_alloc.ReadX(args[2]);
|
||||||
|
RegAlloc::Realize(Xresult, Xthen, Xelse);
|
||||||
|
ctx.reg_alloc.SpillFlags();
|
||||||
|
|
||||||
|
// TODO: FSEL for fprs
|
||||||
|
|
||||||
|
code.LDR(Wscratch0, Xstate, ctx.conf.state_nzcv_offset);
|
||||||
|
code.MSR(oaknut::SystemReg::NZCV, Xscratch0);
|
||||||
|
code.CSEL(Xresult, Xthen, Xelse, static_cast<oaknut::Cond>(cond));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void EmitIR<IR::Opcode::ConditionalSelectNZCV>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
void EmitIR<IR::Opcode::ConditionalSelectNZCV>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
||||||
(void)code;
|
EmitIR<IR::Opcode::ConditionalSelect32>(code, ctx, inst);
|
||||||
(void)ctx;
|
|
||||||
(void)inst;
|
|
||||||
ASSERT_FALSE("Unimplemented");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
Loading…
Reference in a new issue