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