From 708761963e09ceb4619f8f21fffc7af051a8f020 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 26 Feb 2018 15:56:34 -0300 Subject: Fix corner cases of ADCS and SBFM --- ChocolArm64/Instruction/AInstEmitAluHelper.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'ChocolArm64/Instruction/AInstEmitAluHelper.cs') diff --git a/ChocolArm64/Instruction/AInstEmitAluHelper.cs b/ChocolArm64/Instruction/AInstEmitAluHelper.cs index b2ea92a6..ef9dd7a7 100644 --- a/ChocolArm64/Instruction/AInstEmitAluHelper.cs +++ b/ChocolArm64/Instruction/AInstEmitAluHelper.cs @@ -7,6 +7,31 @@ namespace ChocolArm64.Instruction { static class AInstEmitAluHelper { + public static void EmitAdcsCCheck(AILEmitterCtx Context) + { + //C = (Rd == Rn && CIn) || Rd < Rn + Context.EmitSttmp(); + Context.EmitLdtmp(); + Context.EmitLdtmp(); + + EmitDataLoadRn(Context); + + Context.Emit(OpCodes.Ceq); + + Context.EmitLdflg((int)APState.CBit); + + Context.Emit(OpCodes.And); + + Context.EmitLdtmp(); + + EmitDataLoadRn(Context); + + Context.Emit(OpCodes.Clt_Un); + Context.Emit(OpCodes.Or); + + Context.EmitStflg((int)APState.CBit); + } + public static void EmitAddsCCheck(AILEmitterCtx Context) { //C = Rd < Rn -- cgit v1.2.3