DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] hash: fix library compilation for CPU with no SSE4.1
@ 2015-07-16  9:00 Pablo de Lara
  2015-07-16 14:55 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo de Lara @ 2015-07-16  9:00 UTC (permalink / raw)
  To: dev

From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>

_mm_test_all_zeros is not available for CPUs with no SSE4.1,
therefore, DPDK would not build.
This patch adds an alternative for this, using _mm_cmpeq_epi32 and
_mm_movemask_epi8.

Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---

Changes in v2:
- Fixed wrong ifndef (should be ifdef)

 lib/librte_hash/rte_cuckoo_hash.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c
index 39cafb7..d85b15e 100644
--- a/lib/librte_hash/rte_cuckoo_hash.c
+++ b/lib/librte_hash/rte_cuckoo_hash.c
@@ -1128,9 +1128,15 @@ rte_hash_k16_cmp_eq(const void *key1, const void *key2, size_t key_len __rte_unu
 {
 	const __m128i k1 = _mm_loadu_si128((const __m128i *) key1);
 	const __m128i k2 = _mm_loadu_si128((const __m128i *) key2);
+#ifdef RTE_MACHINE_CPUFLAG_SSE4_1
 	const __m128i x = _mm_xor_si128(k1, k2);
 
 	return !_mm_test_all_zeros(x, x);
+#else
+	const __m128i x = _mm_cmpeq_epi32(k1, k2);
+
+	return (_mm_movemask_epi8(x) != 0xffff);
+#endif
 }
 
 static int
-- 
2.4.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH v2] hash: fix library compilation for CPU with no SSE4.1
  2015-07-16  9:00 [dpdk-dev] [PATCH v2] hash: fix library compilation for CPU with no SSE4.1 Pablo de Lara
@ 2015-07-16 14:55 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2015-07-16 14:55 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: dev

2015-07-16 10:00, Pablo de Lara:
> From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
> 
> _mm_test_all_zeros is not available for CPUs with no SSE4.1,
> therefore, DPDK would not build.
> This patch adds an alternative for this, using _mm_cmpeq_epi32 and
> _mm_movemask_epi8.
> 
> Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-16 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-16  9:00 [dpdk-dev] [PATCH v2] hash: fix library compilation for CPU with no SSE4.1 Pablo de Lara
2015-07-16 14:55 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).