From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 71EBAA034F; Tue, 9 Nov 2021 18:25:21 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 007E440E03; Tue, 9 Nov 2021 18:25:21 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id EC0E34068B for ; Tue, 9 Nov 2021 18:25:19 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10163"; a="229965843" X-IronPort-AV: E=Sophos;i="5.87,220,1631602800"; d="scan'208";a="229965843" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2021 09:25:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,220,1631602800"; d="scan'208";a="451998610" Received: from silpixa00400072.ir.intel.com (HELO silpixa00400072.ger.corp.intel.com) ([10.237.222.91]) by orsmga003.jf.intel.com with ESMTP; 09 Nov 2021 09:25:16 -0800 From: Vladimir Medvedkin To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, konstantin.ananyev@intel.com, lance.richardson@broadcom.com, vladimir.medvedkin@intel.com, Yipeng Wang , Sameh Gobriel , Bruce Richardson Date: Tue, 9 Nov 2021 17:24:55 +0000 Message-Id: <20211109172456.147140-1-vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] hash: fix thash gfni implementation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch replaces _mm512_set_epi8 with _mm512_set_epi32 due to the lack of support by some compilers. Also this patch checks if AVX512F is supported along with GFNI. This is done if the code is built on a platform that supports GFNI, but does not support AVX512. Fixes: 4fd8c4cb0de1 ("hash: add new Toeplitz hash implementation") Cc: vladimir.medvedkin@intel.com Signed-off-by: Vladimir Medvedkin --- lib/hash/rte_thash_x86_gfni.h | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/lib/hash/rte_thash_x86_gfni.h b/lib/hash/rte_thash_x86_gfni.h index c2889c3734..7afbbedc08 100644 --- a/lib/hash/rte_thash_x86_gfni.h +++ b/lib/hash/rte_thash_x86_gfni.h @@ -18,7 +18,7 @@ extern "C" { #endif -#ifdef __GFNI__ +#if defined(__GFNI__) && defined(__AVX512F__) #define RTE_THASH_GFNI_DEFINED #define RTE_THASH_FIRST_ITER_MSK 0x0f0f0f0f0f0e0c08 @@ -56,23 +56,18 @@ static inline __m512i __rte_thash_gfni(const uint64_t *mtrx, const uint8_t *tuple, const uint8_t *secondary_tuple, int len) { - __m512i permute_idx = _mm512_set_epi8(7, 6, 5, 4, 7, 6, 5, 4, - 6, 5, 4, 3, 6, 5, 4, 3, - 5, 4, 3, 2, 5, 4, 3, 2, - 4, 3, 2, 1, 4, 3, 2, 1, - 3, 2, 1, 0, 3, 2, 1, 0, - 2, 1, 0, -1, 2, 1, 0, -1, - 1, 0, -1, -2, 1, 0, -1, -2, - 0, -1, -2, -3, 0, -1, -2, -3); - - const __m512i rewind_idx = _mm512_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 59, 0, 0, 0, 59, - 0, 0, 59, 58, 0, 0, 59, 58, - 0, 59, 58, 57, 0, 59, 58, 57); + __m512i permute_idx = _mm512_set_epi32(0x7060504, 0x7060504, + 0x6050403, 0x6050403, + 0x5040302, 0x5040302, + 0x4030201, 0x4030201, + 0x3020100, 0x3020100, + 0x20100FF, 0x20100FF, + 0x100FFFE, 0x100FFFE, + 0xFFFEFD, 0xFFFEFD); + const __m512i rewind_idx = _mm512_set_epi32(0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0x3B, 0x3B, + 0x3B3A, 0x3B3A, + 0x3B3A39, 0x3B3A39); const __mmask64 rewind_mask = RTE_THASH_REWIND_MSK; const __m512i shift_8 = _mm512_set1_epi8(8); __m512i xor_acc = _mm512_setzero_si512(); -- 2.25.1