[dpdk-dev] [PATCH v1] lib/hash: support non sse42 cpu architecture

Wang, Yipeng1 yipeng1.wang at intel.com
Wed Mar 24 23:59:06 CET 2021


> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of kumar amber
> Sent: Monday, January 11, 2021 11:25 PM
> To: dev at dpdk.org
> Cc: Richardson, Bruce <bruce.richardson at intel.com>
> Subject: [dpdk-dev] [PATCH v1] lib/hash: support non sse42 cpu architecture
> 
> add _SSE42_ flag to enable compilation of
> sse42 specific instructions only on supported architecture
> 
> Signed-off-by: kumar amber <kumar.amber at intel.com>
> ---
>  lib/librte_hash/rte_hash_crc.h | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
> index 3e131aa6bb..e9f063780c 100644
> --- a/lib/librte_hash/rte_hash_crc.h
> +++ b/lib/librte_hash/rte_hash_crc.h
> @@ -358,7 +358,7 @@ crc32c_2words(uint64_t data, uint32_t init_val)
>  	return crc;
>  }
> 
> -#if defined(RTE_ARCH_X86)
> +#if defined(RTE_ARCH_X86) && defined(__SSE42__)
>  static inline uint32_t
>  crc32c_sse42_u8(uint8_t data, uint32_t init_val)  { @@ -404,7 +404,7 @@
> crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)  }  #endif

...

> -#if defined RTE_ARCH_X86
> +#if defined(RTE_ARCH_X86) && defined(__SSE42__)
>  	if (likely(crc32_alg & CRC32_SSE42))
>  		return crc32c_sse42_u64_mimic(data, init_val);  #endif
> --
> 2.25.1

[Wang, Yipeng] 
Hi, Kumar, thanks for the patch.
I think the minimum required machine for x86 is sse4.2 compatible already. So I wonder if we really need this.

Also, I think the right way to check machine flag in DPDK should be:
#If defined (RTE_MACHINE_CPUFLAG_SSE4_2)
Instead of using compiler dependent macro.


More information about the dev mailing list