From 19caf2060f7b2a75d90e76e5646a7ccab5f37e33 Mon Sep 17 00:00:00 2001 From: hnwyllmm Date: Wed, 27 Jul 2022 16:42:30 +0800 Subject: [PATCH] revert 'use isal for crc check' --- deps/oblib/src/lib/checksum/ob_crc64.cpp | 34 +++++------------------- deps/oblib/src/lib/checksum/ob_crc64.h | 1 - 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/deps/oblib/src/lib/checksum/ob_crc64.cpp b/deps/oblib/src/lib/checksum/ob_crc64.cpp index 70bee2815a..b93ab55508 100644 --- a/deps/oblib/src/lib/checksum/ob_crc64.cpp +++ b/deps/oblib/src/lib/checksum/ob_crc64.cpp @@ -13,8 +13,6 @@ #include #include "lib/checksum/ob_crc64.h" #include "lib/ob_define.h" -#include "isa-l/crc64.h" -#include "isa-l/crc.h" namespace oceanbase { namespace common { @@ -2832,12 +2830,6 @@ uint64_t fast_crc64_sse42_manually(uint64_t crc, const char* buf, int64_t len) return crc; } -//If the CPU is intel, ISA-L library for CRC can be used -inline static uint64_t ob_crc64_isal(uint64_t uCRC64, const char* buf, int64_t cb) -{ - return crc32_iscsi((unsigned char*)(buf), cb, uCRC64); -} - uint64_t crc64_sse42_dispatch(uint64_t crc, const char* buf, int64_t len) { #if defined(__x86_64__) @@ -2845,26 +2837,14 @@ uint64_t crc64_sse42_dispatch(uint64_t crc, const char* buf, int64_t len) uint32_t b = 0; uint32_t c = 0; uint32_t d = 0; - uint32_t vendor_info[4]; - __asm__("mov $0x0, %eax\n\t"); - __asm__("cpuid\n\t"); - __asm__("mov %%ebx, %0\n\t":"=r" (vendor_info[0])); - __asm__("mov %%edx, %0\n\t":"=r" (vendor_info[1])); - __asm__("mov %%ecx, %0\n\t":"=r" (vendor_info[2])); - vendor_info[3]='\0'; - if (strcmp((char*)vendor_info, "GenuineIntel") == 0) { - ob_crc64_sse42_func = &ob_crc64_isal; - _OB_LOG(INFO, "Use ISAL for crc64 calculate"); - } else{ - asm("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(1)); - if ((c & (1 << 20)) != 0) { - ob_crc64_sse42_func = &crc64_sse42; - _OB_LOG(INFO, "Use CPU crc32 instructs for crc64 calculate"); - } else { - ob_crc64_sse42_func = &fast_crc64_sse42_manually; - _OB_LOG(INFO, "Use manual crc32 table lookup for crc64 calculate"); - } + asm("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(1)); + if ((c & (1 << 20)) != 0) { + ob_crc64_sse42_func = &crc64_sse42; + _OB_LOG(INFO, "Use CPU crc32 instructs for crc64 calculate"); + } else { + ob_crc64_sse42_func = &fast_crc64_sse42_manually; + _OB_LOG(INFO, "Use manual crc32 table lookup for crc64 calculate"); } #elif defined(__aarch64__) diff --git a/deps/oblib/src/lib/checksum/ob_crc64.h b/deps/oblib/src/lib/checksum/ob_crc64.h index 34b60b5e94..60c3482ab0 100644 --- a/deps/oblib/src/lib/checksum/ob_crc64.h +++ b/deps/oblib/src/lib/checksum/ob_crc64.h @@ -66,7 +66,6 @@ inline uint64_t ob_crc64_sse42(const void* pv, int64_t cb) return (*ob_crc64_sse42_func)(0, static_cast(pv), cb); } -uint64_t ob_crc64_isal(uint64_t uCRC64, const void* pv, int64_t cb); uint64_t crc64_sse42_manually(uint64_t crc, const char* buf, int64_t len); uint64_t fast_crc64_sse42_manually(uint64_t crc, const char* buf, int64_t len); -- GitLab