[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.0.4-339-g05e5bb0

mysql vizuser noreply at mpich.org
Tue Jul 16 14:20:03 CDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  05e5bb0513638325eb4545eb82bd57313a771635 (commit)
      from  828b0b4d46f0a499560123f2f3797b197c07abea (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/05e5bb0513638325eb4545eb82bd57313a771635

commit 05e5bb0513638325eb4545eb82bd57313a771635
Author: Ken Raffenetti <raffenet at mcs.anl.gov>
Date:   Tue Jul 16 12:53:03 2013 -0500

    Add configure test for __builtin_expect
    
    Fixes #1695
    
    Signed-off-by: Pavan Balaji <balaji at mcs.anl.gov>

diff --git a/confdb/aclocal_cc.m4 b/confdb/aclocal_cc.m4
index 41fba79..3c4f052 100644
--- a/confdb/aclocal_cc.m4
+++ b/confdb/aclocal_cc.m4
@@ -1651,3 +1651,21 @@ AC_DEFUN([PAC_C_MACRO_VA_ARGS],[
     fi
     rm -f pac_test.log
 ])dnl
+
+# Will AC_DEFINE([HAVE_BUILTIN_EXPECT]) if the compiler supports __builtin_expect.
+AC_DEFUN([PAC_C_BUILTIN_EXPECT],[
+AC_MSG_CHECKING([if C compiler supports __builtin_expect])
+
+AC_TRY_LINK(, [
+    return __builtin_expect(1, 1) ? 1 : 0
+], [
+    have_builtin_expect=yes
+    AC_MSG_RESULT([yes])
+], [
+    have_builtin_expect=no
+    AC_MSG_RESULT([no])
+])
+if test x$have_builtin_expect = xyes ; then
+    AC_DEFINE([HAVE_BUILTIN_EXPECT], [1], [Define to 1 if the compiler supports __builtin_expect.])
+fi
+])
diff --git a/configure.ac b/configure.ac
index fe8194e..803184b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2738,6 +2738,7 @@ AC_C_RESTRICT
 AC_C_INLINE
 
 PAC_C_GNU_ATTRIBUTE
+PAC_C_BUILTIN_EXPECT
 # We need to check for the endianess in order to implement the
 # "external32" representations.  This defines "WORDS_BIGENDIAN when
 # the system is bigendian.
diff --git a/src/include/mpiutil.h b/src/include/mpiutil.h
index 221f990..6b6559a 100644
--- a/src/include/mpiutil.h
+++ b/src/include/mpiutil.h
@@ -338,8 +338,7 @@ int MPIR_Assert_fail_fmt(const char *cond, const char *file_name, int line_num,
  *
  * These macros are not namespaced because the namespacing is cumbersome.
  */
-/* safety guard for now, add a configure check in the future */
-#if ( defined(__GNUC__) && (__GNUC__ >= 3) ) || defined(__xlc__)
+#ifdef HAVE_BUILTIN_EXPECT
 #  define unlikely(x_) __builtin_expect(!!(x_),0)
 #  define likely(x_)   __builtin_expect(!!(x_),1)
 #else

-----------------------------------------------------------------------

Summary of changes:
 confdb/aclocal_cc.m4  |   18 ++++++++++++++++++
 configure.ac          |    1 +
 src/include/mpiutil.h |    3 +--
 3 files changed, 20 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list