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 7FAB9428BC; Tue, 4 Apr 2023 22:07:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 090A341141; Tue, 4 Apr 2023 22:07:32 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C64D140EE3 for ; Tue, 4 Apr 2023 22:07:29 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 0E01B210DEA0; Tue, 4 Apr 2023 13:07:28 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0E01B210DEA0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1680638849; bh=aVNgvOGAqJXcMymeeUabNQLNbDPaZZ1fFdt0Ib9Ah9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AEgRMKMclF23hchMIM+uy3Je8RW6FQIESWswlt98zV1fKDK4ccIlPDNpe7ySGt+yV ee123EyH5BsEkGFHmFvl0ItylgRirB5EQh+B8se5JMJ0A19n3MXKOYG8Bt7kh/faHF faIdX9gJVohtgD8sxf4wmhVkv/8+BBRINUPIyAhM= 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 v2 2/9] eal: use rtm and xtest intrinsics when compiling with msvc Date: Tue, 4 Apr 2023 13:07:20 -0700 Message-Id: <1680638847-26430-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1680638847-26430-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1680638847-26430-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