aboutsummaryrefslogtreecommitdiff
path: root/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs
diff options
context:
space:
mode:
authorLDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>2018-08-27 08:44:01 +0200
committergdkchan <gab.dark.100@gmail.com>2018-08-27 03:44:01 -0300
commit68300368d7fd4ee49ced471beafad4d64c3e7709 (patch)
treee96e0676472ca74d67d229bac1e8c16c4b66fb37 /ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs
parent43c4e7c78d98b09e8dc51e3450396cd99b2b3a92 (diff)
Add SHADD, SHSUB, UHSUB, SRHADD, URHADD, instructions; add 12 Tests. (#380)
* Update AOpCodeTable.cs * Update AInstEmitSimdArithmetic.cs * Update Instructions.cs * Update CpuTestSimdReg.cs * Update CpuTest.cs * Update CpuTestSimd.cs * Update CpuTestSimdCrypto.cs
Diffstat (limited to 'ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs')
-rw-r--r--ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs78
1 files changed, 69 insertions, 9 deletions
diff --git a/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs b/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs
index 92da9ff9..1e4002a0 100644
--- a/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs
+++ b/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs
@@ -1042,6 +1042,28 @@ namespace ChocolArm64.Instruction
EmitVectorWidenRmBinaryOpSx(Context, () => Context.Emit(OpCodes.Add));
}
+ public static void Shadd_V(AILEmitterCtx Context)
+ {
+ EmitVectorBinaryOpSx(Context, () =>
+ {
+ Context.Emit(OpCodes.Add);
+
+ Context.Emit(OpCodes.Ldc_I4_1);
+ Context.Emit(OpCodes.Shr);
+ });
+ }
+
+ public static void Shsub_V(AILEmitterCtx Context)
+ {
+ EmitVectorBinaryOpSx(Context, () =>
+ {
+ Context.Emit(OpCodes.Sub);
+
+ Context.Emit(OpCodes.Ldc_I4_1);
+ Context.Emit(OpCodes.Shr);
+ });
+ }
+
public static void Smax_V(AILEmitterCtx Context)
{
Type[] Types = new Type[] { typeof(long), typeof(long) };
@@ -1181,6 +1203,20 @@ namespace ChocolArm64.Instruction
EmitVectorSaturatingNarrowOpSxZx(Context, () => { });
}
+ public static void Srhadd_V(AILEmitterCtx Context)
+ {
+ EmitVectorBinaryOpSx(Context, () =>
+ {
+ Context.Emit(OpCodes.Add);
+
+ Context.Emit(OpCodes.Ldc_I4_1);
+ Context.Emit(OpCodes.Add);
+
+ Context.Emit(OpCodes.Ldc_I4_1);
+ Context.Emit(OpCodes.Shr);
+ });
+ }
+
public static void Ssubw_V(AILEmitterCtx Context)
{
EmitVectorWidenRmBinaryOpSx(Context, () => Context.Emit(OpCodes.Sub));
@@ -1303,44 +1339,54 @@ namespace ChocolArm64.Instruction
{
Context.Emit(OpCodes.Add);
- Context.EmitLdc_I4(1);
+ Context.Emit(OpCodes.Ldc_I4_1);
+ Context.Emit(OpCodes.Shr_Un);
+ });
+ }
+ public static void Uhsub_V(AILEmitterCtx Context)
+ {
+ EmitVectorBinaryOpZx(Context, () =>
+ {
+ Context.Emit(OpCodes.Sub);
+
+ Context.Emit(OpCodes.Ldc_I4_1);
Context.Emit(OpCodes.Shr_Un);
});
}
- public static void Umin_V(AILEmitterCtx Context)
+ public static void Umax_V(AILEmitterCtx Context)
{
Type[] Types = new Type[] { typeof(ulong), typeof(ulong) };
- MethodInfo MthdInfo = typeof(Math).GetMethod(nameof(Math.Min), Types);
+ MethodInfo MthdInfo = typeof(Math).GetMethod(nameof(Math.Max), Types);
EmitVectorBinaryOpZx(Context, () => Context.EmitCall(MthdInfo));
}
- public static void Uminp_V(AILEmitterCtx Context)
+ public static void Umaxp_V(AILEmitterCtx Context)
{
Type[] Types = new Type[] { typeof(ulong), typeof(ulong) };
- MethodInfo MthdInfo = typeof(Math).GetMethod(nameof(Math.Min), Types);
+ MethodInfo MthdInfo = typeof(Math).GetMethod(nameof(Math.Max), Types);
EmitVectorPairwiseOpZx(Context, () => Context.EmitCall(MthdInfo));
}
- public static void Umax_V(AILEmitterCtx Context)
+ public static void Umin_V(AILEmitterCtx Context)
{
Type[] Types = new Type[] { typeof(ulong), typeof(ulong) };
- MethodInfo MthdInfo = typeof(Math).GetMethod(nameof(Math.Max), Types);
+ MethodInfo MthdInfo = typeof(Math).GetMethod(nameof(Math.Min), Types);
EmitVectorBinaryOpZx(Context, () => Context.EmitCall(MthdInfo));
}
- public static void Umaxp_V(AILEmitterCtx Context)
+ public static void Uminp_V(AILEmitterCtx Context)
{
Type[] Types = new Type[] { typeof(ulong), typeof(ulong) };
- MethodInfo MthdInfo = typeof(Math).GetMethod(nameof(Math.Max), Types);
+ MethodInfo MthdInfo = typeof(Math).GetMethod(nameof(Math.Min), Types);
EmitVectorPairwiseOpZx(Context, () => Context.EmitCall(MthdInfo));
}
@@ -1380,6 +1426,20 @@ namespace ChocolArm64.Instruction
EmitVectorSaturatingNarrowOpZxZx(Context, () => { });
}
+ public static void Urhadd_V(AILEmitterCtx Context)
+ {
+ EmitVectorBinaryOpZx(Context, () =>
+ {
+ Context.Emit(OpCodes.Add);
+
+ Context.Emit(OpCodes.Ldc_I4_1);
+ Context.Emit(OpCodes.Add);
+
+ Context.Emit(OpCodes.Ldc_I4_1);
+ Context.Emit(OpCodes.Shr_Un);
+ });
+ }
+
public static void Usqadd_S(AILEmitterCtx Context)
{
EmitScalarSaturatingBinaryOpZx(Context, SaturatingFlags.Accumulate);