From 187f89951deeb40b18ad8a38768c482249f5a265 Mon Sep 17 00:00:00 2001 From: Merry Date: Sun, 24 Jul 2022 19:45:55 +0100 Subject: [PATCH] emit_arm64_data_processing: Implement Mul --- .../arm64/emit_arm64_data_processing.cpp | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/dynarmic/backend/arm64/emit_arm64_data_processing.cpp b/src/dynarmic/backend/arm64/emit_arm64_data_processing.cpp index 75297b95..946239ce 100644 --- a/src/dynarmic/backend/arm64/emit_arm64_data_processing.cpp +++ b/src/dynarmic/backend/arm64/emit_arm64_data_processing.cpp @@ -32,6 +32,18 @@ static void EmitTwoOp(oaknut::CodeGenerator&, EmitContext& ctx, IR::Inst* inst, emit(Rresult, Roperand); } +template +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(inst); + auto Ra = ctx.reg_alloc.ReadReg(args[0]); + auto Rb = ctx.reg_alloc.ReadReg(args[1]); + RegAlloc::Realize(Rresult, Ra, Rb); + + emit(Rresult, Ra, Rb); +} + template<> void EmitIR(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) { auto args = ctx.reg_alloc.GetArgumentInfo(inst); @@ -783,18 +795,16 @@ void EmitIR(oaknut::CodeGenerator& code, EmitContext& ctx, IR template<> void EmitIR(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) { - (void)code; - (void)ctx; - (void)inst; - ASSERT_FALSE("Unimplemented"); + EmitThreeOp<32>( + code, ctx, inst, + [&](auto& Wresult, auto& Wa, auto& Wb) { code.MUL(Wresult, Wa, Wb); }); } template<> void EmitIR(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) { - (void)code; - (void)ctx; - (void)inst; - ASSERT_FALSE("Unimplemented"); + EmitThreeOp<64>( + code, ctx, inst, + [&](auto& Xresult, auto& Xa, auto& Xb) { code.MUL(Xresult, Xa, Xb); }); } template<>