[Mesa-dev] [PATCH V2 1/2] mesa: add runtime support for SSSE3

Timothy Arceri t_arceri at yahoo.com.au
Fri Nov 7 04:21:10 PST 2014


V2:
- remove unrequired #ifdef bit_SSSE3
- order flag check in config

Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
---
 configure.ac                       | 6 ++++++
 src/mesa/x86/common_x86.c          | 2 ++
 src/mesa/x86/common_x86_features.h | 4 +++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 03f1bca..f86edf1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -252,6 +252,12 @@ AC_SUBST([VISIBILITY_CXXFLAGS])
 dnl
 dnl Optional flags, check for compiler support
 dnl
+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])
+
 AX_CHECK_COMPILE_FLAG([-msse4.1], [SSE41_SUPPORTED=1], [SSE41_SUPPORTED=0])
 if test "x$SSE41_SUPPORTED" = x1; then
     DEFINES="$DEFINES -DUSE_SSE41"
diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c
index 25f5c40..bef9cf2 100644
--- a/src/mesa/x86/common_x86.c
+++ b/src/mesa/x86/common_x86.c
@@ -352,6 +352,8 @@ _mesa_get_x86_features(void)
 
       __get_cpuid(1, &eax, &ebx, &ecx, &edx);
 
+      if (ecx & bit_SSSE3)
+         _mesa_x86_cpu_features |= X86_FEATURE_SSSE3;
       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
-- 
1.9.3



More information about the mesa-dev mailing list