From: Matt Turner Date: Fri, 2 May 2014 19:10:17 +0000 (-0700) Subject: mesa/x86: Support SSE 4.1 detection on x86-64. X-Git-Tag: upstream/10.3~1925 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8b9302f2b4b0536abb91cb73682ec13640fe9eaf;p=platform%2Fupstream%2Fmesa.git mesa/x86: Support SSE 4.1 detection on x86-64. Uses the cpuid.h header provided by gcc and clang. Other platforms are encouraged to switch. --- diff --git a/src/mesa/main/cpuinfo.c b/src/mesa/main/cpuinfo.c index 8d482a6..73e295c 100644 --- a/src/mesa/main/cpuinfo.c +++ b/src/mesa/main/cpuinfo.c @@ -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 } diff --git a/src/mesa/main/cpuinfo.h b/src/mesa/main/cpuinfo.h index 3678889..fcd611e 100644 --- a/src/mesa/main/cpuinfo.h +++ b/src/mesa/main/cpuinfo.h @@ -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 diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c index 3c1adc9..a91f07e 100644 --- a/src/mesa/x86/common_x86.c +++ b/src/mesa/x86/common_x86.c @@ -47,6 +47,9 @@ #include #include #endif +#if defined(__x86_64__) && !defined(_MSC_VER) +#include +#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;