xref: /aosp_15_r20/prebuilts/clang-tools/linux-x86/clang-headers/clwbintrin.h (revision bed243d3d9cd544cfb038bfa7be843dedc6e6bf7)
1*bed243d3SAndroid Build Coastguard Worker /*===---- clwbintrin.h - CLWB 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 #ifndef __IMMINTRIN_H
11*bed243d3SAndroid Build Coastguard Worker #error "Never use <clwbintrin.h> directly; include <immintrin.h> instead."
12*bed243d3SAndroid Build Coastguard Worker #endif
13*bed243d3SAndroid Build Coastguard Worker 
14*bed243d3SAndroid Build Coastguard Worker #ifndef __CLWBINTRIN_H
15*bed243d3SAndroid Build Coastguard Worker #define __CLWBINTRIN_H
16*bed243d3SAndroid Build Coastguard Worker 
17*bed243d3SAndroid Build Coastguard Worker /* Define the default attributes for the functions in this file. */
18*bed243d3SAndroid Build Coastguard Worker #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__,  __target__("clwb")))
19*bed243d3SAndroid Build Coastguard Worker 
20*bed243d3SAndroid Build Coastguard Worker /// Writes back to memory the cache line (if modified) that contains the
21*bed243d3SAndroid Build Coastguard Worker /// linear address specified in \a __p from any level of the cache hierarchy in
22*bed243d3SAndroid Build Coastguard Worker /// the cache coherence domain
23*bed243d3SAndroid Build Coastguard Worker ///
24*bed243d3SAndroid Build Coastguard Worker /// \headerfile <immintrin.h>
25*bed243d3SAndroid Build Coastguard Worker ///
26*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the <c> CLWB </c> instruction.
27*bed243d3SAndroid Build Coastguard Worker ///
28*bed243d3SAndroid Build Coastguard Worker /// \param __p
29*bed243d3SAndroid Build Coastguard Worker ///    A pointer to the memory location used to identify the cache line to be
30*bed243d3SAndroid Build Coastguard Worker ///    written back.
31*bed243d3SAndroid Build Coastguard Worker static __inline__ void __DEFAULT_FN_ATTRS
_mm_clwb(void const * __p)32*bed243d3SAndroid Build Coastguard Worker _mm_clwb(void const *__p) {
33*bed243d3SAndroid Build Coastguard Worker   __builtin_ia32_clwb(__p);
34*bed243d3SAndroid Build Coastguard Worker }
35*bed243d3SAndroid Build Coastguard Worker 
36*bed243d3SAndroid Build Coastguard Worker #undef __DEFAULT_FN_ATTRS
37*bed243d3SAndroid Build Coastguard Worker 
38*bed243d3SAndroid Build Coastguard Worker #endif
39