From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 9A4555A99 for ; Thu, 16 Jul 2015 11:00:57 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 16 Jul 2015 02:00:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,486,1432623600"; d="scan'208";a="525244441" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 16 Jul 2015 02:00:55 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t6G90skq011601; Thu, 16 Jul 2015 10:00:54 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t6G90sAZ026616; Thu, 16 Jul 2015 10:00:54 +0100 Received: (from pdelarax@localhost) by sivswdev02.ir.intel.com with id t6G90sVp026612; Thu, 16 Jul 2015 10:00:54 +0100 From: Pablo de Lara To: dev@dpdk.org Date: Thu, 16 Jul 2015 10:00:54 +0100 Message-Id: <1437037254-26348-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH v2] hash: fix library compilation for CPU with no SSE4.1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2015 09:00:58 -0000 From: "De Lara Guarch, Pablo" _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 --- 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