summaryrefslogtreecommitdiff
path: root/ext/standard/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/string.c')
-rw-r--r--ext/standard/string.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 2aebfa77db..d0797725bd 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -3376,6 +3376,8 @@ PHP_FUNCTION(strtr)
Reverse a string */
#if ZEND_INTRIN_SSSE3_NATIVE
#include <tmmintrin.h>
+#elif defined(__aarch64__)
+#include <arm_neon.h>
#endif
PHP_FUNCTION(strrev)
{
@@ -3408,6 +3410,19 @@ PHP_FUNCTION(strrev)
e -= 16;
} while (e - s > 15);
}
+#elif defined(__aarch64__)
+ if (e - s > 15) {
+ do {
+ const uint8x16_t str = vld1q_u8((uint8_t *)(e - 15));
+ /* Synthesize rev128 with a rev64 + ext. */
+ const uint8x16_t rev = vrev64q_u8(str);
+ const uint8x16_t ext = (uint8x16_t)
+ vextq_u64((uint64x2_t)rev, (uint64x2_t)rev, 1);
+ vst1q_u8((uint8_t *)p, ext);
+ p += 16;
+ e -= 16;
+ } while (e - s > 15);
+ }
#endif
while (e >= s) {
*p++ = *e--;