mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Move check for __builtin_expect to configure
This allows __builtin_expect to be used more accurately
This commit is contained in:
parent
a50e9d87f2
commit
017f89e871
3 changed files with 24 additions and 3 deletions
|
@ -257,9 +257,9 @@ char *alloca();
|
|||
# endif
|
||||
#endif /* ZEND_DEBUG */
|
||||
|
||||
#if (defined (__GNUC__) && __GNUC__ > 2 ) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX)
|
||||
# define EXPECTED(condition) __builtin_expect(!(!(condition)), 1)
|
||||
# define UNEXPECTED(condition) __builtin_expect(!(!(condition)), 0)
|
||||
#if PHP_HAVE_BUILTIN_EXPECT
|
||||
# define EXPECTED(condition) __builtin_expect(!!(condition), 1)
|
||||
# define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
|
||||
#else
|
||||
# define EXPECTED(condition) (condition)
|
||||
# define UNEXPECTED(condition) (condition)
|
||||
|
|
18
acinclude.m4
18
acinclude.m4
|
@ -3031,3 +3031,21 @@ AC_DEFUN([PHP_CHECK_STDINT_TYPES], [
|
|||
])
|
||||
AC_DEFINE([PHP_HAVE_STDINT_TYPES], [1], [Checked for stdint types])
|
||||
])
|
||||
|
||||
dnl PHP_CHECK_BUILTIN_EXPECT
|
||||
AC_DEFUN([PHP_CHECK_BUILTIN_EXPECT], [
|
||||
AC_MSG_CHECKING([for __builtin_expect])
|
||||
|
||||
AC_TRY_LINK(, [
|
||||
return __builtin_expect(1,1) ? 1 : 0;
|
||||
], [
|
||||
have_builtin_expect=1
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
have_builtin_expect=0
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
|
||||
AC_DEFINE([PHP_HAVE_BUILTIN_EXPECT], [$have_builtin_expect], [Whether the compiler supports __builtin_expect])
|
||||
|
||||
])
|
||||
|
|
|
@ -575,6 +575,9 @@ PHP_CHECK_SIZEOF(ptrdiff_t, 8)
|
|||
dnl Check stdint types (must be after header check)
|
||||
PHP_CHECK_STDINT_TYPES
|
||||
|
||||
dnl Check __builtin_expect
|
||||
PHP_CHECK_BUILTIN_EXPECT
|
||||
|
||||
dnl Check for members of the stat structure
|
||||
AC_STRUCT_ST_BLKSIZE
|
||||
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue