mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Autotools: Refactor builtin checks (#14835)
This creates a single M4 macro PHP_CHECK_BUILTIN and removes other PHP_CHECK_BUILTIN_* macros. Checks are wrapped in AC_CACHE_CHECK and PHP_HAVE_BUILTIN_* CPP macro definitions are defined to 1 if builtin is found and undefined if not. This also changes all PHP_HAVE_BUILTIN_ symbols to be either undefined or defined (to value 1) and syncs all #if/ifdef/defined usages of them in the php-src code. This way it is simpler to use them because they don't need to be defined to value 0 on Windows, for example. This is done as previous usages in php-src were mixed and on many places they were only checked with ifdef.
This commit is contained in:
parent
745ae8ddd8
commit
9e94d2b040
10 changed files with 86 additions and 398 deletions
|
@ -153,6 +153,9 @@ PHP 8.4 INTERNALS UPGRADE NOTES
|
||||||
AX_CHECK_COMPILE_FLAG).
|
AX_CHECK_COMPILE_FLAG).
|
||||||
- M4 macro PHP_PROG_RE2C got a new 2nd argument to define common default re2c
|
- M4 macro PHP_PROG_RE2C got a new 2nd argument to define common default re2c
|
||||||
command-line options substituted to the Makefile RE2C_FLAGS variable.
|
command-line options substituted to the Makefile RE2C_FLAGS variable.
|
||||||
|
- M4 macros PHP_CHECK_BUILTIN_* have been removed in favor of
|
||||||
|
PHP_CHECK_BUILTIN and all PHP_HAVE_BUILTIN_* symbols changed to be either
|
||||||
|
undefined or defined to 1 whether compiler supports the builtin.
|
||||||
- Added php-config --lib-dir and --lib-embed options for PHP embed SAPI.
|
- Added php-config --lib-dir and --lib-embed options for PHP embed SAPI.
|
||||||
- PDO extensions in php-src don't have the include flag -I$pdo_cv_inc_path
|
- PDO extensions in php-src don't have the include flag -I$pdo_cv_inc_path
|
||||||
directory anymore.
|
directory anymore.
|
||||||
|
|
|
@ -40,7 +40,7 @@ ZEND_API bool zend_call_stack_get(zend_call_stack *stack);
|
||||||
static zend_always_inline void *zend_call_stack_position(void) {
|
static zend_always_inline void *zend_call_stack_position(void) {
|
||||||
#ifdef ZEND_WIN32
|
#ifdef ZEND_WIN32
|
||||||
return _AddressOfReturnAddress();
|
return _AddressOfReturnAddress();
|
||||||
#elif PHP_HAVE_BUILTIN_FRAME_ADDRESS
|
#elif defined(PHP_HAVE_BUILTIN_FRAME_ADDRESS)
|
||||||
return __builtin_frame_address(0);
|
return __builtin_frame_address(0);
|
||||||
#else
|
#else
|
||||||
void *a;
|
void *a;
|
||||||
|
|
|
@ -118,7 +118,7 @@ ZEND_API int zend_cpu_supports(zend_cpu_feature feature);
|
||||||
# define ZEND_NO_SANITIZE_ADDRESS
|
# define ZEND_NO_SANITIZE_ADDRESS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PHP_HAVE_BUILTIN_CPU_SUPPORTS
|
#ifdef PHP_HAVE_BUILTIN_CPU_SUPPORTS
|
||||||
/* NOTE: you should use following inline function in
|
/* NOTE: you should use following inline function in
|
||||||
* resolver functions (ifunc), as it could be called
|
* resolver functions (ifunc), as it could be called
|
||||||
* before all PLT symbols are resolved. in other words,
|
* before all PLT symbols are resolved. in other words,
|
||||||
|
@ -126,7 +126,7 @@ ZEND_API int zend_cpu_supports(zend_cpu_feature feature);
|
||||||
* functions */
|
* functions */
|
||||||
ZEND_NO_SANITIZE_ADDRESS
|
ZEND_NO_SANITIZE_ADDRESS
|
||||||
static inline int zend_cpu_supports_sse2(void) {
|
static inline int zend_cpu_supports_sse2(void) {
|
||||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
#ifdef PHP_HAVE_BUILTIN_CPU_INIT
|
||||||
__builtin_cpu_init();
|
__builtin_cpu_init();
|
||||||
#endif
|
#endif
|
||||||
return __builtin_cpu_supports("sse2");
|
return __builtin_cpu_supports("sse2");
|
||||||
|
@ -134,7 +134,7 @@ static inline int zend_cpu_supports_sse2(void) {
|
||||||
|
|
||||||
ZEND_NO_SANITIZE_ADDRESS
|
ZEND_NO_SANITIZE_ADDRESS
|
||||||
static inline int zend_cpu_supports_sse3(void) {
|
static inline int zend_cpu_supports_sse3(void) {
|
||||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
#ifdef PHP_HAVE_BUILTIN_CPU_INIT
|
||||||
__builtin_cpu_init();
|
__builtin_cpu_init();
|
||||||
#endif
|
#endif
|
||||||
return __builtin_cpu_supports("sse3");
|
return __builtin_cpu_supports("sse3");
|
||||||
|
@ -142,7 +142,7 @@ static inline int zend_cpu_supports_sse3(void) {
|
||||||
|
|
||||||
ZEND_NO_SANITIZE_ADDRESS
|
ZEND_NO_SANITIZE_ADDRESS
|
||||||
static inline int zend_cpu_supports_ssse3(void) {
|
static inline int zend_cpu_supports_ssse3(void) {
|
||||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
#ifdef PHP_HAVE_BUILTIN_CPU_INIT
|
||||||
__builtin_cpu_init();
|
__builtin_cpu_init();
|
||||||
#endif
|
#endif
|
||||||
return __builtin_cpu_supports("ssse3");
|
return __builtin_cpu_supports("ssse3");
|
||||||
|
@ -150,7 +150,7 @@ static inline int zend_cpu_supports_ssse3(void) {
|
||||||
|
|
||||||
ZEND_NO_SANITIZE_ADDRESS
|
ZEND_NO_SANITIZE_ADDRESS
|
||||||
static inline int zend_cpu_supports_sse41(void) {
|
static inline int zend_cpu_supports_sse41(void) {
|
||||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
#ifdef PHP_HAVE_BUILTIN_CPU_INIT
|
||||||
__builtin_cpu_init();
|
__builtin_cpu_init();
|
||||||
#endif
|
#endif
|
||||||
return __builtin_cpu_supports("sse4.1");
|
return __builtin_cpu_supports("sse4.1");
|
||||||
|
@ -158,7 +158,7 @@ static inline int zend_cpu_supports_sse41(void) {
|
||||||
|
|
||||||
ZEND_NO_SANITIZE_ADDRESS
|
ZEND_NO_SANITIZE_ADDRESS
|
||||||
static inline int zend_cpu_supports_sse42(void) {
|
static inline int zend_cpu_supports_sse42(void) {
|
||||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
#ifdef PHP_HAVE_BUILTIN_CPU_INIT
|
||||||
__builtin_cpu_init();
|
__builtin_cpu_init();
|
||||||
#endif
|
#endif
|
||||||
return __builtin_cpu_supports("sse4.2");
|
return __builtin_cpu_supports("sse4.2");
|
||||||
|
@ -166,7 +166,7 @@ static inline int zend_cpu_supports_sse42(void) {
|
||||||
|
|
||||||
ZEND_NO_SANITIZE_ADDRESS
|
ZEND_NO_SANITIZE_ADDRESS
|
||||||
static inline int zend_cpu_supports_avx(void) {
|
static inline int zend_cpu_supports_avx(void) {
|
||||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
#ifdef PHP_HAVE_BUILTIN_CPU_INIT
|
||||||
__builtin_cpu_init();
|
__builtin_cpu_init();
|
||||||
#endif
|
#endif
|
||||||
return __builtin_cpu_supports("avx");
|
return __builtin_cpu_supports("avx");
|
||||||
|
@ -174,7 +174,7 @@ static inline int zend_cpu_supports_avx(void) {
|
||||||
|
|
||||||
ZEND_NO_SANITIZE_ADDRESS
|
ZEND_NO_SANITIZE_ADDRESS
|
||||||
static inline int zend_cpu_supports_avx2(void) {
|
static inline int zend_cpu_supports_avx2(void) {
|
||||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
#ifdef PHP_HAVE_BUILTIN_CPU_INIT
|
||||||
__builtin_cpu_init();
|
__builtin_cpu_init();
|
||||||
#endif
|
#endif
|
||||||
return __builtin_cpu_supports("avx2");
|
return __builtin_cpu_supports("avx2");
|
||||||
|
@ -183,7 +183,7 @@ static inline int zend_cpu_supports_avx2(void) {
|
||||||
#ifdef PHP_HAVE_AVX512_SUPPORTS
|
#ifdef PHP_HAVE_AVX512_SUPPORTS
|
||||||
ZEND_NO_SANITIZE_ADDRESS
|
ZEND_NO_SANITIZE_ADDRESS
|
||||||
static inline int zend_cpu_supports_avx512(void) {
|
static inline int zend_cpu_supports_avx512(void) {
|
||||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
#ifdef PHP_HAVE_BUILTIN_CPU_INIT
|
||||||
__builtin_cpu_init();
|
__builtin_cpu_init();
|
||||||
#endif
|
#endif
|
||||||
return __builtin_cpu_supports("avx512f") && __builtin_cpu_supports("avx512dq")
|
return __builtin_cpu_supports("avx512f") && __builtin_cpu_supports("avx512dq")
|
||||||
|
@ -195,7 +195,7 @@ static inline int zend_cpu_supports_avx512(void) {
|
||||||
#ifdef PHP_HAVE_AVX512_VBMI_SUPPORTS
|
#ifdef PHP_HAVE_AVX512_VBMI_SUPPORTS
|
||||||
ZEND_NO_SANITIZE_ADDRESS
|
ZEND_NO_SANITIZE_ADDRESS
|
||||||
static inline int zend_cpu_supports_avx512_vbmi(void) {
|
static inline int zend_cpu_supports_avx512_vbmi(void) {
|
||||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
#ifdef PHP_HAVE_BUILTIN_CPU_INIT
|
||||||
__builtin_cpu_init();
|
__builtin_cpu_init();
|
||||||
#endif
|
#endif
|
||||||
return zend_cpu_supports_avx512() && __builtin_cpu_supports("avx512vbmi");
|
return zend_cpu_supports_avx512() && __builtin_cpu_supports("avx512vbmi");
|
||||||
|
@ -244,10 +244,10 @@ static zend_always_inline int zend_cpu_supports_avx512_vbmi(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* __builtin_cpu_supports has pclmul from gcc9 */
|
/* __builtin_cpu_supports has pclmul from gcc9 */
|
||||||
#if PHP_HAVE_BUILTIN_CPU_SUPPORTS && (!defined(__GNUC__) || (ZEND_GCC_VERSION >= 9000))
|
#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && (!defined(__GNUC__) || (ZEND_GCC_VERSION >= 9000))
|
||||||
ZEND_NO_SANITIZE_ADDRESS
|
ZEND_NO_SANITIZE_ADDRESS
|
||||||
static inline int zend_cpu_supports_pclmul(void) {
|
static inline int zend_cpu_supports_pclmul(void) {
|
||||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
#ifdef PHP_HAVE_BUILTIN_CPU_INIT
|
||||||
__builtin_cpu_init();
|
__builtin_cpu_init();
|
||||||
#endif
|
#endif
|
||||||
return __builtin_cpu_supports("pclmul");
|
return __builtin_cpu_supports("pclmul");
|
||||||
|
@ -259,10 +259,10 @@ static inline int zend_cpu_supports_pclmul(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* __builtin_cpu_supports has cldemote from gcc11 */
|
/* __builtin_cpu_supports has cldemote from gcc11 */
|
||||||
#if PHP_HAVE_BUILTIN_CPU_SUPPORTS && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000)
|
#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000)
|
||||||
ZEND_NO_SANITIZE_ADDRESS
|
ZEND_NO_SANITIZE_ADDRESS
|
||||||
static inline int zend_cpu_supports_cldemote(void) {
|
static inline int zend_cpu_supports_cldemote(void) {
|
||||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
#ifdef PHP_HAVE_BUILTIN_CPU_INIT
|
||||||
__builtin_cpu_init();
|
__builtin_cpu_init();
|
||||||
#endif
|
#endif
|
||||||
return __builtin_cpu_supports("cldemote");
|
return __builtin_cpu_supports("cldemote");
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#ifndef ZEND_MULTIPLY_H
|
#ifndef ZEND_MULTIPLY_H
|
||||||
#define ZEND_MULTIPLY_H
|
#define ZEND_MULTIPLY_H
|
||||||
|
|
||||||
#if PHP_HAVE_BUILTIN_SMULL_OVERFLOW && SIZEOF_LONG == SIZEOF_ZEND_LONG
|
#if defined(PHP_HAVE_BUILTIN_SMULL_OVERFLOW) && SIZEOF_LONG == SIZEOF_ZEND_LONG
|
||||||
|
|
||||||
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
||||||
long __tmpvar; \
|
long __tmpvar; \
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
else (lval) = __tmpvar; \
|
else (lval) = __tmpvar; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#elif PHP_HAVE_BUILTIN_SMULLL_OVERFLOW && SIZEOF_LONG_LONG == SIZEOF_ZEND_LONG
|
#elif defined(PHP_HAVE_BUILTIN_SMULLL_OVERFLOW) && SIZEOF_LONG_LONG == SIZEOF_ZEND_LONG
|
||||||
|
|
||||||
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
||||||
long long __tmpvar; \
|
long long __tmpvar; \
|
||||||
|
|
|
@ -550,7 +550,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||||
return;
|
return;
|
||||||
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||||
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MAX + 1.0);
|
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MAX + 1.0);
|
||||||
#elif PHP_HAVE_BUILTIN_SADDL_OVERFLOW && SIZEOF_LONG == SIZEOF_ZEND_LONG
|
#elif defined(PHP_HAVE_BUILTIN_SADDL_OVERFLOW) && SIZEOF_LONG == SIZEOF_ZEND_LONG
|
||||||
long lresult;
|
long lresult;
|
||||||
if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
|
if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
|
||||||
/* switch to double */
|
/* switch to double */
|
||||||
|
@ -558,7 +558,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||||
} else {
|
} else {
|
||||||
Z_LVAL_P(op1) = lresult;
|
Z_LVAL_P(op1) = lresult;
|
||||||
}
|
}
|
||||||
#elif PHP_HAVE_BUILTIN_SADDLL_OVERFLOW && SIZEOF_LONG_LONG == SIZEOF_ZEND_LONG
|
#elif defined(PHP_HAVE_BUILTIN_SADDLL_OVERFLOW) && SIZEOF_LONG_LONG == SIZEOF_ZEND_LONG
|
||||||
long long llresult;
|
long long llresult;
|
||||||
if (UNEXPECTED(__builtin_saddll_overflow(Z_LVAL_P(op1), 1, &llresult))) {
|
if (UNEXPECTED(__builtin_saddll_overflow(Z_LVAL_P(op1), 1, &llresult))) {
|
||||||
/* switch to double */
|
/* switch to double */
|
||||||
|
@ -613,7 +613,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||||
return;
|
return;
|
||||||
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||||
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MIN - 1.0);
|
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MIN - 1.0);
|
||||||
#elif PHP_HAVE_BUILTIN_SSUBL_OVERFLOW && SIZEOF_LONG == SIZEOF_ZEND_LONG
|
#elif defined(PHP_HAVE_BUILTIN_SSUBL_OVERFLOW) && SIZEOF_LONG == SIZEOF_ZEND_LONG
|
||||||
long lresult;
|
long lresult;
|
||||||
if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
|
if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
|
||||||
/* switch to double */
|
/* switch to double */
|
||||||
|
@ -621,7 +621,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||||
} else {
|
} else {
|
||||||
Z_LVAL_P(op1) = lresult;
|
Z_LVAL_P(op1) = lresult;
|
||||||
}
|
}
|
||||||
#elif PHP_HAVE_BUILTIN_SSUBLL_OVERFLOW && SIZEOF_LONG_LONG == SIZEOF_ZEND_LONG
|
#elif defined(PHP_HAVE_BUILTIN_SSUBLL_OVERFLOW) && SIZEOF_LONG_LONG == SIZEOF_ZEND_LONG
|
||||||
long long llresult;
|
long long llresult;
|
||||||
if (UNEXPECTED(__builtin_ssubll_overflow(Z_LVAL_P(op1), 1, &llresult))) {
|
if (UNEXPECTED(__builtin_ssubll_overflow(Z_LVAL_P(op1), 1, &llresult))) {
|
||||||
/* switch to double */
|
/* switch to double */
|
||||||
|
@ -697,14 +697,14 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||||
return;
|
return;
|
||||||
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||||
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
|
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
|
||||||
#elif PHP_HAVE_BUILTIN_SADDL_OVERFLOW && SIZEOF_LONG == SIZEOF_ZEND_LONG
|
#elif defined(PHP_HAVE_BUILTIN_SADDL_OVERFLOW) && SIZEOF_LONG == SIZEOF_ZEND_LONG
|
||||||
long lresult;
|
long lresult;
|
||||||
if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) {
|
if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) {
|
||||||
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
|
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
|
||||||
} else {
|
} else {
|
||||||
ZVAL_LONG(result, lresult);
|
ZVAL_LONG(result, lresult);
|
||||||
}
|
}
|
||||||
#elif PHP_HAVE_BUILTIN_SADDLL_OVERFLOW && SIZEOF_LONG_LONG == SIZEOF_ZEND_LONG
|
#elif defined(PHP_HAVE_BUILTIN_SADDLL_OVERFLOW) && SIZEOF_LONG_LONG == SIZEOF_ZEND_LONG
|
||||||
long long llresult;
|
long long llresult;
|
||||||
if (UNEXPECTED(__builtin_saddll_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &llresult))) {
|
if (UNEXPECTED(__builtin_saddll_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &llresult))) {
|
||||||
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
|
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
|
||||||
|
@ -785,14 +785,14 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||||
return;
|
return;
|
||||||
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||||
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
|
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
|
||||||
#elif PHP_HAVE_BUILTIN_SSUBL_OVERFLOW && SIZEOF_LONG == SIZEOF_ZEND_LONG
|
#elif defined(PHP_HAVE_BUILTIN_SSUBL_OVERFLOW) && SIZEOF_LONG == SIZEOF_ZEND_LONG
|
||||||
long lresult;
|
long lresult;
|
||||||
if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) {
|
if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) {
|
||||||
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
|
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
|
||||||
} else {
|
} else {
|
||||||
ZVAL_LONG(result, lresult);
|
ZVAL_LONG(result, lresult);
|
||||||
}
|
}
|
||||||
#elif PHP_HAVE_BUILTIN_SSUBLL_OVERFLOW && SIZEOF_LONG_LONG == SIZEOF_ZEND_LONG
|
#elif defined(PHP_HAVE_BUILTIN_SSUBLL_OVERFLOW) && SIZEOF_LONG_LONG == SIZEOF_ZEND_LONG
|
||||||
long long llresult;
|
long long llresult;
|
||||||
if (UNEXPECTED(__builtin_ssubll_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &llresult))) {
|
if (UNEXPECTED(__builtin_ssubll_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &llresult))) {
|
||||||
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
|
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
#elif defined(__clang__) && __has_builtin(__builtin_assume)
|
#elif defined(__clang__) && __has_builtin(__builtin_assume)
|
||||||
# pragma clang diagnostic ignored "-Wassume"
|
# pragma clang diagnostic ignored "-Wassume"
|
||||||
# define ZEND_ASSUME(c) __builtin_assume(c)
|
# define ZEND_ASSUME(c) __builtin_assume(c)
|
||||||
#elif PHP_HAVE_BUILTIN_UNREACHABLE && PHP_HAVE_BUILTIN_EXPECT
|
#elif defined(PHP_HAVE_BUILTIN_UNREACHABLE) && defined(PHP_HAVE_BUILTIN_EXPECT)
|
||||||
# define ZEND_ASSUME(c) do { \
|
# define ZEND_ASSUME(c) do { \
|
||||||
if (__builtin_expect(!(c), 0)) __builtin_unreachable(); \
|
if (__builtin_expect(!(c), 0)) __builtin_unreachable(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
370
build/php.m4
370
build/php.m4
|
@ -2389,343 +2389,43 @@ AC_DEFUN([PHP_CHECK_STDINT_TYPES], [
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl PHP_CHECK_BUILTIN_EXPECT
|
dnl PHP_CHECK_BUILTIN(builtin)
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_EXPECT], [
|
dnl Check GNU C builtin "builtin" and define the CPP macro
|
||||||
AC_MSG_CHECKING([for __builtin_expect])
|
dnl PHP_HAVE_<BUILTIN_WITHOUT_LEADING_UNDERSCORES> to 1 if found.
|
||||||
|
dnl
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
AC_DEFUN([PHP_CHECK_BUILTIN],
|
||||||
return __builtin_expect(1,1) ? 1 : 0;
|
[AS_VAR_PUSHDEF([php_var], [php_cv_have_$1])
|
||||||
]])], [
|
AC_CACHE_CHECK([for $1], [php_var],
|
||||||
have_builtin_expect=1
|
[AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { m4_case([$1],
|
||||||
AC_MSG_RESULT([yes])
|
[__builtin_clz], [return $1(1) ? 1 : 0;],
|
||||||
], [
|
[__builtin_clzl], [return $1(1) ? 1 : 0;],
|
||||||
have_builtin_expect=0
|
[__builtin_clzll], [return $1(1) ? 1 : 0;],
|
||||||
AC_MSG_RESULT([no])
|
[__builtin_cpu_init], [$1();],
|
||||||
])
|
[__builtin_cpu_supports], [return $1("sse")? 1 : 0;],
|
||||||
|
[__builtin_ctzl], [return $1(2L) ? 1 : 0;],
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_EXPECT], [$have_builtin_expect], [Whether the compiler supports __builtin_expect])
|
[__builtin_ctzll], [return $1(2LL) ? 1 : 0;],
|
||||||
|
[__builtin_expect], [return $1(1,1) ? 1 : 0;],
|
||||||
|
[__builtin_frame_address], [return $1(0) != (void*)0;],
|
||||||
|
[__builtin_saddl_overflow], [long tmpvar; return $1(3, 7, &tmpvar);],
|
||||||
|
[__builtin_saddll_overflow], [long long tmpvar; return $1(3, 7, &tmpvar);],
|
||||||
|
[__builtin_smull_overflow], [long tmpvar; return $1(3, 7, &tmpvar);],
|
||||||
|
[__builtin_smulll_overflow], [long long tmpvar; return $1(3, 7, &tmpvar);],
|
||||||
|
[__builtin_ssubl_overflow], [long tmpvar; return $1(3, 7, &tmpvar);],
|
||||||
|
[__builtin_ssubll_overflow], [long long tmpvar; return $1(3, 7, &tmpvar);],
|
||||||
|
[__builtin_unreachable], [$1();],
|
||||||
|
[__builtin_usub_overflow], [unsigned int tmpvar; return $1(3, 7, &tmpvar);],
|
||||||
|
[
|
||||||
|
m4_warn([syntax], [Unsupported builtin '$1', the test may fail.])
|
||||||
|
$1();
|
||||||
|
]) return 0; }])],
|
||||||
|
[AS_VAR_SET([php_var], [yes])],
|
||||||
|
[AS_VAR_SET([php_var], [no])])
|
||||||
])
|
])
|
||||||
|
AS_VAR_IF([php_var], [yes],
|
||||||
dnl
|
[AC_DEFINE_UNQUOTED(AS_TR_CPP([PHP_HAVE_]m4_bpatsubst([$1], [^_*], [])), [1],
|
||||||
dnl PHP_CHECK_BUILTIN_UNREACHABLE
|
[Define to 1 if compiler supports '$1'.])])
|
||||||
dnl
|
AS_VAR_POPDEF([php_var])
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_UNREACHABLE], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_unreachable])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
__builtin_unreachable();
|
|
||||||
]])], [
|
|
||||||
have_builtin_unreachable=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_unreachable=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_UNREACHABLE], [$have_builtin_unreachable], [Whether the compiler supports __builtin_unreachable])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_CLZ
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_CLZ], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_clz])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
return __builtin_clz(1) ? 1 : 0;
|
|
||||||
]])], [
|
|
||||||
have_builtin_clz=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_clz=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CLZ], [$have_builtin_clz], [Whether the compiler supports __builtin_clz])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_CLZL
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_CLZL], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_clzl])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
return __builtin_clzl(1) ? 1 : 0;
|
|
||||||
]])], [
|
|
||||||
have_builtin_clzl=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_clzl=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CLZL], [$have_builtin_clzl], [Whether the compiler supports __builtin_clzl])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_CLZLL
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_CLZLL], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_clzll])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
return __builtin_clzll(1) ? 1 : 0;
|
|
||||||
]])], [
|
|
||||||
have_builtin_clzll=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_clzll=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CLZLL], [$have_builtin_clzll], [Whether the compiler supports __builtin_clzll])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_CTZL
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_CTZL], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_ctzl])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
return __builtin_ctzl(2L) ? 1 : 0;
|
|
||||||
]])], [
|
|
||||||
have_builtin_ctzl=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_ctzl=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CTZL], [$have_builtin_ctzl], [Whether the compiler supports __builtin_ctzl])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_CTZLL
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_CTZLL], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_ctzll])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
return __builtin_ctzll(2LL) ? 1 : 0;
|
|
||||||
]])], [
|
|
||||||
have_builtin_ctzll=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_ctzll=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CTZLL], [$have_builtin_ctzll], [Whether the compiler supports __builtin_ctzll])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_SMULL_OVERFLOW
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_SMULL_OVERFLOW], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_smull_overflow])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
long tmpvar;
|
|
||||||
return __builtin_smull_overflow(3, 7, &tmpvar);
|
|
||||||
]])], [
|
|
||||||
have_builtin_smull_overflow=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_smull_overflow=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_SMULL_OVERFLOW],
|
|
||||||
[$have_builtin_smull_overflow], [Whether the compiler supports __builtin_smull_overflow])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_SMULLL_OVERFLOW
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_SMULLL_OVERFLOW], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_smulll_overflow])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
long long tmpvar;
|
|
||||||
return __builtin_smulll_overflow(3, 7, &tmpvar);
|
|
||||||
]])], [
|
|
||||||
have_builtin_smulll_overflow=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_smulll_overflow=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_SMULLL_OVERFLOW],
|
|
||||||
[$have_builtin_smulll_overflow], [Whether the compiler supports __builtin_smulll_overflow])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_SADDL_OVERFLOW
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_SADDL_OVERFLOW], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_saddl_overflow])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
long tmpvar;
|
|
||||||
return __builtin_saddl_overflow(3, 7, &tmpvar);
|
|
||||||
]])], [
|
|
||||||
have_builtin_saddl_overflow=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_saddl_overflow=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_SADDL_OVERFLOW],
|
|
||||||
[$have_builtin_saddl_overflow], [Whether the compiler supports __builtin_saddl_overflow])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_SADDLL_OVERFLOW
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_SADDLL_OVERFLOW], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_saddll_overflow])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
long long tmpvar;
|
|
||||||
return __builtin_saddll_overflow(3, 7, &tmpvar);
|
|
||||||
]])], [
|
|
||||||
have_builtin_saddll_overflow=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_saddll_overflow=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_SADDLL_OVERFLOW],
|
|
||||||
[$have_builtin_saddll_overflow], [Whether the compiler supports __builtin_saddll_overflow])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_USUB_OVERFLOW
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_USUB_OVERFLOW], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_usub_overflow])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
unsigned int tmpvar;
|
|
||||||
return __builtin_usub_overflow(3, 7, &tmpvar);
|
|
||||||
]])], [
|
|
||||||
have_builtin_usub_overflow=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_usub_overflow=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_USUB_OVERFLOW],
|
|
||||||
[$have_builtin_usub_overflow], [Whether the compiler supports __builtin_usub_overflow])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_SSUBL_OVERFLOW
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_SSUBL_OVERFLOW], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_ssubl_overflow])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
long tmpvar;
|
|
||||||
return __builtin_ssubl_overflow(3, 7, &tmpvar);
|
|
||||||
]])], [
|
|
||||||
have_builtin_ssubl_overflow=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_ssubl_overflow=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_SSUBL_OVERFLOW],
|
|
||||||
[$have_builtin_ssubl_overflow], [Whether the compiler supports __builtin_ssubl_overflow])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_SSUBLL_OVERFLOW
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_SSUBLL_OVERFLOW], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_ssubll_overflow])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
long long tmpvar;
|
|
||||||
return __builtin_ssubll_overflow(3, 7, &tmpvar);
|
|
||||||
]])], [
|
|
||||||
have_builtin_ssubll_overflow=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_ssubll_overflow=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_SSUBLL_OVERFLOW],
|
|
||||||
[$have_builtin_ssubll_overflow], [Whether the compiler supports __builtin_ssubll_overflow])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_CPU_INIT
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_CPU_INIT], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_cpu_init])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
__builtin_cpu_init();
|
|
||||||
]])], [
|
|
||||||
have_builtin_cpu_init=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_cpu_init=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CPU_INIT],
|
|
||||||
[$have_builtin_cpu_init], [Whether the compiler supports __builtin_cpu_init])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_CPU_SUPPORTS
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_CPU_SUPPORTS], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_cpu_supports])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
return __builtin_cpu_supports("sse")? 1 : 0;
|
|
||||||
]])], [
|
|
||||||
have_builtin_cpu_supports=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_cpu_supports=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CPU_SUPPORTS],
|
|
||||||
[$have_builtin_cpu_supports], [Whether the compiler supports __builtin_cpu_supports])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_BUILTIN_FRAME_ADDRESS
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_BUILTIN_FRAME_ADDRESS], [
|
|
||||||
AC_MSG_CHECKING([for __builtin_frame_address])
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
|
||||||
return __builtin_frame_address(0) != (void*)0;
|
|
||||||
]])], [
|
|
||||||
have_builtin_frame_address=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
have_builtin_frame_address=0
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_FRAME_ADDRESS],
|
|
||||||
[$have_builtin_frame_address], [Whether the compiler supports __builtin_frame_address])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
|
|
53
configure.ac
53
configure.ac
|
@ -476,40 +476,25 @@ PHP_CHECK_SIZEOF(ptrdiff_t, 8)
|
||||||
dnl Check stdint types (must be after header check).
|
dnl Check stdint types (must be after header check).
|
||||||
PHP_CHECK_STDINT_TYPES
|
PHP_CHECK_STDINT_TYPES
|
||||||
|
|
||||||
dnl Check __builtin_expect
|
dnl Check GNU C builtins.
|
||||||
PHP_CHECK_BUILTIN_EXPECT
|
PHP_CHECK_BUILTIN([__builtin_clz])
|
||||||
dnl Check __builtin_unreachable
|
PHP_CHECK_BUILTIN([__builtin_clzl])
|
||||||
PHP_CHECK_BUILTIN_UNREACHABLE
|
PHP_CHECK_BUILTIN([__builtin_clzll])
|
||||||
dnl Check __builtin_clz
|
PHP_CHECK_BUILTIN([__builtin_cpu_init])
|
||||||
PHP_CHECK_BUILTIN_CLZ
|
PHP_CHECK_BUILTIN([__builtin_cpu_supports])
|
||||||
dnl Check __builtin_clzl
|
PHP_CHECK_BUILTIN([__builtin_ctzl])
|
||||||
PHP_CHECK_BUILTIN_CLZL
|
PHP_CHECK_BUILTIN([__builtin_ctzll])
|
||||||
dnl Check __builtin_clzll
|
PHP_CHECK_BUILTIN([__builtin_expect])
|
||||||
PHP_CHECK_BUILTIN_CLZLL
|
PHP_CHECK_BUILTIN([__builtin_frame_address])
|
||||||
dnl Check __builtin_ctzl
|
PHP_CHECK_BUILTIN([__builtin_saddl_overflow])
|
||||||
PHP_CHECK_BUILTIN_CTZL
|
PHP_CHECK_BUILTIN([__builtin_saddll_overflow])
|
||||||
dnl Check __builtin_ctzll
|
PHP_CHECK_BUILTIN([__builtin_smull_overflow])
|
||||||
PHP_CHECK_BUILTIN_CTZLL
|
PHP_CHECK_BUILTIN([__builtin_smulll_overflow])
|
||||||
dnl Check __builtin_smull_overflow
|
PHP_CHECK_BUILTIN([__builtin_ssubl_overflow])
|
||||||
PHP_CHECK_BUILTIN_SMULL_OVERFLOW
|
PHP_CHECK_BUILTIN([__builtin_ssubll_overflow])
|
||||||
dnl Check __builtin_smulll_overflow
|
PHP_CHECK_BUILTIN([__builtin_unreachable])
|
||||||
PHP_CHECK_BUILTIN_SMULLL_OVERFLOW
|
PHP_CHECK_BUILTIN([__builtin_usub_overflow])
|
||||||
dnl Check __builtin_saddl_overflow
|
|
||||||
PHP_CHECK_BUILTIN_SADDL_OVERFLOW
|
|
||||||
dnl Check __builtin_saddll_overflow
|
|
||||||
PHP_CHECK_BUILTIN_SADDLL_OVERFLOW
|
|
||||||
dnl Check __builtin_usub_overflow
|
|
||||||
PHP_CHECK_BUILTIN_USUB_OVERFLOW
|
|
||||||
dnl Check __builtin_ssubl_overflow
|
|
||||||
PHP_CHECK_BUILTIN_SSUBL_OVERFLOW
|
|
||||||
dnl Check __builtin_ssubll_overflow
|
|
||||||
PHP_CHECK_BUILTIN_SSUBLL_OVERFLOW
|
|
||||||
dnl Check __builtin_cpu_init
|
|
||||||
PHP_CHECK_BUILTIN_CPU_INIT
|
|
||||||
dnl Check __builtin_cpu_supports
|
|
||||||
PHP_CHECK_BUILTIN_CPU_SUPPORTS
|
|
||||||
dnl Check __builtin_frame_address
|
|
||||||
PHP_CHECK_BUILTIN_FRAME_ADDRESS
|
|
||||||
dnl Check AVX512
|
dnl Check AVX512
|
||||||
PHP_CHECK_AVX512_SUPPORTS
|
PHP_CHECK_AVX512_SUPPORTS
|
||||||
dnl Check AVX512 VBMI
|
dnl Check AVX512 VBMI
|
||||||
|
|
|
@ -752,7 +752,7 @@ static size_t mb_utf16be_to_wchar_avx2(unsigned char **in, size_t *in_len, uint3
|
||||||
*out++ = (((n & 0x3FF) << 10) | (n2 & 0x3FF)) + 0x10000;
|
*out++ = (((n & 0x3FF) << 10) | (n2 & 0x3FF)) + 0x10000;
|
||||||
bufsize--;
|
bufsize--;
|
||||||
len -= 4;
|
len -= 4;
|
||||||
#if defined(PHP_HAVE_BUILTIN_USUB_OVERFLOW) && PHP_HAVE_BUILTIN_USUB_OVERFLOW
|
#ifdef PHP_HAVE_BUILTIN_USUB_OVERFLOW
|
||||||
/* Subtracting 2 from `n_chars` will automatically set the CPU's flags;
|
/* Subtracting 2 from `n_chars` will automatically set the CPU's flags;
|
||||||
* branch directly off the appropriate flag (CF on x86) rather than using
|
* branch directly off the appropriate flag (CF on x86) rather than using
|
||||||
* another instruction (CMP on x86) to check for underflow */
|
* another instruction (CMP on x86) to check for underflow */
|
||||||
|
@ -938,7 +938,7 @@ static size_t mb_utf16le_to_wchar_avx2(unsigned char **in, size_t *in_len, uint3
|
||||||
*out++ = (((n & 0x3FF) << 10) | (n2 & 0x3FF)) + 0x10000;
|
*out++ = (((n & 0x3FF) << 10) | (n2 & 0x3FF)) + 0x10000;
|
||||||
bufsize--;
|
bufsize--;
|
||||||
len -= 4;
|
len -= 4;
|
||||||
#if defined(PHP_HAVE_BUILTIN_USUB_OVERFLOW) && PHP_HAVE_BUILTIN_USUB_OVERFLOW
|
#ifdef PHP_HAVE_BUILTIN_USUB_OVERFLOW
|
||||||
if (__builtin_usub_overflow(n_chars, 2, &n_chars)) {
|
if (__builtin_usub_overflow(n_chars, 2, &n_chars)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3185,7 +3185,7 @@ static void zend_jit_setup(void)
|
||||||
if (zend_cpu_supports_avx()) {
|
if (zend_cpu_supports_avx()) {
|
||||||
allowed_opt_flags |= ZEND_JIT_CPU_AVX;
|
allowed_opt_flags |= ZEND_JIT_CPU_AVX;
|
||||||
}
|
}
|
||||||
# if PHP_HAVE_BUILTIN_CPU_SUPPORTS && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000)
|
# if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000)
|
||||||
if (zend_cpu_supports_cldemote()) {
|
if (zend_cpu_supports_cldemote()) {
|
||||||
default_mflags |= IR_X86_CLDEMOTE;
|
default_mflags |= IR_X86_CLDEMOTE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue