xref: /freebsd/contrib/llvm-project/clang/lib/Headers/waitpkgintrin.h (revision 924226fba12cc9a228c73b956e1b7fa24c60b055)
1 /*===----------------------- waitpkgintrin.h - WAITPKG --------------------===
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 #if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
10 #error "Never use <waitpkgintrin.h> directly; include <x86intrin.h> instead."
11 #endif
12 
13 #ifndef __WAITPKGINTRIN_H
14 #define __WAITPKGINTRIN_H
15 
16 /* Define the default attributes for the functions in this file. */
17 #define __DEFAULT_FN_ATTRS \
18   __attribute__((__always_inline__, __nodebug__,  __target__("waitpkg")))
19 
20 static __inline__ void __DEFAULT_FN_ATTRS
21 _umonitor (void * __address)
22 {
23   __builtin_ia32_umonitor (__address);
24 }
25 
26 static __inline__ unsigned char __DEFAULT_FN_ATTRS
27 _umwait (unsigned int __control, unsigned long long __counter)
28 {
29   return __builtin_ia32_umwait (__control,
30     (unsigned int)(__counter >> 32), (unsigned int)__counter);
31 }
32 
33 static __inline__ unsigned char __DEFAULT_FN_ATTRS
34 _tpause (unsigned int __control, unsigned long long __counter)
35 {
36   return __builtin_ia32_tpause (__control,
37     (unsigned int)(__counter >> 32), (unsigned int)__counter);
38 }
39 
40 #undef __DEFAULT_FN_ATTRS
41 
42 #endif /* __WAITPKGINTRIN_H */
43