summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo de Lara <pablo.de.lara.guarch@intel.com>2015-07-16 10:00:54 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-07-16 16:52:15 +0200
commitaf083e9fcc61fe5417a5c7f5561973eeebcc7222 (patch)
tree66570d6b3e02c29ef7d777778cb0ab87e418693c
parent6f71544ce28f09e9aae452954b3b72c448aad2ec (diff)
downloaddpdk-af083e9fcc61fe5417a5c7f5561973eeebcc7222.zip
dpdk-af083e9fcc61fe5417a5c7f5561973eeebcc7222.tar.gz
dpdk-af083e9fcc61fe5417a5c7f5561973eeebcc7222.tar.xz
hash: fix build without SSE4.1
_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>
-rw-r--r--lib/librte_hash/rte_cuckoo_hash.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c
index 00ba3a3..d9ba066 100644
--- a/lib/librte_hash/rte_cuckoo_hash.c
+++ b/lib/librte_hash/rte_cuckoo_hash.c
@@ -1125,9 +1125,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