From cb657e3170349a27e753cdf6316513f56550205e Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Tue, 25 Feb 2014 11:21:41 -0800 Subject: [PATCH] Add configure test to verify SSE2 code compiles. Make sure that emmintrin.h can be #include'd without causing a compilation error, rather than blindly defining HAVE_SSE2 based on architecture. Attempts to force SSE2 compilation on a 32-bit Ubuntu 13.10 system running as a VMware guest resulted in a no-win choice without any obvious explanation besides toolchain misconfiguration/bug: - Suffer compilation failure due to __MMX__, __SSE__, and __SSE2__ not being defined, even if -mmmx, -msse, and -msse2 are manually specified (note that they appear to be enabled by default). - Manually define __MMX__, __SSE__, and __SSE2__, and suffer compiler warnings that they are already automatically defined. This results in successful compilation and execution, but the noise is intolerable. --- configure.ac | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 938c0191..3837a786 100644 --- a/configure.ac +++ b/configure.ac @@ -198,21 +198,21 @@ CPU_SPINWAIT="" case "${host_cpu}" in i[[345]]86) ;; - i686) - JE_COMPILABLE([__asm__], [], [[__asm__ volatile("pause"); return 0;]], - [je_cv_asm]) - if test "x${je_cv_asm}" = "xyes" ; then + i686|x86_64) + JE_COMPILABLE([pause instruction], [], + [[__asm__ volatile("pause"); return 0;]], + [je_cv_pause]) + if test "x${je_cv_pause}" = "xyes" ; then CPU_SPINWAIT='__asm__ volatile("pause")' fi - AC_DEFINE_UNQUOTED([HAVE_SSE2], [ ]) - ;; - x86_64) - JE_COMPILABLE([__asm__ syntax], [], - [[__asm__ volatile("pause"); return 0;]], [je_cv_asm]) - if test "x${je_cv_asm}" = "xyes" ; then - CPU_SPINWAIT='__asm__ volatile("pause")' + dnl emmintrin.h fails to compile unless MMX, SSE, and SSE2 are + dnl supported. + JE_COMPILABLE([SSE2 intrinsics], [ +#include +], [], [je_cv_sse2]) + if test "x${je_cv_sse2}" = "xyes" ; then + AC_DEFINE_UNQUOTED([HAVE_SSE2], [ ]) fi - AC_DEFINE_UNQUOTED([HAVE_SSE2], [ ]) ;; powerpc) AC_DEFINE_UNQUOTED([HAVE_ALTIVEC], [ ])