aboutsummaryrefslogtreecommitdiff
path: root/ChocolArm64/Instruction/AInstEmitAlu.cs
diff options
context:
space:
mode:
authorLDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>2018-03-24 02:06:05 +0100
committergdkchan <gab.dark.100@gmail.com>2018-03-23 22:06:05 -0300
commit873a7cd112d2f1cc84b628344c0ecc426573f636 (patch)
tree868ed5f2918b6f6be0bf0312fc171337ed952e25 /ChocolArm64/Instruction/AInstEmitAlu.cs
parent0d2f07315248a38febec3b015673e3421a787c49 (diff)
Add Cls Instruction. (#67)
* Update AInstEmitAlu.cs * Update ASoftFallback.cs * Update AOpCodeTable.cs
Diffstat (limited to 'ChocolArm64/Instruction/AInstEmitAlu.cs')
-rw-r--r--ChocolArm64/Instruction/AInstEmitAlu.cs20
1 files changed, 19 insertions, 1 deletions
diff --git a/ChocolArm64/Instruction/AInstEmitAlu.cs b/ChocolArm64/Instruction/AInstEmitAlu.cs
index 57020364..bacbfc9e 100644
--- a/ChocolArm64/Instruction/AInstEmitAlu.cs
+++ b/ChocolArm64/Instruction/AInstEmitAlu.cs
@@ -100,6 +100,24 @@ namespace ChocolArm64.Instruction
EmitDataStore(Context, SetFlags);
}
+ public static void Cls(AILEmitterCtx Context)
+ {
+ AOpCodeAlu Op = (AOpCodeAlu)Context.CurrOp;
+
+ Context.EmitLdintzr(Op.Rn);
+
+ if (Op.RegisterSize == ARegisterSize.Int32)
+ {
+ ASoftFallback.EmitCall(Context, nameof(ASoftFallback.CountLeadingSigns32));
+ }
+ else
+ {
+ ASoftFallback.EmitCall(Context, nameof(ASoftFallback.CountLeadingSigns64));
+ }
+
+ Context.EmitStintzr(Op.Rd);
+ }
+
public static void Clz(AILEmitterCtx Context)
{
AOpCodeAlu Op = (AOpCodeAlu)Context.CurrOp;
@@ -383,4 +401,4 @@ namespace ChocolArm64.Instruction
Context.EmitStflg((int)APState.CBit);
}
}
-} \ No newline at end of file
+}