DPDK 25.03.0-rc0
rte_prefetch.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2015 Intel Corporation
3 */
4
5#ifndef _RTE_PREFETCH_H_
6#define _RTE_PREFETCH_H_
7
8#include <rte_compat.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
31static inline void rte_prefetch0(const volatile void *p);
32
38static inline void rte_prefetch1(const volatile void *p);
39
46static inline void rte_prefetch2(const volatile void *p);
47
58static inline void rte_prefetch_non_temporal(const volatile void *p);
59
70__rte_experimental
71static inline void
72rte_prefetch0_write(const void *p)
73{
74 /* 1 indicates intention to write, 3 sets target cache level to L1. See
75 * GCC docs where these integer constants are described in more detail:
76 * https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
77 */
78#ifdef RTE_TOOLCHAIN_MSVC
80#else
81 __builtin_prefetch(p, 1, 3);
82#endif
83}
84
95__rte_experimental
96static inline void
97rte_prefetch1_write(const void *p)
98{
99 /* 1 indicates intention to write, 2 sets target cache level to L2. See
100 * GCC docs where these integer constants are described in more detail:
101 * https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
102 */
103#ifdef RTE_TOOLCHAIN_MSVC
104 rte_prefetch1(p);
105#else
106 __builtin_prefetch(p, 1, 2);
107#endif
108}
109
120__rte_experimental
121static inline void
123{
124 /* 1 indicates intention to write, 1 sets target cache level to L3. See
125 * GCC docs where these integer constants are described in more detail:
126 * https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
127 */
128#ifdef RTE_TOOLCHAIN_MSVC
129 rte_prefetch2(p);
130#else
131 __builtin_prefetch(p, 1, 1);
132#endif
133}
134
149__rte_experimental
150static inline void
151rte_cldemote(const volatile void *p);
152
153#ifdef __cplusplus
154}
155#endif
156
157#endif /* _RTE_PREFETCH_H_ */
static void rte_prefetch_non_temporal(const volatile void *p)
static __rte_experimental void rte_prefetch1_write(const void *p)
Definition: rte_prefetch.h:97
static void rte_prefetch1(const volatile void *p)
static __rte_experimental void rte_prefetch0_write(const void *p)
Definition: rte_prefetch.h:72
static void rte_prefetch0(const volatile void *p)
static __rte_experimental void rte_prefetch2_write(const void *p)
Definition: rte_prefetch.h:122
static void rte_prefetch2(const volatile void *p)
static __rte_experimental void rte_cldemote(const volatile void *p)