emit_arm64_data_processing: Implement Mul
This commit is contained in:
parent
bf55920ce9
commit
187f89951d
1 changed files with 18 additions and 8 deletions
|
@ -32,6 +32,18 @@ static void EmitTwoOp(oaknut::CodeGenerator&, EmitContext& ctx, IR::Inst* inst,
|
||||||
emit(Rresult, Roperand);
|
emit(Rresult, Roperand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<size_t bitsize, typename EmitFn>
|
||||||
|
static void EmitThreeOp(oaknut::CodeGenerator&, EmitContext& ctx, IR::Inst* inst, EmitFn emit) {
|
||||||
|
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||||
|
|
||||||
|
auto Rresult = ctx.reg_alloc.WriteReg<bitsize>(inst);
|
||||||
|
auto Ra = ctx.reg_alloc.ReadReg<bitsize>(args[0]);
|
||||||
|
auto Rb = ctx.reg_alloc.ReadReg<bitsize>(args[1]);
|
||||||
|
RegAlloc::Realize(Rresult, Ra, Rb);
|
||||||
|
|
||||||
|
emit(Rresult, Ra, Rb);
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void EmitIR<IR::Opcode::Pack2x32To1x64>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
void EmitIR<IR::Opcode::Pack2x32To1x64>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
||||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||||
|
@ -783,18 +795,16 @@ void EmitIR<IR::Opcode::Sub64>(oaknut::CodeGenerator& code, EmitContext& ctx, IR
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void EmitIR<IR::Opcode::Mul32>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
void EmitIR<IR::Opcode::Mul32>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
||||||
(void)code;
|
EmitThreeOp<32>(
|
||||||
(void)ctx;
|
code, ctx, inst,
|
||||||
(void)inst;
|
[&](auto& Wresult, auto& Wa, auto& Wb) { code.MUL(Wresult, Wa, Wb); });
|
||||||
ASSERT_FALSE("Unimplemented");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void EmitIR<IR::Opcode::Mul64>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
void EmitIR<IR::Opcode::Mul64>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
||||||
(void)code;
|
EmitThreeOp<64>(
|
||||||
(void)ctx;
|
code, ctx, inst,
|
||||||
(void)inst;
|
[&](auto& Xresult, auto& Xa, auto& Xb) { code.MUL(Xresult, Xa, Xb); });
|
||||||
ASSERT_FALSE("Unimplemented");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
Loading…
Reference in a new issue