[Instrumentation] Fix a warning
[llvm-project.git] / clang / lib / Headers / ppc_wrappers / bmiintrin.h
blob7d3315958c7b7f06915c0135d06201a82f24b0b8
1 /*===---- bmiintrin.h - Implementation of BMI intrinsics on PowerPC --------===
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
7 *===-----------------------------------------------------------------------===
8 */
10 #if !defined X86GPRINTRIN_H_
11 #error "Never use <bmiintrin.h> directly; include <x86gprintrin.h> instead."
12 #endif
14 #ifndef BMIINTRIN_H_
15 #define BMIINTRIN_H_
17 extern __inline unsigned short
18 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
19 __tzcnt_u16(unsigned short __X) {
20 return __builtin_ctz(__X);
23 extern __inline unsigned int
24 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
25 __andn_u32(unsigned int __X, unsigned int __Y) {
26 return (~__X & __Y);
29 extern __inline unsigned int
30 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
31 _bextr_u32(unsigned int __X, unsigned int __P, unsigned int __L) {
32 return ((__X << (32 - (__L + __P))) >> (32 - __L));
35 extern __inline unsigned int
36 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
37 __bextr_u32(unsigned int __X, unsigned int __Y) {
38 unsigned int __P, __L;
39 __P = __Y & 0xFF;
40 __L = (__Y >> 8) & 0xFF;
41 return (_bextr_u32(__X, __P, __L));
44 extern __inline unsigned int
45 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
46 __blsi_u32(unsigned int __X) {
47 return (__X & -__X);
50 extern __inline unsigned int
51 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
52 _blsi_u32(unsigned int __X) {
53 return __blsi_u32(__X);
56 extern __inline unsigned int
57 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
58 __blsmsk_u32(unsigned int __X) {
59 return (__X ^ (__X - 1));
62 extern __inline unsigned int
63 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
64 _blsmsk_u32(unsigned int __X) {
65 return __blsmsk_u32(__X);
68 extern __inline unsigned int
69 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
70 __blsr_u32(unsigned int __X) {
71 return (__X & (__X - 1));
74 extern __inline unsigned int
75 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
76 _blsr_u32(unsigned int __X) {
77 return __blsr_u32(__X);
80 extern __inline unsigned int
81 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
82 __tzcnt_u32(unsigned int __X) {
83 return __builtin_ctz(__X);
86 extern __inline unsigned int
87 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
88 _tzcnt_u32(unsigned int __X) {
89 return __builtin_ctz(__X);
92 /* use the 64-bit shift, rotate, and count leading zeros instructions
93 for long long. */
94 #ifdef __PPC64__
95 extern __inline unsigned long long
96 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
97 __andn_u64(unsigned long long __X, unsigned long long __Y) {
98 return (~__X & __Y);
101 extern __inline unsigned long long
102 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
103 _bextr_u64(unsigned long long __X, unsigned int __P, unsigned int __L) {
104 return ((__X << (64 - (__L + __P))) >> (64 - __L));
107 extern __inline unsigned long long
108 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
109 __bextr_u64(unsigned long long __X, unsigned long long __Y) {
110 unsigned int __P, __L;
111 __P = __Y & 0xFF;
112 __L = (__Y & 0xFF00) >> 8;
113 return (_bextr_u64(__X, __P, __L));
116 extern __inline unsigned long long
117 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
118 __blsi_u64(unsigned long long __X) {
119 return __X & -__X;
122 extern __inline unsigned long long
123 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
124 _blsi_u64(unsigned long long __X) {
125 return __blsi_u64(__X);
128 extern __inline unsigned long long
129 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
130 __blsmsk_u64(unsigned long long __X) {
131 return (__X ^ (__X - 1));
134 extern __inline unsigned long long
135 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
136 _blsmsk_u64(unsigned long long __X) {
137 return __blsmsk_u64(__X);
140 extern __inline unsigned long long
141 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
142 __blsr_u64(unsigned long long __X) {
143 return (__X & (__X - 1));
146 extern __inline unsigned long long
147 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
148 _blsr_u64(unsigned long long __X) {
149 return __blsr_u64(__X);
152 extern __inline unsigned long long
153 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
154 __tzcnt_u64(unsigned long long __X) {
155 return __builtin_ctzll(__X);
158 extern __inline unsigned long long
159 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
160 _tzcnt_u64(unsigned long long __X) {
161 return __builtin_ctzll(__X);
163 #endif /* __PPC64__ */
165 #endif /* BMIINTRIN_H_ */