Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rob Latham
MPICH-BlueGene
Commits
05e5bb05
Commit
05e5bb05
authored
Jul 16, 2013
by
Kenneth Raffenetti
Browse files
Add configure test for __builtin_expect
Fixes #1695 Signed-off-by:
Pavan Balaji
<
balaji@mcs.anl.gov
>
parent
828b0b4d
Changes
3
Hide whitespace changes
Inline
Side-by-side
confdb/aclocal_cc.m4
View file @
05e5bb05
...
...
@@ -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
])
configure.ac
View file @
05e5bb05
...
...
@@ -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.
...
...
src/include/mpiutil.h
View file @
05e5bb05
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment