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 71C6442A31; Mon, 1 May 2023 14:57:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EEB9340EE5; Mon, 1 May 2023 14:57:17 +0200 (CEST) Received: from forward502c.mail.yandex.net (forward502c.mail.yandex.net [178.154.239.210]) by mails.dpdk.org (Postfix) with ESMTP id 44FAA40EE3 for ; Mon, 1 May 2023 14:57:16 +0200 (CEST) Received: from mail-nwsmtp-smtp-production-main-87.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-87.sas.yp-c.yandex.net [IPv6:2a02:6b8:c08:9396:0:640:dd2a:0]) by forward502c.mail.yandex.net (Yandex) with ESMTP id 9533A5E834; Mon, 1 May 2023 15:57:15 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-87.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id CvLfrGeDYeA0-ZvPIedrZ; Mon, 01 May 2023 15:57:14 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1682945834; bh=GmuRFTFNnWACbcBY2yS3oqpVji21rjV4J05gBTOGJ5g=; h=From:Subject:In-Reply-To:Cc:Date:References:To:Message-ID; b=MGC4qD0Zmcyb0DwJWK22l5mdBahoiQbGwPL7RUkOqgAMQMz7ePqXe7Crifsl+qqn0 zKnfj0ZRk3zPmp37orPu1ORiiHkCTlyV4aT63iBLK80kp5QC/J/B5Gf55pWCy8CGqb z9Dr8GBoE9myVgUmtH6OhCR1iPu3P+FVT5dN9kXI= Authentication-Results: mail-nwsmtp-smtp-production-main-87.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <271a5d94-264a-e656-b99c-a6760baf72b1@yandex.ru> Date: Mon, 1 May 2023 13:57:12 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 To: roretzla@linux.microsoft.com Cc: bruce.richardson@intel.com, david.marchand@redhat.com, dev@dpdk.org, konstantin.ananyev@huawei.com, mb@smartsharesystems.com, thomas@monjalon.net References: <1681747838-12778-7-git-send-email-roretzla@linux.microsoft.com> Subject: Re: [PATCH v7 06/14] eal: use prefetch intrinsics Content-Language: en-US From: Konstantin Ananyev In-Reply-To: <1681747838-12778-7-git-send-email-roretzla@linux.microsoft.com> Content-Type: text/plain; charset=UTF-8; format=flowed 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 > nline 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 > --- > 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..239e611 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 > + > +#ifndef RTE_TOOLCHAIN_MSVC > /* > * We use raw byte codes for now as only the newest compiler > * versions support this instruction natively. > @@ -43,6 +51,15 @@ static inline void rte_prefetch_non_temporal(const volatile void *p) > { > asm volatile(".byte 0x0f, 0x1c, 0x06" :: "S" (p)); > } > +#else > +__rte_experimental > +static inline void > +rte_cldemote(const volatile void *p) > +{ > + _mm_cldemote(p); > +} > +#endif > + > > #ifdef __cplusplus > } > -- Acked-by: Konstantin Ananyev > 1.8.3.1