xref: /aosp_15_r20/prebuilts/clang-tools/linux-x86/clang-headers/ia32intrin.h (revision bed243d3d9cd544cfb038bfa7be843dedc6e6bf7)
1*bed243d3SAndroid Build Coastguard Worker /* ===-------- ia32intrin.h ---------------------------------------------------===
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 __X86INTRIN_H
11*bed243d3SAndroid Build Coastguard Worker #error "Never use <ia32intrin.h> directly; include <x86intrin.h> instead."
12*bed243d3SAndroid Build Coastguard Worker #endif
13*bed243d3SAndroid Build Coastguard Worker 
14*bed243d3SAndroid Build Coastguard Worker #ifndef __IA32INTRIN_H
15*bed243d3SAndroid Build Coastguard Worker #define __IA32INTRIN_H
16*bed243d3SAndroid Build Coastguard Worker 
17*bed243d3SAndroid Build Coastguard Worker /* Define the default attributes for the functions in this file. */
18*bed243d3SAndroid Build Coastguard Worker #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
19*bed243d3SAndroid Build Coastguard Worker #define __DEFAULT_FN_ATTRS_CRC32 __attribute__((__always_inline__, __nodebug__, __target__("crc32")))
20*bed243d3SAndroid Build Coastguard Worker 
21*bed243d3SAndroid Build Coastguard Worker #if defined(__cplusplus) && (__cplusplus >= 201103L)
22*bed243d3SAndroid Build Coastguard Worker #define __DEFAULT_FN_ATTRS_CAST __attribute__((__always_inline__)) constexpr
23*bed243d3SAndroid Build Coastguard Worker #define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
24*bed243d3SAndroid Build Coastguard Worker #else
25*bed243d3SAndroid Build Coastguard Worker #define __DEFAULT_FN_ATTRS_CAST __attribute__((__always_inline__))
26*bed243d3SAndroid Build Coastguard Worker #define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
27*bed243d3SAndroid Build Coastguard Worker #endif
28*bed243d3SAndroid Build Coastguard Worker 
29*bed243d3SAndroid Build Coastguard Worker /// Finds the first set bit starting from the least significant bit. The result
30*bed243d3SAndroid Build Coastguard Worker ///    is undefined if the input is 0.
31*bed243d3SAndroid Build Coastguard Worker ///
32*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
33*bed243d3SAndroid Build Coastguard Worker ///
34*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c BSF instruction or the
35*bed243d3SAndroid Build Coastguard Worker ///    \c TZCNT instruction.
36*bed243d3SAndroid Build Coastguard Worker ///
37*bed243d3SAndroid Build Coastguard Worker /// \param __A
38*bed243d3SAndroid Build Coastguard Worker ///    A 32-bit integer operand.
39*bed243d3SAndroid Build Coastguard Worker /// \returns A 32-bit integer containing the bit number.
40*bed243d3SAndroid Build Coastguard Worker /// \see _bit_scan_forward
41*bed243d3SAndroid Build Coastguard Worker static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
__bsfd(int __A)42*bed243d3SAndroid Build Coastguard Worker __bsfd(int __A) {
43*bed243d3SAndroid Build Coastguard Worker   return __builtin_ctz((unsigned int)__A);
44*bed243d3SAndroid Build Coastguard Worker }
45*bed243d3SAndroid Build Coastguard Worker 
46*bed243d3SAndroid Build Coastguard Worker /// Finds the first set bit starting from the most significant bit. The result
47*bed243d3SAndroid Build Coastguard Worker ///    is undefined if the input is 0.
48*bed243d3SAndroid Build Coastguard Worker ///
49*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
50*bed243d3SAndroid Build Coastguard Worker ///
51*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c BSR instruction or the
52*bed243d3SAndroid Build Coastguard Worker ///    \c LZCNT instruction and an \c XOR.
53*bed243d3SAndroid Build Coastguard Worker ///
54*bed243d3SAndroid Build Coastguard Worker /// \param __A
55*bed243d3SAndroid Build Coastguard Worker ///    A 32-bit integer operand.
56*bed243d3SAndroid Build Coastguard Worker /// \returns A 32-bit integer containing the bit number.
57*bed243d3SAndroid Build Coastguard Worker /// \see _bit_scan_reverse
58*bed243d3SAndroid Build Coastguard Worker static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
__bsrd(int __A)59*bed243d3SAndroid Build Coastguard Worker __bsrd(int __A) {
60*bed243d3SAndroid Build Coastguard Worker   return 31 - __builtin_clz((unsigned int)__A);
61*bed243d3SAndroid Build Coastguard Worker }
62*bed243d3SAndroid Build Coastguard Worker 
63*bed243d3SAndroid Build Coastguard Worker /// Swaps the bytes in the input, converting little endian to big endian or
64*bed243d3SAndroid Build Coastguard Worker ///    vice versa.
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 BSWAP instruction.
69*bed243d3SAndroid Build Coastguard Worker ///
70*bed243d3SAndroid Build Coastguard Worker /// \param __A
71*bed243d3SAndroid Build Coastguard Worker ///    A 32-bit integer operand.
72*bed243d3SAndroid Build Coastguard Worker /// \returns A 32-bit integer containing the swapped bytes.
73*bed243d3SAndroid Build Coastguard Worker static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
__bswapd(int __A)74*bed243d3SAndroid Build Coastguard Worker __bswapd(int __A) {
75*bed243d3SAndroid Build Coastguard Worker   return (int)__builtin_bswap32((unsigned int)__A);
76*bed243d3SAndroid Build Coastguard Worker }
77*bed243d3SAndroid Build Coastguard Worker 
78*bed243d3SAndroid Build Coastguard Worker /// Swaps the bytes in the input, converting little endian to big endian or
79*bed243d3SAndroid Build Coastguard Worker ///    vice versa.
80*bed243d3SAndroid Build Coastguard Worker ///
81*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
82*bed243d3SAndroid Build Coastguard Worker ///
83*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c BSWAP instruction.
84*bed243d3SAndroid Build Coastguard Worker ///
85*bed243d3SAndroid Build Coastguard Worker /// \param __A
86*bed243d3SAndroid Build Coastguard Worker ///    A 32-bit integer operand.
87*bed243d3SAndroid Build Coastguard Worker /// \returns A 32-bit integer containing the swapped bytes.
88*bed243d3SAndroid Build Coastguard Worker static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
_bswap(int __A)89*bed243d3SAndroid Build Coastguard Worker _bswap(int __A) {
90*bed243d3SAndroid Build Coastguard Worker   return (int)__builtin_bswap32((unsigned int)__A);
91*bed243d3SAndroid Build Coastguard Worker }
92*bed243d3SAndroid Build Coastguard Worker 
93*bed243d3SAndroid Build Coastguard Worker /// Finds the first set bit starting from the least significant bit. The result
94*bed243d3SAndroid Build Coastguard Worker ///    is undefined if the input is 0.
95*bed243d3SAndroid Build Coastguard Worker ///
96*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
97*bed243d3SAndroid Build Coastguard Worker ///
98*bed243d3SAndroid Build Coastguard Worker /// \code
99*bed243d3SAndroid Build Coastguard Worker /// int _bit_scan_forward(int A);
100*bed243d3SAndroid Build Coastguard Worker /// \endcode
101*bed243d3SAndroid Build Coastguard Worker ///
102*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c BSF instruction or the
103*bed243d3SAndroid Build Coastguard Worker ///    \c TZCNT instruction.
104*bed243d3SAndroid Build Coastguard Worker ///
105*bed243d3SAndroid Build Coastguard Worker /// \param A
106*bed243d3SAndroid Build Coastguard Worker ///    A 32-bit integer operand.
107*bed243d3SAndroid Build Coastguard Worker /// \returns A 32-bit integer containing the bit number.
108*bed243d3SAndroid Build Coastguard Worker /// \see __bsfd
109*bed243d3SAndroid Build Coastguard Worker #define _bit_scan_forward(A) __bsfd((A))
110*bed243d3SAndroid Build Coastguard Worker 
111*bed243d3SAndroid Build Coastguard Worker /// Finds the first set bit starting from the most significant bit. The result
112*bed243d3SAndroid Build Coastguard Worker ///    is undefined if the input is 0.
113*bed243d3SAndroid Build Coastguard Worker ///
114*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
115*bed243d3SAndroid Build Coastguard Worker ///
116*bed243d3SAndroid Build Coastguard Worker /// \code
117*bed243d3SAndroid Build Coastguard Worker /// int _bit_scan_reverse(int A);
118*bed243d3SAndroid Build Coastguard Worker /// \endcode
119*bed243d3SAndroid Build Coastguard Worker ///
120*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c BSR instruction or the
121*bed243d3SAndroid Build Coastguard Worker ///    \c LZCNT instruction and an \c XOR.
122*bed243d3SAndroid Build Coastguard Worker ///
123*bed243d3SAndroid Build Coastguard Worker /// \param A
124*bed243d3SAndroid Build Coastguard Worker ///    A 32-bit integer operand.
125*bed243d3SAndroid Build Coastguard Worker /// \returns A 32-bit integer containing the bit number.
126*bed243d3SAndroid Build Coastguard Worker /// \see __bsrd
127*bed243d3SAndroid Build Coastguard Worker #define _bit_scan_reverse(A) __bsrd((A))
128*bed243d3SAndroid Build Coastguard Worker 
129*bed243d3SAndroid Build Coastguard Worker #ifdef __x86_64__
130*bed243d3SAndroid Build Coastguard Worker /// Finds the first set bit starting from the least significant bit. The result
131*bed243d3SAndroid Build Coastguard Worker ///    is undefined if the input is 0.
132*bed243d3SAndroid Build Coastguard Worker ///
133*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
134*bed243d3SAndroid Build Coastguard Worker ///
135*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c BSF instruction or the
136*bed243d3SAndroid Build Coastguard Worker ///    \c TZCNT instruction.
137*bed243d3SAndroid Build Coastguard Worker ///
138*bed243d3SAndroid Build Coastguard Worker /// \param __A
139*bed243d3SAndroid Build Coastguard Worker ///    A 64-bit integer operand.
140*bed243d3SAndroid Build Coastguard Worker /// \returns A 32-bit integer containing the bit number.
141*bed243d3SAndroid Build Coastguard Worker static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
__bsfq(long long __A)142*bed243d3SAndroid Build Coastguard Worker __bsfq(long long __A) {
143*bed243d3SAndroid Build Coastguard Worker   return (long long)__builtin_ctzll((unsigned long long)__A);
144*bed243d3SAndroid Build Coastguard Worker }
145*bed243d3SAndroid Build Coastguard Worker 
146*bed243d3SAndroid Build Coastguard Worker /// Finds the first set bit starting from the most significant bit. The result
147*bed243d3SAndroid Build Coastguard Worker ///    is undefined if input is 0.
148*bed243d3SAndroid Build Coastguard Worker ///
149*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
150*bed243d3SAndroid Build Coastguard Worker ///
151*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c BSR instruction or the
152*bed243d3SAndroid Build Coastguard Worker ///    \c LZCNT instruction and an \c XOR.
153*bed243d3SAndroid Build Coastguard Worker ///
154*bed243d3SAndroid Build Coastguard Worker /// \param __A
155*bed243d3SAndroid Build Coastguard Worker ///    A 64-bit integer operand.
156*bed243d3SAndroid Build Coastguard Worker /// \returns A 32-bit integer containing the bit number.
157*bed243d3SAndroid Build Coastguard Worker static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
__bsrq(long long __A)158*bed243d3SAndroid Build Coastguard Worker __bsrq(long long __A) {
159*bed243d3SAndroid Build Coastguard Worker   return 63 - __builtin_clzll((unsigned long long)__A);
160*bed243d3SAndroid Build Coastguard Worker }
161*bed243d3SAndroid Build Coastguard Worker 
162*bed243d3SAndroid Build Coastguard Worker /// Swaps the bytes in the input, converting little endian to big endian or
163*bed243d3SAndroid Build Coastguard Worker ///    vice versa.
164*bed243d3SAndroid Build Coastguard Worker ///
165*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
166*bed243d3SAndroid Build Coastguard Worker ///
167*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c BSWAP instruction.
168*bed243d3SAndroid Build Coastguard Worker ///
169*bed243d3SAndroid Build Coastguard Worker /// \param __A
170*bed243d3SAndroid Build Coastguard Worker ///    A 64-bit integer operand.
171*bed243d3SAndroid Build Coastguard Worker /// \returns A 64-bit integer containing the swapped bytes.
172*bed243d3SAndroid Build Coastguard Worker /// \see _bswap64
173*bed243d3SAndroid Build Coastguard Worker static __inline__ long long __DEFAULT_FN_ATTRS_CONSTEXPR
__bswapq(long long __A)174*bed243d3SAndroid Build Coastguard Worker __bswapq(long long __A) {
175*bed243d3SAndroid Build Coastguard Worker   return (long long)__builtin_bswap64((unsigned long long)__A);
176*bed243d3SAndroid Build Coastguard Worker }
177*bed243d3SAndroid Build Coastguard Worker 
178*bed243d3SAndroid Build Coastguard Worker /// Swaps the bytes in the input, converting little endian to big endian or
179*bed243d3SAndroid Build Coastguard Worker ///    vice versa.
180*bed243d3SAndroid Build Coastguard Worker ///
181*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
182*bed243d3SAndroid Build Coastguard Worker ///
183*bed243d3SAndroid Build Coastguard Worker /// \code
184*bed243d3SAndroid Build Coastguard Worker /// long long _bswap64(long long A);
185*bed243d3SAndroid Build Coastguard Worker /// \endcode
186*bed243d3SAndroid Build Coastguard Worker ///
187*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c BSWAP instruction.
188*bed243d3SAndroid Build Coastguard Worker ///
189*bed243d3SAndroid Build Coastguard Worker /// \param A
190*bed243d3SAndroid Build Coastguard Worker ///    A 64-bit integer operand.
191*bed243d3SAndroid Build Coastguard Worker /// \returns A 64-bit integer containing the swapped bytes.
192*bed243d3SAndroid Build Coastguard Worker /// \see __bswapq
193*bed243d3SAndroid Build Coastguard Worker #define _bswap64(A) __bswapq((A))
194*bed243d3SAndroid Build Coastguard Worker #endif /* __x86_64__ */
195*bed243d3SAndroid Build Coastguard Worker 
196*bed243d3SAndroid Build Coastguard Worker /// Counts the number of bits in the source operand having a value of 1.
197*bed243d3SAndroid Build Coastguard Worker ///
198*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
199*bed243d3SAndroid Build Coastguard Worker ///
200*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c POPCNT instruction or a
201*bed243d3SAndroid Build Coastguard Worker ///    sequence of arithmetic and logic operations to calculate it.
202*bed243d3SAndroid Build Coastguard Worker ///
203*bed243d3SAndroid Build Coastguard Worker /// \param __A
204*bed243d3SAndroid Build Coastguard Worker ///    An unsigned 32-bit integer operand.
205*bed243d3SAndroid Build Coastguard Worker /// \returns A 32-bit integer containing the number of bits with value 1 in the
206*bed243d3SAndroid Build Coastguard Worker ///    source operand.
207*bed243d3SAndroid Build Coastguard Worker /// \see _popcnt32
208*bed243d3SAndroid Build Coastguard Worker static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
__popcntd(unsigned int __A)209*bed243d3SAndroid Build Coastguard Worker __popcntd(unsigned int __A)
210*bed243d3SAndroid Build Coastguard Worker {
211*bed243d3SAndroid Build Coastguard Worker   return __builtin_popcount(__A);
212*bed243d3SAndroid Build Coastguard Worker }
213*bed243d3SAndroid Build Coastguard Worker 
214*bed243d3SAndroid Build Coastguard Worker /// Counts the number of bits in the source operand having a value of 1.
215*bed243d3SAndroid Build Coastguard Worker ///
216*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
217*bed243d3SAndroid Build Coastguard Worker ///
218*bed243d3SAndroid Build Coastguard Worker /// \code
219*bed243d3SAndroid Build Coastguard Worker /// int _popcnt32(int A);
220*bed243d3SAndroid Build Coastguard Worker /// \endcode
221*bed243d3SAndroid Build Coastguard Worker ///
222*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c POPCNT instruction or a
223*bed243d3SAndroid Build Coastguard Worker ///    sequence of arithmetic and logic operations to calculate it.
224*bed243d3SAndroid Build Coastguard Worker ///
225*bed243d3SAndroid Build Coastguard Worker /// \param A
226*bed243d3SAndroid Build Coastguard Worker ///    An unsigned 32-bit integer operand.
227*bed243d3SAndroid Build Coastguard Worker /// \returns A 32-bit integer containing the number of bits with value 1 in the
228*bed243d3SAndroid Build Coastguard Worker ///    source operand.
229*bed243d3SAndroid Build Coastguard Worker /// \see __popcntd
230*bed243d3SAndroid Build Coastguard Worker #define _popcnt32(A) __popcntd((A))
231*bed243d3SAndroid Build Coastguard Worker 
232*bed243d3SAndroid Build Coastguard Worker #ifdef __x86_64__
233*bed243d3SAndroid Build Coastguard Worker /// Counts the number of bits in the source operand having a value of 1.
234*bed243d3SAndroid Build Coastguard Worker ///
235*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
236*bed243d3SAndroid Build Coastguard Worker ///
237*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c POPCNT instruction or a
238*bed243d3SAndroid Build Coastguard Worker ///    sequence of arithmetic and logic operations to calculate it.
239*bed243d3SAndroid Build Coastguard Worker ///
240*bed243d3SAndroid Build Coastguard Worker /// \param __A
241*bed243d3SAndroid Build Coastguard Worker ///    An unsigned 64-bit integer operand.
242*bed243d3SAndroid Build Coastguard Worker /// \returns A 64-bit integer containing the number of bits with value 1 in the
243*bed243d3SAndroid Build Coastguard Worker ///    source operand.
244*bed243d3SAndroid Build Coastguard Worker /// \see _popcnt64
245*bed243d3SAndroid Build Coastguard Worker static __inline__ long long __DEFAULT_FN_ATTRS_CONSTEXPR
__popcntq(unsigned long long __A)246*bed243d3SAndroid Build Coastguard Worker __popcntq(unsigned long long __A)
247*bed243d3SAndroid Build Coastguard Worker {
248*bed243d3SAndroid Build Coastguard Worker   return __builtin_popcountll(__A);
249*bed243d3SAndroid Build Coastguard Worker }
250*bed243d3SAndroid Build Coastguard Worker 
251*bed243d3SAndroid Build Coastguard Worker /// Counts the number of bits in the source operand having a value of 1.
252*bed243d3SAndroid Build Coastguard Worker ///
253*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
254*bed243d3SAndroid Build Coastguard Worker ///
255*bed243d3SAndroid Build Coastguard Worker /// \code
256*bed243d3SAndroid Build Coastguard Worker /// long long _popcnt64(unsigned long long A);
257*bed243d3SAndroid Build Coastguard Worker /// \endcode
258*bed243d3SAndroid Build Coastguard Worker ///
259*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c POPCNT instruction or a
260*bed243d3SAndroid Build Coastguard Worker ///    sequence of arithmetic and logic operations to calculate it.
261*bed243d3SAndroid Build Coastguard Worker ///
262*bed243d3SAndroid Build Coastguard Worker /// \param A
263*bed243d3SAndroid Build Coastguard Worker ///    An unsigned 64-bit integer operand.
264*bed243d3SAndroid Build Coastguard Worker /// \returns A 64-bit integer containing the number of bits with value 1 in the
265*bed243d3SAndroid Build Coastguard Worker ///    source operand.
266*bed243d3SAndroid Build Coastguard Worker /// \see __popcntq
267*bed243d3SAndroid Build Coastguard Worker #define _popcnt64(A) __popcntq((A))
268*bed243d3SAndroid Build Coastguard Worker #endif /* __x86_64__ */
269*bed243d3SAndroid Build Coastguard Worker 
270*bed243d3SAndroid Build Coastguard Worker #ifdef __x86_64__
271*bed243d3SAndroid Build Coastguard Worker /// Returns the program status-and-control \c RFLAGS register with the \c VM
272*bed243d3SAndroid Build Coastguard Worker ///    and \c RF flags cleared.
273*bed243d3SAndroid Build Coastguard Worker ///
274*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
275*bed243d3SAndroid Build Coastguard Worker ///
276*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c PUSHFQ + \c POP instruction sequence.
277*bed243d3SAndroid Build Coastguard Worker ///
278*bed243d3SAndroid Build Coastguard Worker /// \returns The 64-bit value of the RFLAGS register.
279*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__readeflags(void)280*bed243d3SAndroid Build Coastguard Worker __readeflags(void)
281*bed243d3SAndroid Build Coastguard Worker {
282*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_readeflags_u64();
283*bed243d3SAndroid Build Coastguard Worker }
284*bed243d3SAndroid Build Coastguard Worker 
285*bed243d3SAndroid Build Coastguard Worker /// Writes the specified value to the program status-and-control \c RFLAGS
286*bed243d3SAndroid Build Coastguard Worker ///    register. Reserved bits are not affected.
287*bed243d3SAndroid Build Coastguard Worker ///
288*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
289*bed243d3SAndroid Build Coastguard Worker ///
290*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c PUSH + \c POPFQ instruction sequence.
291*bed243d3SAndroid Build Coastguard Worker ///
292*bed243d3SAndroid Build Coastguard Worker /// \param __f
293*bed243d3SAndroid Build Coastguard Worker ///    The 64-bit value to write to \c RFLAGS.
294*bed243d3SAndroid Build Coastguard Worker static __inline__ void __DEFAULT_FN_ATTRS
__writeeflags(unsigned long long __f)295*bed243d3SAndroid Build Coastguard Worker __writeeflags(unsigned long long __f)
296*bed243d3SAndroid Build Coastguard Worker {
297*bed243d3SAndroid Build Coastguard Worker   __builtin_ia32_writeeflags_u64(__f);
298*bed243d3SAndroid Build Coastguard Worker }
299*bed243d3SAndroid Build Coastguard Worker 
300*bed243d3SAndroid Build Coastguard Worker #else /* !__x86_64__ */
301*bed243d3SAndroid Build Coastguard Worker /// Returns the program status-and-control \c EFLAGS register with the \c VM
302*bed243d3SAndroid Build Coastguard Worker ///    and \c RF flags cleared.
303*bed243d3SAndroid Build Coastguard Worker ///
304*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
305*bed243d3SAndroid Build Coastguard Worker ///
306*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c PUSHFD + \c POP instruction sequence.
307*bed243d3SAndroid Build Coastguard Worker ///
308*bed243d3SAndroid Build Coastguard Worker /// \returns The 32-bit value of the EFLAGS register.
309*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned int __DEFAULT_FN_ATTRS
__readeflags(void)310*bed243d3SAndroid Build Coastguard Worker __readeflags(void)
311*bed243d3SAndroid Build Coastguard Worker {
312*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_readeflags_u32();
313*bed243d3SAndroid Build Coastguard Worker }
314*bed243d3SAndroid Build Coastguard Worker 
315*bed243d3SAndroid Build Coastguard Worker /// Writes the specified value to the program status-and-control \c EFLAGS
316*bed243d3SAndroid Build Coastguard Worker ///    register. Reserved bits are not affected.
317*bed243d3SAndroid Build Coastguard Worker ///
318*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
319*bed243d3SAndroid Build Coastguard Worker ///
320*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c PUSH + \c POPFD instruction sequence.
321*bed243d3SAndroid Build Coastguard Worker ///
322*bed243d3SAndroid Build Coastguard Worker /// \param __f
323*bed243d3SAndroid Build Coastguard Worker ///    The 32-bit value to write to \c EFLAGS.
324*bed243d3SAndroid Build Coastguard Worker static __inline__ void __DEFAULT_FN_ATTRS
__writeeflags(unsigned int __f)325*bed243d3SAndroid Build Coastguard Worker __writeeflags(unsigned int __f)
326*bed243d3SAndroid Build Coastguard Worker {
327*bed243d3SAndroid Build Coastguard Worker   __builtin_ia32_writeeflags_u32(__f);
328*bed243d3SAndroid Build Coastguard Worker }
329*bed243d3SAndroid Build Coastguard Worker #endif /* !__x86_64__ */
330*bed243d3SAndroid Build Coastguard Worker 
331*bed243d3SAndroid Build Coastguard Worker /// Casts a 32-bit float value to a 32-bit unsigned integer value.
332*bed243d3SAndroid Build Coastguard Worker ///
333*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
334*bed243d3SAndroid Build Coastguard Worker ///
335*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c VMOVD / \c MOVD instruction in x86_64,
336*bed243d3SAndroid Build Coastguard Worker ///    and corresponds to the \c VMOVL / \c MOVL instruction in ia32.
337*bed243d3SAndroid Build Coastguard Worker ///
338*bed243d3SAndroid Build Coastguard Worker /// \param __A
339*bed243d3SAndroid Build Coastguard Worker ///    A 32-bit float value.
340*bed243d3SAndroid Build Coastguard Worker /// \returns A 32-bit unsigned integer containing the converted value.
341*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned int __DEFAULT_FN_ATTRS_CAST
_castf32_u32(float __A)342*bed243d3SAndroid Build Coastguard Worker _castf32_u32(float __A) {
343*bed243d3SAndroid Build Coastguard Worker   return __builtin_bit_cast(unsigned int, __A);
344*bed243d3SAndroid Build Coastguard Worker }
345*bed243d3SAndroid Build Coastguard Worker 
346*bed243d3SAndroid Build Coastguard Worker /// Casts a 64-bit float value to a 64-bit unsigned integer value.
347*bed243d3SAndroid Build Coastguard Worker ///
348*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
349*bed243d3SAndroid Build Coastguard Worker ///
350*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c VMOVQ / \c MOVQ instruction in x86_64,
351*bed243d3SAndroid Build Coastguard Worker ///    and corresponds to the \c VMOVL / \c MOVL instruction in ia32.
352*bed243d3SAndroid Build Coastguard Worker ///
353*bed243d3SAndroid Build Coastguard Worker /// \param __A
354*bed243d3SAndroid Build Coastguard Worker ///    A 64-bit float value.
355*bed243d3SAndroid Build Coastguard Worker /// \returns A 64-bit unsigned integer containing the converted value.
356*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CAST
_castf64_u64(double __A)357*bed243d3SAndroid Build Coastguard Worker _castf64_u64(double __A) {
358*bed243d3SAndroid Build Coastguard Worker   return __builtin_bit_cast(unsigned long long, __A);
359*bed243d3SAndroid Build Coastguard Worker }
360*bed243d3SAndroid Build Coastguard Worker 
361*bed243d3SAndroid Build Coastguard Worker /// Casts a 32-bit unsigned integer value to a 32-bit float value.
362*bed243d3SAndroid Build Coastguard Worker ///
363*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
364*bed243d3SAndroid Build Coastguard Worker ///
365*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c VMOVQ / \c MOVQ instruction in x86_64,
366*bed243d3SAndroid Build Coastguard Worker ///    and corresponds to the \c FLDS instruction in ia32.
367*bed243d3SAndroid Build Coastguard Worker ///
368*bed243d3SAndroid Build Coastguard Worker /// \param __A
369*bed243d3SAndroid Build Coastguard Worker ///    A 32-bit unsigned integer value.
370*bed243d3SAndroid Build Coastguard Worker /// \returns A 32-bit float value containing the converted value.
371*bed243d3SAndroid Build Coastguard Worker static __inline__ float __DEFAULT_FN_ATTRS_CAST
_castu32_f32(unsigned int __A)372*bed243d3SAndroid Build Coastguard Worker _castu32_f32(unsigned int __A) {
373*bed243d3SAndroid Build Coastguard Worker   return __builtin_bit_cast(float, __A);
374*bed243d3SAndroid Build Coastguard Worker }
375*bed243d3SAndroid Build Coastguard Worker 
376*bed243d3SAndroid Build Coastguard Worker /// Casts a 64-bit unsigned integer value to a 64-bit float value.
377*bed243d3SAndroid Build Coastguard Worker ///
378*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
379*bed243d3SAndroid Build Coastguard Worker ///
380*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c VMOVQ / \c MOVQ instruction in x86_64,
381*bed243d3SAndroid Build Coastguard Worker ///    and corresponds to the \c FLDL instruction in ia32.
382*bed243d3SAndroid Build Coastguard Worker ///
383*bed243d3SAndroid Build Coastguard Worker /// \param __A
384*bed243d3SAndroid Build Coastguard Worker ///    A 64-bit unsigned integer value.
385*bed243d3SAndroid Build Coastguard Worker /// \returns A 64-bit float value containing the converted value.
386*bed243d3SAndroid Build Coastguard Worker static __inline__ double __DEFAULT_FN_ATTRS_CAST
_castu64_f64(unsigned long long __A)387*bed243d3SAndroid Build Coastguard Worker _castu64_f64(unsigned long long __A) {
388*bed243d3SAndroid Build Coastguard Worker   return __builtin_bit_cast(double, __A);
389*bed243d3SAndroid Build Coastguard Worker }
390*bed243d3SAndroid Build Coastguard Worker 
391*bed243d3SAndroid Build Coastguard Worker /// Adds the unsigned integer operand to the CRC-32C checksum of the
392*bed243d3SAndroid Build Coastguard Worker ///     unsigned char operand.
393*bed243d3SAndroid Build Coastguard Worker ///
394*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
395*bed243d3SAndroid Build Coastguard Worker ///
396*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c CRC32B instruction.
397*bed243d3SAndroid Build Coastguard Worker ///
398*bed243d3SAndroid Build Coastguard Worker /// \param __C
399*bed243d3SAndroid Build Coastguard Worker ///    An unsigned integer operand to add to the CRC-32C checksum of operand
400*bed243d3SAndroid Build Coastguard Worker ///    \a  __D.
401*bed243d3SAndroid Build Coastguard Worker /// \param __D
402*bed243d3SAndroid Build Coastguard Worker ///    An unsigned 8-bit integer operand used to compute the CRC-32C checksum.
403*bed243d3SAndroid Build Coastguard Worker /// \returns The result of adding operand \a __C to the CRC-32C checksum of
404*bed243d3SAndroid Build Coastguard Worker ///    operand \a __D.
405*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned int __DEFAULT_FN_ATTRS_CRC32
__crc32b(unsigned int __C,unsigned char __D)406*bed243d3SAndroid Build Coastguard Worker __crc32b(unsigned int __C, unsigned char __D)
407*bed243d3SAndroid Build Coastguard Worker {
408*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_crc32qi(__C, __D);
409*bed243d3SAndroid Build Coastguard Worker }
410*bed243d3SAndroid Build Coastguard Worker 
411*bed243d3SAndroid Build Coastguard Worker /// Adds the unsigned integer operand to the CRC-32C checksum of the
412*bed243d3SAndroid Build Coastguard Worker ///    unsigned short operand.
413*bed243d3SAndroid Build Coastguard Worker ///
414*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
415*bed243d3SAndroid Build Coastguard Worker ///
416*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c CRC32W instruction.
417*bed243d3SAndroid Build Coastguard Worker ///
418*bed243d3SAndroid Build Coastguard Worker /// \param __C
419*bed243d3SAndroid Build Coastguard Worker ///    An unsigned integer operand to add to the CRC-32C checksum of operand
420*bed243d3SAndroid Build Coastguard Worker ///    \a  __D.
421*bed243d3SAndroid Build Coastguard Worker /// \param __D
422*bed243d3SAndroid Build Coastguard Worker ///    An unsigned 16-bit integer operand used to compute the CRC-32C checksum.
423*bed243d3SAndroid Build Coastguard Worker /// \returns The result of adding operand \a __C to the CRC-32C checksum of
424*bed243d3SAndroid Build Coastguard Worker ///    operand \a __D.
425*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned int __DEFAULT_FN_ATTRS_CRC32
__crc32w(unsigned int __C,unsigned short __D)426*bed243d3SAndroid Build Coastguard Worker __crc32w(unsigned int __C, unsigned short __D)
427*bed243d3SAndroid Build Coastguard Worker {
428*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_crc32hi(__C, __D);
429*bed243d3SAndroid Build Coastguard Worker }
430*bed243d3SAndroid Build Coastguard Worker 
431*bed243d3SAndroid Build Coastguard Worker /// Adds the unsigned integer operand to the CRC-32C checksum of the
432*bed243d3SAndroid Build Coastguard Worker ///    second unsigned integer operand.
433*bed243d3SAndroid Build Coastguard Worker ///
434*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
435*bed243d3SAndroid Build Coastguard Worker ///
436*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c CRC32D instruction.
437*bed243d3SAndroid Build Coastguard Worker ///
438*bed243d3SAndroid Build Coastguard Worker /// \param __C
439*bed243d3SAndroid Build Coastguard Worker ///    An unsigned integer operand to add to the CRC-32C checksum of operand
440*bed243d3SAndroid Build Coastguard Worker ///    \a  __D.
441*bed243d3SAndroid Build Coastguard Worker /// \param __D
442*bed243d3SAndroid Build Coastguard Worker ///    An unsigned 32-bit integer operand used to compute the CRC-32C checksum.
443*bed243d3SAndroid Build Coastguard Worker /// \returns The result of adding operand \a __C to the CRC-32C checksum of
444*bed243d3SAndroid Build Coastguard Worker ///    operand \a __D.
445*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned int __DEFAULT_FN_ATTRS_CRC32
__crc32d(unsigned int __C,unsigned int __D)446*bed243d3SAndroid Build Coastguard Worker __crc32d(unsigned int __C, unsigned int __D)
447*bed243d3SAndroid Build Coastguard Worker {
448*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_crc32si(__C, __D);
449*bed243d3SAndroid Build Coastguard Worker }
450*bed243d3SAndroid Build Coastguard Worker 
451*bed243d3SAndroid Build Coastguard Worker #ifdef __x86_64__
452*bed243d3SAndroid Build Coastguard Worker /// Adds the unsigned integer operand to the CRC-32C checksum of the
453*bed243d3SAndroid Build Coastguard Worker ///    unsigned 64-bit integer operand.
454*bed243d3SAndroid Build Coastguard Worker ///
455*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
456*bed243d3SAndroid Build Coastguard Worker ///
457*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c CRC32Q instruction.
458*bed243d3SAndroid Build Coastguard Worker ///
459*bed243d3SAndroid Build Coastguard Worker /// \param __C
460*bed243d3SAndroid Build Coastguard Worker ///    An unsigned integer operand to add to the CRC-32C checksum of operand
461*bed243d3SAndroid Build Coastguard Worker ///    \a  __D.
462*bed243d3SAndroid Build Coastguard Worker /// \param __D
463*bed243d3SAndroid Build Coastguard Worker ///    An unsigned 64-bit integer operand used to compute the CRC-32C checksum.
464*bed243d3SAndroid Build Coastguard Worker /// \returns The result of adding operand \a __C to the CRC-32C checksum of
465*bed243d3SAndroid Build Coastguard Worker ///    operand \a __D.
466*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CRC32
__crc32q(unsigned long long __C,unsigned long long __D)467*bed243d3SAndroid Build Coastguard Worker __crc32q(unsigned long long __C, unsigned long long __D)
468*bed243d3SAndroid Build Coastguard Worker {
469*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_crc32di(__C, __D);
470*bed243d3SAndroid Build Coastguard Worker }
471*bed243d3SAndroid Build Coastguard Worker #endif /* __x86_64__ */
472*bed243d3SAndroid Build Coastguard Worker 
473*bed243d3SAndroid Build Coastguard Worker /// Reads the specified performance-monitoring counter. Refer to your
474*bed243d3SAndroid Build Coastguard Worker ///    processor's documentation to determine which performance counters are
475*bed243d3SAndroid Build Coastguard Worker ///    supported.
476*bed243d3SAndroid Build Coastguard Worker ///
477*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
478*bed243d3SAndroid Build Coastguard Worker ///
479*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c RDPMC instruction.
480*bed243d3SAndroid Build Coastguard Worker ///
481*bed243d3SAndroid Build Coastguard Worker /// \param __A
482*bed243d3SAndroid Build Coastguard Worker ///    The performance counter to read.
483*bed243d3SAndroid Build Coastguard Worker /// \returns The 64-bit value read from the performance counter.
484*bed243d3SAndroid Build Coastguard Worker /// \see _rdpmc
485*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__rdpmc(int __A)486*bed243d3SAndroid Build Coastguard Worker __rdpmc(int __A) {
487*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_rdpmc(__A);
488*bed243d3SAndroid Build Coastguard Worker }
489*bed243d3SAndroid Build Coastguard Worker 
490*bed243d3SAndroid Build Coastguard Worker /// Reads the processor's time-stamp counter and the \c IA32_TSC_AUX MSR
491*bed243d3SAndroid Build Coastguard Worker ///    \c (0xc0000103).
492*bed243d3SAndroid Build Coastguard Worker ///
493*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
494*bed243d3SAndroid Build Coastguard Worker ///
495*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c RDTSCP instruction.
496*bed243d3SAndroid Build Coastguard Worker ///
497*bed243d3SAndroid Build Coastguard Worker /// \param __A
498*bed243d3SAndroid Build Coastguard Worker ///    The address of where to store the 32-bit \c IA32_TSC_AUX value.
499*bed243d3SAndroid Build Coastguard Worker /// \returns The 64-bit value of the time-stamp counter.
500*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__rdtscp(unsigned int * __A)501*bed243d3SAndroid Build Coastguard Worker __rdtscp(unsigned int *__A) {
502*bed243d3SAndroid Build Coastguard Worker   return __builtin_ia32_rdtscp(__A);
503*bed243d3SAndroid Build Coastguard Worker }
504*bed243d3SAndroid Build Coastguard Worker 
505*bed243d3SAndroid Build Coastguard Worker /// Reads the processor's time-stamp counter.
506*bed243d3SAndroid Build Coastguard Worker ///
507*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
508*bed243d3SAndroid Build Coastguard Worker ///
509*bed243d3SAndroid Build Coastguard Worker /// \code
510*bed243d3SAndroid Build Coastguard Worker /// unsigned long long _rdtsc();
511*bed243d3SAndroid Build Coastguard Worker /// \endcode
512*bed243d3SAndroid Build Coastguard Worker ///
513*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c RDTSC instruction.
514*bed243d3SAndroid Build Coastguard Worker ///
515*bed243d3SAndroid Build Coastguard Worker /// \returns The 64-bit value of the time-stamp counter.
516*bed243d3SAndroid Build Coastguard Worker #define _rdtsc() __rdtsc()
517*bed243d3SAndroid Build Coastguard Worker 
518*bed243d3SAndroid Build Coastguard Worker /// Reads the specified performance monitoring counter. Refer to your
519*bed243d3SAndroid Build Coastguard Worker ///    processor's documentation to determine which performance counters are
520*bed243d3SAndroid Build Coastguard Worker ///    supported.
521*bed243d3SAndroid Build Coastguard Worker ///
522*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
523*bed243d3SAndroid Build Coastguard Worker ///
524*bed243d3SAndroid Build Coastguard Worker /// \code
525*bed243d3SAndroid Build Coastguard Worker /// unsigned long long _rdpmc(int A);
526*bed243d3SAndroid Build Coastguard Worker /// \endcode
527*bed243d3SAndroid Build Coastguard Worker ///
528*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c RDPMC instruction.
529*bed243d3SAndroid Build Coastguard Worker ///
530*bed243d3SAndroid Build Coastguard Worker /// \param A
531*bed243d3SAndroid Build Coastguard Worker ///    The performance counter to read.
532*bed243d3SAndroid Build Coastguard Worker /// \returns The 64-bit value read from the performance counter.
533*bed243d3SAndroid Build Coastguard Worker /// \see __rdpmc
534*bed243d3SAndroid Build Coastguard Worker #define _rdpmc(A) __rdpmc(A)
535*bed243d3SAndroid Build Coastguard Worker 
536*bed243d3SAndroid Build Coastguard Worker static __inline__ void __DEFAULT_FN_ATTRS
_wbinvd(void)537*bed243d3SAndroid Build Coastguard Worker _wbinvd(void) {
538*bed243d3SAndroid Build Coastguard Worker   __builtin_ia32_wbinvd();
539*bed243d3SAndroid Build Coastguard Worker }
540*bed243d3SAndroid Build Coastguard Worker 
541*bed243d3SAndroid Build Coastguard Worker /// Rotates an 8-bit value to the left by the specified number of bits.
542*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
543*bed243d3SAndroid Build Coastguard Worker ///    the value.
544*bed243d3SAndroid Build Coastguard Worker ///
545*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
546*bed243d3SAndroid Build Coastguard Worker ///
547*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROL instruction.
548*bed243d3SAndroid Build Coastguard Worker ///
549*bed243d3SAndroid Build Coastguard Worker /// \param __X
550*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 8-bit value to be rotated.
551*bed243d3SAndroid Build Coastguard Worker /// \param __C
552*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
553*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
554*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
__rolb(unsigned char __X,int __C)555*bed243d3SAndroid Build Coastguard Worker __rolb(unsigned char __X, int __C) {
556*bed243d3SAndroid Build Coastguard Worker   return __builtin_rotateleft8(__X, __C);
557*bed243d3SAndroid Build Coastguard Worker }
558*bed243d3SAndroid Build Coastguard Worker 
559*bed243d3SAndroid Build Coastguard Worker /// Rotates an 8-bit value to the right by the specified number of bits.
560*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
561*bed243d3SAndroid Build Coastguard Worker ///    the value.
562*bed243d3SAndroid Build Coastguard Worker ///
563*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
564*bed243d3SAndroid Build Coastguard Worker ///
565*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROR instruction.
566*bed243d3SAndroid Build Coastguard Worker ///
567*bed243d3SAndroid Build Coastguard Worker /// \param __X
568*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 8-bit value to be rotated.
569*bed243d3SAndroid Build Coastguard Worker /// \param __C
570*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
571*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
572*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
__rorb(unsigned char __X,int __C)573*bed243d3SAndroid Build Coastguard Worker __rorb(unsigned char __X, int __C) {
574*bed243d3SAndroid Build Coastguard Worker   return __builtin_rotateright8(__X, __C);
575*bed243d3SAndroid Build Coastguard Worker }
576*bed243d3SAndroid Build Coastguard Worker 
577*bed243d3SAndroid Build Coastguard Worker /// Rotates a 16-bit value to the left by the specified number of bits.
578*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
579*bed243d3SAndroid Build Coastguard Worker ///    the value.
580*bed243d3SAndroid Build Coastguard Worker ///
581*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
582*bed243d3SAndroid Build Coastguard Worker ///
583*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROL instruction.
584*bed243d3SAndroid Build Coastguard Worker ///
585*bed243d3SAndroid Build Coastguard Worker /// \param __X
586*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 16-bit value to be rotated.
587*bed243d3SAndroid Build Coastguard Worker /// \param __C
588*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
589*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
590*bed243d3SAndroid Build Coastguard Worker /// \see _rotwl
591*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned short __DEFAULT_FN_ATTRS_CONSTEXPR
__rolw(unsigned short __X,int __C)592*bed243d3SAndroid Build Coastguard Worker __rolw(unsigned short __X, int __C) {
593*bed243d3SAndroid Build Coastguard Worker   return __builtin_rotateleft16(__X, __C);
594*bed243d3SAndroid Build Coastguard Worker }
595*bed243d3SAndroid Build Coastguard Worker 
596*bed243d3SAndroid Build Coastguard Worker /// Rotates a 16-bit value to the right by the specified number of bits.
597*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
598*bed243d3SAndroid Build Coastguard Worker ///    the value.
599*bed243d3SAndroid Build Coastguard Worker ///
600*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
601*bed243d3SAndroid Build Coastguard Worker ///
602*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROR instruction.
603*bed243d3SAndroid Build Coastguard Worker ///
604*bed243d3SAndroid Build Coastguard Worker /// \param __X
605*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 16-bit value to be rotated.
606*bed243d3SAndroid Build Coastguard Worker /// \param __C
607*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
608*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
609*bed243d3SAndroid Build Coastguard Worker /// \see _rotwr
610*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned short __DEFAULT_FN_ATTRS_CONSTEXPR
__rorw(unsigned short __X,int __C)611*bed243d3SAndroid Build Coastguard Worker __rorw(unsigned short __X, int __C) {
612*bed243d3SAndroid Build Coastguard Worker   return __builtin_rotateright16(__X, __C);
613*bed243d3SAndroid Build Coastguard Worker }
614*bed243d3SAndroid Build Coastguard Worker 
615*bed243d3SAndroid Build Coastguard Worker /// Rotates a 32-bit value to the left by the specified number of bits.
616*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
617*bed243d3SAndroid Build Coastguard Worker ///    the value.
618*bed243d3SAndroid Build Coastguard Worker ///
619*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
620*bed243d3SAndroid Build Coastguard Worker ///
621*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROL instruction.
622*bed243d3SAndroid Build Coastguard Worker ///
623*bed243d3SAndroid Build Coastguard Worker /// \param __X
624*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 32-bit value to be rotated.
625*bed243d3SAndroid Build Coastguard Worker /// \param __C
626*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
627*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
628*bed243d3SAndroid Build Coastguard Worker /// \see _rotl
629*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR
__rold(unsigned int __X,int __C)630*bed243d3SAndroid Build Coastguard Worker __rold(unsigned int __X, int __C) {
631*bed243d3SAndroid Build Coastguard Worker   return __builtin_rotateleft32(__X, (unsigned int)__C);
632*bed243d3SAndroid Build Coastguard Worker }
633*bed243d3SAndroid Build Coastguard Worker 
634*bed243d3SAndroid Build Coastguard Worker /// Rotates a 32-bit value to the right by the specified number of bits.
635*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
636*bed243d3SAndroid Build Coastguard Worker ///    the value.
637*bed243d3SAndroid Build Coastguard Worker ///
638*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
639*bed243d3SAndroid Build Coastguard Worker ///
640*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROR instruction.
641*bed243d3SAndroid Build Coastguard Worker ///
642*bed243d3SAndroid Build Coastguard Worker /// \param __X
643*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 32-bit value to be rotated.
644*bed243d3SAndroid Build Coastguard Worker /// \param __C
645*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
646*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
647*bed243d3SAndroid Build Coastguard Worker /// \see _rotr
648*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR
__rord(unsigned int __X,int __C)649*bed243d3SAndroid Build Coastguard Worker __rord(unsigned int __X, int __C) {
650*bed243d3SAndroid Build Coastguard Worker   return __builtin_rotateright32(__X, (unsigned int)__C);
651*bed243d3SAndroid Build Coastguard Worker }
652*bed243d3SAndroid Build Coastguard Worker 
653*bed243d3SAndroid Build Coastguard Worker #ifdef __x86_64__
654*bed243d3SAndroid Build Coastguard Worker /// Rotates a 64-bit value to the left by the specified number of bits.
655*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
656*bed243d3SAndroid Build Coastguard Worker ///    the value.
657*bed243d3SAndroid Build Coastguard Worker ///
658*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
659*bed243d3SAndroid Build Coastguard Worker ///
660*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROL instruction.
661*bed243d3SAndroid Build Coastguard Worker ///
662*bed243d3SAndroid Build Coastguard Worker /// \param __X
663*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 64-bit value to be rotated.
664*bed243d3SAndroid Build Coastguard Worker /// \param __C
665*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
666*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
667*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
__rolq(unsigned long long __X,int __C)668*bed243d3SAndroid Build Coastguard Worker __rolq(unsigned long long __X, int __C) {
669*bed243d3SAndroid Build Coastguard Worker   return __builtin_rotateleft64(__X, (unsigned long long)__C);
670*bed243d3SAndroid Build Coastguard Worker }
671*bed243d3SAndroid Build Coastguard Worker 
672*bed243d3SAndroid Build Coastguard Worker /// Rotates a 64-bit value to the right by the specified number of bits.
673*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
674*bed243d3SAndroid Build Coastguard Worker ///    the value.
675*bed243d3SAndroid Build Coastguard Worker ///
676*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
677*bed243d3SAndroid Build Coastguard Worker ///
678*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROR instruction.
679*bed243d3SAndroid Build Coastguard Worker ///
680*bed243d3SAndroid Build Coastguard Worker /// \param __X
681*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 64-bit value to be rotated.
682*bed243d3SAndroid Build Coastguard Worker /// \param __C
683*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
684*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
685*bed243d3SAndroid Build Coastguard Worker static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
__rorq(unsigned long long __X,int __C)686*bed243d3SAndroid Build Coastguard Worker __rorq(unsigned long long __X, int __C) {
687*bed243d3SAndroid Build Coastguard Worker   return __builtin_rotateright64(__X, (unsigned long long)__C);
688*bed243d3SAndroid Build Coastguard Worker }
689*bed243d3SAndroid Build Coastguard Worker #endif /* __x86_64__ */
690*bed243d3SAndroid Build Coastguard Worker 
691*bed243d3SAndroid Build Coastguard Worker #ifndef _MSC_VER
692*bed243d3SAndroid Build Coastguard Worker /* These are already provided as builtins for MSVC. */
693*bed243d3SAndroid Build Coastguard Worker /* Select the correct function based on the size of long. */
694*bed243d3SAndroid Build Coastguard Worker #ifdef __LP64__
695*bed243d3SAndroid Build Coastguard Worker /// Rotates a 64-bit value to the left by the specified number of bits.
696*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
697*bed243d3SAndroid Build Coastguard Worker ///    the value.
698*bed243d3SAndroid Build Coastguard Worker ///
699*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
700*bed243d3SAndroid Build Coastguard Worker ///
701*bed243d3SAndroid Build Coastguard Worker /// \code
702*bed243d3SAndroid Build Coastguard Worker /// unsigned long long _lrotl(unsigned long long a, int b);
703*bed243d3SAndroid Build Coastguard Worker /// \endcode
704*bed243d3SAndroid Build Coastguard Worker ///
705*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROL instruction.
706*bed243d3SAndroid Build Coastguard Worker ///
707*bed243d3SAndroid Build Coastguard Worker /// \param a
708*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 64-bit value to be rotated.
709*bed243d3SAndroid Build Coastguard Worker /// \param b
710*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
711*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
712*bed243d3SAndroid Build Coastguard Worker /// \see __rolq
713*bed243d3SAndroid Build Coastguard Worker #define _lrotl(a,b) __rolq((a), (b))
714*bed243d3SAndroid Build Coastguard Worker 
715*bed243d3SAndroid Build Coastguard Worker /// Rotates a 64-bit value to the right by the specified number of bits.
716*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
717*bed243d3SAndroid Build Coastguard Worker ///    the value.
718*bed243d3SAndroid Build Coastguard Worker ///
719*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
720*bed243d3SAndroid Build Coastguard Worker ///
721*bed243d3SAndroid Build Coastguard Worker /// \code
722*bed243d3SAndroid Build Coastguard Worker /// unsigned long long _lrotr(unsigned long long a, int b);
723*bed243d3SAndroid Build Coastguard Worker /// \endcode
724*bed243d3SAndroid Build Coastguard Worker ///
725*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROR instruction.
726*bed243d3SAndroid Build Coastguard Worker ///
727*bed243d3SAndroid Build Coastguard Worker /// \param a
728*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 64-bit value to be rotated.
729*bed243d3SAndroid Build Coastguard Worker /// \param b
730*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
731*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
732*bed243d3SAndroid Build Coastguard Worker /// \see __rorq
733*bed243d3SAndroid Build Coastguard Worker #define _lrotr(a,b) __rorq((a), (b))
734*bed243d3SAndroid Build Coastguard Worker #else // __LP64__
735*bed243d3SAndroid Build Coastguard Worker /// Rotates a 32-bit value to the left by the specified number of bits.
736*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
737*bed243d3SAndroid Build Coastguard Worker ///    the value.
738*bed243d3SAndroid Build Coastguard Worker ///
739*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
740*bed243d3SAndroid Build Coastguard Worker ///
741*bed243d3SAndroid Build Coastguard Worker /// \code
742*bed243d3SAndroid Build Coastguard Worker /// unsigned int _lrotl(unsigned int a, int b);
743*bed243d3SAndroid Build Coastguard Worker /// \endcode
744*bed243d3SAndroid Build Coastguard Worker ///
745*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROL instruction.
746*bed243d3SAndroid Build Coastguard Worker ///
747*bed243d3SAndroid Build Coastguard Worker /// \param a
748*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 32-bit value to be rotated.
749*bed243d3SAndroid Build Coastguard Worker /// \param b
750*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
751*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
752*bed243d3SAndroid Build Coastguard Worker /// \see __rold
753*bed243d3SAndroid Build Coastguard Worker #define _lrotl(a,b) __rold((a), (b))
754*bed243d3SAndroid Build Coastguard Worker 
755*bed243d3SAndroid Build Coastguard Worker /// Rotates a 32-bit value to the right by the specified number of bits.
756*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
757*bed243d3SAndroid Build Coastguard Worker ///    the value.
758*bed243d3SAndroid Build Coastguard Worker ///
759*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
760*bed243d3SAndroid Build Coastguard Worker ///
761*bed243d3SAndroid Build Coastguard Worker /// \code
762*bed243d3SAndroid Build Coastguard Worker /// unsigned int _lrotr(unsigned int a, int b);
763*bed243d3SAndroid Build Coastguard Worker /// \endcode
764*bed243d3SAndroid Build Coastguard Worker ///
765*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROR instruction.
766*bed243d3SAndroid Build Coastguard Worker ///
767*bed243d3SAndroid Build Coastguard Worker /// \param a
768*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 32-bit value to be rotated.
769*bed243d3SAndroid Build Coastguard Worker /// \param b
770*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
771*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
772*bed243d3SAndroid Build Coastguard Worker /// \see __rord
773*bed243d3SAndroid Build Coastguard Worker #define _lrotr(a,b) __rord((a), (b))
774*bed243d3SAndroid Build Coastguard Worker #endif // __LP64__
775*bed243d3SAndroid Build Coastguard Worker 
776*bed243d3SAndroid Build Coastguard Worker /// Rotates a 32-bit value to the left by the specified number of bits.
777*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
778*bed243d3SAndroid Build Coastguard Worker ///    the value.
779*bed243d3SAndroid Build Coastguard Worker ///
780*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
781*bed243d3SAndroid Build Coastguard Worker ///
782*bed243d3SAndroid Build Coastguard Worker /// \code
783*bed243d3SAndroid Build Coastguard Worker /// unsigned int _rotl(unsigned int a, int b);
784*bed243d3SAndroid Build Coastguard Worker /// \endcode
785*bed243d3SAndroid Build Coastguard Worker ///
786*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROL instruction.
787*bed243d3SAndroid Build Coastguard Worker ///
788*bed243d3SAndroid Build Coastguard Worker /// \param a
789*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 32-bit value to be rotated.
790*bed243d3SAndroid Build Coastguard Worker /// \param b
791*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
792*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
793*bed243d3SAndroid Build Coastguard Worker /// \see __rold
794*bed243d3SAndroid Build Coastguard Worker #define _rotl(a,b) __rold((a), (b))
795*bed243d3SAndroid Build Coastguard Worker 
796*bed243d3SAndroid Build Coastguard Worker /// Rotates a 32-bit value to the right by the specified number of bits.
797*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
798*bed243d3SAndroid Build Coastguard Worker ///    the value.
799*bed243d3SAndroid Build Coastguard Worker ///
800*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
801*bed243d3SAndroid Build Coastguard Worker ///
802*bed243d3SAndroid Build Coastguard Worker /// \code
803*bed243d3SAndroid Build Coastguard Worker /// unsigned int _rotr(unsigned int a, int b);
804*bed243d3SAndroid Build Coastguard Worker /// \endcode
805*bed243d3SAndroid Build Coastguard Worker ///
806*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROR instruction.
807*bed243d3SAndroid Build Coastguard Worker ///
808*bed243d3SAndroid Build Coastguard Worker /// \param a
809*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 32-bit value to be rotated.
810*bed243d3SAndroid Build Coastguard Worker /// \param b
811*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
812*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
813*bed243d3SAndroid Build Coastguard Worker /// \see __rord
814*bed243d3SAndroid Build Coastguard Worker #define _rotr(a,b) __rord((a), (b))
815*bed243d3SAndroid Build Coastguard Worker #endif // _MSC_VER
816*bed243d3SAndroid Build Coastguard Worker 
817*bed243d3SAndroid Build Coastguard Worker /* These are not builtins so need to be provided in all modes. */
818*bed243d3SAndroid Build Coastguard Worker /// Rotates a 16-bit value to the left by the specified number of bits.
819*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
820*bed243d3SAndroid Build Coastguard Worker ///    the value.
821*bed243d3SAndroid Build Coastguard Worker ///
822*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
823*bed243d3SAndroid Build Coastguard Worker ///
824*bed243d3SAndroid Build Coastguard Worker /// \code
825*bed243d3SAndroid Build Coastguard Worker /// unsigned short _rotwl(unsigned short a, int b);
826*bed243d3SAndroid Build Coastguard Worker /// \endcode
827*bed243d3SAndroid Build Coastguard Worker ///
828*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROL instruction.
829*bed243d3SAndroid Build Coastguard Worker ///
830*bed243d3SAndroid Build Coastguard Worker /// \param a
831*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 16-bit value to be rotated.
832*bed243d3SAndroid Build Coastguard Worker /// \param b
833*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
834*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
835*bed243d3SAndroid Build Coastguard Worker /// \see __rolw
836*bed243d3SAndroid Build Coastguard Worker #define _rotwl(a,b) __rolw((a), (b))
837*bed243d3SAndroid Build Coastguard Worker 
838*bed243d3SAndroid Build Coastguard Worker /// Rotates a 16-bit value to the right by the specified number of bits.
839*bed243d3SAndroid Build Coastguard Worker ///    This operation is undefined if the number of bits exceeds the size of
840*bed243d3SAndroid Build Coastguard Worker ///    the value.
841*bed243d3SAndroid Build Coastguard Worker ///
842*bed243d3SAndroid Build Coastguard Worker /// \headerfile <x86intrin.h>
843*bed243d3SAndroid Build Coastguard Worker ///
844*bed243d3SAndroid Build Coastguard Worker /// \code
845*bed243d3SAndroid Build Coastguard Worker /// unsigned short _rotwr(unsigned short a, int b);
846*bed243d3SAndroid Build Coastguard Worker /// \endcode
847*bed243d3SAndroid Build Coastguard Worker ///
848*bed243d3SAndroid Build Coastguard Worker /// This intrinsic corresponds to the \c ROR instruction.
849*bed243d3SAndroid Build Coastguard Worker ///
850*bed243d3SAndroid Build Coastguard Worker /// \param a
851*bed243d3SAndroid Build Coastguard Worker ///    The unsigned 16-bit value to be rotated.
852*bed243d3SAndroid Build Coastguard Worker /// \param b
853*bed243d3SAndroid Build Coastguard Worker ///    The number of bits to rotate the value.
854*bed243d3SAndroid Build Coastguard Worker /// \returns The rotated value.
855*bed243d3SAndroid Build Coastguard Worker /// \see __rorw
856*bed243d3SAndroid Build Coastguard Worker #define _rotwr(a,b) __rorw((a), (b))
857*bed243d3SAndroid Build Coastguard Worker 
858*bed243d3SAndroid Build Coastguard Worker #undef __DEFAULT_FN_ATTRS
859*bed243d3SAndroid Build Coastguard Worker #undef __DEFAULT_FN_ATTRS_CAST
860*bed243d3SAndroid Build Coastguard Worker #undef __DEFAULT_FN_ATTRS_CRC32
861*bed243d3SAndroid Build Coastguard Worker #undef __DEFAULT_FN_ATTRS_CONSTEXPR
862*bed243d3SAndroid Build Coastguard Worker 
863*bed243d3SAndroid Build Coastguard Worker #endif /* __IA32INTRIN_H */
864