[Mesa-dev] [PATCH] configure.ac: fix test for SSE4.1 assembler support

Jonathan Gray jsg at jsg.id.au
Tue Dec 8 21:37:26 PST 2015


Change the __m128i variables to be volatile so gcc 4.9 won't optimise
all of them out with -O1 or greater.  The _mm_set1_epi32/pinsrd calls
still get optimised out but now there is at least one SSE4.1 instruction
generated via _mm_max_epu32/pmaxud.  When all of the sse4.1 instructions
got optimised out the configure test would incorrectly pass when the
compiler supported the intrinsics and the assembler didn't support the
instructions.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91806
Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
Cc: "11.0 11.1" <mesa-stable at lists.freedesktop.org>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 260934d..1d82e47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -384,7 +384,7 @@ CFLAGS="$SSE41_CFLAGS $CFLAGS"
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
 #include <smmintrin.h>
 int main () {
-    __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
+    volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
     c = _mm_max_epu32(a, b);
     return 0;
 }]])], SSE41_SUPPORTED=1)
-- 
2.6.3



More information about the mesa-dev mailing list