diff options
author | Jason Evans <jasone@canonware.com> | 2014-02-25 19:21:41 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2014-02-25 19:21:41 (GMT) |
commit | cb657e3170349a27e753cdf6316513f56550205e (patch) | |
tree | 480877b0dbeae09b0a8452f76c5fb2710217be41 | |
parent | ad47e8996e649ff8b4c920abb937bbacb8b9625e (diff) | |
download | jemalloc-cb657e3170349a27e753cdf6316513f56550205e.zip jemalloc-cb657e3170349a27e753cdf6316513f56550205e.tar.gz jemalloc-cb657e3170349a27e753cdf6316513f56550205e.tar.bz2 |
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.
-rw-r--r-- | configure.ac | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index 938c019..3837a78 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 <emmintrin.h> +], [], [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], [ ]) |