Sync #if/ifdef/defined (#14511)

These are either undefined or defined to value 1:
- ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE
- ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
- ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PROTO
- ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PTR

Follow up of GH-5526 (-Wundef)
This commit is contained in:
Peter Kokot 2024-06-09 07:13:23 +02:00 committed by GitHub
parent 01887afdfa
commit 0dcb467dae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 12 deletions

View File

@ -29,7 +29,7 @@ PHP_HASH_API void PHP_CRC32Update(PHP_CRC32_CTX *context, const unsigned char *i
{
size_t i = 0;
#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER)
i += crc32_x86_simd_update(X86_CRC32, &context->state, input, len);
#endif
@ -42,7 +42,7 @@ PHP_HASH_API void PHP_CRC32BUpdate(PHP_CRC32_CTX *context, const unsigned char *
{
size_t i = 0;
#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER)
i += crc32_x86_simd_update(X86_CRC32B, &context->state, input, len);
#endif
@ -55,7 +55,7 @@ PHP_HASH_API void PHP_CRC32CUpdate(PHP_CRC32_CTX *context, const unsigned char *
{
size_t i = 0;
#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER)
i += crc32_x86_simd_update(X86_CRC32C, &context->state, input, len);
#endif

View File

@ -115,7 +115,7 @@ PHPAPI uint32_t php_crc32_bulk_update(uint32_t crc, const char *p, size_t nr)
}
#endif
#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER)
size_t nr_simd = crc32_x86_simd_update(X86_CRC32B, &crc, (const unsigned char *)p, nr);
nr -= nr_simd;
p += nr_simd;

View File

@ -19,16 +19,16 @@
#include "crc32_x86.h"
#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER)
# include <nmmintrin.h>
# include <wmmintrin.h>
#endif
#if ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
#ifdef ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
# include "Zend/zend_cpuinfo.h"
#endif
#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER)
typedef struct _crc32_pclmul_bit_consts {
uint64_t k1k2[2];
@ -287,7 +287,7 @@ size_t crc32_pclmul_reflected_batch(uint32_t *crc, const unsigned char *p, size_
return (nr_in - nr); /* the nr processed */
}
# if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE
# if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE)
size_t crc32_x86_simd_update(X86_CRC32_TYPE type, uint32_t *crc, const unsigned char *p, size_t nr)
# else /* ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER */
size_t crc32_sse42_pclmul_update(X86_CRC32_TYPE type, uint32_t *crc, const unsigned char *p, size_t nr)
@ -310,13 +310,13 @@ size_t crc32_sse42_pclmul_update(X86_CRC32_TYPE type, uint32_t *crc, const unsig
}
#endif
#if ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
#ifdef ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
static size_t crc32_x86_simd_update_default(X86_CRC32_TYPE type, uint32_t *crc, const unsigned char *p, size_t nr)
{
return 0;
}
# if ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PROTO
# ifdef ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PROTO
size_t crc32_x86_simd_update(X86_CRC32_TYPE type, uint32_t *crc, const unsigned char *p, size_t nr) __attribute__((ifunc("resolve_crc32_x86_simd_update")));
typedef size_t (*crc32_x86_simd_func_t)(X86_CRC32_TYPE type, uint32_t *crc, const unsigned char *p, size_t nr);

View File

@ -35,11 +35,11 @@ typedef enum {
X86_CRC32_MAX,
} X86_CRC32_TYPE;
#if ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PTR
#ifdef ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PTR
PHP_MINIT_FUNCTION(crc32_x86_intrin);
#endif
#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER)
/* Return the size processed by SIMD routine */
size_t crc32_x86_simd_update(X86_CRC32_TYPE type, uint32_t *crc, const unsigned char *p, size_t nr);
#else