From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id CA24B595E for ; Wed, 15 Jul 2015 14:40:46 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 15 Jul 2015 05:40:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,480,1432623600"; d="scan'208";a="764908532" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 15 Jul 2015 05:40:44 -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 t6FCei9q012569 for ; Wed, 15 Jul 2015 13:40:44 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t6FCeiWL005782 for ; Wed, 15 Jul 2015 13:40:44 +0100 Received: (from pdelarax@localhost) by sivswdev02.ir.intel.com with id t6FCeiCi005778 for dev@dpdk.org; Wed, 15 Jul 2015 13:40:44 +0100 From: Pablo de Lara To: dev@dpdk.org Date: Wed, 15 Jul 2015 13:40:43 +0100 Message-Id: <1436964043-5729-3-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1436964043-5729-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <1436964043-5729-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH] 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: Wed, 15 Jul 2015 12:40:47 -0000 _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 --- 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 80cb126..0f33376 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); +#ifndef 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