From 035efc913e7f2a68315d4206cef46672005b8442 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 24 Feb 2018 11:19:28 -0300 Subject: Fix cpu issue with cmp optimization, add HINT and FRINTX (scalar) instructions, fix for NvFlinger sometimes missing free buffers --- ChocolArm64/Translation/AILEmitterCtx.cs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'ChocolArm64/Translation') diff --git a/ChocolArm64/Translation/AILEmitterCtx.cs b/ChocolArm64/Translation/AILEmitterCtx.cs index cf644540..9199eddc 100644 --- a/ChocolArm64/Translation/AILEmitterCtx.cs +++ b/ChocolArm64/Translation/AILEmitterCtx.cs @@ -18,8 +18,8 @@ namespace ChocolArm64.Translation private AILBlock ILBlock; - private AOpCode LastCmpOp; - private AOpCode LastFlagOp; + private AOpCode OptOpLastCompare; + private AOpCode OptOpLastFlagSet; private int BlkIndex; private int OpcIndex; @@ -75,6 +75,9 @@ namespace ChocolArm64.Translation BlkIndex++; OpcIndex = -1; + OptOpLastFlagSet = null; + OptOpLastCompare = null; + ILBlock = Emitter.GetILBlock(BlkIndex); } @@ -120,7 +123,7 @@ namespace ChocolArm64.Translation public void TryOptMarkCondWithoutCmp() { - LastCmpOp = CurrOp; + OptOpLastCompare = CurrOp; AInstEmitAluHelper.EmitDataLoadOpers(this); @@ -146,14 +149,15 @@ namespace ChocolArm64.Translation { OpCode ILOp; - int IntCond = (int)Cond; + int IntCond = (int)Cond; - if (LastCmpOp != null && LastFlagOp == LastCmpOp && BranchOps.ContainsKey(Cond)) + if (OptOpLastCompare != null && + OptOpLastCompare == OptOpLastFlagSet && BranchOps.ContainsKey(Cond)) { - Ldloc(Tmp3Index, AIoType.Int, LastCmpOp.RegisterSize); - Ldloc(Tmp4Index, AIoType.Int, LastCmpOp.RegisterSize); + Ldloc(Tmp3Index, AIoType.Int, OptOpLastCompare.RegisterSize); + Ldloc(Tmp4Index, AIoType.Int, OptOpLastCompare.RegisterSize); - if (LastCmpOp.Emitter == AInstEmit.Adds) + if (OptOpLastCompare.Emitter == AInstEmit.Adds) { Emit(OpCodes.Neg); } @@ -356,7 +360,7 @@ namespace ChocolArm64.Translation public void EmitLdflg(int Index) => Ldloc(Index, AIoType.Flag); public void EmitStflg(int Index) { - LastFlagOp = CurrOp; + OptOpLastFlagSet = CurrOp; Stloc(Index, AIoType.Flag); } -- cgit v1.2.3