diff options
| author | LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com> | 2018-04-18 15:56:27 +0200 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-04-18 10:56:27 -0300 |
| commit | 8b75080639204b667e4b78acd3a88090f15bc651 (patch) | |
| tree | 458d07f77bbe5c8172b98ee1ce0de79b9930bb18 /ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs | |
| parent | 7450b9d68adbabc48bc59efec9df45f029781658 (diff) | |
Add ABS (scalar & vector), ADD (scalar), NEG (scalar) instructions. (#88)
* Update AOpCodeTable.cs
* Update AInstEmitSimdArithmetic.cs
* Update AOpCodeTable.cs
Diffstat (limited to 'ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs')
| -rw-r--r-- | ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs b/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs index 721fd7eb..bc7ed890 100644 --- a/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs +++ b/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs @@ -11,6 +11,35 @@ namespace ChocolArm64.Instruction { static partial class AInstEmit { + public static void Abs_S(AILEmitterCtx Context) + { + EmitScalarUnaryOpSx(Context, () => EmitAbs(Context)); + } + + public static void Abs_V(AILEmitterCtx Context) + { + EmitVectorUnaryOpSx(Context, () => EmitAbs(Context)); + } + + private static void EmitAbs(AILEmitterCtx Context) + { + AILLabel LblTrue = new AILLabel(); + + Context.Emit(OpCodes.Dup); + + Context.Emit(OpCodes.Ldc_I4_0); + Context.Emit(OpCodes.Bge_S, LblTrue); + + Context.Emit(OpCodes.Neg); + + Context.MarkLabel(LblTrue); + } + + public static void Add_S(AILEmitterCtx Context) + { + EmitScalarBinaryOpZx(Context, () => Context.Emit(OpCodes.Add)); + } + public static void Add_V(AILEmitterCtx Context) { EmitVectorBinaryOpZx(Context, () => Context.Emit(OpCodes.Add)); @@ -738,6 +767,11 @@ namespace ChocolArm64.Instruction EmitVectorBinaryOpByElemZx(Context, () => Context.Emit(OpCodes.Mul)); } + public static void Neg_S(AILEmitterCtx Context) + { + EmitScalarUnaryOpSx(Context, () => Context.Emit(OpCodes.Neg)); + } + public static void Neg_V(AILEmitterCtx Context) { EmitVectorUnaryOpSx(Context, () => Context.Emit(OpCodes.Neg)); |
