xref: /freebsd/contrib/llvm-project/clang/lib/Headers/cldemoteintrin.h (revision e25152834cdf3b353892835a4f3b157e066a8ed4)
10b57cec5SDimitry Andric /*===---- cldemoteintrin.h - CLDEMOTE intrinsic ----------------------------===
20b57cec5SDimitry Andric  *
30b57cec5SDimitry Andric  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric  * See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric  *
70b57cec5SDimitry Andric  *===-----------------------------------------------------------------------===
80b57cec5SDimitry Andric  */
90b57cec5SDimitry Andric 
100b57cec5SDimitry Andric #if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
110b57cec5SDimitry Andric #error "Never use <cldemoteintrin.h> directly; include <x86intrin.h> instead."
120b57cec5SDimitry Andric #endif
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifndef __CLDEMOTEINTRIN_H
150b57cec5SDimitry Andric #define __CLDEMOTEINTRIN_H
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric /* Define the default attributes for the functions in this file. */
180b57cec5SDimitry Andric #define __DEFAULT_FN_ATTRS \
190b57cec5SDimitry Andric   __attribute__((__always_inline__, __nodebug__,  __target__("cldemote")))
200b57cec5SDimitry Andric 
21*5ffd83dbSDimitry Andric /// Hint to hardware that the cache line that contains \p __P should be demoted
22*5ffd83dbSDimitry Andric /// from the cache closest to the processor core to a level more distant from
23*5ffd83dbSDimitry Andric /// the processor core.
24*5ffd83dbSDimitry Andric ///
25*5ffd83dbSDimitry Andric /// \headerfile <x86intrin.h>
26*5ffd83dbSDimitry Andric ///
27*5ffd83dbSDimitry Andric /// This intrinsic corresponds to the <c> CLDEMOTE </c> instruction.
280b57cec5SDimitry Andric static __inline__ void __DEFAULT_FN_ATTRS
_cldemote(const void * __P)290b57cec5SDimitry Andric _cldemote(const void * __P) {
300b57cec5SDimitry Andric   __builtin_ia32_cldemote(__P);
310b57cec5SDimitry Andric }
320b57cec5SDimitry Andric 
33*5ffd83dbSDimitry Andric #define _mm_cldemote(p) _cldemote(p)
340b57cec5SDimitry Andric #undef __DEFAULT_FN_ATTRS
350b57cec5SDimitry Andric 
360b57cec5SDimitry Andric #endif
37