1 | /* Copyright (C) 2010-2021 Free Software Foundation, Inc.
|
---|
2 |
|
---|
3 | This file is part of GCC.
|
---|
4 |
|
---|
5 | GCC is free software; you can redistribute it and/or modify
|
---|
6 | it under the terms of the GNU General Public License as published by
|
---|
7 | the Free Software Foundation; either version 3, or (at your option)
|
---|
8 | any later version.
|
---|
9 |
|
---|
10 | GCC is distributed in the hope that it will be useful,
|
---|
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | GNU General Public License for more details.
|
---|
14 |
|
---|
15 | Under Section 7 of GPL version 3, you are granted additional
|
---|
16 | permissions described in the GCC Runtime Library Exception, version
|
---|
17 | 3.1, as published by the Free Software Foundation.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU General Public License and
|
---|
20 | a copy of the GCC Runtime Library Exception along with this program;
|
---|
21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
---|
22 | <http://www.gnu.org/licenses/>. */
|
---|
23 |
|
---|
24 | #ifndef _X86GPRINTRIN_H_INCLUDED
|
---|
25 | # error "Never use <tbmintrin.h> directly; include <x86gprintrin.h> instead."
|
---|
26 | #endif
|
---|
27 |
|
---|
28 | #ifndef _TBMINTRIN_H_INCLUDED
|
---|
29 | #define _TBMINTRIN_H_INCLUDED
|
---|
30 |
|
---|
31 | #ifndef __TBM__
|
---|
32 | #pragma GCC push_options
|
---|
33 | #pragma GCC target("tbm")
|
---|
34 | #define __DISABLE_TBM__
|
---|
35 | #endif /* __TBM__ */
|
---|
36 |
|
---|
37 | #ifdef __OPTIMIZE__
|
---|
38 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
39 | __bextri_u32 (unsigned int __X, const unsigned int __I)
|
---|
40 | {
|
---|
41 | return __builtin_ia32_bextri_u32 (__X, __I);
|
---|
42 | }
|
---|
43 | #else
|
---|
44 | #define __bextri_u32(X, I) \
|
---|
45 | ((unsigned int)__builtin_ia32_bextri_u32 ((unsigned int)(X), \
|
---|
46 | (unsigned int)(I)))
|
---|
47 | #endif /*__OPTIMIZE__ */
|
---|
48 |
|
---|
49 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
50 | __blcfill_u32 (unsigned int __X)
|
---|
51 | {
|
---|
52 | return __X & (__X + 1);
|
---|
53 | }
|
---|
54 |
|
---|
55 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
56 | __blci_u32 (unsigned int __X)
|
---|
57 | {
|
---|
58 | return __X | ~(__X + 1);
|
---|
59 | }
|
---|
60 |
|
---|
61 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
62 | __blcic_u32 (unsigned int __X)
|
---|
63 | {
|
---|
64 | return ~__X & (__X + 1);
|
---|
65 | }
|
---|
66 |
|
---|
67 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
68 | __blcmsk_u32 (unsigned int __X)
|
---|
69 | {
|
---|
70 | return __X ^ (__X + 1);
|
---|
71 | }
|
---|
72 |
|
---|
73 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
74 | __blcs_u32 (unsigned int __X)
|
---|
75 | {
|
---|
76 | return __X | (__X + 1);
|
---|
77 | }
|
---|
78 |
|
---|
79 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
80 | __blsfill_u32 (unsigned int __X)
|
---|
81 | {
|
---|
82 | return __X | (__X - 1);
|
---|
83 | }
|
---|
84 |
|
---|
85 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
86 | __blsic_u32 (unsigned int __X)
|
---|
87 | {
|
---|
88 | return ~__X | (__X - 1);
|
---|
89 | }
|
---|
90 |
|
---|
91 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
92 | __t1mskc_u32 (unsigned int __X)
|
---|
93 | {
|
---|
94 | return ~__X | (__X + 1);
|
---|
95 | }
|
---|
96 |
|
---|
97 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
98 | __tzmsk_u32 (unsigned int __X)
|
---|
99 | {
|
---|
100 | return ~__X & (__X - 1);
|
---|
101 | }
|
---|
102 |
|
---|
103 |
|
---|
104 |
|
---|
105 | #ifdef __x86_64__
|
---|
106 | #ifdef __OPTIMIZE__
|
---|
107 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
108 | __bextri_u64 (unsigned long long __X, const unsigned int __I)
|
---|
109 | {
|
---|
110 | return __builtin_ia32_bextri_u64 (__X, __I);
|
---|
111 | }
|
---|
112 | #else
|
---|
113 | #define __bextri_u64(X, I) \
|
---|
114 | ((unsigned long long)__builtin_ia32_bextri_u64 ((unsigned long long)(X), \
|
---|
115 | (unsigned long long)(I)))
|
---|
116 | #endif /*__OPTIMIZE__ */
|
---|
117 |
|
---|
118 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
119 | __blcfill_u64 (unsigned long long __X)
|
---|
120 | {
|
---|
121 | return __X & (__X + 1);
|
---|
122 | }
|
---|
123 |
|
---|
124 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
125 | __blci_u64 (unsigned long long __X)
|
---|
126 | {
|
---|
127 | return __X | ~(__X + 1);
|
---|
128 | }
|
---|
129 |
|
---|
130 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
131 | __blcic_u64 (unsigned long long __X)
|
---|
132 | {
|
---|
133 | return ~__X & (__X + 1);
|
---|
134 | }
|
---|
135 |
|
---|
136 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
137 | __blcmsk_u64 (unsigned long long __X)
|
---|
138 | {
|
---|
139 | return __X ^ (__X + 1);
|
---|
140 | }
|
---|
141 |
|
---|
142 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
143 | __blcs_u64 (unsigned long long __X)
|
---|
144 | {
|
---|
145 | return __X | (__X + 1);
|
---|
146 | }
|
---|
147 |
|
---|
148 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
149 | __blsfill_u64 (unsigned long long __X)
|
---|
150 | {
|
---|
151 | return __X | (__X - 1);
|
---|
152 | }
|
---|
153 |
|
---|
154 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
155 | __blsic_u64 (unsigned long long __X)
|
---|
156 | {
|
---|
157 | return ~__X | (__X - 1);
|
---|
158 | }
|
---|
159 |
|
---|
160 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
161 | __t1mskc_u64 (unsigned long long __X)
|
---|
162 | {
|
---|
163 | return ~__X | (__X + 1);
|
---|
164 | }
|
---|
165 |
|
---|
166 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
---|
167 | __tzmsk_u64 (unsigned long long __X)
|
---|
168 | {
|
---|
169 | return ~__X & (__X - 1);
|
---|
170 | }
|
---|
171 |
|
---|
172 |
|
---|
173 | #endif /* __x86_64__ */
|
---|
174 |
|
---|
175 | #ifdef __DISABLE_TBM__
|
---|
176 | #undef __DISABLE_TBM__
|
---|
177 | #pragma GCC pop_options
|
---|
178 | #endif /* __DISABLE_TBM__ */
|
---|
179 |
|
---|
180 | #endif /* _TBMINTRIN_H_INCLUDED */
|
---|