diff --git a/clang/lib/Headers/mwaitxintrin.h b/clang/lib/Headers/mwaitxintrin.h index ed485380af795..4d51892ec234a 100644 --- a/clang/lib/Headers/mwaitxintrin.h +++ b/clang/lib/Headers/mwaitxintrin.h @@ -16,12 +16,41 @@ /* Define the default attributes for the functions in this file. */ #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("mwaitx"))) + +/// Establishes a linear address memory range to be monitored and puts +/// the processor in the monitor event pending state. Data stored in the +/// monitored address range causes the processor to exit the pending state. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the \c MONITORX instruction. +/// +/// \param __p +/// The memory range to be monitored. The size of the range is determined by +/// CPUID function 0000_0005h. +/// \param __extensions +/// Optional extensions for the monitoring state. +/// \param __hints +/// Optional hints for the monitoring state. static __inline__ void __DEFAULT_FN_ATTRS _mm_monitorx(void * __p, unsigned __extensions, unsigned __hints) { __builtin_ia32_monitorx(__p, __extensions, __hints); } +/// Used with the \c MONITORX instruction to wait while the processor is in +/// the monitor event pending state. Data stored in the monitored address +/// range causes the processor to exit the pending state. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the \c MWAITX instruction. +/// +/// \param __extensions +/// Optional extensions for the monitoring state, which can vary by +/// processor. +/// \param __hints +/// Optional hints for the monitoring state, which can vary by processor. static __inline__ void __DEFAULT_FN_ATTRS _mm_mwaitx(unsigned __extensions, unsigned __hints, unsigned __clock) { diff --git a/clang/lib/Headers/pmmintrin.h b/clang/lib/Headers/pmmintrin.h index ee660e95d2744..ce06695558e61 100644 --- a/clang/lib/Headers/pmmintrin.h +++ b/clang/lib/Headers/pmmintrin.h @@ -253,9 +253,12 @@ _mm_movedup_pd(__m128d __a) /// the processor in the monitor event pending state. Data stored in the /// monitored address range causes the processor to exit the pending state. /// +/// The \c MONITOR instruction can be used in kernel mode, and in other modes +/// if MSR C001_0015h[MonMwaitUserEn] is set. +/// /// \headerfile /// -/// This intrinsic corresponds to the MONITOR instruction. +/// This intrinsic corresponds to the \c MONITOR instruction. /// /// \param __p /// The memory range to be monitored. The size of the range is determined by @@ -270,19 +273,22 @@ _mm_monitor(void const *__p, unsigned __extensions, unsigned __hints) __builtin_ia32_monitor(__p, __extensions, __hints); } -/// Used with the MONITOR instruction to wait while the processor is in +/// Used with the \c MONITOR instruction to wait while the processor is in /// the monitor event pending state. Data stored in the monitored address /// range causes the processor to exit the pending state. /// +/// The \c MWAIT instruction can be used in kernel mode, and in other modes if +/// MSR C001_0015h[MonMwaitUserEn] is set. +/// /// \headerfile /// -/// This intrinsic corresponds to the MWAIT instruction. +/// This intrinsic corresponds to the \c MWAIT instruction. /// /// \param __extensions -/// Optional extensions for the monitoring state, which may vary by +/// Optional extensions for the monitoring state, which can vary by /// processor. /// \param __hints -/// Optional hints for the monitoring state, which may vary by processor. +/// Optional hints for the monitoring state, which can vary by processor. static __inline__ void __DEFAULT_FN_ATTRS _mm_mwait(unsigned __extensions, unsigned __hints) {