[1/2] eal: provide prefetch functions for MSVC

Message ID 1710969509-20627-2-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series adapt prefetch functions for MSVC |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff March 20, 2024, 9:18 p.m. UTC
  MSVC 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.

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

Patch

diff --git a/lib/eal/include/generic/rte_prefetch.h b/lib/eal/include/generic/rte_prefetch.h
index f9fab5e..773b3b8 100644
--- a/lib/eal/include/generic/rte_prefetch.h
+++ b/lib/eal/include/generic/rte_prefetch.h
@@ -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
 }
 
 /**