[Mesa-dev] [PATCH 1/2] mesa: add runtime support for SSSE3
Ian Romanick
idr at freedesktop.org
Thu Nov 6 13:30:16 PST 2014
On 11/06/2014 04:18 AM, Timothy Arceri wrote:
> Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
> ---
> configure.ac | 6 ++++++
> src/mesa/x86/common_x86.c | 4 ++++
> src/mesa/x86/common_x86_features.h | 4 +++-
> 3 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index 03f1bca..cc0a661 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -258,6 +258,12 @@ if test "x$SSE41_SUPPORTED" = x1; then
> fi
> AM_CONDITIONAL([SSE41_SUPPORTED], [test x$SSE41_SUPPORTED = x1])
>
> +AX_CHECK_COMPILE_FLAG([-mssse3], [SSSE3_SUPPORTED=1], [SSSE3_SUPPORTED=0])
> +if test "x$SSSE3_SUPPORTED" = x1; then
> + DEFINES="$DEFINES -DUSE_SSSE3"
> +fi
> +AM_CONDITIONAL([SSSE3_SUPPORTED], [test x$SSSE3_SUPPORTED = x1])
> +
Just so people can find things, the SSSE3 check should logically come
before the SSE4.1 check.
> dnl Can't have static and shared libraries, default to static if user
> dnl explicitly requested. If both disabled, set to static since shared
> dnl was explicitly requested.
> diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c
> index 25f5c40..ad0648a 100644
> --- a/src/mesa/x86/common_x86.c
> +++ b/src/mesa/x86/common_x86.c
> @@ -352,6 +352,10 @@ _mesa_get_x86_features(void)
>
> __get_cpuid(1, &eax, &ebx, &ecx, &edx);
>
> +#ifdef bit_SSSE3
> + if (ecx & bit_SSSE3)
> + _mesa_x86_cpu_features |= X86_FEATURE_SSSE3;
> +#endif
> if (ecx & bit_SSE4_1)
> _mesa_x86_cpu_features |= X86_FEATURE_SSE4_1;
> }
> diff --git a/src/mesa/x86/common_x86_features.h b/src/mesa/x86/common_x86_features.h
> index 66f2cf6..6eb2b38 100644
> --- a/src/mesa/x86/common_x86_features.h
> +++ b/src/mesa/x86/common_x86_features.h
> @@ -43,7 +43,8 @@
> #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)
> +#define X86_FEATURE_SSSE3 (1<<9)
> +#define X86_FEATURE_SSE4_1 (1<<10)
>
> /* standard X86 CPU features */
> #define X86_CPU_FPU (1<<0)
> @@ -65,6 +66,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_ssse3 (_mesa_x86_cpu_features & X86_FEATURE_SSSE3)
> #define cpu_has_sse4_1 (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1)
>
> #endif
>
More information about the mesa-dev
mailing list