From 0f47d29912b0e3d0e387db715a16b7b4f273f389 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 19 Mar 2020 21:15:42 +0100 Subject: [SERVER] crc32: Fix compile with optimizations Should have tested in "Release" mode I guess. Seems we're at about 24x performance this way, so hooray. --- src/shared/crc32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/shared') diff --git a/src/shared/crc32.c b/src/shared/crc32.c index 50f476a..098615f 100644 --- a/src/shared/crc32.c +++ b/src/shared/crc32.c @@ -508,7 +508,7 @@ static const uint32_t crc_table[TBLS][256] = * V. Gopal, E. Ozturk, et al., 2009, http://intel.ly/2ySEwL0 */ static uint32_t -__attribute__((target("pclmul"))) +__attribute__((target("pclmul,sse4.1"))) crc32pclmul(uint32_t crc, const uint8_t *buf, size_t len) { /* @@ -676,7 +676,7 @@ uint32_t crc32(crc, buf, len) #if defined(__x86_64__) || defined(__amd64__) static atomic_int pclmul = -1; if (pclmul == -1) { - pclmul = __builtin_cpu_supports("pclmul"); + pclmul = __builtin_cpu_supports("pclmul") && __builtin_cpu_supports("sse4.1"); } if (pclmul && len >= PCLMUL_MIN_LEN) { c = crc32pclmul(c, buf, len & ~PCLMUL_ALIGN_MASK); -- cgit v1.2.3-55-g7522