mesa/x86: add SSE4.1 runtime detection.
Add a bit to _mesa_x86_features for SSE 4.1, along with macros to query. Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
@@ -241,6 +241,7 @@ _mesa_get_x86_features(void)
|
|||||||
|
|
||||||
/* get cpu features */
|
/* get cpu features */
|
||||||
cpu_features = _mesa_x86_cpuid_edx(1);
|
cpu_features = _mesa_x86_cpuid_edx(1);
|
||||||
|
cpu_features_ecx = _mesa_x86_cpuid_ecx(1);
|
||||||
|
|
||||||
if (cpu_features & X86_CPU_FPU)
|
if (cpu_features & X86_CPU_FPU)
|
||||||
_mesa_x86_cpu_features |= X86_FEATURE_FPU;
|
_mesa_x86_cpu_features |= X86_FEATURE_FPU;
|
||||||
@@ -257,6 +258,8 @@ _mesa_get_x86_features(void)
|
|||||||
_mesa_x86_cpu_features |= X86_FEATURE_XMM;
|
_mesa_x86_cpu_features |= X86_FEATURE_XMM;
|
||||||
if (cpu_features & X86_CPU_XMM2)
|
if (cpu_features & X86_CPU_XMM2)
|
||||||
_mesa_x86_cpu_features |= X86_FEATURE_XMM2;
|
_mesa_x86_cpu_features |= X86_FEATURE_XMM2;
|
||||||
|
if (cpu_features & x86_CPU_SSE4_1)
|
||||||
|
_mesa_x86_features |= X86_FEATURE_SSE4_1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* query extended cpu features */
|
/* query extended cpu features */
|
||||||
@@ -341,6 +344,9 @@ _mesa_get_x86_features(void)
|
|||||||
_mesa_x86_cpu_features |= X86_FEATURE_XMM | X86_FEATURE_XMM2;
|
_mesa_x86_cpu_features |= X86_FEATURE_XMM | X86_FEATURE_XMM2;
|
||||||
|
|
||||||
__get_cpuid(1, &eax, &ebx, &ecx, &edx);
|
__get_cpuid(1, &eax, &ebx, &ecx, &edx);
|
||||||
|
|
||||||
|
if (ecx & bit_SSE4_1)
|
||||||
|
_mesa_x86_cpu_features |= X86_FEATURE_SSE4_1;
|
||||||
#endif /* USE_X86_ASM */
|
#endif /* USE_X86_ASM */
|
||||||
|
|
||||||
(void) detection_debug;
|
(void) detection_debug;
|
||||||
|
@@ -43,6 +43,7 @@
|
|||||||
#define X86_FEATURE_XMM2 (1<<6)
|
#define X86_FEATURE_XMM2 (1<<6)
|
||||||
#define X86_FEATURE_3DNOWEXT (1<<7)
|
#define X86_FEATURE_3DNOWEXT (1<<7)
|
||||||
#define X86_FEATURE_3DNOW (1<<8)
|
#define X86_FEATURE_3DNOW (1<<8)
|
||||||
|
#define X86_FEATURE_SSE4_1 (1<<9)
|
||||||
|
|
||||||
/* standard X86 CPU features */
|
/* standard X86 CPU features */
|
||||||
#define X86_CPU_FPU (1<<0)
|
#define X86_CPU_FPU (1<<0)
|
||||||
@@ -50,6 +51,8 @@
|
|||||||
#define X86_CPU_MMX (1<<23)
|
#define X86_CPU_MMX (1<<23)
|
||||||
#define X86_CPU_XMM (1<<25)
|
#define X86_CPU_XMM (1<<25)
|
||||||
#define X86_CPU_XMM2 (1<<26)
|
#define X86_CPU_XMM2 (1<<26)
|
||||||
|
/* ECX. */
|
||||||
|
#define X86_CPU_SSE4_1 (1<<19)
|
||||||
|
|
||||||
/* extended X86 CPU features */
|
/* extended X86 CPU features */
|
||||||
#define X86_CPUEXT_MMX_EXT (1<<22)
|
#define X86_CPUEXT_MMX_EXT (1<<22)
|
||||||
@@ -62,6 +65,7 @@
|
|||||||
#define cpu_has_xmm2 (_mesa_x86_cpu_features & X86_FEATURE_XMM2)
|
#define cpu_has_xmm2 (_mesa_x86_cpu_features & X86_FEATURE_XMM2)
|
||||||
#define cpu_has_3dnow (_mesa_x86_cpu_features & X86_FEATURE_3DNOW)
|
#define cpu_has_3dnow (_mesa_x86_cpu_features & X86_FEATURE_3DNOW)
|
||||||
#define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT)
|
#define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT)
|
||||||
|
#define cpu_has_sse4_1 (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user