[PATCH] Add check for avx support.

Tomáš Chvátal tomas.chvatal at gmail.com
Wed Aug 3 04:52:13 PDT 2011


---
 configure.in |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/configure.in b/configure.in
index cf308dc..7dc6fa3 100755
--- a/configure.in
+++ b/configure.in
@@ -1885,6 +1885,37 @@ fi
 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
 
 dnl ===================================================================
+dnl Check for AVX
+dnl ===================================================================
+AS_IF([test "x$AVX_CFLAGS" = "x"], [
+  AS_IF([test "x$SUNCC" = "xyes" && test "x$AMD64_ABI" = "xno"], [
+       AVX_CFLAGS="-xarch=avx"
+  ])
+], [
+  AVX_CFLAGS="-mavx -Winline"
+])
+
+have_avx_intrinsics=no
+AC_MSG_CHECKING(whether to use AVX intrinsics)
+avx_save_CFLAGS=$CFLAGS
+CFLAGS="$AVX_CFLAGS $CFLAGS"
+AC_COMPILE_IFELSE([
+#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))
+#   if !defined(__amd64__) && !defined(__x86_64__)
+#      error "Need GCC >= 4.5 for AVX intrinsics on x86"
+#   endif
+#endif
+#include <immintrin.h>
+int main () {
+    __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
+        c = _mm256_permute2f128_si256 (a, b, 0);
+    return 0;
+}], have_avx_intrinsics=yes)
+CFLAGS=$avx_save_CFLAGS
+AC_MSG_RESULT([$have_avx_intrinsics])
+AM_CONDITIONAL(USE_AVX, [test "x$have_avx_intrinsics" = "xyes"])
+
+dnl ===================================================================
 dnl Set up a different compiler to produce tools to run on the build
 dnl machine when doing cross-compilation
 dnl ===================================================================
-- 
1.7.3.4


--------------040701090906090204020506
Content-Type: text/x-patch;
 name="0001-Fix-segmentation-fault-when-linking-mavx-on-new-CPUs.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0001-Fix-segmentation-fault-when-linking-mavx-on-new-CPUs.pa";
 filename*1="tch"



More information about the LibreOffice mailing list