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 @@ -2674,6 +2674,30 @@ AC_DEFUN([PHP_CHECK_BUILTIN_CPU_SUPPORTS], [
2674
2674
[ $have_builtin_cpu_supports] , [ Whether the compiler supports __builtin_cpu_supports] )
2675
2675
] )
2676
2676
2677
+ dnl
2678
+ dnl PHP_CHECK_CPU_SUPPORTS
2679
+ dnl
2680
+ AC_DEFUN ( [ PHP_CHECK_CPU_SUPPORTS] , [
2681
+ AC_REQUIRE ( [ PHP_CHECK_BUILTIN_CPU_INIT] )
2682
+ AC_REQUIRE ( [ PHP_CHECK_BUILTIN_CPU_SUPPORTS] )
2683
+ have_ext_instructions=0
2684
+ if test $have_builtin_cpu_supports = 1; then
2685
+ AC_MSG_CHECKING ( [ for $1 instructions supports] )
2686
+ AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [ [
2687
+ int main() {
2688
+ return __builtin_cpu_supports("$1 ")? 0 : 1;
2689
+ }
2690
+ ] ] ) ] , [
2691
+ have_ext_instructions=1
2692
+ AC_MSG_RESULT ( [ yes] )
2693
+ ] , [
2694
+ AC_MSG_RESULT ( [ no] )
2695
+ ] , [ AC_MSG_RESULT ( [ no] ) ] )
2696
+ fi
2697
+ AC_DEFINE_UNQUOTED ( AS_TR_CPP ( [ PHP_HAVE_$1 _INSTRUCTIONS] ) ,
2698
+ [ $have_ext_instructions] , [ Whether the compiler supports $1 instructions] )
2699
+ ] )
2700
+
2677
2701
dnl
2678
2702
dnl PHP_PATCH_CONFIG_HEADERS([FILE])
2679
2703
dnl
Original file line number Diff line number Diff line change @@ -541,6 +541,12 @@ PHP_CHECK_BUILTIN_CPU_INIT
541
541
dnl Check __builtin_cpu_supports
542
542
PHP_CHECK_BUILTIN_CPU_SUPPORTS
543
543
544
+ dnl Check instructions.
545
+ PHP_CHECK_CPU_SUPPORTS([ ssse3] )
546
+ PHP_CHECK_CPU_SUPPORTS([ sse4.2] )
547
+ PHP_CHECK_CPU_SUPPORTS([ avx] )
548
+ PHP_CHECK_CPU_SUPPORTS([ avx2] )
549
+
544
550
dnl Check for structure members.
545
551
AC_CHECK_MEMBERS ( [ struct tm.tm_gmtoff] ,,,[ #include <time.h>] )
546
552
AC_CHECK_MEMBERS ( [ struct stat.st_blksize, struct stat.st_rdev] )
You can’t perform that action at this time.
0 commit comments