1 |
709 |
jeremybenn |
/* Copyright (C) 2010 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 _X86INTRIN_H_INCLUDED
|
25 |
|
|
# error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead."
|
26 |
|
|
#endif
|
27 |
|
|
|
28 |
|
|
#ifndef __TBM__
|
29 |
|
|
# error "TBM instruction set not enabled"
|
30 |
|
|
#endif /* __TBM__ */
|
31 |
|
|
|
32 |
|
|
#ifndef _TBMINTRIN_H_INCLUDED
|
33 |
|
|
#define _TBMINTRIN_H_INCLUDED
|
34 |
|
|
|
35 |
|
|
#ifdef __OPTIMIZE__
|
36 |
|
|
extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
37 |
|
|
__bextri_u32 (unsigned int __X, const unsigned int __I)
|
38 |
|
|
{
|
39 |
|
|
return __builtin_ia32_bextri_u32 (__X, __I);
|
40 |
|
|
}
|
41 |
|
|
#else
|
42 |
|
|
#define __bextri_u32(X, I) \
|
43 |
|
|
((unsigned int)__builtin_ia32_bextri_u32 ((unsigned int)(X), \
|
44 |
|
|
(unsigned int)(I)))
|
45 |
|
|
#endif /*__OPTIMIZE__ */
|
46 |
|
|
|
47 |
|
|
extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
48 |
|
|
__blcfill_u32 (unsigned int __X)
|
49 |
|
|
{
|
50 |
|
|
return __X & (__X + 1);
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
54 |
|
|
__blci_u32 (unsigned int __X)
|
55 |
|
|
{
|
56 |
|
|
return __X | ~(__X + 1);
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
60 |
|
|
__blcic_u32 (unsigned int __X)
|
61 |
|
|
{
|
62 |
|
|
return ~__X & (__X + 1);
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
66 |
|
|
__blcmsk_u32 (unsigned int __X)
|
67 |
|
|
{
|
68 |
|
|
return __X ^ (__X + 1);
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
72 |
|
|
__blcs_u32 (unsigned int __X)
|
73 |
|
|
{
|
74 |
|
|
return __X | (__X + 1);
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
78 |
|
|
__blsfill_u32 (unsigned int __X)
|
79 |
|
|
{
|
80 |
|
|
return __X | (__X - 1);
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
84 |
|
|
__blsic_u32 (unsigned int __X)
|
85 |
|
|
{
|
86 |
|
|
return ~__X | (__X - 1);
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
90 |
|
|
__t1mskc_u32 (unsigned int __X)
|
91 |
|
|
{
|
92 |
|
|
return ~__X | (__X + 1);
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
96 |
|
|
__tzmsk_u32 (unsigned int __X)
|
97 |
|
|
{
|
98 |
|
|
return ~__X & (__X - 1);
|
99 |
|
|
}
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
#ifdef __x86_64__
|
104 |
|
|
#ifdef __OPTIMIZE__
|
105 |
|
|
extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
106 |
|
|
__bextri_u64 (unsigned long long __X, const unsigned int __I)
|
107 |
|
|
{
|
108 |
|
|
return __builtin_ia32_bextri_u64 (__X, __I);
|
109 |
|
|
}
|
110 |
|
|
#else
|
111 |
|
|
#define __bextri_u64(X, I) \
|
112 |
|
|
((unsigned long long)__builtin_ia32_bextri_u64 ((unsigned long long)(X), \
|
113 |
|
|
(unsigned long long)(I)))
|
114 |
|
|
#endif /*__OPTIMIZE__ */
|
115 |
|
|
|
116 |
|
|
extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
117 |
|
|
__blcfill_u64 (unsigned long long __X)
|
118 |
|
|
{
|
119 |
|
|
return __X & (__X + 1);
|
120 |
|
|
}
|
121 |
|
|
|
122 |
|
|
extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
123 |
|
|
__blci_u64 (unsigned long long __X)
|
124 |
|
|
{
|
125 |
|
|
return __X | ~(__X + 1);
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
129 |
|
|
__blcic_u64 (unsigned long long __X)
|
130 |
|
|
{
|
131 |
|
|
return ~__X & (__X + 1);
|
132 |
|
|
}
|
133 |
|
|
|
134 |
|
|
extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
135 |
|
|
__blcmsk_u64 (unsigned long long __X)
|
136 |
|
|
{
|
137 |
|
|
return __X ^ (__X + 1);
|
138 |
|
|
}
|
139 |
|
|
|
140 |
|
|
extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
141 |
|
|
__blcs_u64 (unsigned long long __X)
|
142 |
|
|
{
|
143 |
|
|
return __X | (__X + 1);
|
144 |
|
|
}
|
145 |
|
|
|
146 |
|
|
extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
147 |
|
|
__blsfill_u64 (unsigned long long __X)
|
148 |
|
|
{
|
149 |
|
|
return __X | (__X - 1);
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
153 |
|
|
__blsic_u64 (unsigned long long __X)
|
154 |
|
|
{
|
155 |
|
|
return ~__X | (__X - 1);
|
156 |
|
|
}
|
157 |
|
|
|
158 |
|
|
extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
159 |
|
|
__t1mskc_u64 (unsigned long long __X)
|
160 |
|
|
{
|
161 |
|
|
return ~__X | (__X + 1);
|
162 |
|
|
}
|
163 |
|
|
|
164 |
|
|
extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
165 |
|
|
__tzmsk_u64 (unsigned long long __X)
|
166 |
|
|
{
|
167 |
|
|
return ~__X & (__X - 1);
|
168 |
|
|
}
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
#endif /* __x86_64__ */
|
172 |
|
|
#endif /* _TBMINTRIN_H_INCLUDED */
|