1 /* Copyright (C) 2010-2016 Free Software Foundation, Inc.
3 This file is part of GCC.
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)
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.
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.
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/>. */
24 #ifndef _X86INTRIN_H_INCLUDED
25 # error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead."
28 #ifndef _TBMINTRIN_H_INCLUDED
29 #define _TBMINTRIN_H_INCLUDED
32 #pragma GCC push_options
33 #pragma GCC target("tbm")
34 #define __DISABLE_TBM__
38 extern __inline
unsigned int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
39 __bextri_u32 (unsigned int __X
, const unsigned int __I
)
41 return __builtin_ia32_bextri_u32 (__X
, __I
);
44 #define __bextri_u32(X, I) \
45 ((unsigned int)__builtin_ia32_bextri_u32 ((unsigned int)(X), \
47 #endif /*__OPTIMIZE__ */
49 extern __inline
unsigned int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
50 __blcfill_u32 (unsigned int __X
)
52 return __X
& (__X
+ 1);
55 extern __inline
unsigned int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
56 __blci_u32 (unsigned int __X
)
58 return __X
| ~(__X
+ 1);
61 extern __inline
unsigned int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
62 __blcic_u32 (unsigned int __X
)
64 return ~__X
& (__X
+ 1);
67 extern __inline
unsigned int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
68 __blcmsk_u32 (unsigned int __X
)
70 return __X
^ (__X
+ 1);
73 extern __inline
unsigned int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
74 __blcs_u32 (unsigned int __X
)
76 return __X
| (__X
+ 1);
79 extern __inline
unsigned int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
80 __blsfill_u32 (unsigned int __X
)
82 return __X
| (__X
- 1);
85 extern __inline
unsigned int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
86 __blsic_u32 (unsigned int __X
)
88 return ~__X
| (__X
- 1);
91 extern __inline
unsigned int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
92 __t1mskc_u32 (unsigned int __X
)
94 return ~__X
| (__X
+ 1);
97 extern __inline
unsigned int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
98 __tzmsk_u32 (unsigned int __X
)
100 return ~__X
& (__X
- 1);
107 extern __inline
unsigned long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
108 __bextri_u64 (unsigned long long __X
, const unsigned int __I
)
110 return __builtin_ia32_bextri_u64 (__X
, __I
);
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__ */
118 extern __inline
unsigned long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
119 __blcfill_u64 (unsigned long long __X
)
121 return __X
& (__X
+ 1);
124 extern __inline
unsigned long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
125 __blci_u64 (unsigned long long __X
)
127 return __X
| ~(__X
+ 1);
130 extern __inline
unsigned long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
131 __blcic_u64 (unsigned long long __X
)
133 return ~__X
& (__X
+ 1);
136 extern __inline
unsigned long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
137 __blcmsk_u64 (unsigned long long __X
)
139 return __X
^ (__X
+ 1);
142 extern __inline
unsigned long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
143 __blcs_u64 (unsigned long long __X
)
145 return __X
| (__X
+ 1);
148 extern __inline
unsigned long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
149 __blsfill_u64 (unsigned long long __X
)
151 return __X
| (__X
- 1);
154 extern __inline
unsigned long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
155 __blsic_u64 (unsigned long long __X
)
157 return ~__X
| (__X
- 1);
160 extern __inline
unsigned long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
161 __t1mskc_u64 (unsigned long long __X
)
163 return ~__X
| (__X
+ 1);
166 extern __inline
unsigned long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
167 __tzmsk_u64 (unsigned long long __X
)
169 return ~__X
& (__X
- 1);
173 #endif /* __x86_64__ */
175 #ifdef __DISABLE_TBM__
176 #undef __DISABLE_TBM__
177 #pragma GCC pop_options
178 #endif /* __DISABLE_TBM__ */
180 #endif /* _TBMINTRIN_H_INCLUDED */