xref: /aosp_15_r20/prebuilts/clang-tools/linux-x86/clang-headers/pmmintrin.h (revision bed243d3d9cd544cfb038bfa7be843dedc6e6bf7)
1*bed243d3SAndroid Build Coastguard Worker /*===---- pmmintrin.h - SSE3 intrinsics ------------------------------------===
2*bed243d3SAndroid Build Coastguard Worker  *
3*bed243d3SAndroid Build Coastguard Worker  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*bed243d3SAndroid Build Coastguard Worker  * See https://llvm.org/LICENSE.txt for license information.
5*bed243d3SAndroid Build Coastguard Worker  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*bed243d3SAndroid Build Coastguard Worker  *
7*bed243d3SAndroid Build Coastguard Worker  *===-----------------------------------------------------------------------===
8*bed243d3SAndroid Build Coastguard Worker  */
9*bed243d3SAndroid Build Coastguard Worker 
10*bed243d3SAndroid Build Coastguard Worker #ifndef __PMMINTRIN_H
11*bed243d3SAndroid Build Coastguard Worker #define __PMMINTRIN_H
12*bed243d3SAndroid Build Coastguard Worker 
13*bed243d3SAndroid Build Coastguard Worker #if !defined(__i386__) && !defined(__x86_64__)
14*bed243d3SAndroid Build Coastguard Worker #error "This header is only meant to be used on x86 and x64 architecture"
15*bed243d3SAndroid Build Coastguard Worker #endif
16*bed243d3SAndroid Build Coastguard Worker 
17*bed243d3SAndroid Build Coastguard Worker #include <emmintrin.h>
18*bed243d3SAndroid Build Coastguard Worker 
19*bed243d3SAndroid Build Coastguard Worker /* Define the default attributes for the functions in this file. */
20*bed243d3SAndroid Build Coastguard Worker #define __DEFAULT_FN_ATTRS                                                     \
21*bed243d3SAndroid Build Coastguard Worker   __attribute__((__always_inline__, __nodebug__,                               \
22*bed243d3SAndroid Build Coastguard Worker                  __target__("sse3,no-evex512"), __min_vector_width__(128)))
23*bed243d3SAndroid Build Coastguard Worker 
24*bed243d3SAndroid Build Coastguard Worker /// Loads data from an unaligned memory location to elements in a 128-bit
25*bed243d3SAndroid Build Coastguard Worker ///    vector.
26*bed243d3SAndroid Build Coastguard Worker ///
27*bed243d3SAndroid Build Coastguard Worker ///    If the address of the data is not 16-byte aligned, the instruction may
28*bed243d3SAndroid Build Coastguard Worker ///    read two adjacent aligned blocks of memory to retrieve the requested
29*bed243d3SAndroid Build Coastguard Worker ///    data.
30*bed243d3SAndroid Build Coastguard Worker ///
31*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
32*bed243d3SAndroid Build Coastguard Worker ///
33*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the <c> VLDDQU </c> instruction.
34*bed243d3SAndroid Build Coastguard Worker ///
35*bed243d3SAndroid Build Coastguard Worker /// \param __p
36*bed243d3SAndroid Build Coastguard Worker ///    A pointer to a 128-bit integer vector containing integer values.
37*bed243d3SAndroid Build Coastguard Worker /// \returns A 128-bit vector containing the moved values.
38*bed243d3SAndroid Build Coastguard Worker static __inline__ __m128i __DEFAULT_FN_ATTRS
_mm_lddqu_si128(__m128i_u const * __p)39*bed243d3SAndroid Build Coastguard Worker _mm_lddqu_si128(__m128i_u const *__p)
40*bed243d3SAndroid Build Coastguard Worker {
41*bed243d3SAndroid Build Coastguard Worker   return (__m128i)__builtin_ia32_lddqu((char const *)__p);
42*bed243d3SAndroid Build Coastguard Worker }
43*bed243d3SAndroid Build Coastguard Worker 
44*bed243d3SAndroid Build Coastguard Worker /// Adds the even-indexed values and subtracts the odd-indexed values of
45*bed243d3SAndroid Build Coastguard Worker ///    two 128-bit vectors of [4 x float].
46*bed243d3SAndroid Build Coastguard Worker ///
47*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
48*bed243d3SAndroid Build Coastguard Worker ///
49*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the <c> VADDSUBPS </c> instruction.
50*bed243d3SAndroid Build Coastguard Worker ///
51*bed243d3SAndroid Build Coastguard Worker /// \param __a
52*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [4 x float] containing the left source operand.
53*bed243d3SAndroid Build Coastguard Worker /// \param __b
54*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [4 x float] containing the right source operand.
55*bed243d3SAndroid Build Coastguard Worker /// \returns A 128-bit vector of [4 x float] containing the alternating sums and
56*bed243d3SAndroid Build Coastguard Worker ///    differences of both operands.
57*bed243d3SAndroid Build Coastguard Worker static __inline__ __m128 __DEFAULT_FN_ATTRS
_mm_addsub_ps(__m128 __a,__m128 __b)58*bed243d3SAndroid Build Coastguard Worker _mm_addsub_ps(__m128 __a, __m128 __b)
59*bed243d3SAndroid Build Coastguard Worker {
60*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_addsubps((__v4sf)__a, (__v4sf)__b);
61*bed243d3SAndroid Build Coastguard Worker }
62*bed243d3SAndroid Build Coastguard Worker 
63*bed243d3SAndroid Build Coastguard Worker /// Horizontally adds the adjacent pairs of values contained in two
64*bed243d3SAndroid Build Coastguard Worker ///    128-bit vectors of [4 x float].
65*bed243d3SAndroid Build Coastguard Worker ///
66*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
67*bed243d3SAndroid Build Coastguard Worker ///
68*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the <c> VHADDPS </c> instruction.
69*bed243d3SAndroid Build Coastguard Worker ///
70*bed243d3SAndroid Build Coastguard Worker /// \param __a
71*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [4 x float] containing one of the source operands.
72*bed243d3SAndroid Build Coastguard Worker ///    The horizontal sums of the values are stored in the lower bits of the
73*bed243d3SAndroid Build Coastguard Worker ///    destination.
74*bed243d3SAndroid Build Coastguard Worker /// \param __b
75*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [4 x float] containing one of the source operands.
76*bed243d3SAndroid Build Coastguard Worker ///    The horizontal sums of the values are stored in the upper bits of the
77*bed243d3SAndroid Build Coastguard Worker ///    destination.
78*bed243d3SAndroid Build Coastguard Worker /// \returns A 128-bit vector of [4 x float] containing the horizontal sums of
79*bed243d3SAndroid Build Coastguard Worker ///    both operands.
80*bed243d3SAndroid Build Coastguard Worker static __inline__ __m128 __DEFAULT_FN_ATTRS
_mm_hadd_ps(__m128 __a,__m128 __b)81*bed243d3SAndroid Build Coastguard Worker _mm_hadd_ps(__m128 __a, __m128 __b)
82*bed243d3SAndroid Build Coastguard Worker {
83*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_haddps((__v4sf)__a, (__v4sf)__b);
84*bed243d3SAndroid Build Coastguard Worker }
85*bed243d3SAndroid Build Coastguard Worker 
86*bed243d3SAndroid Build Coastguard Worker /// Horizontally subtracts the adjacent pairs of values contained in two
87*bed243d3SAndroid Build Coastguard Worker ///    128-bit vectors of [4 x float].
88*bed243d3SAndroid Build Coastguard Worker ///
89*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
90*bed243d3SAndroid Build Coastguard Worker ///
91*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the <c> VHSUBPS </c> instruction.
92*bed243d3SAndroid Build Coastguard Worker ///
93*bed243d3SAndroid Build Coastguard Worker /// \param __a
94*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [4 x float] containing one of the source operands.
95*bed243d3SAndroid Build Coastguard Worker ///    The horizontal differences between the values are stored in the lower
96*bed243d3SAndroid Build Coastguard Worker ///    bits of the destination.
97*bed243d3SAndroid Build Coastguard Worker /// \param __b
98*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [4 x float] containing one of the source operands.
99*bed243d3SAndroid Build Coastguard Worker ///    The horizontal differences between the values are stored in the upper
100*bed243d3SAndroid Build Coastguard Worker ///    bits of the destination.
101*bed243d3SAndroid Build Coastguard Worker /// \returns A 128-bit vector of [4 x float] containing the horizontal
102*bed243d3SAndroid Build Coastguard Worker ///    differences of both operands.
103*bed243d3SAndroid Build Coastguard Worker static __inline__ __m128 __DEFAULT_FN_ATTRS
_mm_hsub_ps(__m128 __a,__m128 __b)104*bed243d3SAndroid Build Coastguard Worker _mm_hsub_ps(__m128 __a, __m128 __b)
105*bed243d3SAndroid Build Coastguard Worker {
106*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_hsubps((__v4sf)__a, (__v4sf)__b);
107*bed243d3SAndroid Build Coastguard Worker }
108*bed243d3SAndroid Build Coastguard Worker 
109*bed243d3SAndroid Build Coastguard Worker /// Moves and duplicates odd-indexed values from a 128-bit vector
110*bed243d3SAndroid Build Coastguard Worker ///    of [4 x float] to float values stored in a 128-bit vector of
111*bed243d3SAndroid Build Coastguard Worker ///    [4 x float].
112*bed243d3SAndroid Build Coastguard Worker ///
113*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
114*bed243d3SAndroid Build Coastguard Worker ///
115*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the <c> VMOVSHDUP </c> instruction.
116*bed243d3SAndroid Build Coastguard Worker ///
117*bed243d3SAndroid Build Coastguard Worker /// \param __a
118*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [4 x float]. \n
119*bed243d3SAndroid Build Coastguard Worker ///    Bits [127:96] of the source are written to bits [127:96] and [95:64] of
120*bed243d3SAndroid Build Coastguard Worker ///    the destination. \n
121*bed243d3SAndroid Build Coastguard Worker ///    Bits [63:32] of the source are written to bits [63:32] and [31:0] of the
122*bed243d3SAndroid Build Coastguard Worker ///    destination.
123*bed243d3SAndroid Build Coastguard Worker /// \returns A 128-bit vector of [4 x float] containing the moved and duplicated
124*bed243d3SAndroid Build Coastguard Worker ///    values.
125*bed243d3SAndroid Build Coastguard Worker static __inline__ __m128 __DEFAULT_FN_ATTRS
_mm_movehdup_ps(__m128 __a)126*bed243d3SAndroid Build Coastguard Worker _mm_movehdup_ps(__m128 __a)
127*bed243d3SAndroid Build Coastguard Worker {
128*bed243d3SAndroid Build Coastguard Worker   return __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 1, 1, 3, 3);
129*bed243d3SAndroid Build Coastguard Worker }
130*bed243d3SAndroid Build Coastguard Worker 
131*bed243d3SAndroid Build Coastguard Worker /// Duplicates even-indexed values from a 128-bit vector of
132*bed243d3SAndroid Build Coastguard Worker ///    [4 x float] to float values stored in a 128-bit vector of [4 x float].
133*bed243d3SAndroid Build Coastguard Worker ///
134*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
135*bed243d3SAndroid Build Coastguard Worker ///
136*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the <c> VMOVSLDUP </c> instruction.
137*bed243d3SAndroid Build Coastguard Worker ///
138*bed243d3SAndroid Build Coastguard Worker /// \param __a
139*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [4 x float] \n
140*bed243d3SAndroid Build Coastguard Worker ///    Bits [95:64] of the source are written to bits [127:96] and [95:64] of
141*bed243d3SAndroid Build Coastguard Worker ///    the destination. \n
142*bed243d3SAndroid Build Coastguard Worker ///    Bits [31:0] of the source are written to bits [63:32] and [31:0] of the
143*bed243d3SAndroid Build Coastguard Worker ///    destination.
144*bed243d3SAndroid Build Coastguard Worker /// \returns A 128-bit vector of [4 x float] containing the moved and duplicated
145*bed243d3SAndroid Build Coastguard Worker ///    values.
146*bed243d3SAndroid Build Coastguard Worker static __inline__ __m128 __DEFAULT_FN_ATTRS
_mm_moveldup_ps(__m128 __a)147*bed243d3SAndroid Build Coastguard Worker _mm_moveldup_ps(__m128 __a)
148*bed243d3SAndroid Build Coastguard Worker {
149*bed243d3SAndroid Build Coastguard Worker   return __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 0, 2, 2);
150*bed243d3SAndroid Build Coastguard Worker }
151*bed243d3SAndroid Build Coastguard Worker 
152*bed243d3SAndroid Build Coastguard Worker /// Adds the even-indexed values and subtracts the odd-indexed values of
153*bed243d3SAndroid Build Coastguard Worker ///    two 128-bit vectors of [2 x double].
154*bed243d3SAndroid Build Coastguard Worker ///
155*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
156*bed243d3SAndroid Build Coastguard Worker ///
157*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the <c> VADDSUBPD </c> instruction.
158*bed243d3SAndroid Build Coastguard Worker ///
159*bed243d3SAndroid Build Coastguard Worker /// \param __a
160*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [2 x double] containing the left source operand.
161*bed243d3SAndroid Build Coastguard Worker /// \param __b
162*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [2 x double] containing the right source operand.
163*bed243d3SAndroid Build Coastguard Worker /// \returns A 128-bit vector of [2 x double] containing the alternating sums
164*bed243d3SAndroid Build Coastguard Worker ///    and differences of both operands.
165*bed243d3SAndroid Build Coastguard Worker static __inline__ __m128d __DEFAULT_FN_ATTRS
_mm_addsub_pd(__m128d __a,__m128d __b)166*bed243d3SAndroid Build Coastguard Worker _mm_addsub_pd(__m128d __a, __m128d __b)
167*bed243d3SAndroid Build Coastguard Worker {
168*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_addsubpd((__v2df)__a, (__v2df)__b);
169*bed243d3SAndroid Build Coastguard Worker }
170*bed243d3SAndroid Build Coastguard Worker 
171*bed243d3SAndroid Build Coastguard Worker /// Horizontally adds the pairs of values contained in two 128-bit
172*bed243d3SAndroid Build Coastguard Worker ///    vectors of [2 x double].
173*bed243d3SAndroid Build Coastguard Worker ///
174*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
175*bed243d3SAndroid Build Coastguard Worker ///
176*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the <c> VHADDPD </c> instruction.
177*bed243d3SAndroid Build Coastguard Worker ///
178*bed243d3SAndroid Build Coastguard Worker /// \param __a
179*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [2 x double] containing one of the source operands.
180*bed243d3SAndroid Build Coastguard Worker ///    The horizontal sum of the values is stored in the lower bits of the
181*bed243d3SAndroid Build Coastguard Worker ///    destination.
182*bed243d3SAndroid Build Coastguard Worker /// \param __b
183*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [2 x double] containing one of the source operands.
184*bed243d3SAndroid Build Coastguard Worker ///    The horizontal sum of the values is stored in the upper bits of the
185*bed243d3SAndroid Build Coastguard Worker ///    destination.
186*bed243d3SAndroid Build Coastguard Worker /// \returns A 128-bit vector of [2 x double] containing the horizontal sums of
187*bed243d3SAndroid Build Coastguard Worker ///    both operands.
188*bed243d3SAndroid Build Coastguard Worker static __inline__ __m128d __DEFAULT_FN_ATTRS
_mm_hadd_pd(__m128d __a,__m128d __b)189*bed243d3SAndroid Build Coastguard Worker _mm_hadd_pd(__m128d __a, __m128d __b)
190*bed243d3SAndroid Build Coastguard Worker {
191*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_haddpd((__v2df)__a, (__v2df)__b);
192*bed243d3SAndroid Build Coastguard Worker }
193*bed243d3SAndroid Build Coastguard Worker 
194*bed243d3SAndroid Build Coastguard Worker /// Horizontally subtracts the pairs of values contained in two 128-bit
195*bed243d3SAndroid Build Coastguard Worker ///    vectors of [2 x double].
196*bed243d3SAndroid Build Coastguard Worker ///
197*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
198*bed243d3SAndroid Build Coastguard Worker ///
199*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the <c> VHSUBPD </c> instruction.
200*bed243d3SAndroid Build Coastguard Worker ///
201*bed243d3SAndroid Build Coastguard Worker /// \param __a
202*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [2 x double] containing one of the source operands.
203*bed243d3SAndroid Build Coastguard Worker ///    The horizontal difference of the values is stored in the lower bits of
204*bed243d3SAndroid Build Coastguard Worker ///    the destination.
205*bed243d3SAndroid Build Coastguard Worker /// \param __b
206*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [2 x double] containing one of the source operands.
207*bed243d3SAndroid Build Coastguard Worker ///    The horizontal difference of the values is stored in the upper bits of
208*bed243d3SAndroid Build Coastguard Worker ///    the destination.
209*bed243d3SAndroid Build Coastguard Worker /// \returns A 128-bit vector of [2 x double] containing the horizontal
210*bed243d3SAndroid Build Coastguard Worker ///    differences of both operands.
211*bed243d3SAndroid Build Coastguard Worker static __inline__ __m128d __DEFAULT_FN_ATTRS
_mm_hsub_pd(__m128d __a,__m128d __b)212*bed243d3SAndroid Build Coastguard Worker _mm_hsub_pd(__m128d __a, __m128d __b)
213*bed243d3SAndroid Build Coastguard Worker {
214*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_hsubpd((__v2df)__a, (__v2df)__b);
215*bed243d3SAndroid Build Coastguard Worker }
216*bed243d3SAndroid Build Coastguard Worker 
217*bed243d3SAndroid Build Coastguard Worker /// Moves and duplicates one double-precision value to double-precision
218*bed243d3SAndroid Build Coastguard Worker ///    values stored in a 128-bit vector of [2 x double].
219*bed243d3SAndroid Build Coastguard Worker ///
220*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
221*bed243d3SAndroid Build Coastguard Worker ///
222*bed243d3SAndroid Build Coastguard Worker /// \code
223*bed243d3SAndroid Build Coastguard Worker /// __m128d _mm_loaddup_pd(double const *dp);
224*bed243d3SAndroid Build Coastguard Worker /// \endcode
225*bed243d3SAndroid Build Coastguard Worker ///
226*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the <c> VMOVDDUP </c> instruction.
227*bed243d3SAndroid Build Coastguard Worker ///
228*bed243d3SAndroid Build Coastguard Worker /// \param dp
229*bed243d3SAndroid Build Coastguard Worker ///    A pointer to a double-precision value to be moved and duplicated.
230*bed243d3SAndroid Build Coastguard Worker /// \returns A 128-bit vector of [2 x double] containing the moved and
231*bed243d3SAndroid Build Coastguard Worker ///    duplicated values.
232*bed243d3SAndroid Build Coastguard Worker #define        _mm_loaddup_pd(dp)        _mm_load1_pd(dp)
233*bed243d3SAndroid Build Coastguard Worker 
234*bed243d3SAndroid Build Coastguard Worker /// Moves and duplicates the double-precision value in the lower bits of
235*bed243d3SAndroid Build Coastguard Worker ///    a 128-bit vector of [2 x double] to double-precision values stored in a
236*bed243d3SAndroid Build Coastguard Worker ///    128-bit vector of [2 x double].
237*bed243d3SAndroid Build Coastguard Worker ///
238*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
239*bed243d3SAndroid Build Coastguard Worker ///
240*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the <c> VMOVDDUP </c> instruction.
241*bed243d3SAndroid Build Coastguard Worker ///
242*bed243d3SAndroid Build Coastguard Worker /// \param __a
243*bed243d3SAndroid Build Coastguard Worker ///    A 128-bit vector of [2 x double]. Bits [63:0] are written to bits
244*bed243d3SAndroid Build Coastguard Worker ///    [127:64] and [63:0] of the destination.
245*bed243d3SAndroid Build Coastguard Worker /// \returns A 128-bit vector of [2 x double] containing the moved and
246*bed243d3SAndroid Build Coastguard Worker ///    duplicated values.
247*bed243d3SAndroid Build Coastguard Worker static __inline__ __m128d __DEFAULT_FN_ATTRS
_mm_movedup_pd(__m128d __a)248*bed243d3SAndroid Build Coastguard Worker _mm_movedup_pd(__m128d __a)
249*bed243d3SAndroid Build Coastguard Worker {
250*bed243d3SAndroid Build Coastguard Worker   return __builtin_shufflevector((__v2df)__a, (__v2df)__a, 0, 0);
251*bed243d3SAndroid Build Coastguard Worker }
252*bed243d3SAndroid Build Coastguard Worker 
253*bed243d3SAndroid Build Coastguard Worker /// Establishes a linear address memory range to be monitored and puts
254*bed243d3SAndroid Build Coastguard Worker ///    the processor in the monitor event pending state. Data stored in the
255*bed243d3SAndroid Build Coastguard Worker ///    monitored address range causes the processor to exit the pending state.
256*bed243d3SAndroid Build Coastguard Worker ///
257*bed243d3SAndroid Build Coastguard Worker /// The \c MONITOR instruction can be used in kernel mode, and in other modes
258*bed243d3SAndroid Build Coastguard Worker /// if MSR <c> C001_0015h[MonMwaitUserEn] </c> is set.
259*bed243d3SAndroid Build Coastguard Worker ///
260*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
261*bed243d3SAndroid Build Coastguard Worker ///
262*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c MONITOR instruction.
263*bed243d3SAndroid Build Coastguard Worker ///
264*bed243d3SAndroid Build Coastguard Worker /// \param __p
265*bed243d3SAndroid Build Coastguard Worker ///    The memory range to be monitored. The size of the range is determined by
266*bed243d3SAndroid Build Coastguard Worker ///    CPUID function 0000_0005h.
267*bed243d3SAndroid Build Coastguard Worker /// \param __extensions
268*bed243d3SAndroid Build Coastguard Worker ///    Optional extensions for the monitoring state.
269*bed243d3SAndroid Build Coastguard Worker /// \param __hints
270*bed243d3SAndroid Build Coastguard Worker ///    Optional hints for the monitoring state.
271*bed243d3SAndroid Build Coastguard Worker static __inline__ void __DEFAULT_FN_ATTRS
_mm_monitor(void const * __p,unsigned __extensions,unsigned __hints)272*bed243d3SAndroid Build Coastguard Worker _mm_monitor(void const *__p, unsigned __extensions, unsigned __hints)
273*bed243d3SAndroid Build Coastguard Worker {
274*bed243d3SAndroid Build Coastguard Worker   __builtin_ia32_monitor(__p, __extensions, __hints);
275*bed243d3SAndroid Build Coastguard Worker }
276*bed243d3SAndroid Build Coastguard Worker 
277*bed243d3SAndroid Build Coastguard Worker /// Used with the \c MONITOR instruction to wait while the processor is in
278*bed243d3SAndroid Build Coastguard Worker ///    the monitor event pending state. Data stored in the monitored address
279*bed243d3SAndroid Build Coastguard Worker ///    range, or an interrupt, causes the processor to exit the pending state.
280*bed243d3SAndroid Build Coastguard Worker ///
281*bed243d3SAndroid Build Coastguard Worker /// The \c MWAIT instruction can be used in kernel mode, and in other modes if
282*bed243d3SAndroid Build Coastguard Worker /// MSR <c> C001_0015h[MonMwaitUserEn] </c> is set.
283*bed243d3SAndroid Build Coastguard Worker ///
284*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
285*bed243d3SAndroid Build Coastguard Worker ///
286*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c MWAIT instruction.
287*bed243d3SAndroid Build Coastguard Worker ///
288*bed243d3SAndroid Build Coastguard Worker /// \param __extensions
289*bed243d3SAndroid Build Coastguard Worker ///    Optional extensions for the monitoring state, which can vary by
290*bed243d3SAndroid Build Coastguard Worker ///    processor.
291*bed243d3SAndroid Build Coastguard Worker /// \param __hints
292*bed243d3SAndroid Build Coastguard Worker ///    Optional hints for the monitoring state, which can vary by processor.
293*bed243d3SAndroid Build Coastguard Worker static __inline__ void __DEFAULT_FN_ATTRS
_mm_mwait(unsigned __extensions,unsigned __hints)294*bed243d3SAndroid Build Coastguard Worker _mm_mwait(unsigned __extensions, unsigned __hints)
295*bed243d3SAndroid Build Coastguard Worker {
296*bed243d3SAndroid Build Coastguard Worker   __builtin_ia32_mwait(__extensions, __hints);
297*bed243d3SAndroid Build Coastguard Worker }
298*bed243d3SAndroid Build Coastguard Worker 
299*bed243d3SAndroid Build Coastguard Worker #undef __DEFAULT_FN_ATTRS
300*bed243d3SAndroid Build Coastguard Worker 
301*bed243d3SAndroid Build Coastguard Worker #endif /* __PMMINTRIN_H */
302