From: Florian Krohm Date: Wed, 29 Oct 2014 13:57:49 +0000 (+0000) Subject: Configury and Makefile tweaks to support compilation with Intel's X-Git-Tag: svn/VALGRIND_3_11_0~874 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b21985c7589462d402051804a144576eb54b030c;p=thirdparty%2Fvalgrind.git Configury and Makefile tweaks to support compilation with Intel's ICC Compiler. Patch mostly by Gregory Czajkowski . Fixes BZ #339542. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14674 --- diff --git a/Makefile.vex.am b/Makefile.vex.am index 5784a6fe57..53ec38001b 100644 --- a/Makefile.vex.am +++ b/Makefile.vex.am @@ -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 2e1e0abccb..963377ffd7 100644 --- 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) diff --git a/configure.ac b/configure.ac index 55f0b46268..410b9d72f2 100644 --- a/configure.ac +++ b/configure.ac @@ -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__( diff --git a/coregrind/m_compiler.c b/coregrind/m_compiler.c index f51cd6316f..3be4549444 100644 --- a/coregrind/m_compiler.c +++ b/coregrind/m_compiler.c @@ -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 ---*/ /*--------------------------------------------------------------------*/ diff --git a/exp-bbv/tests/amd64-linux/Makefile.am b/exp-bbv/tests/amd64-linux/Makefile.am index c5c68a215f..2705feca5a 100644 --- a/exp-bbv/tests/amd64-linux/Makefile.am +++ b/exp-bbv/tests/amd64-linux/Makefile.am @@ -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 diff --git a/exp-bbv/tests/amd64-linux/ll.vgtest b/exp-bbv/tests/amd64-linux/ll.vgtest index 6031a5862c..82fc9c1dd8 100644 --- a/exp-bbv/tests/amd64-linux/ll.vgtest +++ b/exp-bbv/tests/amd64-linux/ll.vgtest @@ -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 diff --git a/none/tests/amd64/Makefile.am b/none/tests/amd64/Makefile.am index d5f9e48a4a..97967b05f2 100644 --- a/none/tests/amd64/Makefile.am +++ b/none/tests/amd64/Makefile.am @@ -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