mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Small change SIMD codes (#18626)
* use zend_simd.h in zend_accelerator_util_funcs.c * use zend_simd.h in mbstring * Remove unnecessary SSE3 includes
This commit is contained in:
parent
04522cd1c4
commit
462fd4dffe
2 changed files with 6 additions and 16 deletions
|
@ -65,14 +65,7 @@
|
||||||
|
|
||||||
#include "rare_cp_bitvec.h"
|
#include "rare_cp_bitvec.h"
|
||||||
|
|
||||||
#ifdef __SSE2__
|
#include "zend_simd.h"
|
||||||
#include <emmintrin.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __SSE3__
|
|
||||||
#include <immintrin.h>
|
|
||||||
#include <pmmintrin.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -1749,7 +1742,7 @@ PHP_FUNCTION(mb_str_split)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __SSE2__
|
#ifdef XSSE2
|
||||||
/* Thanks to StackOverflow user 'Paul R' (https://stackoverflow.com/users/253056/paul-r)
|
/* Thanks to StackOverflow user 'Paul R' (https://stackoverflow.com/users/253056/paul-r)
|
||||||
* From: https://stackoverflow.com/questions/36998538/fastest-way-to-horizontally-sum-sse-unsigned-byte-vector
|
* From: https://stackoverflow.com/questions/36998538/fastest-way-to-horizontally-sum-sse-unsigned-byte-vector
|
||||||
* Takes a 128-bit XMM register, treats each byte as an 8-bit integer, and sums up all
|
* Takes a 128-bit XMM register, treats each byte as an 8-bit integer, and sums up all
|
||||||
|
@ -1780,7 +1773,7 @@ static size_t mb_fast_strlen_utf8(unsigned char *p, size_t len)
|
||||||
{
|
{
|
||||||
unsigned char *e = p + len;
|
unsigned char *e = p + len;
|
||||||
|
|
||||||
#ifdef __SSE2__
|
#ifdef XSSE2
|
||||||
if (len >= sizeof(__m128i)) {
|
if (len >= sizeof(__m128i)) {
|
||||||
e -= sizeof(__m128i);
|
e -= sizeof(__m128i);
|
||||||
|
|
||||||
|
@ -4919,7 +4912,7 @@ MBSTRING_API bool php_mb_check_encoding(const char *input, size_t length, const
|
||||||
static bool mb_fast_check_utf8_default(zend_string *str)
|
static bool mb_fast_check_utf8_default(zend_string *str)
|
||||||
{
|
{
|
||||||
unsigned char *p = (unsigned char*)ZSTR_VAL(str);
|
unsigned char *p = (unsigned char*)ZSTR_VAL(str);
|
||||||
# ifdef __SSE2__
|
# ifdef XSSE2
|
||||||
/* `e` points 1 byte past the last full 16-byte block of string content
|
/* `e` points 1 byte past the last full 16-byte block of string content
|
||||||
* Note that we include the terminating null byte which is included in each zend_string
|
* Note that we include the terminating null byte which is included in each zend_string
|
||||||
* as part of the content to check; this ensures that multi-byte characters which are
|
* as part of the content to check; this ensures that multi-byte characters which are
|
||||||
|
|
|
@ -27,10 +27,7 @@
|
||||||
#include "zend_shared_alloc.h"
|
#include "zend_shared_alloc.h"
|
||||||
#include "zend_observer.h"
|
#include "zend_observer.h"
|
||||||
|
|
||||||
#ifdef __SSE2__
|
#include "zend_simd.h"
|
||||||
/* For SSE2 adler32 */
|
|
||||||
#include <immintrin.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef int (*id_function_t)(void *, void *);
|
typedef int (*id_function_t)(void *, void *);
|
||||||
typedef void (*unique_copy_ctor_func_t)(void *pElement);
|
typedef void (*unique_copy_ctor_func_t)(void *pElement);
|
||||||
|
@ -466,7 +463,7 @@ static zend_always_inline void adler32_do16_loop(unsigned char *buf, unsigned ch
|
||||||
unsigned int s1 = *s1_out;
|
unsigned int s1 = *s1_out;
|
||||||
unsigned int s2 = *s2_out;
|
unsigned int s2 = *s2_out;
|
||||||
|
|
||||||
#ifdef __SSE2__
|
#ifdef XSSE2
|
||||||
const __m128i zero = _mm_setzero_si128();
|
const __m128i zero = _mm_setzero_si128();
|
||||||
|
|
||||||
__m128i accumulate_s2 = zero;
|
__m128i accumulate_s2 = zero;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue