From 19b83445683cf9cfcf9e3d27596ab030eb08353c Mon Sep 17 00:00:00 2001 From: gdkchan Date: Fri, 30 Mar 2018 16:30:23 -0300 Subject: [PATCH] Add UABD instruction --- ChocolArm64/AOpCodeTable.cs | 1 + .../Instruction/AInstEmitSimdArithmetic.cs | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ChocolArm64/AOpCodeTable.cs b/ChocolArm64/AOpCodeTable.cs index eefa94d185..c2929d9bce 100644 --- a/ChocolArm64/AOpCodeTable.cs +++ b/ChocolArm64/AOpCodeTable.cs @@ -285,6 +285,7 @@ namespace ChocolArm64 Set("01111110xx1xxxxx100001xxxxxxxxxx", AInstEmit.Sub_S, typeof(AOpCodeSimdReg)); Set("0>101110<<1xxxxx100001xxxxxxxxxx", AInstEmit.Sub_V, typeof(AOpCodeSimdReg)); Set("0x001110000xxxxx0xx000xxxxxxxxxx", AInstEmit.Tbl_V, typeof(AOpCodeSimdTbl)); + Set("0x101110<<1xxxxx011101xxxxxxxxxx", AInstEmit.Uabd_V, typeof(AOpCodeSimdReg)); Set("0x101110<<1xxxxx011100xxxxxxxxxx", AInstEmit.Uabdl_V, typeof(AOpCodeSimdReg)); Set("0x101110<<1xxxxx000000xxxxxxxxxx", AInstEmit.Uaddl_V, typeof(AOpCodeSimdReg)); Set("001011100x110000001110xxxxxxxxxx", AInstEmit.Uaddlv_V, typeof(AOpCodeSimd)); diff --git a/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs b/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs index 84a5babfe7..1d40ee8912 100644 --- a/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs +++ b/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs @@ -546,18 +546,25 @@ namespace ChocolArm64.Instruction EmitVectorBinaryOpZx(Context, () => Context.Emit(OpCodes.Sub)); } + public static void Uabd_V(AILEmitterCtx Context) + { + EmitVectorTernaryOpZx(Context, () => EmitAbd(Context)); + } + public static void Uabdl_V(AILEmitterCtx Context) { - EmitVectorWidenRnRmTernaryOpZx(Context, () => - { - Context.Emit(OpCodes.Sub); + EmitVectorWidenRnRmTernaryOpZx(Context, () => EmitAbd(Context)); + } - Type[] Types = new Type[] { typeof(long) }; + private static void EmitAbd(AILEmitterCtx Context) + { + Context.Emit(OpCodes.Sub); - Context.EmitCall(typeof(Math).GetMethod(nameof(Math.Abs), Types)); + Type[] Types = new Type[] { typeof(long) }; - Context.Emit(OpCodes.Add); - }); + Context.EmitCall(typeof(Math).GetMethod(nameof(Math.Abs), Types)); + + Context.Emit(OpCodes.Add); } public static void Uaddl_V(AILEmitterCtx Context)