xref: /freebsd/contrib/llvm-project/clang/lib/Headers/prfchiintrin.h (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
1 /*===---- prfchiintrin.h - PREFETCHI intrinsic -----------------------------===
2  *
3  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4  * See https://llvm.org/LICENSE.txt for license information.
5  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6  *
7  *===-----------------------------------------------------------------------===
8  */
9 
10 #ifndef __PRFCHIINTRIN_H
11 #define __PRFCHIINTRIN_H
12 
13 #ifdef __x86_64__
14 
15 /* Define the default attributes for the functions in this file. */
16 #define __DEFAULT_FN_ATTRS                                                     \
17   __attribute__((__always_inline__, __nodebug__, __target__("prefetchi")))
18 
19 /// Loads an instruction sequence containing the specified memory address into
20 ///    all level cache.
21 ///
22 ///    Note that the effect of this intrinsic is dependent on the processor
23 ///    implementation.
24 ///
25 /// \headerfile <x86intrin.h>
26 ///
27 /// This intrinsic corresponds to the \c PREFETCHIT0 instruction.
28 ///
29 /// \param __P
30 ///    A pointer specifying the memory address to be prefetched.
31 static __inline__ void __DEFAULT_FN_ATTRS
_m_prefetchit0(volatile const void * __P)32 _m_prefetchit0(volatile const void *__P) {
33 #pragma clang diagnostic push
34 #pragma clang diagnostic ignored "-Wcast-qual"
35   __builtin_ia32_prefetchi((const void *)__P, 3 /* _MM_HINT_T0 */);
36 #pragma clang diagnostic pop
37 }
38 
39 /// Loads an instruction sequence containing the specified memory address into
40 ///    all but the first-level cache.
41 ///
42 ///    Note that the effect of this intrinsic is dependent on the processor
43 ///    implementation.
44 ///
45 /// \headerfile <x86intrin.h>
46 ///
47 /// This intrinsic corresponds to the \c PREFETCHIT1 instruction.
48 ///
49 /// \param __P
50 ///    A pointer specifying the memory address to be prefetched.
51 static __inline__ void __DEFAULT_FN_ATTRS
_m_prefetchit1(volatile const void * __P)52 _m_prefetchit1(volatile const void *__P) {
53 #pragma clang diagnostic push
54 #pragma clang diagnostic ignored "-Wcast-qual"
55   __builtin_ia32_prefetchi((const void *)__P, 2 /* _MM_HINT_T1 */);
56 #pragma clang diagnostic pop
57 }
58 #endif /* __x86_64__ */
59 #undef __DEFAULT_FN_ATTRS
60 
61 #endif /* __PRFCHWINTRIN_H */
62