summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2014-11-15 18:37:22 +0000
committerEmil Velikov <[email protected]>2014-11-19 00:51:44 +0000
commit6452e24ebc6ccc22bca5bf02c4bb0ed27646512a (patch)
tree90169e1e7979d6750e65de7b327a163bdcb930ae
parent4186c1c7b1ab594686a43b69c0a626e9e5d75129 (diff)
configure.ac: roll up a program for the sse4.1 check
So when checking/building sse code we have three possibilities: 1 Old compiler, throws an error when using -msse* 2 New compiler, user disables sse* (-mno-sse*) 3 New compiler, user doesn't disable sse The original code, added code for #1 but not #2. Later on we patched around the lack of handling #2 by wrapping the code in __SSE4_1__. Yet it lead to a missing/undefined symbol in case of #1 or #2, which might cause an issue for #2 when using the i965 driver. A bit later we "fixed" the undefined symbol by using #1, rather than updating it to handle #2. With this commit we set things straight :) To top it all up, conventions state that in case of conflicting (-enable-foo -disable-foo) options, the latter one takes precedence. Thus we need to make sure to prepend -msse4.1 to CFLAGS in our test. v2: Clean the #includes. Suggested by Ilia, Matt & Siavash. Cc: "10.3 10.4" <[email protected]> Tested-by: David Heidelberg <[email protected]> Tested-by: Siavash Eliasi <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Emil Velikov <[email protected]> (cherry picked from commit 1a6ae840413d7fb6d2e83f6a83081d5246c7ac9e)
-rw-r--r--configure.ac11
1 files changed, 10 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 3d6d8491824..33cbf227ddc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -252,7 +252,16 @@ AC_SUBST([VISIBILITY_CXXFLAGS])
dnl
dnl Optional flags, check for compiler support
dnl
-AX_CHECK_COMPILE_FLAG([-msse4.1], [SSE41_SUPPORTED=1], [SSE41_SUPPORTED=0])
+save_CFLAGS="$CFLAGS"
+CFLAGS="-msse4.1 $CFLAGS"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <smmintrin.h>
+int main () {
+ __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
+ c = _mm_max_epu32(a, b);
+ return 0;
+}]])], SSE41_SUPPORTED=1)
+CFLAGS="$save_CFLAGS"
if test "x$SSE41_SUPPORTED" = x1; then
DEFINES="$DEFINES -DUSE_SSE41"
fi