xref: /aosp_15_r20/prebuilts/clang-tools/linux-x86/clang-headers/prfchwintrin.h (revision bed243d3d9cd544cfb038bfa7be843dedc6e6bf7)
1*bed243d3SAndroid Build Coastguard Worker /*===---- prfchwintrin.h - PREFETCHW intrinsic -----------------------------===
2*bed243d3SAndroid Build Coastguard Worker  *
3*bed243d3SAndroid Build Coastguard Worker  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*bed243d3SAndroid Build Coastguard Worker  * See https://llvm.org/LICENSE.txt for license information.
5*bed243d3SAndroid Build Coastguard Worker  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*bed243d3SAndroid Build Coastguard Worker  *
7*bed243d3SAndroid Build Coastguard Worker  *===-----------------------------------------------------------------------===
8*bed243d3SAndroid Build Coastguard Worker  */
9*bed243d3SAndroid Build Coastguard Worker 
10*bed243d3SAndroid Build Coastguard Worker #if !defined(__X86INTRIN_H) && !defined(_MM3DNOW_H_INCLUDED)
11*bed243d3SAndroid Build Coastguard Worker #error "Never use <prfchwintrin.h> directly; include <x86intrin.h> or <mm3dnow.h> instead."
12*bed243d3SAndroid Build Coastguard Worker #endif
13*bed243d3SAndroid Build Coastguard Worker 
14*bed243d3SAndroid Build Coastguard Worker #ifndef __PRFCHWINTRIN_H
15*bed243d3SAndroid Build Coastguard Worker #define __PRFCHWINTRIN_H
16*bed243d3SAndroid Build Coastguard Worker 
17*bed243d3SAndroid Build Coastguard Worker /// Loads a memory sequence containing the specified memory address into
18*bed243d3SAndroid Build Coastguard Worker ///    all data cache levels.
19*bed243d3SAndroid Build Coastguard Worker ///
20*bed243d3SAndroid Build Coastguard Worker ///    The cache-coherency state is set to exclusive. Data can be read from
21*bed243d3SAndroid Build Coastguard Worker ///    and written to the cache line without additional delay.
22*bed243d3SAndroid Build Coastguard Worker ///
23*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
24*bed243d3SAndroid Build Coastguard Worker ///
25*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c PREFETCHT0 instruction.
26*bed243d3SAndroid Build Coastguard Worker ///
27*bed243d3SAndroid Build Coastguard Worker /// \param __P
28*bed243d3SAndroid Build Coastguard Worker ///    A pointer specifying the memory address to be prefetched.
29*bed243d3SAndroid Build Coastguard Worker static __inline__ void __attribute__((__always_inline__, __nodebug__))
_m_prefetch(void * __P)30*bed243d3SAndroid Build Coastguard Worker _m_prefetch(void *__P)
31*bed243d3SAndroid Build Coastguard Worker {
32*bed243d3SAndroid Build Coastguard Worker   __builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
33*bed243d3SAndroid Build Coastguard Worker }
34*bed243d3SAndroid Build Coastguard Worker 
35*bed243d3SAndroid Build Coastguard Worker /// Loads a memory sequence containing the specified memory address into
36*bed243d3SAndroid Build Coastguard Worker ///    the L1 data cache and sets the cache-coherency state to modified.
37*bed243d3SAndroid Build Coastguard Worker ///
38*bed243d3SAndroid Build Coastguard Worker ///    This provides a hint to the processor that the cache line will be
39*bed243d3SAndroid Build Coastguard Worker ///    modified. It is intended for use when the cache line will be written to
40*bed243d3SAndroid Build Coastguard Worker ///    shortly after the prefetch is performed.
41*bed243d3SAndroid Build Coastguard Worker ///
42*bed243d3SAndroid Build Coastguard Worker ///    Note that the effect of this intrinsic is dependent on the processor
43*bed243d3SAndroid Build Coastguard Worker ///    implementation.
44*bed243d3SAndroid Build Coastguard Worker ///
45*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
46*bed243d3SAndroid Build Coastguard Worker ///
47*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c PREFETCHW instruction.
48*bed243d3SAndroid Build Coastguard Worker ///
49*bed243d3SAndroid Build Coastguard Worker /// \param __P
50*bed243d3SAndroid Build Coastguard Worker ///    A pointer specifying the memory address to be prefetched.
51*bed243d3SAndroid Build Coastguard Worker static __inline__ void __attribute__((__always_inline__, __nodebug__))
_m_prefetchw(volatile const void * __P)52*bed243d3SAndroid Build Coastguard Worker _m_prefetchw(volatile const void *__P)
53*bed243d3SAndroid Build Coastguard Worker {
54*bed243d3SAndroid Build Coastguard Worker #pragma clang diagnostic push
55*bed243d3SAndroid Build Coastguard Worker #pragma clang diagnostic ignored "-Wcast-qual"
56*bed243d3SAndroid Build Coastguard Worker   __builtin_prefetch ((const void*)__P, 1, 3 /* _MM_HINT_T0 */);
57*bed243d3SAndroid Build Coastguard Worker #pragma clang diagnostic pop
58*bed243d3SAndroid Build Coastguard Worker }
59*bed243d3SAndroid Build Coastguard Worker 
60*bed243d3SAndroid Build Coastguard Worker #endif /* __PRFCHWINTRIN_H */
61