From 3fd19aac99e7b416a33eef4eb5051dbf13fbaa90 Mon Sep 17 00:00:00 2001 From: Merry Date: Sat, 26 Nov 2022 16:49:21 +0000 Subject: [PATCH] emit_arm64_floating_point: Implement ToOdd for FPDoubleToSingle --- .../backend/arm64/emit_arm64_floating_point.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/dynarmic/backend/arm64/emit_arm64_floating_point.cpp b/src/dynarmic/backend/arm64/emit_arm64_floating_point.cpp index 57b45807..6d85cd23 100644 --- a/src/dynarmic/backend/arm64/emit_arm64_floating_point.cpp +++ b/src/dynarmic/backend/arm64/emit_arm64_floating_point.cpp @@ -575,6 +575,20 @@ void EmitIR(oaknut::CodeGenerator& code, EmitContext template<> void EmitIR(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) { + const auto rounding_mode = static_cast(inst->GetArg(1).GetU8()); + + if (rounding_mode == FP::RoundingMode::ToOdd) { + auto args = ctx.reg_alloc.GetArgumentInfo(inst); + auto Sto = ctx.reg_alloc.WriteS(inst); + auto Dfrom = ctx.reg_alloc.ReadD(args[0]); + RegAlloc::Realize(Sto, Dfrom); + ctx.fpsr.Load(); + + code.FCVTXN(Sto, Dfrom); + + return; + } + EmitConvert<64, 32>(code, ctx, inst, [&](auto& Sto, auto& Dfrom) { code.FCVT(Sto, Dfrom); }); }