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 <roret...@linux.microsoft.com>
---
 lib/eal/include/generic/rte_prefetch.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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
 }
 
 /**
-- 
1.8.3.1

Reply via email to