DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
	Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH 2/2] eal: adjust intrinsic type casts for CXX
Date: Wed, 20 Mar 2024 14:18:29 -0700	[thread overview]
Message-ID: <1710969509-20627-3-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1710969509-20627-1-git-send-email-roretzla@linux.microsoft.com>

_mm_prefetch does not take a volatile qualified pointer, cast it away.
Additionally the pointer type should be char * not void * so adjust the
cast to match.

_mm_cldemote does not take a volatile qualified pointer, cast it away.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/x86/include/rte_prefetch.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/eal/x86/include/rte_prefetch.h b/lib/eal/x86/include/rte_prefetch.h
index 715c61b..8a93777 100644
--- a/lib/eal/x86/include/rte_prefetch.h
+++ b/lib/eal/x86/include/rte_prefetch.h
@@ -20,7 +20,7 @@
 static inline void rte_prefetch0(const volatile void *p)
 {
 #ifdef RTE_TOOLCHAIN_MSVC
-	_mm_prefetch((const void *)p, _MM_HINT_T0);
+	_mm_prefetch((const char *)(uintptr_t)p, _MM_HINT_T0);
 #else
 	asm volatile ("prefetcht0 %[p]" : : [p] "m" (*(const volatile char *)p));
 #endif
@@ -29,7 +29,7 @@ static inline void rte_prefetch0(const volatile void *p)
 static inline void rte_prefetch1(const volatile void *p)
 {
 #ifdef RTE_TOOLCHAIN_MSVC
-	_mm_prefetch((const void *)p, _MM_HINT_T1);
+	_mm_prefetch((const char *)(uintptr_t)p, _MM_HINT_T1);
 #else
 	asm volatile ("prefetcht1 %[p]" : : [p] "m" (*(const volatile char *)p));
 #endif
@@ -38,7 +38,7 @@ static inline void rte_prefetch1(const volatile void *p)
 static inline void rte_prefetch2(const volatile void *p)
 {
 #ifdef RTE_TOOLCHAIN_MSVC
-	_mm_prefetch((const void *)p, _MM_HINT_T2);
+	_mm_prefetch((const char *)(uintptr_t)p, _MM_HINT_T2);
 #else
 	asm volatile ("prefetcht2 %[p]" : : [p] "m" (*(const volatile char *)p));
 #endif
@@ -47,7 +47,7 @@ static inline void rte_prefetch2(const volatile void *p)
 static inline void rte_prefetch_non_temporal(const volatile void *p)
 {
 #ifdef RTE_TOOLCHAIN_MSVC
-	_mm_prefetch((const void *)p, _MM_HINT_NTA);
+	_mm_prefetch((const char *)(uintptr_t)p, _MM_HINT_NTA);
 #else
 	asm volatile ("prefetchnta %[p]" : : [p] "m" (*(const volatile char *)p));
 #endif
@@ -58,7 +58,7 @@ static inline void rte_prefetch_non_temporal(const volatile void *p)
 rte_cldemote(const volatile void *p)
 {
 #ifdef RTE_TOOLCHAIN_MSVC
-	_mm_cldemote(p);
+	_mm_cldemote((const void *)(uintptr_t)p);
 #else
 	/*
 	 * We use raw byte codes for now as only the newest compiler
-- 
1.8.3.1


      parent reply	other threads:[~2024-03-20 21:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 21:18 [PATCH 0/2] adapt prefetch functions for MSVC Tyler Retzlaff
2024-03-20 21:18 ` [PATCH 1/2] eal: provide " Tyler Retzlaff
2024-03-20 21:18 ` Tyler Retzlaff [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1710969509-20627-3-git-send-email-roretzla@linux.microsoft.com \
    --to=roretzla@linux.microsoft.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.v.ananyev@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).