adapt prefetch functions for MSVC
PATCH 2/2 eal: adjust intrinsic type casts for CXX
In reply to Tyler Retzlaff_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.
--- lib/eal/x86/include/rte_prefetch.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
lib/eal/x86/include/rte_prefetch.h +5 -5
@@ -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 asmvolatile ("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 asmvolatile ("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 asmvolatile ("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 asmvolatile ("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
Signature · 1 line
1.8.3.1
PATCH 1/2 eal: provide prefetch functions for MSVC
In reply to Tyler RetzlaffMSVC does not have an equivalent of __builtin_prefetch that allows read or read-write parameter. Introduce conditional compile expansion of rte_prefetch[0-2] inline functions when building with MSVC.
--- lib/eal/include/generic/rte_prefetch.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
lib/eal/include/generic/rte_prefetch.h +12 -0
@@ -71,7 +71,11 @@* GCC docs where these integer constants are described in more detail: * https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */ +#ifdef RTE_TOOLCHAIN_MSVC +rte_prefetch0 (p); +#else __builtin_prefetch (p,1 ,3 ); +#endif }/**
@@ -92,7 +96,11 @@* GCC docs where these integer constants are described in more detail: * https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */ +#ifdef RTE_TOOLCHAIN_MSVC +rte_prefetch1 (p); +#else __builtin_prefetch (p,1 ,2 ); +#endif }/**
@@ -113,7 +121,11 @@* GCC docs where these integer constants are described in more detail: * https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */ +#ifdef RTE_TOOLCHAIN_MSVC +rte_prefetch2 (p); +#else __builtin_prefetch (p,1 ,1 ); +#endif }/**
Signature · 1 line
1.8.3.1
cover adapt prefetch functions for MSVC
MSVC does not have intrinsics that allow prefetch specifying read/write so adjust conditional compilation to allow MSVC to use the non access type inline functions from rte_prefetch.h
While here fix issues with C++ build (which only appears on MSVC because it uses intrinsics and not inline assembly)
Tyler Retzlaff (2):
eal: provide prefetch functions for MSVC
eal: adjust intrinsic type casts for CXX
lib/eal/include/generic/rte_prefetch.h | 12 ++++++++++++ lib/eal/x86/include/rte_prefetch.h | 10 +++++----- 2 files changed, 17 insertions(+), 5 deletions(-)
Signature · 1 line
1.8.3.1
Quoted 8 lines · Tyler Retzlaff
MSVC does not have intrinsics that allow prefetch specifying read/write so adjust conditional compilation to allow MSVC to use the non access type inline functions from
rte_prefetch.hWhile here fix issues with C++ build (which only appears on MSVC because it uses intrinsics and not inline assembly)
Quoted 8 lines
Tyler Retzlaff (2):
eal: provide prefetch functions for MSVC
eal: adjust intrinsic type casts for CXXlib/eal/include/generic/rte_prefetch.h | 12 ++++++++++++ lib/eal/x86/include/rte_prefetch.h | 10 +++++----- 2 files changed, 17 insertions(+), 5 deletions(-)
Series applied, thanks.
Signature · 1 line
David Marchand