From e73c3909272b620ec6fd66f17857796b8a3fa714 Mon Sep 17 00:00:00 2001 From: Merry Date: Sat, 30 Jul 2022 12:19:06 +0100 Subject: [PATCH] emit_arm64_packed: Fix signed packed add sub --- src/dynarmic/backend/arm64/emit_arm64_packed.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/dynarmic/backend/arm64/emit_arm64_packed.cpp b/src/dynarmic/backend/arm64/emit_arm64_packed.cpp index 9297e047..5a10ba74 100644 --- a/src/dynarmic/backend/arm64/emit_arm64_packed.cpp +++ b/src/dynarmic/backend/arm64/emit_arm64_packed.cpp @@ -248,9 +248,14 @@ static void EmitPackedAddSub(oaknut::CodeGenerator& code, EmitContext& ctx, IR:: auto Vge = ctx.reg_alloc.WriteD(ge_inst); RegAlloc::Realize(Vge); - code.CMEQ(Vge->H4(), Vresult->H4(), 0); - code.EOR(Vge->B8(), Vge->B8(), V2.B8()); - code.SHRN(Vge->H4(), Vge->toQ().S4(), 16); + if (is_signed) { + code.CMGE(Vge->S2(), Vresult->S2(), 0); + code.XTN(Vge->H4(), Vge->toQ().S4()); + } else { + code.CMEQ(Vge->H4(), Vresult->H4(), 0); + code.EOR(Vge->B8(), Vge->B8(), V2.B8()); + code.SHRN(Vge->H4(), Vge->toQ().S4(), 16); + } } code.XTN(Vresult->H4(), Vresult->toQ().S4());