Merge pull request #2802 from BrzVlad/feature-evacuation-opt2
[mono.git] / mono / utils / mono-hwcap-x86.c
index 642613ba53c73e19761c5382245f3624eeafea36..4a96aa3a088eeb3d6a646c123c603bb305c29296 100644 (file)
@@ -16,6 +16,7 @@
  * Copyright 2006 Broadcom
  * Copyright 2007-2008 Andreas Faerber
  * Copyright 2011-2013 Xamarin Inc
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
 #include "mono/utils/mono-hwcap-x86.h"
@@ -42,6 +43,10 @@ gboolean mono_hwcap_x86_has_sse4a = FALSE;
 static gboolean
 cpuid (int id, int *p_eax, int *p_ebx, int *p_ecx, int *p_edx)
 {
+#if defined(_MSC_VER)
+       int info [4];
+#endif
+
        /* First, make sure we can use cpuid if we're on 32-bit. */
 #if defined(TARGET_X86)
        gboolean have_cpuid = FALSE;
@@ -86,7 +91,6 @@ cpuid (int id, int *p_eax, int *p_ebx, int *p_ecx, int *p_edx)
        /* Now issue the actual cpuid instruction. We can use
           MSVC's __cpuid on both 32-bit and 64-bit. */
 #if defined(_MSC_VER)
-       int info [4];
        __cpuid (info, id);
        *p_eax = info [0];
        *p_ebx = info [1];
@@ -158,3 +162,18 @@ mono_hwcap_arch_init (void)
        mono_hwcap_x86_is_xen = !access ("/proc/xen", F_OK);
 #endif
 }
+
+void
+mono_hwcap_print (FILE *f)
+{
+       g_fprintf (f, "mono_hwcap_x86_is_xen = %i\n", mono_hwcap_x86_is_xen);
+       g_fprintf (f, "mono_hwcap_x86_has_cmov = %i\n", mono_hwcap_x86_has_cmov);
+       g_fprintf (f, "mono_hwcap_x86_has_fcmov = %i\n", mono_hwcap_x86_has_fcmov);
+       g_fprintf (f, "mono_hwcap_x86_has_sse1 = %i\n", mono_hwcap_x86_has_sse1);
+       g_fprintf (f, "mono_hwcap_x86_has_sse2 = %i\n", mono_hwcap_x86_has_sse2);
+       g_fprintf (f, "mono_hwcap_x86_has_sse3 = %i\n", mono_hwcap_x86_has_sse3);
+       g_fprintf (f, "mono_hwcap_x86_has_ssse3 = %i\n", mono_hwcap_x86_has_ssse3);
+       g_fprintf (f, "mono_hwcap_x86_has_sse41 = %i\n", mono_hwcap_x86_has_sse41);
+       g_fprintf (f, "mono_hwcap_x86_has_sse42 = %i\n", mono_hwcap_x86_has_sse42);
+       g_fprintf (f, "mono_hwcap_x86_has_sse4a = %i\n", mono_hwcap_x86_has_sse4a);
+}