From: Sebastian Pop Date: Wed, 17 Apr 2019 15:03:37 +0000 (+0000) Subject: [AArch64] Use NEON to initialize zend_hash X-Git-Tag: php-7.4.0alpha1~338 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6fad150cfdec697cb1b789447d10056f009a208d;p=php [AArch64] Use NEON to initialize zend_hash On A72, google-benchmark measure before and after the patch: -------------------------------------------------------------- Benchmark Time CPU Iterations -------------------------------------------------------------- BM_hash_init_before 43.6 ns 43.6 ns 16052937 BM_hash_init_after 27.0 ns 27.0 ns 25877296 Patch written by Ali Saidi and Sebastian Pop --- diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index e4024d9688..56695c4229 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -22,6 +22,10 @@ #include "zend_globals.h" #include "zend_variables.h" +#if defined(__aarch64__) +# include +#endif + #ifdef __SSE2__ # include # include @@ -156,6 +160,14 @@ static zend_always_inline void zend_hash_real_init_mixed_ex(HashTable *ht) _mm_storeu_si128((__m128i*)&HT_HASH_EX(data, 8), xmm0); _mm_storeu_si128((__m128i*)&HT_HASH_EX(data, 12), xmm0); } while (0); +#elif defined(__aarch64__) + do { + int32x4_t t = vdupq_n_s32(-1); + vst1q_s32((int32_t*)&HT_HASH_EX(data, 0), t); + vst1q_s32((int32_t*)&HT_HASH_EX(data, 4), t); + vst1q_s32((int32_t*)&HT_HASH_EX(data, 8), t); + vst1q_s32((int32_t*)&HT_HASH_EX(data, 12), t); + } while (0); #else HT_HASH_EX(data, 0) = -1; HT_HASH_EX(data, 1) = -1;