Browse Source

(CPU) Fix CRC32 instruction when constant values are used as input (#2183)

gdkchan 5 years ago
parent
commit
d43a56726c
1 changed files with 14 additions and 1 deletions
  1. 14 1
      ARMeilleure/CodeGen/X86/PreAllocator.cs

+ 14 - 1
ARMeilleure/CodeGen/X86/PreAllocator.cs

@@ -135,7 +135,7 @@ namespace ARMeilleure.CodeGen.X86
 
         private static void HandleConstantRegCopy(IntrusiveList<Node> nodes, Node node, Operation operation)
         {
-            if (operation.SourcesCount == 0 || IsIntrinsic(operation.Instruction))
+            if (operation.SourcesCount == 0 || IsXmmIntrinsic(operation))
             {
                 return;
             }
@@ -1400,5 +1400,18 @@ namespace ARMeilleure.CodeGen.X86
         {
             return inst == Instruction.Extended;
         }
+
+        private static bool IsXmmIntrinsic(Operation operation)
+        {
+            if (operation.Instruction != Instruction.Extended)
+            {
+                return false;
+            }
+
+            IntrinsicOperation intrinOp = (IntrinsicOperation)operation;
+            IntrinsicInfo info = IntrinsicTable.GetInfo(intrinOp.Intrinsic);
+
+            return info.Type != IntrinsicType.Crc32;
+        }
     }
 }