clang 20.0.0git
tbmintrin.h
Go to the documentation of this file.
1/*===---- tbmintrin.h - TBM intrinsics -------------------------------------===
2 *
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
6 *
7 *===-----------------------------------------------------------------------===
8 */
9
10#ifndef __X86INTRIN_H
11#error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead."
12#endif
13
14#ifndef __TBMINTRIN_H
15#define __TBMINTRIN_H
16
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__("tbm"))) constexpr
21#else
22#define __DEFAULT_FN_ATTRS \
23 __attribute__((__always_inline__, __nodebug__, __target__("tbm")))
24#endif
25
26#define __bextri_u32(a, b) \
27 ((unsigned int)__builtin_ia32_bextri_u32((unsigned int)(a), \
28 (unsigned int)(b)))
29
30static __inline__ unsigned int __DEFAULT_FN_ATTRS
31__blcfill_u32(unsigned int __a) {
32 return __a & (__a + 1);
33}
34
35static __inline__ unsigned int __DEFAULT_FN_ATTRS
36__blci_u32(unsigned int __a) {
37 return __a | ~(__a + 1);
38}
39
40static __inline__ unsigned int __DEFAULT_FN_ATTRS
41__blcic_u32(unsigned int __a) {
42 return ~__a & (__a + 1);
43}
44
45static __inline__ unsigned int __DEFAULT_FN_ATTRS
46__blcmsk_u32(unsigned int __a) {
47 return __a ^ (__a + 1);
48}
49
50static __inline__ unsigned int __DEFAULT_FN_ATTRS
51__blcs_u32(unsigned int __a) {
52 return __a | (__a + 1);
53}
54
55static __inline__ unsigned int __DEFAULT_FN_ATTRS
56__blsfill_u32(unsigned int __a) {
57 return __a | (__a - 1);
58}
59
60static __inline__ unsigned int __DEFAULT_FN_ATTRS
61__blsic_u32(unsigned int __a) {
62 return ~__a | (__a - 1);
63}
64
65static __inline__ unsigned int __DEFAULT_FN_ATTRS
66__t1mskc_u32(unsigned int __a) {
67 return ~__a | (__a + 1);
68}
69
70static __inline__ unsigned int __DEFAULT_FN_ATTRS
71__tzmsk_u32(unsigned int __a) {
72 return ~__a & (__a - 1);
73}
74
75#ifdef __x86_64__
76#define __bextri_u64(a, b) \
77 ((unsigned long long)__builtin_ia32_bextri_u64((unsigned long long)(a), \
78 (unsigned long long)(b)))
79
80static __inline__ unsigned long long __DEFAULT_FN_ATTRS
81__blcfill_u64(unsigned long long __a) {
82 return __a & (__a + 1);
83}
84
85static __inline__ unsigned long long __DEFAULT_FN_ATTRS
86__blci_u64(unsigned long long __a) {
87 return __a | ~(__a + 1);
88}
89
90static __inline__ unsigned long long __DEFAULT_FN_ATTRS
91__blcic_u64(unsigned long long __a) {
92 return ~__a & (__a + 1);
93}
94
95static __inline__ unsigned long long __DEFAULT_FN_ATTRS
96__blcmsk_u64(unsigned long long __a) {
97 return __a ^ (__a + 1);
98}
99
100static __inline__ unsigned long long __DEFAULT_FN_ATTRS
101__blcs_u64(unsigned long long __a) {
102 return __a | (__a + 1);
103}
104
105static __inline__ unsigned long long __DEFAULT_FN_ATTRS
106__blsfill_u64(unsigned long long __a) {
107 return __a | (__a - 1);
108}
109
110static __inline__ unsigned long long __DEFAULT_FN_ATTRS
111__blsic_u64(unsigned long long __a) {
112 return ~__a | (__a - 1);
113}
114
115static __inline__ unsigned long long __DEFAULT_FN_ATTRS
116__t1mskc_u64(unsigned long long __a) {
117 return ~__a | (__a + 1);
118}
119
120static __inline__ unsigned long long __DEFAULT_FN_ATTRS
121__tzmsk_u64(unsigned long long __a) {
122 return ~__a & (__a - 1);
123}
124#endif
125
126#undef __DEFAULT_FN_ATTRS
127
128#endif /* __TBMINTRIN_H */
static __inline__ void int __a
Definition: emmintrin.h:4079
static __inline__ unsigned int __DEFAULT_FN_ATTRS __blcmsk_u32(unsigned int __a)
Definition: tbmintrin.h:46
static __inline__ unsigned int __DEFAULT_FN_ATTRS __blcs_u32(unsigned int __a)
Definition: tbmintrin.h:51
static __inline__ unsigned int __DEFAULT_FN_ATTRS __blcic_u32(unsigned int __a)
Definition: tbmintrin.h:41
#define __DEFAULT_FN_ATTRS
Definition: tbmintrin.h:22
static __inline__ unsigned int __DEFAULT_FN_ATTRS __blci_u32(unsigned int __a)
Definition: tbmintrin.h:36
static __inline__ unsigned int __DEFAULT_FN_ATTRS __blcfill_u32(unsigned int __a)
Definition: tbmintrin.h:31
static __inline__ unsigned int __DEFAULT_FN_ATTRS __blsfill_u32(unsigned int __a)
Definition: tbmintrin.h:56
static __inline__ unsigned int __DEFAULT_FN_ATTRS __tzmsk_u32(unsigned int __a)
Definition: tbmintrin.h:71
static __inline__ unsigned int __DEFAULT_FN_ATTRS __t1mskc_u32(unsigned int __a)
Definition: tbmintrin.h:66
static __inline__ unsigned int __DEFAULT_FN_ATTRS __blsic_u32(unsigned int __a)
Definition: tbmintrin.h:61