[Mesa-dev] [PATCH 1/2] mesa/x86: add SSE4.1 runtime detection
Ian Romanick
idr at freedesktop.org
Fri May 2 11:49:15 PDT 2014
NAK.
common_x86 is only used for 32-bit builds, and there is nothing
equivalent for 64-bit. As a result, this will disable the optimization
completely for 64-bit.
Gallium has a bunch of CPU detection code, so if we need to update the
CPU detection code in core Mesa, we should move the Gallium code to a
higher level in the tree to be shared. I believe this has been
discussed before.
On 05/02/2014 11:11 AM, Matthew Atwood wrote:
> From: Matt Atwood <matthew.s.atwood at intel.com>
>
> add in bit to _mesa_x86_features for sse4.1, along with macros to query
> ---
> src/mesa/x86/common_x86.c | 3 +++
> src/mesa/x86/common_x86_features.h | 3 +++
> 2 files changed, 6 insertions(+)
>
> diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c
> index 3c1adc9..87fa68a 100644
> --- a/src/mesa/x86/common_x86.c
> +++ b/src/mesa/x86/common_x86.c
> @@ -238,6 +238,7 @@ _mesa_get_x86_features(void)
>
> /* get cpu features */
> cpu_features = _mesa_x86_cpuid_edx(1);
> + cpu_features_ecx = _mesa_x86_cpuid_ecx(1);
>
> if (cpu_features & X86_CPU_FPU)
> _mesa_x86_cpu_features |= X86_FEATURE_FPU;
> @@ -254,6 +255,8 @@ _mesa_get_x86_features(void)
> _mesa_x86_cpu_features |= X86_FEATURE_XMM;
> if (cpu_features & X86_CPU_XMM2)
> _mesa_x86_cpu_features |= X86_FEATURE_XMM2;
> + if (cpu_features & x86_CPU_SSE4_1)
> + _mesa_x86_features |= X86_FEATURE_SSE4_1;
> #endif
>
> /* query extended cpu features */
> diff --git a/src/mesa/x86/common_x86_features.h b/src/mesa/x86/common_x86_features.h
> index 8625484..1e4bbfc 100644
> --- a/src/mesa/x86/common_x86_features.h
> +++ b/src/mesa/x86/common_x86_features.h
> @@ -43,6 +43,7 @@
> #define X86_FEATURE_XMM2 (1<<6)
> #define X86_FEATURE_3DNOWEXT (1<<7)
> #define X86_FEATURE_3DNOW (1<<8)
> +#define X86_FEATURE_SSE4_1 (1<<9)
>
> /* standard X86 CPU features */
> #define X86_CPU_FPU (1<<0)
> @@ -50,6 +51,7 @@
> #define X86_CPU_MMX (1<<23)
> #define X86_CPU_XMM (1<<25)
> #define X86_CPU_XMM2 (1<<26)
> +#define X86_CPU_SSE4_1 (1<<19)
>
> /* extended X86 CPU features */
> #define X86_CPUEXT_MMX_EXT (1<<22)
> @@ -62,6 +64,7 @@
> #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_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT)
> +#define cpu_has_sse4_1 (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1)
>
> #endif
>
>
More information about the mesa-dev
mailing list