Skip to content

Commit 6f40213

Browse files
committed
disable ARM Neon optimizations
fix seems to be non-trivial, can look into it later.
1 parent 6634154 commit 6f40213

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

build/php.m4

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2848,6 +2848,28 @@ AC_DEFUN([PHP_CHECK_AVX512_VBMI_SUPPORTS], [
28482848
])
28492849

28502850

2851+
dnl PHP_CHECK_ARM_NEON_SUPPORT
2852+
dnl check if we're compiling for ARM NEON
2853+
AC_DEFUN([PHP_CHECK_ARM_NEON_SUPPORT], [
2854+
AC_CACHE_CHECK([for ARM NEON support],ac_cv_target_arm_neon,[
2855+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
2856+
int main(void) {
2857+
#if defined(__ARM_NEON__) || defined(__ARM_NEON)
2858+
return 0;
2859+
#else
2860+
return 1;
2861+
#endif
2862+
}
2863+
]])],[
2864+
ac_cv_target_arm_neon=yes
2865+
],[
2866+
ac_cv_target_arm_neon=no
2867+
],[
2868+
ac_cv_target_arm_neon=no
2869+
])])
2870+
])
2871+
2872+
28512873
dnl
28522874
dnl PHP_CHECK_X86_TARGET
28532875
dnl

ext/hash/config.m4

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ fi
1010

1111
EXT_HASH_BLAKE3_SOURCES="hash_blake3.c blake3/upstream_blake3/c/blake3.c blake3/upstream_blake3/c/blake3_dispatch.c blake3/upstream_blake3/c/blake3_portable.c"
1212

13+
dnl if test $ac_cv_target_arm_neon = yes; then
14+
dnl EXT_HASH_BLAKE3_SOURCES="$EXT_HASH_BLAKE3_SOURCES blake3/upstream_blake3/c/blake3_neon.c"
15+
dnl EXT_HASH_BLAKE3_HEADERS="$EXT_HASH_BLAKE3_HEADERS ext/hash/blake3/upstream_blake3/c/blake3_impl.h"
16+
dnl fi
17+
PHP_HASH_CFLAGS="$PHP_HASH_CFLAGS -DBLAKE3_USE_NEON=0"
18+
19+
1320
if test $ac_cv_c_bigendian_php = yes; then
1421
EXT_HASH_SHA3_SOURCES="hash_sha3.c"
1522
AC_DEFINE(HAVE_SLOW_HASH3, 1, [Define if hash3 algo is available])

ext/hash/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if (!CHECK_HEADER_ADD_INCLUDE('KeccakHash.h', 'CFLAGS_HASH', hash_sha3_dir)) {
3131
}
3232

3333
ADD_FLAG('CFLAGS_HASH', '/DKeccakP200_excluded /DKeccakP400_excluded /DKeccakP800_excluded /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 ' +
34-
'/DBLAKE3_NO_SSE2 /DBLAKE3_NO_SSE41 /DBLAKE3_NO_AVX2 /DBLAKE3_NO_AVX512');
34+
'/DBLAKE3_NO_SSE2 /DBLAKE3_NO_SSE41 /DBLAKE3_NO_AVX2 /DBLAKE3_NO_AVX512 /DBLAKE3_USE_NEON=0');
3535

3636
var hash_murmur_dir = 'ext/hash/murmur';
3737
if (!CHECK_HEADER_ADD_INCLUDE('PMurHash.h', 'CFLAGS_HASH', hash_murmur_dir)) {

0 commit comments

Comments
 (0)