mesa/x86: Support SSE 4.1 detection on x86-64.
authorMatt Turner <mattst88@gmail.com>
Fri, 2 May 2014 19:10:17 +0000 (12:10 -0700)
committerMatt Turner <mattst88@gmail.com>
Thu, 22 May 2014 17:17:16 +0000 (10:17 -0700)
Uses the cpuid.h header provided by gcc and clang. Other platforms are
encouraged to switch.

src/mesa/main/cpuinfo.c
src/mesa/main/cpuinfo.h
src/mesa/x86/common_x86.c

index 8d482a6ac146f177edfe78d4019170a7cbb1ac2a..73e295c75b7a541ea6133343bb0194a03dd9a755 100644 (file)
@@ -34,7 +34,7 @@
 void
 _mesa_get_cpu_features(void)
 {
-#ifdef USE_X86_ASM
+#if defined USE_X86_ASM || (defined __x86_64__ && !defined _MSC_VER)
    _mesa_get_x86_features();
 #endif
 }
index 367888905584f482418a260334f5f3ec418f0758..fcd611e42e71199d1df32fcdc038b0ae87c23a68 100644 (file)
@@ -27,7 +27,7 @@
 #define CPUINFO_H
 
 
-#if defined(USE_X86_ASM)
+#if defined USE_X86_ASM || (defined __x86_64__ && !defined _MSC_VER)
 #include "x86/common_x86_asm.h"
 #endif
 
index 3c1adc916f3b314e88e57950b291d11a3d5cc250..a91f07e2e8916f508ee3d9927c5f0a755a3f1691 100644 (file)
@@ -47,6 +47,9 @@
 #include <sys/sysctl.h>
 #include <machine/cpu.h>
 #endif
+#if defined(__x86_64__) && !defined(_MSC_VER)
+#include <cpuid.h>
+#endif
 
 #include "main/imports.h"
 #include "common_x86_asm.h"
@@ -330,6 +333,14 @@ _mesa_get_x86_features(void)
    }
 #endif
 
+#elif defined(__x86_64__) && !defined(_MSC_VER)
+   unsigned int uninitialized_var(eax), uninitialized_var(ebx),
+                uninitialized_var(ecx), uninitialized_var(edx);
+
+   /* Always available on x86-64. */
+   _mesa_x86_cpu_features |= X86_FEATURE_XMM | X86_FEATURE_XMM2;
+
+   __get_cpuid(1, &eax, &ebx, &ecx, &edx);
 #endif /* USE_X86_ASM */
 
    (void) detection_debug;