From: Michael Qiu Date: Mon, 9 Mar 2015 05:58:05 +0000 (+0800) Subject: hash: fix unsupported crc instruction in i686 platform X-Git-Tag: spdx-start~9468 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=12fa4a00788d8153f4f478a0d7aef13df8c7833c;p=dpdk.git hash: fix unsupported crc instruction in i686 platform Error: unsupported instruction `crc32' The root cause is that i686 platform does not support 'crc32q' Need make it only available in x86_64 platform. Signed-off-by: Michael Qiu Acked-by: Yerden Zhumabekov --- diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h index d28bb2af92..3dcd362841 100644 --- a/lib/librte_hash/rte_hash_crc.h +++ b/lib/librte_hash/rte_hash_crc.h @@ -47,6 +47,7 @@ extern "C" { #include #include #include +#include /* Lookup tables for software implementation of CRC32C */ static const uint32_t crc32c_tables[8][256] = {{ @@ -364,6 +365,8 @@ crc32c_2words(uint64_t data, uint32_t init_val) return crc; } +#if defined(RTE_ARCH_I686) || defined(RTE_ARCH_X86_64) + static inline uint32_t crc32c_sse42_u32(uint32_t data, uint32_t init_val) { @@ -374,16 +377,6 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val) return init_val; } -static inline uint32_t -crc32c_sse42_u64(uint64_t data, uint64_t init_val) -{ - __asm__ volatile( - "crc32q %[data], %[init_val];" - : [init_val] "+r" (init_val) - : [data] "rm" (data)); - return init_val; -} - static inline uint32_t crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val) { @@ -398,6 +391,47 @@ crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val) return init_val; } +#else + +static inline uint32_t +crc32c_sse42_u32(__rte_unused uint32_t data, + __rte_unused uint32_t init_val) +{ + return 0; +} + +static inline uint32_t +crc32c_sse42_u64_mimic(__rte_unused uint32_t data, + __rte_unused uint32_t init_val) +{ + return 0; +} + +#endif + +#ifdef RTE_ARCH_X86_64 + +static inline uint32_t +crc32c_sse42_u64(uint64_t data, uint64_t init_val) +{ + __asm__ volatile( + "crc32q %[data], %[init_val];" + : [init_val] "+r" (init_val) + : [data] "rm" (data)); + return init_val; +} + +#else + +static inline uint32_t +crc32c_sse42_u64(__rte_unused uint64_t data, + __rte_unused uint64_t init_val) +{ + return 0; +} + +#endif + #define CRC32_SW (1U << 0) #define CRC32_SSE42 (1U << 1) #define CRC32_x64 (1U << 2)