diff options
| author | LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com> | 2018-06-26 03:32:29 +0200 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-06-25 22:32:29 -0300 |
| commit | 8f6387128ad6fc6a6106d1347f86ea97e549f5a2 (patch) | |
| tree | 3d14d93182910d614cdcbf01962752e635ded1c9 /ChocolArm64/Instruction/AInstEmitSimdHelper.cs | |
| parent | 37a6e84fd49a4e73747281e92d795c5401be901e (diff) | |
Add Sse Opt. for Cmeq_V_2D, Cmgt_V_2D (Reg). Add Sse Opt. for Crc32cb, Crc32ch, Crc32cw, Crc32cx. Add 10 simple tests for Fcmgt, Fcmge, Fcmeq, Fcmle, Fcmlt (S, V) (Reg, Zero). Add 2 Cnt_V tests. (#183)
* Add files via upload
* Add files via upload
* Add files via upload
* CPE
* Add EmitSse42Crc32()
* Update CpuTestSimdCmp.cs
* Update Pseudocode.cs
* Update Instructions.cs
* Update CpuTestSimd.cs
* Update Instructions.cs
Diffstat (limited to 'ChocolArm64/Instruction/AInstEmitSimdHelper.cs')
| -rw-r--r-- | ChocolArm64/Instruction/AInstEmitSimdHelper.cs | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/ChocolArm64/Instruction/AInstEmitSimdHelper.cs b/ChocolArm64/Instruction/AInstEmitSimdHelper.cs index 3caf2a3e..80c6aeb7 100644 --- a/ChocolArm64/Instruction/AInstEmitSimdHelper.cs +++ b/ChocolArm64/Instruction/AInstEmitSimdHelper.cs @@ -3,6 +3,7 @@ using ChocolArm64.State; using ChocolArm64.Translation; using System; using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; @@ -34,11 +35,27 @@ namespace ChocolArm64.Instruction return (8 << (Op.Size + 1)) - Op.Imm; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void EmitSse2Call(AILEmitterCtx Context, string Name) { - AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; + EmitSseCall(Context, Name, typeof(Sse2)); + } - int SizeF = Op.Size & 1; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void EmitSse41Call(AILEmitterCtx Context, string Name) + { + EmitSseCall(Context, Name, typeof(Sse41)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void EmitSse42Call(AILEmitterCtx Context, string Name) + { + EmitSseCall(Context, Name, typeof(Sse42)); + } + + private static void EmitSseCall(AILEmitterCtx Context, string Name, Type Type) + { + AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; void Ldvec(int Reg) { @@ -57,8 +74,6 @@ namespace ChocolArm64.Instruction Type BaseType = null; - Type[] Types; - switch (Op.Size) { case 0: BaseType = typeof(Vector128<sbyte>); break; @@ -71,15 +86,13 @@ namespace ChocolArm64.Instruction { Ldvec(BinOp.Rm); - Types = new Type[] { BaseType, BaseType }; + Context.EmitCall(Type.GetMethod(Name, new Type[] { BaseType, BaseType })); } else { - Types = new Type[] { BaseType }; + Context.EmitCall(Type.GetMethod(Name, new Type[] { BaseType })); } - Context.EmitCall(typeof(Sse2).GetMethod(Name, Types)); - switch (Op.Size) { case 0: AVectorHelper.EmitCall(Context, nameof(AVectorHelper.VectorSByteToSingle)); break; @@ -96,7 +109,7 @@ namespace ChocolArm64.Instruction } } - public static void EmitSse2CallF(AILEmitterCtx Context, string Name) + public static void EmitSseOrSse2CallF(AILEmitterCtx Context, string Name) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; @@ -114,36 +127,31 @@ namespace ChocolArm64.Instruction Ldvec(Op.Rn); - Type BaseType = SizeF == 0 - ? typeof(Vector128<float>) - : typeof(Vector128<double>); - - Type[] Types; + Type Type; + Type BaseType; - if (Op is AOpCodeSimdReg BinOp) + if (SizeF == 0) { - Ldvec(BinOp.Rm); - - Types = new Type[] { BaseType, BaseType }; + Type = typeof(Sse); + BaseType = typeof(Vector128<float>); } - else + else /* if (SizeF == 1) */ { - Types = new Type[] { BaseType }; + Type = typeof(Sse2); + BaseType = typeof(Vector128<double>); } - MethodInfo MthdInfo; - - if (SizeF == 0) + if (Op is AOpCodeSimdReg BinOp) { - MthdInfo = typeof(Sse).GetMethod(Name, Types); + Ldvec(BinOp.Rm); + + Context.EmitCall(Type.GetMethod(Name, new Type[] { BaseType, BaseType })); } - else /* if (SizeF == 1) */ + else { - MthdInfo = typeof(Sse2).GetMethod(Name, Types); + Context.EmitCall(Type.GetMethod(Name, new Type[] { BaseType })); } - Context.EmitCall(MthdInfo); - if (SizeF == 1) { AVectorHelper.EmitCall(Context, nameof(AVectorHelper.VectorDoubleToSingle)); |
