fix simd opcode size

This commit is contained in:
unknown 2018-04-18 22:45:40 +02:00
commit 39c0e2c2ff

View file

@ -254,6 +254,7 @@ namespace ChocolArm64.Instruction
public static void Fmin_S(AILEmitterCtx Context) public static void Fmin_S(AILEmitterCtx Context)
{ {
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
EmitScalarBinaryOpF(Context, () => EmitScalarBinaryOpF(Context, () =>
{ {
if (Op.Size == 0) if (Op.Size == 0)
@ -275,13 +276,15 @@ namespace ChocolArm64.Instruction
{ {
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
int SizeF = Op.Size & 1;
EmitVectorBinaryOpF(Context, () => EmitVectorBinaryOpF(Context, () =>
{ {
if (Op.Size == 2) if (SizeF == 0)
{ {
ASoftFallback.EmitCall(Context, nameof(ASoftFallback.MinF)); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.MinF));
} }
else if (Op.Size == 3) else if (SizeF == 1)
{ {
ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Min)); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Min));
} }
@ -577,17 +580,19 @@ namespace ChocolArm64.Instruction
{ {
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
int SizeF = Op.Size & 1;
EmitVectorUnaryOpF(Context, () => EmitVectorUnaryOpF(Context, () =>
{ {
Context.EmitLdarg(ATranslatedSub.StateArgIdx); Context.EmitLdarg(ATranslatedSub.StateArgIdx);
Context.EmitCallPropGet(typeof(AThreadState), nameof(AThreadState.Fpcr)); Context.EmitCallPropGet(typeof(AThreadState), nameof(AThreadState.Fpcr));
if (Op.Size == 2) if (SizeF == 0)
{ {
ASoftFallback.EmitCall(Context, nameof(ASoftFallback.RoundF)); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.RoundF));
} }
else if (Op.Size == 3) else if (SizeF == 1)
{ {
ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Round)); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Round));
} }