CNDP 22.08.0
Loading...
Searching...
No Matches
cne_prefetch.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2019-2022 Intel Corporation
3 */
4
5#ifndef _CNE_PREFETCH_H_
6#define _CNE_PREFETCH_H_
7
13
14#include <cne_common.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
26static inline void
27cne_prefetch0(const volatile void *p)
28{
29 asm volatile("prefetcht0 %[p]" : : [p] "m"(*(const volatile char *)p));
30}
31
38static inline void
39cne_prefetch1(const volatile void *p)
40{
41 asm volatile("prefetcht1 %[p]" : : [p] "m"(*(const volatile char *)p));
42}
43
50static inline void
51cne_prefetch2(const volatile void *p)
52{
53 asm volatile("prefetcht2 %[p]" : : [p] "m"(*(const volatile char *)p));
54}
55
63static inline void
64cne_prefetch_non_temporal(const volatile void *p)
65{
66 asm volatile("prefetchnta %[p]" : : [p] "m"(*(const volatile char *)p));
67}
68
76static inline void
77cne_prefetch0_write(const void *p)
78{
79 /* 1 indicates intention to write, 3 sets target cache level to L1. See
80 * GCC docs where these integer constants are described in more detail:
81 * https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
82 */
83 __builtin_prefetch(p, 1, 3);
84}
85
93static inline void
94cne_prefetch1_write(const void *p)
95{
96 /* 1 indicates intention to write, 2 sets target cache level to L2. See
97 * GCC docs where these integer constants are described in more detail:
98 * https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
99 */
100 __builtin_prefetch(p, 1, 2);
101}
102
110static inline void
112{
113 /* 1 indicates intention to write, 1 sets target cache level to L3. See
114 * GCC docs where these integer constants are described in more detail:
115 * https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
116 */
117 __builtin_prefetch(p, 1, 1);
118}
119
120#ifdef __cplusplus
121}
122#endif
123
124#endif /* _CNE_PREFETCH_H_ */
static void cne_prefetch2(const volatile void *p)
static void cne_prefetch1_write(const void *p)
static void cne_prefetch2_write(const void *p)
static void cne_prefetch_non_temporal(const volatile void *p)
static void cne_prefetch0(const volatile void *p)
static void cne_prefetch0_write(const void *p)
static void cne_prefetch1(const volatile void *p)