From patchwork Fri Aug 11 19:20:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 130200 X-Patchwork-Delegate: david.marchand@redhat.com 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 BE65243037; Fri, 11 Aug 2023 21:21:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A9244327B; Fri, 11 Aug 2023 21:21:12 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id A87F240F17 for ; Fri, 11 Aug 2023 21:21:01 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 78CDD20FD0E4; Fri, 11 Aug 2023 12:21:00 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 78CDD20FD0E4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1691781660; bh=w+QVq1B9vMO46jggBj+ImzeYs3RHkEKQSzKvJNzoXs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=axylZvzwm8Mm5CCyFMcEucjx1BcVyhVhVF6v3oJuTkYBxOUbmd+cYljqes0XtbtHh YUG4EGt5uVmwI92WI0kGgd1zImrrIFaxC/8bczaIw9TquGvLXCGCM+DrpzG3+/dXNd 98fD836wWBc36mWE+YcXCeV/ZI2n70D5TQHWjt48= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v11 07/16] eal: use byte swap intrinsics Date: Fri, 11 Aug 2023 12:20:49 -0700 Message-Id: <1691781658-32520-8-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1691781658-32520-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1691781658-32520-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Inline assembly is not supported for MSVC x64 instead expand use _byteswap_u{ushort,ulong,uint64} intrinsics instead. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup --- lib/eal/include/generic/rte_byteorder.h | 11 +++++++++++ lib/eal/x86/include/rte_byteorder.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/lib/eal/include/generic/rte_byteorder.h b/lib/eal/include/generic/rte_byteorder.h index a67e1d7..1e32a1b 100644 --- a/lib/eal/include/generic/rte_byteorder.h +++ b/lib/eal/include/generic/rte_byteorder.h @@ -234,6 +234,7 @@ #endif /* __DOXYGEN__ */ #ifdef RTE_FORCE_INTRINSICS +#ifndef RTE_TOOLCHAIN_MSVC #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) #define rte_bswap16(x) __builtin_bswap16(x) #endif @@ -241,6 +242,16 @@ #define rte_bswap32(x) __builtin_bswap32(x) #define rte_bswap64(x) __builtin_bswap64(x) +#else +/* + * note: we may want to #pragma intrsinsic(_byteswap_u{short,long,uint64}) + */ +#define rte_bswap16(x) _byteswap_ushort(x) + +#define rte_bswap32(x) _byteswap_ulong(x) + +#define rte_bswap64(x) _byteswap_uint64(x) +#endif #endif diff --git a/lib/eal/x86/include/rte_byteorder.h b/lib/eal/x86/include/rte_byteorder.h index a2dfecc..3d6e58e 100644 --- a/lib/eal/x86/include/rte_byteorder.h +++ b/lib/eal/x86/include/rte_byteorder.h @@ -18,6 +18,7 @@ #define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN #endif +#ifndef RTE_TOOLCHAIN_MSVC /* * An architecture-optimized byte swap for a 16-bit value. * @@ -69,6 +70,7 @@ static inline uint32_t rte_arch_bswap32(uint32_t _x) rte_arch_bswap16(x))) #endif #endif +#endif #define rte_cpu_to_le_16(x) (x) #define rte_cpu_to_le_32(x) (x) @@ -86,11 +88,13 @@ static inline uint32_t rte_arch_bswap32(uint32_t _x) #define rte_be_to_cpu_32(x) rte_bswap32(x) #define rte_be_to_cpu_64(x) rte_bswap64(x) +#ifndef RTE_TOOLCHAIN_MSVC #ifdef RTE_ARCH_I686 #include "rte_byteorder_32.h" #else #include "rte_byteorder_64.h" #endif +#endif #ifdef __cplusplus }