[flang] Update CommandTest for AIX (NFC) (#118403)
[llvm-project.git] / clang / lib / Headers / tbmintrin.h
blobcf92d5a7b3b0f02eb76041a71e06afedc376d825
1 /*===---- tbmintrin.h - TBM intrinsics -------------------------------------===
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 #ifndef __X86INTRIN_H
11 #error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead."
12 #endif
14 #ifndef __TBMINTRIN_H
15 #define __TBMINTRIN_H
17 /* Define the default attributes for the functions in this file. */
18 #if defined(__cplusplus) && (__cplusplus >= 201103L)
19 #define __DEFAULT_FN_ATTRS \
20 __attribute__((__always_inline__, __nodebug__, __target__("tbm"))) constexpr
21 #else
22 #define __DEFAULT_FN_ATTRS \
23 __attribute__((__always_inline__, __nodebug__, __target__("tbm")))
24 #endif
26 #define __bextri_u32(a, b) \
27 ((unsigned int)__builtin_ia32_bextri_u32((unsigned int)(a), \
28 (unsigned int)(b)))
30 static __inline__ unsigned int __DEFAULT_FN_ATTRS
31 __blcfill_u32(unsigned int __a) {
32 return __a & (__a + 1);
35 static __inline__ unsigned int __DEFAULT_FN_ATTRS
36 __blci_u32(unsigned int __a) {
37 return __a | ~(__a + 1);
40 static __inline__ unsigned int __DEFAULT_FN_ATTRS
41 __blcic_u32(unsigned int __a) {
42 return ~__a & (__a + 1);
45 static __inline__ unsigned int __DEFAULT_FN_ATTRS
46 __blcmsk_u32(unsigned int __a) {
47 return __a ^ (__a + 1);
50 static __inline__ unsigned int __DEFAULT_FN_ATTRS
51 __blcs_u32(unsigned int __a) {
52 return __a | (__a + 1);
55 static __inline__ unsigned int __DEFAULT_FN_ATTRS
56 __blsfill_u32(unsigned int __a) {
57 return __a | (__a - 1);
60 static __inline__ unsigned int __DEFAULT_FN_ATTRS
61 __blsic_u32(unsigned int __a) {
62 return ~__a | (__a - 1);
65 static __inline__ unsigned int __DEFAULT_FN_ATTRS
66 __t1mskc_u32(unsigned int __a) {
67 return ~__a | (__a + 1);
70 static __inline__ unsigned int __DEFAULT_FN_ATTRS
71 __tzmsk_u32(unsigned int __a) {
72 return ~__a & (__a - 1);
75 #ifdef __x86_64__
76 #define __bextri_u64(a, b) \
77 ((unsigned long long)__builtin_ia32_bextri_u64((unsigned long long)(a), \
78 (unsigned long long)(b)))
80 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
81 __blcfill_u64(unsigned long long __a) {
82 return __a & (__a + 1);
85 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
86 __blci_u64(unsigned long long __a) {
87 return __a | ~(__a + 1);
90 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
91 __blcic_u64(unsigned long long __a) {
92 return ~__a & (__a + 1);
95 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
96 __blcmsk_u64(unsigned long long __a) {
97 return __a ^ (__a + 1);
100 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
101 __blcs_u64(unsigned long long __a) {
102 return __a | (__a + 1);
105 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
106 __blsfill_u64(unsigned long long __a) {
107 return __a | (__a - 1);
110 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
111 __blsic_u64(unsigned long long __a) {
112 return ~__a | (__a - 1);
115 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
116 __t1mskc_u64(unsigned long long __a) {
117 return ~__a | (__a + 1);
120 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
121 __tzmsk_u64(unsigned long long __a) {
122 return ~__a & (__a - 1);
124 #endif
126 #undef __DEFAULT_FN_ATTRS
128 #endif /* __TBMINTRIN_H */