[clang][NFC] simplify the unset check in `ParseLabeledStatement` (#117430)
[llvm-project.git] / clang / lib / Headers / lzcntintrin.h
blob27509021ec2589ffd10bb82d612b182d44ff52da
1 /*===---- lzcntintrin.h - LZCNT intrinsics ---------------------------------===
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 *===-----------------------------------------------------------------------===
8 */
10 #if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
11 #error "Never use <lzcntintrin.h> directly; include <x86intrin.h> instead."
12 #endif
14 #ifndef __LZCNTINTRIN_H
15 #define __LZCNTINTRIN_H
17 /* Define the default attributes for the functions in this file. */
18 #if defined(__cplusplus) && (__cplusplus >= 201103L)
19 #define __DEFAULT_FN_ATTRS \
20 __attribute__((__always_inline__, __nodebug__, __target__("lzcnt"))) constexpr
21 #else
22 #define __DEFAULT_FN_ATTRS \
23 __attribute__((__always_inline__, __nodebug__, __target__("lzcnt")))
24 #endif
26 #ifndef _MSC_VER
27 /// Counts the number of leading zero bits in the operand.
28 ///
29 /// \headerfile <x86intrin.h>
30 ///
31 /// This intrinsic corresponds to the \c LZCNT instruction.
32 ///
33 /// \param __X
34 /// An unsigned 16-bit integer whose leading zeros are to be counted.
35 /// \returns An unsigned 16-bit integer containing the number of leading zero
36 /// bits in the operand.
37 #define __lzcnt16(X) __builtin_ia32_lzcnt_u16((unsigned short)(X))
38 #endif // _MSC_VER
40 /// Counts the number of leading zero bits in the operand.
41 ///
42 /// \headerfile <x86intrin.h>
43 ///
44 /// This intrinsic corresponds to the \c LZCNT instruction.
45 ///
46 /// \param __X
47 /// An unsigned 32-bit integer whose leading zeros are to be counted.
48 /// \returns An unsigned 32-bit integer containing the number of leading zero
49 /// bits in the operand.
50 /// \see _lzcnt_u32
51 static __inline__ unsigned int __DEFAULT_FN_ATTRS
52 __lzcnt32(unsigned int __X) {
53 return __builtin_ia32_lzcnt_u32(__X);
56 /// Counts the number of leading zero bits in the operand.
57 ///
58 /// \headerfile <x86intrin.h>
59 ///
60 /// This intrinsic corresponds to the \c LZCNT instruction.
61 ///
62 /// \param __X
63 /// An unsigned 32-bit integer whose leading zeros are to be counted.
64 /// \returns An unsigned 32-bit integer containing the number of leading zero
65 /// bits in the operand.
66 /// \see __lzcnt32
67 static __inline__ unsigned int __DEFAULT_FN_ATTRS
68 _lzcnt_u32(unsigned int __X) {
69 return __builtin_ia32_lzcnt_u32(__X);
72 #ifdef __x86_64__
73 #ifndef _MSC_VER
74 /// Counts the number of leading zero bits in the operand.
75 ///
76 /// \headerfile <x86intrin.h>
77 ///
78 /// This intrinsic corresponds to the \c LZCNT instruction.
79 ///
80 /// \param __X
81 /// An unsigned 64-bit integer whose leading zeros are to be counted.
82 /// \returns An unsigned 64-bit integer containing the number of leading zero
83 /// bits in the operand.
84 /// \see _lzcnt_u64
85 #define __lzcnt64(X) __builtin_ia32_lzcnt_u64((unsigned long long)(X))
86 #endif // _MSC_VER
88 /// Counts the number of leading zero bits in the operand.
89 ///
90 /// \headerfile <x86intrin.h>
91 ///
92 /// This intrinsic corresponds to the \c LZCNT instruction.
93 ///
94 /// \param __X
95 /// An unsigned 64-bit integer whose leading zeros are to be counted.
96 /// \returns An unsigned 64-bit integer containing the number of leading zero
97 /// bits in the operand.
98 /// \see __lzcnt64
99 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
100 _lzcnt_u64(unsigned long long __X) {
101 return __builtin_ia32_lzcnt_u64(__X);
103 #endif
105 #undef __DEFAULT_FN_ATTRS
107 #endif /* __LZCNTINTRIN_H */