etc/services - sync with NetBSD-8
[minix.git] / external / bsd / llvm / dist / clang / lib / Headers / tbmintrin.h
blobf95e34fbc185c881bd527e3357f4f2f7fb7db641
1 /*===---- tbmintrin.h - TBM intrinsics -------------------------------------===
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
21 *===-----------------------------------------------------------------------===
24 #ifndef __TBM__
25 #error "TBM instruction set is not enabled"
26 #endif
28 #ifndef __X86INTRIN_H
29 #error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead."
30 #endif
32 #ifndef __TBMINTRIN_H
33 #define __TBMINTRIN_H
35 #define __bextri_u32(a, b) (__builtin_ia32_bextri_u32((a), (b)))
37 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
38 __blcfill_u32(unsigned int a)
40 return a & (a + 1);
43 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
44 __blci_u32(unsigned int a)
46 return a | ~(a + 1);
49 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
50 __blcic_u32(unsigned int a)
52 return ~a & (a + 1);
55 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
56 __blcmsk_u32(unsigned int a)
58 return a ^ (a + 1);
61 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
62 __blcs_u32(unsigned int a)
64 return a | (a + 1);
67 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
68 __blsfill_u32(unsigned int a)
70 return a | (a - 1);
73 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
74 __blsic_u32(unsigned int a)
76 return ~a | (a - 1);
79 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
80 __t1mskc_u32(unsigned int a)
82 return ~a | (a + 1);
85 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
86 __tzmsk_u32(unsigned int a)
88 return ~a & (a - 1);
91 #ifdef __x86_64__
92 #define __bextri_u64(a, b) (__builtin_ia32_bextri_u64((a), (int)(b)))
94 static __inline__ unsigned long long __attribute__((__always_inline__,
95 __nodebug__))
96 __blcfill_u64(unsigned long long a)
98 return a & (a + 1);
101 static __inline__ unsigned long long __attribute__((__always_inline__,
102 __nodebug__))
103 __blci_u64(unsigned long long a)
105 return a | ~(a + 1);
108 static __inline__ unsigned long long __attribute__((__always_inline__,
109 __nodebug__))
110 __blcic_u64(unsigned long long a)
112 return ~a & (a + 1);
115 static __inline__ unsigned long long __attribute__((__always_inline__,
116 __nodebug__))
117 __blcmsk_u64(unsigned long long a)
119 return a ^ (a + 1);
122 static __inline__ unsigned long long __attribute__((__always_inline__,
123 __nodebug__))
124 __blcs_u64(unsigned long long a)
126 return a | (a + 1);
129 static __inline__ unsigned long long __attribute__((__always_inline__,
130 __nodebug__))
131 __blsfill_u64(unsigned long long a)
133 return a | (a - 1);
136 static __inline__ unsigned long long __attribute__((__always_inline__,
137 __nodebug__))
138 __blsic_u64(unsigned long long a)
140 return ~a | (a - 1);
143 static __inline__ unsigned long long __attribute__((__always_inline__,
144 __nodebug__))
145 __t1mskc_u64(unsigned long long a)
147 return ~a | (a + 1);
150 static __inline__ unsigned long long __attribute__((__always_inline__,
151 __nodebug__))
152 __tzmsk_u64(unsigned long long a)
154 return ~a & (a - 1);
156 #endif
158 #endif /* __TBMINTRIN_H */