diff options
author | Simon Rettberg | 2020-03-19 21:15:42 +0100 |
---|---|---|
committer | Simon Rettberg | 2020-03-19 21:15:42 +0100 |
commit | 0f47d29912b0e3d0e387db715a16b7b4f273f389 (patch) | |
tree | cecc3281a85794ab651bb14e071ddd04bc40ed1a /src/shared | |
parent | [SERVER] Use PCLMUL for crc32 on AMD64 if available (diff) | |
download | dnbd3-0f47d29912b0e3d0e387db715a16b7b4f273f389.tar.gz dnbd3-0f47d29912b0e3d0e387db715a16b7b4f273f389.tar.xz dnbd3-0f47d29912b0e3d0e387db715a16b7b4f273f389.zip |
[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.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/crc32.c | 4 |
1 files changed, 2 insertions, 2 deletions
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); |