[Mesa-dev] [PATCH] mesa: Permanently enable features supported by target CPU at compile time.

Matt Turner mattst88 at gmail.com
Fri Nov 7 23:00:24 PST 2014


On Fri, Nov 7, 2014 at 10:43 PM, Siavash Eliasi <siavashserver at gmail.com> wrote:
> This will remove the need for unnecessary runtime checks for CPU features if
> already supported by target CPU, resulting in smaller and less branchy code.
> ---
>  src/mesa/x86/common_x86_features.h | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/src/mesa/x86/common_x86_features.h b/src/mesa/x86/common_x86_features.h
> index 66f2cf6..9888c26 100644
> --- a/src/mesa/x86/common_x86_features.h
> +++ b/src/mesa/x86/common_x86_features.h
> @@ -67,5 +67,30 @@
>  #define cpu_has_3dnowext       (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT)
>  #define cpu_has_sse4_1         (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1)
>
> +/* Permanently enable features supported by target CPU at compile time */
> +#ifdef __MMX__
> +#define cpu_has_mmx            1
> +#endif
> +
> +#ifdef __SSE__
> +#define cpu_has_xmm            1
> +#endif
> +
> +#ifdef __SSE2__
> +#define cpu_has_xmm2           1
> +#endif
> +
> +#ifdef __3dNOW__
> +#define cpu_has_3dnow          1
> +#endif
> +
> +#ifdef __SSSE3__
> +#define cpu_has_ssse3          1
> +#endif

There's not an existing cpu_has_ssse3 macro.

> +
> +#ifdef __SSE4_1__
> +#define cpu_has_sse4_1         1
> +#endif

As you can see at the beginning of the patch, you're just redefining
the same macros...

They should be

#ifdef __SSE__
#define cpu_has_xmm            1
#else
#define cpu_has_xmm             (_mesa_x86_cpu_features & X86_FEATURE_XMM)
#endif


More information about the mesa-dev mailing list