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 6220442FBA; Wed, 2 Aug 2023 23:35:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8812643265; Wed, 2 Aug 2023 23:35:31 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 250B74021D for ; Wed, 2 Aug 2023 23:35:25 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 014B4238C44E; Wed, 2 Aug 2023 14:35:23 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 014B4238C44E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1691012124; bh=YPX3S+/nCL9ARjU2grly6sww6G3NMRVNvaByo0uTCb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iWNqIrfryWXMTtdqnnMzsdLypjWr2LGT/rnUm0h/aSl7o1l3a1SZyvq3+IQ44TnAg cwWpnoqTILq7BTdzPoEwTtNkE25m4gtzsnQSm6TvwdnmgxaVbo+DoY0dcDyFyBjqYM y9pH5Ag4DDx5ll5Tcnx2dYgj2hF7LmvBZ2RYZ3L4= 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 v10 06/13] eal: use prefetch intrinsics Date: Wed, 2 Aug 2023 14:35:15 -0700 Message-Id: <1691012122-10687-7-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1691012122-10687-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1691012122-10687-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: Bruce Richardson Acked-by: Morten Brørup Acked-by: Konstantin Ananyev --- lib/eal/x86/include/rte_prefetch.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/eal/x86/include/rte_prefetch.h b/lib/eal/x86/include/rte_prefetch.h index 7fd01c4..7a6988e 100644 --- a/lib/eal/x86/include/rte_prefetch.h +++ b/lib/eal/x86/include/rte_prefetch.h @@ -9,30 +9,38 @@ extern "C" { #endif +#include + #include #include #include "generic/rte_prefetch.h" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-qual" + static inline void rte_prefetch0(const volatile void *p) { - asm volatile ("prefetcht0 %[p]" : : [p] "m" (*(const volatile char *)p)); + _mm_prefetch((const void *)p, _MM_HINT_T0); } static inline void rte_prefetch1(const volatile void *p) { - asm volatile ("prefetcht1 %[p]" : : [p] "m" (*(const volatile char *)p)); + _mm_prefetch((const void *)p, _MM_HINT_T1); } static inline void rte_prefetch2(const volatile void *p) { - asm volatile ("prefetcht2 %[p]" : : [p] "m" (*(const volatile char *)p)); + _mm_prefetch((const void *)p, _MM_HINT_T2); } static inline void rte_prefetch_non_temporal(const volatile void *p) { - asm volatile ("prefetchnta %[p]" : : [p] "m" (*(const volatile char *)p)); + _mm_prefetch((const void *)p, _MM_HINT_NTA); } +#pragma GCC diagnostic pop + +#ifdef RTE_TOOLCHAIN_MSVC /* * We use raw byte codes for now as only the newest compiler * versions support this instruction natively. @@ -41,8 +49,17 @@ static inline void rte_prefetch_non_temporal(const volatile void *p) static inline void rte_cldemote(const volatile void *p) { + _mm_cldemote(p); +} +#else +__rte_experimental +static inline void +rte_cldemote(const volatile void *p) +{ asm volatile(".byte 0x0f, 0x1c, 0x06" :: "S" (p)); } +#endif + #ifdef __cplusplus } -- 1.8.3.1