2018-03-14 04:12:05 +01:00
|
|
|
using ChocolArm64.Decoder;
|
|
|
|
using ChocolArm64.State;
|
|
|
|
using ChocolArm64.Translation;
|
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
2018-06-26 03:32:29 +02:00
|
|
|
using System;
|
2018-03-14 04:12:05 +01:00
|
|
|
using System.Reflection.Emit;
|
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
2018-06-26 03:32:29 +02:00
|
|
|
using System.Runtime.Intrinsics.X86;
|
2018-03-14 04:12:05 +01:00
|
|
|
|
|
|
|
namespace ChocolArm64.Instruction
|
|
|
|
{
|
|
|
|
static partial class AInstEmit
|
|
|
|
{
|
|
|
|
public static void Crc32b(AILEmitterCtx Context)
|
|
|
|
{
|
|
|
|
EmitCrc32(Context, nameof(ASoftFallback.Crc32b));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Crc32h(AILEmitterCtx Context)
|
|
|
|
{
|
|
|
|
EmitCrc32(Context, nameof(ASoftFallback.Crc32h));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Crc32w(AILEmitterCtx Context)
|
|
|
|
{
|
|
|
|
EmitCrc32(Context, nameof(ASoftFallback.Crc32w));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Crc32x(AILEmitterCtx Context)
|
|
|
|
{
|
|
|
|
EmitCrc32(Context, nameof(ASoftFallback.Crc32x));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Crc32cb(AILEmitterCtx Context)
|
|
|
|
{
|
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
2018-06-26 03:32:29 +02:00
|
|
|
if (AOptimizations.UseSse42)
|
|
|
|
{
|
|
|
|
EmitSse42Crc32(Context, typeof(uint), typeof(byte));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EmitCrc32(Context, nameof(ASoftFallback.Crc32cb));
|
|
|
|
}
|
2018-03-14 04:12:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void Crc32ch(AILEmitterCtx Context)
|
|
|
|
{
|
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
2018-06-26 03:32:29 +02:00
|
|
|
if (AOptimizations.UseSse42)
|
|
|
|
{
|
|
|
|
EmitSse42Crc32(Context, typeof(uint), typeof(ushort));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EmitCrc32(Context, nameof(ASoftFallback.Crc32ch));
|
|
|
|
}
|
2018-03-14 04:12:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void Crc32cw(AILEmitterCtx Context)
|
|
|
|
{
|
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
2018-06-26 03:32:29 +02:00
|
|
|
if (AOptimizations.UseSse42)
|
|
|
|
{
|
|
|
|
EmitSse42Crc32(Context, typeof(uint), typeof(uint));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EmitCrc32(Context, nameof(ASoftFallback.Crc32cw));
|
|
|
|
}
|
2018-03-14 04:12:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void Crc32cx(AILEmitterCtx Context)
|
|
|
|
{
|
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
2018-06-26 03:32:29 +02:00
|
|
|
if (AOptimizations.UseSse42)
|
|
|
|
{
|
|
|
|
EmitSse42Crc32(Context, typeof(ulong), typeof(ulong));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EmitCrc32(Context, nameof(ASoftFallback.Crc32cx));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void EmitSse42Crc32(AILEmitterCtx Context, Type TCrc, Type TData)
|
|
|
|
{
|
|
|
|
AOpCodeAluRs Op = (AOpCodeAluRs)Context.CurrOp;
|
|
|
|
|
|
|
|
Context.EmitLdintzr(Op.Rn);
|
|
|
|
Context.EmitLdintzr(Op.Rm);
|
|
|
|
|
|
|
|
Context.EmitCall(typeof(Sse42).GetMethod(nameof(Sse42.Crc32), new Type[] { TCrc, TData }));
|
|
|
|
|
|
|
|
Context.EmitStintzr(Op.Rd);
|
2018-03-14 04:12:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private static void EmitCrc32(AILEmitterCtx Context, string Name)
|
|
|
|
{
|
|
|
|
AOpCodeAluRs Op = (AOpCodeAluRs)Context.CurrOp;
|
|
|
|
|
|
|
|
Context.EmitLdintzr(Op.Rn);
|
|
|
|
|
|
|
|
if (Op.RegisterSize != ARegisterSize.Int32)
|
|
|
|
{
|
|
|
|
Context.Emit(OpCodes.Conv_U4);
|
|
|
|
}
|
|
|
|
|
|
|
|
Context.EmitLdintzr(Op.Rm);
|
|
|
|
|
|
|
|
ASoftFallback.EmitCall(Context, Name);
|
|
|
|
|
|
|
|
if (Op.RegisterSize != ARegisterSize.Int32)
|
|
|
|
{
|
|
|
|
Context.Emit(OpCodes.Conv_U8);
|
|
|
|
}
|
|
|
|
|
|
|
|
Context.EmitStintzr(Op.Rd);
|
|
|
|
}
|
|
|
|
}
|
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
2018-06-26 03:32:29 +02:00
|
|
|
}
|