mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Reapply "Remove configure checks for supported instruction sets"
I reverted this previously for 7.4 because of bug #78769. Relanding it now for master, because I still believe that this change is right, and if it causes complications, those indicate a bug elsewhere. --- These were checking whether the instruction set is supported by the host CPU, however they were only used to condition on whether this instruction set is targeted at all. It would still use dynamic dispatch (e.g. based on ifunc resolvers) to select the actual implementation. Whether the target is guaranteed to support the instruction set without dispatch is determined based on pre-defined macros like __SSE2__. This removes the configure-time builtin cpu checks to remove confusion. Additionally this allows targeting an architecture that is newer than the host architecture.
This commit is contained in:
parent
a0abc26ef7
commit
5dc9418a97
3 changed files with 6 additions and 36 deletions
|
@ -494,21 +494,21 @@ extern "C++" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__i386__) || defined(__x86_64__))
|
#if (defined(__i386__) || defined(__x86_64__))
|
||||||
# if PHP_HAVE_SSSE3_INSTRUCTIONS && defined(HAVE_TMMINTRIN_H)
|
# if defined(HAVE_TMMINTRIN_H)
|
||||||
# define PHP_HAVE_SSSE3
|
# define PHP_HAVE_SSSE3
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if PHP_HAVE_SSE4_2_INSTRUCTIONS && defined(HAVE_NMMINTRIN_H)
|
# if defined(HAVE_NMMINTRIN_H)
|
||||||
# define PHP_HAVE_SSE4_2
|
# define PHP_HAVE_SSE4_2
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AVX2 support was added in gcc 4.7, but AVX2 intrinsics don't work in
|
* AVX2 support was added in gcc 4.7, but AVX2 intrinsics don't work in
|
||||||
* __attribute__((target("avx2"))) functions until gcc 4.9.
|
* __attribute__((target("avx2"))) functions until gcc 4.9.
|
||||||
*/
|
*/
|
||||||
# if PHP_HAVE_AVX2_INSTRUCTIONS && defined(HAVE_IMMINTRIN_H) && \
|
# if defined(HAVE_IMMINTRIN_H) && \
|
||||||
(defined(__llvm__) || defined(__clang__) || (defined(__GNUC__) && ZEND_GCC_VERSION >= 4009))
|
(defined(__llvm__) || defined(__clang__) || (defined(__GNUC__) && ZEND_GCC_VERSION >= 4009))
|
||||||
# define PHP_HAVE_AVX2
|
# define PHP_HAVE_AVX2
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
24
build/php.m4
24
build/php.m4
|
@ -2669,30 +2669,6 @@ AC_DEFUN([PHP_CHECK_BUILTIN_CPU_SUPPORTS], [
|
||||||
[$have_builtin_cpu_supports], [Whether the compiler supports __builtin_cpu_supports])
|
[$have_builtin_cpu_supports], [Whether the compiler supports __builtin_cpu_supports])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl PHP_CHECK_CPU_SUPPORTS
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([PHP_CHECK_CPU_SUPPORTS], [
|
|
||||||
AC_REQUIRE([PHP_CHECK_BUILTIN_CPU_INIT])
|
|
||||||
AC_REQUIRE([PHP_CHECK_BUILTIN_CPU_SUPPORTS])
|
|
||||||
have_ext_instructions=0
|
|
||||||
if test $have_builtin_cpu_supports = 1; then
|
|
||||||
AC_MSG_CHECKING([for $1 instructions supports])
|
|
||||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
|
||||||
int main() {
|
|
||||||
return __builtin_cpu_supports("$1")? 0 : 1;
|
|
||||||
}
|
|
||||||
]])], [
|
|
||||||
have_ext_instructions=1
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
], [AC_MSG_RESULT([no])])
|
|
||||||
fi
|
|
||||||
AC_DEFINE_UNQUOTED(AS_TR_CPP([PHP_HAVE_$1_INSTRUCTIONS]),
|
|
||||||
[$have_ext_instructions], [Whether the compiler supports $1 instructions])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl PHP_PATCH_CONFIG_HEADERS([FILE])
|
dnl PHP_PATCH_CONFIG_HEADERS([FILE])
|
||||||
dnl
|
dnl
|
||||||
|
|
|
@ -499,12 +499,6 @@ PHP_CHECK_BUILTIN_CPU_INIT
|
||||||
dnl Check __builtin_cpu_supports
|
dnl Check __builtin_cpu_supports
|
||||||
PHP_CHECK_BUILTIN_CPU_SUPPORTS
|
PHP_CHECK_BUILTIN_CPU_SUPPORTS
|
||||||
|
|
||||||
dnl Check instructions.
|
|
||||||
PHP_CHECK_CPU_SUPPORTS([ssse3])
|
|
||||||
PHP_CHECK_CPU_SUPPORTS([sse4.2])
|
|
||||||
PHP_CHECK_CPU_SUPPORTS([avx])
|
|
||||||
PHP_CHECK_CPU_SUPPORTS([avx2])
|
|
||||||
|
|
||||||
dnl Check for structure members.
|
dnl Check for structure members.
|
||||||
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
|
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
|
||||||
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
|
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue