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 DF3444291F; Tue, 11 Apr 2023 23:13:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A5BBE42D40; Tue, 11 Apr 2023 23:12:41 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8465C42BB1 for ; Tue, 11 Apr 2023 23:12:32 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 30D7221779AE; Tue, 11 Apr 2023 14:12:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 30D7221779AE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681247551; bh=84+oQcCc/TFv+Kn3pr6uUOlxLyLpiVYUHJ3hIJXMZFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RhZhEtN8UG4icY1295tdHltQS4xxYhfFvLvwX8RaARFp9gDVBo6mxHus8HCtMUPjw zG+dq2qg4GXcFn8GykqVq+WgXzwcgQIgAcrksP2X3VIO3NC/3N4DEkGh1NSln7A25a kWnSz9ONEYMzp47nUncJ3A3S8OBFtAUm299BWUdg= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v4 07/14] eal: use byte swap intrinsics Date: Tue, 11 Apr 2023 14:12:21 -0700 Message-Id: <1681247548-18590-8-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681247548-18590-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681247548-18590-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 Inline assembly is not supported for MSVC x64 instead expand use _byteswap_u{short,long} intrinsics instead. Signed-off-by: Tyler Retzlaff --- lib/eal/x86/include/rte_byteorder.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/eal/x86/include/rte_byteorder.h b/lib/eal/x86/include/rte_byteorder.h index a2dfecc..8ddfea7 100644 --- a/lib/eal/x86/include/rte_byteorder.h +++ b/lib/eal/x86/include/rte_byteorder.h @@ -9,6 +9,7 @@ extern "C" { #endif +#include #include #include #include @@ -18,6 +19,7 @@ #define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN #endif +#ifndef RTE_TOOLCHAIN_MSVC /* * An architecture-optimized byte swap for a 16-bit value. * @@ -46,6 +48,31 @@ static inline uint32_t rte_arch_bswap32(uint32_t _x) ); return x; } +#else +/* + * note: we may want to #pragma intrsinsic(_byteswap_u{short,long}) + */ + +/* + * An architecture-optimized byte swap for a 16-bit value. + * + * Do not use this function directly. The preferred function is rte_bswap16(). + */ +static inline uint16_t rte_arch_bswap16(uint16_t _x) +{ + return _byteswap_ushort(_x); +} + +/* + * An architecture-optimized byte swap for a 32-bit value. + * + * Do not use this function directly. The preferred function is rte_bswap32(). + */ +static inline uint32_t rte_arch_bswap32(uint32_t _x) +{ + return _byteswap_ulong(_x); +} +#endif #ifndef RTE_FORCE_INTRINSICS #define rte_bswap16(x) ((uint16_t)(__builtin_constant_p(x) ? \ -- 1.8.3.1