diff --git a/ext/hash/hash_sha_ni.c b/ext/hash/hash_sha_ni.c index 92a2235e28415..f6c5936804091 100644 --- a/ext/hash/hash_sha_ni.c +++ b/ext/hash/hash_sha_ni.c @@ -31,7 +31,7 @@ # include -# if PHP_HASH_INTRIN_SHA_RESOLVER +# if defined(PHP_HASH_INTRIN_SHA_RESOLVER) && defined(HAVE_FUNC_ATTRIBUTE_TARGET) static __m128i be32dec_128(const uint8_t * src) __attribute__((target("ssse3"))); void SHA256_Transform_shani(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64]) __attribute__((target("ssse3,sha"))); # endif diff --git a/ext/hash/php_hash_sha.h b/ext/hash/php_hash_sha.h index d5b04ddd2f479..52fa09cf3ed75 100644 --- a/ext/hash/php_hash_sha.h +++ b/ext/hash/php_hash_sha.h @@ -55,10 +55,10 @@ PHP_HASH_API void PHP_SHA256Update(PHP_SHA256_CTX *, const unsigned char *, size void SHA256_Transform_sse2(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64], uint32_t W[PHP_STATIC_RESTRICT 64], uint32_t S[PHP_STATIC_RESTRICT 8]); #endif -#if (defined(__i386__) || defined(__x86_64__)) && defined(HAVE_IMMINTRIN_H) +#if ((defined(__i386__) || defined(__x86_64__)) && defined(HAVE_IMMINTRIN_H)) || defined(_M_X64) || defined(_M_IX86) # if defined(__SSSE3__) && defined(__SHA__) # define PHP_HASH_INTRIN_SHA_NATIVE 1 -# elif defined(HAVE_FUNC_ATTRIBUTE_TARGET) +# elif defined(HAVE_FUNC_ATTRIBUTE_TARGET) || defined(_M_X64) || defined(_M_IX86) # define PHP_HASH_INTRIN_SHA_RESOLVER 1 # endif #endif