[docs] Fix build-docs.sh
[llvm-project.git] / clang / lib / Headers / tbmintrin.h
blobf4e848a1c0019c1ed5ce827d86fbe1054b203e60
1 /*===---- tbmintrin.h - TBM 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 #ifndef __X86INTRIN_H
11 #error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead."
12 #endif
14 #ifndef __TBMINTRIN_H
15 #define __TBMINTRIN_H
17 /* Define the default attributes for the functions in this file. */
18 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("tbm")))
20 #define __bextri_u32(a, b) \
21 ((unsigned int)__builtin_ia32_bextri_u32((unsigned int)(a), \
22 (unsigned int)(b)))
24 static __inline__ unsigned int __DEFAULT_FN_ATTRS
25 __blcfill_u32(unsigned int __a)
27 return __a & (__a + 1);
30 static __inline__ unsigned int __DEFAULT_FN_ATTRS
31 __blci_u32(unsigned int __a)
33 return __a | ~(__a + 1);
36 static __inline__ unsigned int __DEFAULT_FN_ATTRS
37 __blcic_u32(unsigned int __a)
39 return ~__a & (__a + 1);
42 static __inline__ unsigned int __DEFAULT_FN_ATTRS
43 __blcmsk_u32(unsigned int __a)
45 return __a ^ (__a + 1);
48 static __inline__ unsigned int __DEFAULT_FN_ATTRS
49 __blcs_u32(unsigned int __a)
51 return __a | (__a + 1);
54 static __inline__ unsigned int __DEFAULT_FN_ATTRS
55 __blsfill_u32(unsigned int __a)
57 return __a | (__a - 1);
60 static __inline__ unsigned int __DEFAULT_FN_ATTRS
61 __blsic_u32(unsigned int __a)
63 return ~__a | (__a - 1);
66 static __inline__ unsigned int __DEFAULT_FN_ATTRS
67 __t1mskc_u32(unsigned int __a)
69 return ~__a | (__a + 1);
72 static __inline__ unsigned int __DEFAULT_FN_ATTRS
73 __tzmsk_u32(unsigned int __a)
75 return ~__a & (__a - 1);
78 #ifdef __x86_64__
79 #define __bextri_u64(a, b) \
80 ((unsigned long long)__builtin_ia32_bextri_u64((unsigned long long)(a), \
81 (unsigned long long)(b)))
83 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
84 __blcfill_u64(unsigned long long __a)
86 return __a & (__a + 1);
89 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
90 __blci_u64(unsigned long long __a)
92 return __a | ~(__a + 1);
95 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
96 __blcic_u64(unsigned long long __a)
98 return ~__a & (__a + 1);
101 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
102 __blcmsk_u64(unsigned long long __a)
104 return __a ^ (__a + 1);
107 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
108 __blcs_u64(unsigned long long __a)
110 return __a | (__a + 1);
113 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
114 __blsfill_u64(unsigned long long __a)
116 return __a | (__a - 1);
119 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
120 __blsic_u64(unsigned long long __a)
122 return ~__a | (__a - 1);
125 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
126 __t1mskc_u64(unsigned long long __a)
128 return ~__a | (__a + 1);
131 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
132 __tzmsk_u64(unsigned long long __a)
134 return ~__a & (__a - 1);
136 #endif
138 #undef __DEFAULT_FN_ATTRS
140 #endif /* __TBMINTRIN_H */