From ee0f9b03a4a28bc27351cda9f6e2f7a921ad1fd5 Mon Sep 17 00:00:00 2001
From: gdkchan <gab.dark.100@gmail.com>
Date: Mon, 19 Dec 2022 14:45:58 -0300
Subject: Eliminate zero-extension moves in more cases on 32-bit games (#4140)

* Eliminate zero-extension moves in more cases on 32-bit games

* PPTC version bump

* Revert X86Optimizer changes
---
 ARMeilleure/CodeGen/X86/CodeGenerator.cs | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'ARMeilleure/CodeGen/X86/CodeGenerator.cs')

diff --git a/ARMeilleure/CodeGen/X86/CodeGenerator.cs b/ARMeilleure/CodeGen/X86/CodeGenerator.cs
index 8d8d3b0a..e589da14 100644
--- a/ARMeilleure/CodeGen/X86/CodeGenerator.cs
+++ b/ARMeilleure/CodeGen/X86/CodeGenerator.cs
@@ -1587,6 +1587,12 @@ namespace ARMeilleure.CodeGen.X86
 
             Debug.Assert(dest.Type.IsInteger() && source.Type.IsInteger());
 
+            // We can eliminate the move if source is already 32-bit and the registers are the same.
+            if (dest.Value == source.Value && source.Type == OperandType.I32)
+            {
+                return;
+            }
+
             context.Assembler.Mov(dest, source, OperandType.I32);
         }
 
-- 
cgit v1.2.3-70-g09d2