Add EmitSse42Crc32()

This commit is contained in:
LDj3SNuD 2018-06-24 13:42:35 +02:00 committed by GitHub
parent 1eba6aa860
commit bf5a70ecd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,14 +33,7 @@ namespace ChocolArm64.Instruction
{
if (AOptimizations.UseSse42)
{
AOpCodeAluRs Op = (AOpCodeAluRs)Context.CurrOp;
Context.EmitLdintzr(Op.Rn);
Context.EmitLdintzr(Op.Rm);
Context.EmitCall(typeof(Sse42).GetMethod(nameof(Sse42.Crc32), new Type[] { typeof(uint), typeof(byte) }));
Context.EmitStintzr(Op.Rd);
EmitSse42Crc32(Context, typeof(uint), typeof(byte));
}
else
{
@ -52,14 +45,7 @@ namespace ChocolArm64.Instruction
{
if (AOptimizations.UseSse42)
{
AOpCodeAluRs Op = (AOpCodeAluRs)Context.CurrOp;
Context.EmitLdintzr(Op.Rn);
Context.EmitLdintzr(Op.Rm);
Context.EmitCall(typeof(Sse42).GetMethod(nameof(Sse42.Crc32), new Type[] { typeof(uint), typeof(ushort) }));
Context.EmitStintzr(Op.Rd);
EmitSse42Crc32(Context, typeof(uint), typeof(ushort));
}
else
{
@ -71,14 +57,7 @@ namespace ChocolArm64.Instruction
{
if (AOptimizations.UseSse42)
{
AOpCodeAluRs Op = (AOpCodeAluRs)Context.CurrOp;
Context.EmitLdintzr(Op.Rn);
Context.EmitLdintzr(Op.Rm);
Context.EmitCall(typeof(Sse42).GetMethod(nameof(Sse42.Crc32), new Type[] { typeof(uint), typeof(uint) }));
Context.EmitStintzr(Op.Rd);
EmitSse42Crc32(Context, typeof(uint), typeof(uint));
}
else
{
@ -90,14 +69,7 @@ namespace ChocolArm64.Instruction
{
if (AOptimizations.UseSse42)
{
AOpCodeAluRs Op = (AOpCodeAluRs)Context.CurrOp;
Context.EmitLdintzr(Op.Rn);
Context.EmitLdintzr(Op.Rm);
Context.EmitCall(typeof(Sse42).GetMethod(nameof(Sse42.Crc32), new Type[] { typeof(ulong), typeof(ulong) }));
Context.EmitStintzr(Op.Rd);
EmitSse42Crc32(Context, typeof(ulong), typeof(ulong));
}
else
{
@ -105,6 +77,18 @@ namespace ChocolArm64.Instruction
}
}
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);
}
private static void EmitCrc32(AILEmitterCtx Context, string Name)
{
AOpCodeAluRs Op = (AOpCodeAluRs)Context.CurrOp;
@ -128,4 +112,4 @@ namespace ChocolArm64.Instruction
Context.EmitStintzr(Op.Rd);
}
}
}
}