| 1 |
/*===---- mwaitxintrin.h - MONITORX/MWAITX intrinsics ----------------------=== |
| 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 __X86INTRIN_H |
| 11 |
#error "Never use <mwaitxintrin.h> directly; include <x86intrin.h> instead." |
| 12 |
#endif |
| 13 |
|
| 14 |
#ifndef __MWAITXINTRIN_H |
| 15 |
#define __MWAITXINTRIN_H |
| 16 |
|
| 17 |
/* Define the default attributes for the functions in this file. */ |
| 18 |
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("mwaitx"))) |
| 19 |
|
| 20 |
/// Establishes a linear address memory range to be monitored and puts |
| 21 |
/// the processor in the monitor event pending state. Data stored in the |
| 22 |
/// monitored address range causes the processor to exit the pending state. |
| 23 |
/// |
| 24 |
/// \headerfile <x86intrin.h> |
| 25 |
/// |
| 26 |
/// This intrinsic corresponds to the \c MONITORX instruction. |
| 27 |
/// |
| 28 |
/// \param __p |
| 29 |
/// The memory range to be monitored. The size of the range is determined by |
| 30 |
/// CPUID function 0000_0005h. |
| 31 |
/// \param __extensions |
| 32 |
/// Optional extensions for the monitoring state. |
| 33 |
/// \param __hints |
| 34 |
/// Optional hints for the monitoring state. |
| 35 |
static __inline__ void __DEFAULT_FN_ATTRS |
| 36 |
_mm_monitorx(void * __p, unsigned __extensions, unsigned __hints) |
| 37 |
{ |
| 38 |
__builtin_ia32_monitorx(__p, __extensions, __hints); |
| 39 |
} |
| 40 |
|
| 41 |
/// Used with the \c MONITORX instruction to wait while the processor is in |
| 42 |
/// the monitor event pending state. Data stored in the monitored address |
| 43 |
/// range, or an interrupt, causes the processor to exit the pending state. |
| 44 |
/// |
| 45 |
/// \headerfile <x86intrin.h> |
| 46 |
/// |
| 47 |
/// This intrinsic corresponds to the \c MWAITX instruction. |
| 48 |
/// |
| 49 |
/// \param __extensions |
| 50 |
/// Optional extensions for the monitoring state, which can vary by |
| 51 |
/// processor. |
| 52 |
/// \param __hints |
| 53 |
/// Optional hints for the monitoring state, which can vary by processor. |
| 54 |
static __inline__ void __DEFAULT_FN_ATTRS |
| 55 |
_mm_mwaitx(unsigned __extensions, unsigned __hints, unsigned __clock) |
| 56 |
{ |
| 57 |
__builtin_ia32_mwaitx(__extensions, __hints, __clock); |
| 58 |
} |
| 59 |
|
| 60 |
#undef __DEFAULT_FN_ATTRS |
| 61 |
|
| 62 |
#endif /* __MWAITXINTRIN_H */ |