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 6DD0C4291F; Tue, 11 Apr 2023 23:13:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 71D2F42D37; Tue, 11 Apr 2023 23:12:39 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 658B740E2D for ; Tue, 11 Apr 2023 23:12:32 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 2483821779AC; Tue, 11 Apr 2023 14:12:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2483821779AC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681247551; bh=vjG3fEx3pXCQ8hz+MWBx50vLEuaUHJOSdVRqfTlKHCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EhQ9qh+kYvZ1tppTGk8KuMlUrTgCjIQ5ooDFUrs4uqu9AdHbqcTUajxmDI74Cn530 cAKXhhxytPYDa3d/ddbQunhTqxQe2x3/oyQmC8Bbn94L+jgeDM0CdSVLTeBxtDssMT Fj8s2GMCGkZcPII0AeyIbnsl+JJY/EAg/TDUwqE8= 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 06/14] eal: use prefetch intrinsics Date: Tue, 11 Apr 2023 14:12:20 -0700 Message-Id: <1681247548-18590-7-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 use _mm_prefetch and _mm_cldemote intrinsics. Signed-off-by: Tyler Retzlaff --- lib/eal/x86/include/rte_prefetch.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/eal/x86/include/rte_prefetch.h b/lib/eal/x86/include/rte_prefetch.h index 7fd01c4..1391af0 100644 --- a/lib/eal/x86/include/rte_prefetch.h +++ b/lib/eal/x86/include/rte_prefetch.h @@ -13,6 +13,7 @@ #include #include "generic/rte_prefetch.h" +#ifndef RTE_TOOLCHAIN_MSVC static inline void rte_prefetch0(const volatile void *p) { asm volatile ("prefetcht0 %[p]" : : [p] "m" (*(const volatile char *)p)); @@ -43,6 +44,34 @@ static inline void rte_prefetch_non_temporal(const volatile void *p) { asm volatile(".byte 0x0f, 0x1c, 0x06" :: "S" (p)); } +#else +static inline void rte_prefetch0(const volatile void *p) +{ + _mm_prefetch(p, 1); +} + +static inline void rte_prefetch1(const volatile void *p) +{ + _mm_prefetch(p, 2); +} + +static inline void rte_prefetch2(const volatile void *p) +{ + _mm_prefetch(p, 3); +} + +static inline void rte_prefetch_non_temporal(const volatile void *p) +{ + _mm_prefetch(p, 0); +} +__rte_experimental +static inline void +rte_cldemote(const volatile void *p) +{ + _mm_cldemote(p); +} +#endif + #ifdef __cplusplus } -- 1.8.3.1