From 65a7d9be8d106194697e08cae0e447bc150d7363 Mon Sep 17 00:00:00 2001 From: Merry Date: Sun, 31 Jul 2022 08:48:44 +0100 Subject: [PATCH] emit_arm64_a32: A32SetCheckBit: Handle immediate --- src/dynarmic/backend/arm64/emit_arm64_a32.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/dynarmic/backend/arm64/emit_arm64_a32.cpp b/src/dynarmic/backend/arm64/emit_arm64_a32.cpp index 80fed9d6..298c5144 100644 --- a/src/dynarmic/backend/arm64/emit_arm64_a32.cpp +++ b/src/dynarmic/backend/arm64/emit_arm64_a32.cpp @@ -127,10 +127,18 @@ template<> void EmitIR(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) { auto args = ctx.reg_alloc.GetArgumentInfo(inst); - auto Wbit = ctx.reg_alloc.ReadW(args[0]); - RegAlloc::Realize(Wbit); - - code.STRB(Wbit, SP, offsetof(StackLayout, check_bit)); + if (args[0].IsImmediate()) { + if (args[0].GetImmediateU1()) { + code.MOV(Wscratch0, 1); + code.STRB(Wscratch0, SP, offsetof(StackLayout, check_bit)); + } else { + code.STRB(WZR, SP, offsetof(StackLayout, check_bit)); + } + } else { + auto Wbit = ctx.reg_alloc.ReadW(args[0]); + RegAlloc::Realize(Wbit); + code.STRB(Wbit, SP, offsetof(StackLayout, check_bit)); + } } template<>