File tree Expand file tree Collapse file tree 3 files changed +36
-6
lines changed Expand file tree Collapse file tree 3 files changed +36
-6
lines changed Original file line number Diff line number Diff line change @@ -532,21 +532,21 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
532
532
#endif
533
533
534
534
#if (defined(__i386__ ) || defined(__x86_64__ ))
535
- # if defined(HAVE_TMMINTRIN_H )
536
- # define PHP_HAVE_SSSE3
535
+ # if PHP_HAVE_SSSE3_INSTRUCTIONS && defined(HAVE_TMMINTRIN_H )
536
+ # define PHP_HAVE_SSSE3
537
537
# endif
538
538
539
- # if defined(HAVE_NMMINTRIN_H )
540
- # define PHP_HAVE_SSE4_2
539
+ # if PHP_HAVE_SSE4_2_INSTRUCTIONS && defined(HAVE_NMMINTRIN_H )
540
+ # define PHP_HAVE_SSE4_2
541
541
# endif
542
542
543
543
/*
544
544
* AVX2 support was added in gcc 4.7, but AVX2 intrinsics don't work in
545
545
* __attribute__((target("avx2"))) functions until gcc 4.9.
546
546
*/
547
- # if defined(HAVE_IMMINTRIN_H ) && \
547
+ # if PHP_HAVE_AVX2_INSTRUCTIONS && defined(HAVE_IMMINTRIN_H ) && \
548
548
(defined(__llvm__ ) || defined(__clang__ ) || (defined(__GNUC__ ) && ZEND_GCC_VERSION >= 4009 ))
549
- # define PHP_HAVE_AVX2
549
+ # define PHP_HAVE_AVX2
550
550
# endif
551
551
#endif
552
552
Original file line number Diff line number Diff line change @@ -2677,6 +2677,30 @@ AC_DEFUN([PHP_CHECK_BUILTIN_CPU_SUPPORTS], [
2677
2677
[ $have_builtin_cpu_supports] , [ Whether the compiler supports __builtin_cpu_supports] )
2678
2678
] )
2679
2679
2680
+ dnl
2681
+ dnl PHP_CHECK_CPU_SUPPORTS
2682
+ dnl
2683
+ AC_DEFUN ( [ PHP_CHECK_CPU_SUPPORTS] , [
2684
+ AC_REQUIRE ( [ PHP_CHECK_BUILTIN_CPU_INIT] )
2685
+ AC_REQUIRE ( [ PHP_CHECK_BUILTIN_CPU_SUPPORTS] )
2686
+ have_ext_instructions=0
2687
+ if test $have_builtin_cpu_supports = 1; then
2688
+ AC_MSG_CHECKING ( [ for $1 instructions supports] )
2689
+ AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [ [
2690
+ int main() {
2691
+ return __builtin_cpu_supports("$1 ")? 0 : 1;
2692
+ }
2693
+ ] ] ) ] , [
2694
+ have_ext_instructions=1
2695
+ AC_MSG_RESULT ( [ yes] )
2696
+ ] , [
2697
+ AC_MSG_RESULT ( [ no] )
2698
+ ] , [ AC_MSG_RESULT ( [ no] ) ] )
2699
+ fi
2700
+ AC_DEFINE_UNQUOTED ( AS_TR_CPP ( [ PHP_HAVE_$1 _INSTRUCTIONS] ) ,
2701
+ [ $have_ext_instructions] , [ Whether the compiler supports $1 instructions] )
2702
+ ] )
2703
+
2680
2704
dnl
2681
2705
dnl PHP_PATCH_CONFIG_HEADERS([FILE])
2682
2706
dnl
Original file line number Diff line number Diff line change @@ -540,6 +540,12 @@ PHP_CHECK_BUILTIN_CPU_INIT
540
540
dnl Check __builtin_cpu_supports
541
541
PHP_CHECK_BUILTIN_CPU_SUPPORTS
542
542
543
+ dnl Check instructions.
544
+ PHP_CHECK_CPU_SUPPORTS([ ssse3] )
545
+ PHP_CHECK_CPU_SUPPORTS([ sse4.2] )
546
+ PHP_CHECK_CPU_SUPPORTS([ avx] )
547
+ PHP_CHECK_CPU_SUPPORTS([ avx2] )
548
+
543
549
dnl Check for structure members.
544
550
AC_CHECK_MEMBERS ( [ struct tm.tm_gmtoff] ,,,[ #include <time.h>] )
545
551
AC_CHECK_MEMBERS ( [ struct stat.st_blksize, struct stat.st_rdev] )
You can’t perform that action at this time.
0 commit comments