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

Thomas Monjalon thomas at monjalon.net
Thu Mar 25 09:06:53 CET 2021


24/03/2021 23:59, Wang, Yipeng1:
> From: kumar amber
> > 
> > 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.

Yes, that's why I don't understand this patch.

> Also, I think the right way to check machine flag in DPDK should be:
> #If defined (RTE_MACHINE_CPUFLAG_SSE4_2)

These macros have been removed in DPDK 20.11.

> Instead of using compiler dependent macro.

Compiler macros are well standardized, it is OK.




More information about the dev mailing list