]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Configury and Makefile tweaks to support compilation with Intel's
authorFlorian Krohm <florian@eich-krohm.de>
Wed, 29 Oct 2014 13:57:49 +0000 (13:57 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Wed, 29 Oct 2014 13:57:49 +0000 (13:57 +0000)
ICC Compiler. Patch mostly by Gregory Czajkowski <gregczajkowski@yahoo.com>.
Fixes BZ #339542.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14674

Makefile.vex.am
NEWS
configure.ac
coregrind/m_compiler.c
exp-bbv/tests/amd64-linux/Makefile.am
exp-bbv/tests/amd64-linux/ll.vgtest
none/tests/amd64/Makefile.am

index 5784a6fe579f5260d6cc9636942eb83a63311ab6..53ec38001b78eeb2af81df1d166b4f7f68b89bda 100644 (file)
@@ -73,6 +73,7 @@ endif
 # This is very uggerly.  Need to sed out both "xyzzyN" and
 # "xyzzy$N" since gcc on different targets emits the constants
 # differently -- with a leading $ on x86/amd64 but none on ppc32/64.
+# ICC also emits the constants differently with a leading # #define
 pub/libvex_guest_offsets.h: auxprogs/genoffsets.c \
                            pub/libvex_basictypes.h \
                            pub/libvex_guest_x86.h \
@@ -91,7 +92,8 @@ pub/libvex_guest_offsets.h: auxprogs/genoffsets.c \
              $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \
                                -O -S -o auxprogs/genoffsets.s \
                                         $(srcdir)/auxprogs/genoffsets.c
-       grep xyzzy auxprogs/genoffsets.s | grep "^#define" \
+       grep xyzzy auxprogs/genoffsets.s | grep "^[# ]*#define" \
+          | sed "s/# #define/#define/g" \
           | sed "s/xyzzy\\$$//g" \
           | sed "s/xyzzy#//g" \
           | sed "s/xyzzy//g" \
diff --git a/NEWS b/NEWS
index 2e1e0abccb063f6d10cabb6e20964396db0322cd..963377ffd74ba0eebfc8557e807cabc3d6dd148e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -38,7 +38,7 @@ where XXXXXX is the bug number as listed below.
 
 339442 OS X 10.9 testsuite build failure: threadname.c:6:10:
        fatal error: 'sys/prctl.h' file not found
-
+339542 Support compilation with Intel's ICC compiler
 339688 Mac-specific ASM does not support .version directive (cpuid,
        tronical and pushfpopf tests)
 
index 55f0b462681bf101267ce583d085501d0b9ebe62..410b9d72f253d6450971d8a23f9864207b106dfd 100644 (file)
@@ -131,6 +131,9 @@ then
     is_clang="clang"
     # Don't use -dumpversion with clang: it will always produce "4.2.1".
     gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
+elif test "x`${CC} --version | $SED -n -e 's/icc.+\(ICC\).*/\1/p'`" = "ICC" ; then
+    is_clang="icc"
+    gcc_version=`${CC} --version | $SED -n -e 's/icc.+\(ICC\).+([0-9.]+).*$/\1/p'`
 else
     is_clang="notclang"
     gcc_version=`${CC} -dumpversion 2>/dev/null`
@@ -140,6 +143,7 @@ else
 fi
 ]
 AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang -o $is_clang = applellvm)
+AM_CONDITIONAL(COMPILER_IS_ICC, test $is_clang = icc)
 
 if test $is_clang = clang -o $is_clang = applellvm ; then
     CFLAGS="$CFLAGS -Wno-tautological-compare -Wno-cast-align -Wno-self-assign"
@@ -152,6 +156,9 @@ case "${is_clang}-${gcc_version}" in
      applellvm-5.1|applellvm-6.0*)
        AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])
        ;;
+     icc-1[3-9]*)
+       AC_MSG_RESULT([ok (ICC version ${gcc_version})])
+       ;;
      notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
        AC_MSG_RESULT([ok (${gcc_version})])
        ;;
@@ -160,7 +167,7 @@ case "${is_clang}-${gcc_version}" in
        ;;
      *)
        AC_MSG_RESULT([no (${gcc_version})])
-       AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9])
+       AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0])
        ;;
 esac
 
@@ -2200,6 +2207,7 @@ AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
 
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
   do { unsigned int h, l;
+   __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
    __asm__ __volatile__(
       "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
    __asm__ __volatile__(
index f51cd6316fe0592b5c3b1693a29ac2df998cb178..3be4549444ba3e562e2c8602da09c37be3c3e729 100644 (file)
@@ -38,6 +38,7 @@
 
 #include "config.h"
 #include "pub_core_basics.h"
+#include "pub_core_libcbase.h"
 
 #ifndef HAVE_BUILTIN_POPCOUT
 
@@ -138,6 +139,24 @@ __builtin_ctzll(ULong x)
 }
 #endif
 
+
+#ifdef __INTEL_COMPILER
+
+/* Provide certain functions Intel's ICC compiler expects to be defined. */
+
+void *
+_intel_fast_memcpy(void *dest, const void *src, SizeT sz)
+{
+   return VG_(memcpy)( dest, src, sz );
+}
+
+void *
+_intel_fast_memset(void *dest, int value, SizeT num)
+{
+   return VG_(memset)( dest, value, num );    
+}
+#endif
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index c5c68a215fb9623c5b47cb928c73937598c18bf9..2705feca5a297d2f76422088b446846b04613672 100644 (file)
@@ -3,7 +3,7 @@ include $(top_srcdir)/Makefile.tool-tests.am
 dist_noinst_SCRIPTS = filter_stderr
 
 check_PROGRAMS = \
-       million rep_prefix ll fldcw_check complex_rep clone_test
+       million rep_prefix fldcw_check complex_rep clone_test
 
 EXTRA_DIST = \
           clone_test.stderr.exp \
@@ -30,7 +30,13 @@ LDFLAGS += -nostartfiles -nodefaultlibs
 clone_test_SOURCES = clone_test.S
 complex_rep_SOURCES = complex_rep.S
 fldcw_check_SOURCES = fldcw_check.S
-ll_SOURCES = ll.S
 million_SOURCES = million.S
 rep_prefix_SOURCES = rep_prefix.S
 
+# To compile the ll testcase, the compiler needs to support -Xassembler
+# ICC does not do that
+if !COMPILER_IS_ICC
+AM_CCASFLAGS   += -Xassembler -I$(top_srcdir)/exp-bbv/tests
+check_PROGRAMS += ll
+ll_SOURCES      = ll.S
+endif
index 6031a5862c963fd1c3c502a1bcee4b315a6cf31d..82fc9c1dd8bdbb6f1bcf33c12f51c908c332d89e 100644 (file)
@@ -1,4 +1,5 @@
 prog: ll
+prereq: test -x ll
 vgopts: --interval-size=1000 --bb-out-file=ll.out.bb
 post:  cat ll.out.bb
 cleanup: rm ll.out.bb
index d5f9e48a4a267bc779872b8a7bee3c8375eb5537..97967b05f2fadbf36857d49de966cc6641f70587 100644 (file)
@@ -120,8 +120,10 @@ if BUILD_VPCLMULQDQ_TESTS
 endif
 endif
 if BUILD_AVX2_TESTS
+if !COMPILER_IS_ICC
   check_PROGRAMS += avx2-1
 endif
+endif
 if BUILD_TSX_TESTS
   check_PROGRAMS += tm1 xacq_xrel
 endif