diff --git a/third_party/zlib/contrib/optimizations/insert_string.h b/third_party/zlib/contrib/optimizations/insert_string.h index 1826601..d123305 100644 --- a/third_party/zlib/contrib/optimizations/insert_string.h +++ b/third_party/zlib/contrib/optimizations/insert_string.h @@ -26,15 +26,23 @@ #define _cpu_crc32_u32 _mm_crc32_u32 #elif defined(CRC32_ARMV8_CRC32) - #if defined(__clang__) + #if defined(__GNUC__) || defined(__clang__) #undef TARGET_CPU_WITH_CRC - #define __crc32cw __builtin_arm_crc32cw + #if defined(__clang__) + #define __crc32cw __builtin_arm_crc32cw + #elif defined(__GNUC__) + #define __crc32cw __builtin_aarch64_crc32cw + #endif #endif #define _cpu_crc32_u32 __crc32cw #if defined(__aarch64__) - #define TARGET_CPU_WITH_CRC __attribute__((target("crc"))) + #if defined(__clang__) + #define TARGET_CPU_WITH_CRC __attribute__((target("crc"))) + #elif defined(__GNUC__) + #define TARGET_CPU_WITH_CRC __attribute__((target("+crc"))) + #endif #else // !defined(__aarch64__) #define TARGET_CPU_WITH_CRC __attribute__((target("armv8-a,crc"))) #endif // defined(__aarch64__)