Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Dne 3.8.2011 13:27, Caolán McNamara napsal(a):
On Wed, 2011-08-03 at 12:11 +0100, Caolán McNamara wrote:
On Wed, 2011-08-03 at 12:47 +0200, Tomáš Chvátal wrote:
Attaching the updated patch that adds it only where it should really be
needed.
seems reasonable, pushed.
*bzzt*, x86_64 gcc 4.3.4 doesn't support it, so breaks the build on
those buildbots.

I guess need to instead add a configure check for it, stuff it into an
env variable if supported, and add that env variable to the makefile.mks
instead.

C.

Darn,
Ok first part is the configure.in check, I think the attachment should do the trick.

But I am not entirely sure how to do the check in plain GNUMake.
I wrote it with ifdef USE_AVX and I hope this is the way it should work :)

Tom

From 78ebd6077193a83f9be01fc5c2ee29558e840187 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tomas.chvatal@gmail.com>
Date: Wed, 3 Aug 2011 13:52:13 +0200
Subject: [PATCH] Add check for avx support.

---
 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

From 2f566e2041ddc71039362f1761e3f87cbe999c99 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tomas.chvatal@gmail.com>
Date: Mon, 1 Aug 2011 17:41:29 +0200
Subject: [PATCH] Fix segmentation fault when linking -mavx on new CPUs is enabled by explicitly 
adding -mno-avx to CXXFLAGS.

---
 .../source/cpp_uno/gcc3_linux_intel/makefile.mk    |    6 ++++++
 .../source/cpp_uno/gcc3_linux_x86-64/makefile.mk   |    6 ++++++
 bridges/source/cpp_uno/mingw_intel/makefile.mk     |    6 ++++++
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk 
b/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk
index beedf9d..919cc3f 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk
@@ -52,6 +52,12 @@ CFLAGS += -DLEAK_STATIC_DATA
 # work with the .cxx sources in this directory:
 CFLAGSCXX += -fno-omit-frame-pointer -fno-strict-aliasing
 
+# In case the compiler supports AVX this code segfaults so specifically turn
+# it off.
+ifdef USE_AVX
+    CFLAGSCXX+= -mno-avx
+endif
+
 CFLAGSNOOPT=-O0
 
 SLOFILES= \
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk 
b/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk
index dd35432..0bf5543 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk
@@ -52,6 +52,12 @@ CFLAGS += -DLEAK_STATIC_DATA
 # work with the .cxx sources in this directory:
 CFLAGSCXX += -fno-omit-frame-pointer -fno-strict-aliasing
 
+# In case the compiler supports AVX this code segfaults so specifically turn
+# it off.
+ifdef USE_AVX
+    CFLAGSCXX+= -mno-avx
+endif
+
 SLOFILES= \
     $(SLO)$/abi.obj                    \
     $(SLO)$/except.obj         \
diff --git a/bridges/source/cpp_uno/mingw_intel/makefile.mk 
b/bridges/source/cpp_uno/mingw_intel/makefile.mk
index 2c7a8da..05a2400 100644
--- a/bridges/source/cpp_uno/mingw_intel/makefile.mk
+++ b/bridges/source/cpp_uno/mingw_intel/makefile.mk
@@ -51,6 +51,12 @@ CFLAGS += -DBROKEN_ALLOCA
 # work with the .cxx sources in this directory:
 CFLAGSCXX += -fno-omit-frame-pointer
 
+# In case the compiler supports AVX this code segfaults so specifically turn
+# it off.
+ifdef USE_AVX
+    CFLAGSCXX+= -mno-avx
+endif
+
 NOOPTFILES= \
     $(SLO)$/uno2cpp.obj
 
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.