aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChocolArm64/Instruction/AInstEmitAlu.cs2
-rw-r--r--ChocolArm64/Instruction/AInstEmitAluHelper.cs25
-rw-r--r--ChocolArm64/Instruction/AInstEmitBfm.cs9
3 files changed, 26 insertions, 10 deletions
diff --git a/ChocolArm64/Instruction/AInstEmitAlu.cs b/ChocolArm64/Instruction/AInstEmitAlu.cs
index 71d9a660..57020364 100644
--- a/ChocolArm64/Instruction/AInstEmitAlu.cs
+++ b/ChocolArm64/Instruction/AInstEmitAlu.cs
@@ -39,7 +39,7 @@ namespace ChocolArm64.Instruction
{
Context.EmitZNFlagCheck();
- EmitAddsCCheck(Context);
+ EmitAdcsCCheck(Context);
EmitAddsVCheck(Context);
}
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
diff --git a/ChocolArm64/Instruction/AInstEmitBfm.cs b/ChocolArm64/Instruction/AInstEmitBfm.cs
index 823af738..2e8f2508 100644
--- a/ChocolArm64/Instruction/AInstEmitBfm.cs
+++ b/ChocolArm64/Instruction/AInstEmitBfm.cs
@@ -54,15 +54,6 @@ namespace ChocolArm64.Instruction
{
EmitSbfmCast(Context, OpCodes.Conv_I4);
}
- else if (Op.Shift == 0)
- {
- Context.EmitLdintzr(Op.Rn);
-
- Context.EmitLsl(BitsCount - 1 - Op.Pos);
- Context.EmitAsr(BitsCount - 1);
-
- Context.EmitStintzr(Op.Rd);
- }
else
{
EmitBfmLoadRn(Context);