Implement ExtractRegister
This commit is contained in:
parent
b5f988379a
commit
18e00f2e58
1 changed files with 20 additions and 8 deletions
|
@ -1395,18 +1395,30 @@ void EmitIR<IR::Opcode::CountLeadingZeros64>(oaknut::CodeGenerator& code, EmitCo
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void EmitIR<IR::Opcode::ExtractRegister32>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
void EmitIR<IR::Opcode::ExtractRegister32>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
||||||
(void)code;
|
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||||
(void)ctx;
|
ASSERT(args[2].IsImmediate());
|
||||||
(void)inst;
|
|
||||||
ASSERT_FALSE("Unimplemented");
|
auto Wresult = ctx.reg_alloc.WriteW(inst);
|
||||||
|
auto Wop1 = ctx.reg_alloc.ReadW(args[0]);
|
||||||
|
auto Wop2 = ctx.reg_alloc.ReadW(args[1]);
|
||||||
|
RegAlloc::Realize(Wresult, Wop1, Wop2);
|
||||||
|
const u8 lsb = args[2].GetImmediateU8();
|
||||||
|
|
||||||
|
code.EXTR(Wresult, Wop1, Wop2, lsb);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void EmitIR<IR::Opcode::ExtractRegister64>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
void EmitIR<IR::Opcode::ExtractRegister64>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
||||||
(void)code;
|
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||||
(void)ctx;
|
ASSERT(args[2].IsImmediate());
|
||||||
(void)inst;
|
|
||||||
ASSERT_FALSE("Unimplemented");
|
auto Xresult = ctx.reg_alloc.WriteX(inst);
|
||||||
|
auto Xop1 = ctx.reg_alloc.ReadX(args[0]);
|
||||||
|
auto Xop2 = ctx.reg_alloc.ReadX(args[1]);
|
||||||
|
RegAlloc::Realize(Xresult, Xop1, Xop2);
|
||||||
|
const u8 lsb = args[2].GetImmediateU8();
|
||||||
|
|
||||||
|
code.EXTR(Xresult, Xop1, Xop2, lsb);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
Loading…
Reference in a new issue