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 A0B19428C3; Mon, 3 Apr 2023 23:52:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B82A242BB1; Mon, 3 Apr 2023 23:52:41 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 4382F40EDE for ; Mon, 3 Apr 2023 23:52:37 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 6BA56210DC68; Mon, 3 Apr 2023 14:52:36 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6BA56210DC68 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1680558756; bh=aVNgvOGAqJXcMymeeUabNQLNbDPaZZ1fFdt0Ib9Ah9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hUmHz4qghhx2E3LI54Wr8UCWEhCDvQTdCDpElepoc016qYWFO8j/+5GvP2pX3UASC 7bUI6jJPW7Zi3EjL3CvPylDq36r3FgDylmYqJaphf6FwyKjPZJx8Ng9+OwiRiGejmq lYk42oDnlX3s/i2+x+dSq7Gau7iAyPfh9KfDdJhs= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH 2/9] eal: use rtm and xtest intrinsics when compiling with msvc Date: Mon, 3 Apr 2023 14:52:24 -0700 Message-Id: <1680558751-17931-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-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 use _xbegin, _xend, _xabort and _xtest intrinsics. Signed-off-by: Tyler Retzlaff --- lib/eal/x86/include/rte_rtm.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/eal/x86/include/rte_rtm.h b/lib/eal/x86/include/rte_rtm.h index 36bf498..26672cb 100644 --- a/lib/eal/x86/include/rte_rtm.h +++ b/lib/eal/x86/include/rte_rtm.h @@ -5,6 +5,9 @@ #ifndef _RTE_RTM_H_ #define _RTE_RTM_H_ 1 +#ifdef RTE_TOOLCHAIN_MSVC +#include +#endif /* Official RTM intrinsics interface matching gcc/icc, but works on older gcc compatible compilers and binutils. */ @@ -28,31 +31,47 @@ static __rte_always_inline unsigned int rte_xbegin(void) { +#ifndef RTE_TOOLCHAIN_MSVC unsigned int ret = RTE_XBEGIN_STARTED; asm volatile(".byte 0xc7,0xf8 ; .long 0" : "+a" (ret) :: "memory"); return ret; +#else + return _xbegin(); +#endif } static __rte_always_inline void rte_xend(void) { +#ifndef RTE_TOOLCHAIN_MSVC asm volatile(".byte 0x0f,0x01,0xd5" ::: "memory"); +#else + _xend(); +#endif } /* not an inline function to workaround a clang bug with -O0 */ +#ifndef RTE_TOOLCHAIN_MSVC #define rte_xabort(status) do { \ asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); \ } while (0) +#else +#define rte_xabort(status) _xabort(status) +#endif static __rte_always_inline int rte_xtest(void) { +#ifndef RTE_TOOLCHAIN_MSVC unsigned char out; asm volatile(".byte 0x0f,0x01,0xd6 ; setnz %0" : "=r" (out) :: "memory"); return out; +#else + return _xtest(); +#endif } #ifdef __cplusplus -- 1.8.3.1