From patchwork Wed Mar 20 21:12:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138641 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DC8BC43D0A; Wed, 20 Mar 2024 22:12:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F14D42E10; Wed, 20 Mar 2024 22:12:06 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 5B9EF40A6F for ; Wed, 20 Mar 2024 22:12:03 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id A79EC20B74C1; Wed, 20 Mar 2024 14:12:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A79EC20B74C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1710969122; bh=oFlmxngHL0Ayps9/vVZGVljVvqV1j1GYAB3fd6xchv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WglN15ttxmHI/r7Ag31BppECoGQ+6XWOZvZR/QFv13+a6SlNMGYx4bWksDBkviVR/ KTrb2ODbkHH4snm0AdtmOxUPWJC1wmfnRmBaLdxliOVUcMh8Y3ZzlGuzPHEl86/ALD +ZnbzwH9fh0trzTgX4qS/N7bNtj4Gl5Bfj7qJ1cw= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Jasvinder Singh , Konstantin Ananyev , Tyler Retzlaff Subject: [PATCH] net: stop using mmx intrinsics Date: Wed, 20 Mar 2024 14:12:01 -0700 Message-Id: <1710969121-18503-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1710969121-18503-1-git-send-email-roretzla@linux.microsoft.com> References: <1710969121-18503-1-git-send-email-roretzla@linux.microsoft.com> 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 Update code to use only avx/sse intrinsics as mmx is not supported on MSVC. Signed-off-by: Tyler Retzlaff --- lib/net/net_crc_avx512.c | 28 ++++++++++------------------ lib/net/net_crc_sse.c | 28 ++++++++++------------------ 2 files changed, 20 insertions(+), 36 deletions(-) diff --git a/lib/net/net_crc_avx512.c b/lib/net/net_crc_avx512.c index 0f0dee4..6d0c644 100644 --- a/lib/net/net_crc_avx512.c +++ b/lib/net/net_crc_avx512.c @@ -8,7 +8,11 @@ #include "net_crc.h" +#ifdef RTE_TOOLCHAIN_MSVC +#include +#else #include +#endif /* VPCLMULQDQ CRC computation context structure */ struct crc_vpclmulqdq_ctx { @@ -331,13 +335,10 @@ static const alignas(16) uint32_t mask2[4] = { c9, c10, c11); crc32_eth.fold_3x128b = _mm512_setr_epi64(c12, c13, c14, c15, c16, c17, 0, 0); - crc32_eth.fold_1x128b = _mm_setr_epi64(_mm_cvtsi64_m64(c16), - _mm_cvtsi64_m64(c17)); + crc32_eth.fold_1x128b = _mm_set_epi64x(c17, c16); - crc32_eth.rk5_rk6 = _mm_setr_epi64(_mm_cvtsi64_m64(c18), - _mm_cvtsi64_m64(c19)); - crc32_eth.rk7_rk8 = _mm_setr_epi64(_mm_cvtsi64_m64(c20), - _mm_cvtsi64_m64(c21)); + crc32_eth.rk5_rk6 = _mm_set_epi64x(c19, c18); + crc32_eth.rk7_rk8 = _mm_set_epi64x(c21, c20); } static void @@ -378,13 +379,10 @@ static const alignas(16) uint32_t mask2[4] = { c9, c10, c11); crc16_ccitt.fold_3x128b = _mm512_setr_epi64(c12, c13, c14, c15, c16, c17, 0, 0); - crc16_ccitt.fold_1x128b = _mm_setr_epi64(_mm_cvtsi64_m64(c16), - _mm_cvtsi64_m64(c17)); + crc16_ccitt.fold_1x128b = _mm_set_epi64x(c17, c16); - crc16_ccitt.rk5_rk6 = _mm_setr_epi64(_mm_cvtsi64_m64(c18), - _mm_cvtsi64_m64(c19)); - crc16_ccitt.rk7_rk8 = _mm_setr_epi64(_mm_cvtsi64_m64(c20), - _mm_cvtsi64_m64(c21)); + crc16_ccitt.rk5_rk6 = _mm_set_epi64x(c19, c18); + crc16_ccitt.rk7_rk8 = _mm_set_epi64x(c21, c20); } void @@ -392,12 +390,6 @@ static const alignas(16) uint32_t mask2[4] = { { crc32_load_init_constants(); crc16_load_init_constants(); - - /* - * Reset the register as following calculation may - * use other data types such as float, double, etc. - */ - _mm_empty(); } uint32_t diff --git a/lib/net/net_crc_sse.c b/lib/net/net_crc_sse.c index d673ae3..9ab80a0 100644 --- a/lib/net/net_crc_sse.c +++ b/lib/net/net_crc_sse.c @@ -10,7 +10,11 @@ #include "net_crc.h" +#ifdef RTE_TOOLCHAIN_MSVC +#include +#else #include +#endif /** PCLMULQDQ CRC computation context structure */ struct crc_pclmulqdq_ctx { @@ -272,12 +276,9 @@ static const alignas(16) uint8_t crc_xmm_shift_tab[48] = { p = 0x10811LLU; /** Save the params in context structure */ - crc16_ccitt_pclmulqdq.rk1_rk2 = - _mm_setr_epi64(_mm_cvtsi64_m64(k1), _mm_cvtsi64_m64(k2)); - crc16_ccitt_pclmulqdq.rk5_rk6 = - _mm_setr_epi64(_mm_cvtsi64_m64(k5), _mm_cvtsi64_m64(k6)); - crc16_ccitt_pclmulqdq.rk7_rk8 = - _mm_setr_epi64(_mm_cvtsi64_m64(q), _mm_cvtsi64_m64(p)); + crc16_ccitt_pclmulqdq.rk1_rk2 = _mm_set_epi64x(k2, k1); + crc16_ccitt_pclmulqdq.rk5_rk6 = _mm_set_epi64x(k6, k5); + crc16_ccitt_pclmulqdq.rk7_rk8 = _mm_set_epi64x(p, q); /** Initialize CRC32 data */ k1 = 0xccaa009eLLU; @@ -288,18 +289,9 @@ static const alignas(16) uint8_t crc_xmm_shift_tab[48] = { p = 0x1db710641LLU; /** Save the params in context structure */ - crc32_eth_pclmulqdq.rk1_rk2 = - _mm_setr_epi64(_mm_cvtsi64_m64(k1), _mm_cvtsi64_m64(k2)); - crc32_eth_pclmulqdq.rk5_rk6 = - _mm_setr_epi64(_mm_cvtsi64_m64(k5), _mm_cvtsi64_m64(k6)); - crc32_eth_pclmulqdq.rk7_rk8 = - _mm_setr_epi64(_mm_cvtsi64_m64(q), _mm_cvtsi64_m64(p)); - - /** - * Reset the register as following calculation may - * use other data types such as float, double, etc. - */ - _mm_empty(); + crc32_eth_pclmulqdq.rk1_rk2 = _mm_set_epi64x(k2, k1); + crc32_eth_pclmulqdq.rk5_rk6 = _mm_set_epi64x(k6, k5); + crc32_eth_pclmulqdq.rk7_rk8 = _mm_set_epi64x(p, q); } uint32_t