xref: /freebsd/contrib/llvm-project/clang/lib/Headers/mwaitxintrin.h (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
10b57cec5SDimitry Andric /*===---- mwaitxintrin.h - MONITORX/MWAITX intrinsics ----------------------===
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 #ifndef __X86INTRIN_H
110b57cec5SDimitry Andric #error "Never use <mwaitxintrin.h> directly; include <x86intrin.h> instead."
120b57cec5SDimitry Andric #endif
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifndef __MWAITXINTRIN_H
150b57cec5SDimitry Andric #define __MWAITXINTRIN_H
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric /* Define the default attributes for the functions in this file. */
180b57cec5SDimitry Andric #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__,  __target__("mwaitx")))
19*06c3fb27SDimitry Andric 
20*06c3fb27SDimitry Andric /// Establishes a linear address memory range to be monitored and puts
21*06c3fb27SDimitry Andric ///    the processor in the monitor event pending state. Data stored in the
22*06c3fb27SDimitry Andric ///    monitored address range causes the processor to exit the pending state.
23*06c3fb27SDimitry Andric ///
24*06c3fb27SDimitry Andric /// \headerfile <x86intrin.h>
25*06c3fb27SDimitry Andric ///
26*06c3fb27SDimitry Andric /// This intrinsic corresponds to the \c MONITORX instruction.
27*06c3fb27SDimitry Andric ///
28*06c3fb27SDimitry Andric /// \param __p
29*06c3fb27SDimitry Andric ///    The memory range to be monitored. The size of the range is determined by
30*06c3fb27SDimitry Andric ///    CPUID function 0000_0005h.
31*06c3fb27SDimitry Andric /// \param __extensions
32*06c3fb27SDimitry Andric ///    Optional extensions for the monitoring state.
33*06c3fb27SDimitry Andric /// \param __hints
34*06c3fb27SDimitry Andric ///    Optional hints for the monitoring state.
350b57cec5SDimitry Andric static __inline__ void __DEFAULT_FN_ATTRS
_mm_monitorx(void * __p,unsigned __extensions,unsigned __hints)36480093f4SDimitry Andric _mm_monitorx(void * __p, unsigned __extensions, unsigned __hints)
370b57cec5SDimitry Andric {
38480093f4SDimitry Andric   __builtin_ia32_monitorx(__p, __extensions, __hints);
390b57cec5SDimitry Andric }
400b57cec5SDimitry Andric 
41*06c3fb27SDimitry Andric /// Used with the \c MONITORX instruction to wait while the processor is in
42*06c3fb27SDimitry Andric ///    the monitor event pending state. Data stored in the monitored address
43*06c3fb27SDimitry Andric ///    range, or an interrupt, causes the processor to exit the pending state.
44*06c3fb27SDimitry Andric ///
45*06c3fb27SDimitry Andric /// \headerfile <x86intrin.h>
46*06c3fb27SDimitry Andric ///
47*06c3fb27SDimitry Andric /// This intrinsic corresponds to the \c MWAITX instruction.
48*06c3fb27SDimitry Andric ///
49*06c3fb27SDimitry Andric /// \param __extensions
50*06c3fb27SDimitry Andric ///    Optional extensions for the monitoring state, which can vary by
51*06c3fb27SDimitry Andric ///    processor.
52*06c3fb27SDimitry Andric /// \param __hints
53*06c3fb27SDimitry Andric ///    Optional hints for the monitoring state, which can vary by processor.
540b57cec5SDimitry Andric static __inline__ void __DEFAULT_FN_ATTRS
_mm_mwaitx(unsigned __extensions,unsigned __hints,unsigned __clock)550b57cec5SDimitry Andric _mm_mwaitx(unsigned __extensions, unsigned __hints, unsigned __clock)
560b57cec5SDimitry Andric {
570b57cec5SDimitry Andric   __builtin_ia32_mwaitx(__extensions, __hints, __clock);
580b57cec5SDimitry Andric }
590b57cec5SDimitry Andric 
600b57cec5SDimitry Andric #undef __DEFAULT_FN_ATTRS
610b57cec5SDimitry Andric 
620b57cec5SDimitry Andric #endif /* __MWAITXINTRIN_H */
63