[php-src] PR #24721: ext/opcache: Use NEON for zend_adler32() on AArch64

From: Date: Mon, 26 Oct 2026 07:03:58 +0000
Subject: [php-src] PR #24721: ext/opcache: Use NEON for zend_adler32() on AArch64
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-39894@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/24721 Author: aran112000 > On AArch64, zend_simd.h maps SSE2 to NEON, so zend_adler32() runs the SSE2 loop from #10507 > through that layer. _mm_madd_epi16() and _mm_sad_epu8() take several NEON instructions each > there, on every 16 bytes. This adds a native NEON loop instead: widening multiply-accumulates > for > the weighted sum, pairwise adds for the byte sum, and one horizontal add at the end. The result > is > identical to the scalar and SSE2 versions, so existing file caches still verify, and x86 is > unchanged. (dstogov suggested native NEON code for cases like this on #18413.) > > Checksumming a 64MB buffer on an Apple M4 (Linux arm64 VM) goes from 12GB/s to 24GB/s with GCC > 14 > or Clang, and from 7.4GB/s to 24GB/s with GCC 11. Loading 3,876 cached scripts (184MB) from the > file cache with the default consistency checks went from 81.8ms to 78.0ms (median of 24 > interleaved runs, release build of master, GCC 14). > > The new test compares the checksum stored in the .bin header with hash('adler32') of > the data, > since the existing tests would still pass with a checksum that's consistent but wrong. I > checked > that it fails when the NEON loop is deliberately broken. I couldn't build the _M_ARM64 > branch on > Windows. > > This was written with help from Claude Code; I've reviewed it and tested it as described.

« previous php.git-pulls (#39894) next »