xref: /dpdk/lib/eal/loongarch/include/rte_prefetch.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2022 Loongson Technology Corporation Limited
3  */
4 
5 #ifndef RTE_PREFETCH_LOONGARCH_H
6 #define RTE_PREFETCH_LOONGARCH_H
7 
8 #include <rte_compat.h>
9 #include <rte_common.h>
10 #include "generic/rte_prefetch.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 static inline void rte_prefetch0(const volatile void *p)
17 {
18 	__builtin_prefetch((const void *)(uintptr_t)p, 0, 3);
19 }
20 
21 static inline void rte_prefetch1(const volatile void *p)
22 {
23 	__builtin_prefetch((const void *)(uintptr_t)p, 0, 2);
24 }
25 
26 static inline void rte_prefetch2(const volatile void *p)
27 {
28 	__builtin_prefetch((const void *)(uintptr_t)p, 0, 1);
29 }
30 
31 static inline void rte_prefetch_non_temporal(const volatile void *p)
32 {
33 	/* non-temporal version not available, fallback to rte_prefetch0 */
34 	rte_prefetch0(p);
35 }
36 
37 __rte_experimental
38 static inline void
39 rte_cldemote(const volatile void *p)
40 {
41 	RTE_SET_USED(p);
42 }
43 
44 #ifdef __cplusplus
45 }
46 #endif
47 
48 #endif /* RTE_PREFETCH_LOONGARCH_H */
49