[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / lib / Headers / adxintrin.h
blob72b9ed08f40c5a3bf242f9c30da343e7868ed97a
1 /*===---- adxintrin.h - ADX 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 __IMMINTRIN_H
11 #error "Never use <adxintrin.h> directly; include <immintrin.h> instead."
12 #endif
14 #ifndef __ADXINTRIN_H
15 #define __ADXINTRIN_H
17 /* Define the default attributes for the functions in this file. */
18 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
20 /* Intrinsics that are available only if __ADX__ defined */
21 static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx")))
22 _addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
23 unsigned int *__p)
25 return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
28 #ifdef __x86_64__
29 static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx")))
30 _addcarryx_u64(unsigned char __cf, unsigned long long __x,
31 unsigned long long __y, unsigned long long *__p)
33 return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
35 #endif
37 /* Intrinsics that are also available if __ADX__ undefined */
38 static __inline unsigned char __DEFAULT_FN_ATTRS
39 _addcarry_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
40 unsigned int *__p)
42 return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
45 #ifdef __x86_64__
46 static __inline unsigned char __DEFAULT_FN_ATTRS
47 _addcarry_u64(unsigned char __cf, unsigned long long __x,
48 unsigned long long __y, unsigned long long *__p)
50 return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
52 #endif
54 static __inline unsigned char __DEFAULT_FN_ATTRS
55 _subborrow_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
56 unsigned int *__p)
58 return __builtin_ia32_subborrow_u32(__cf, __x, __y, __p);
61 #ifdef __x86_64__
62 static __inline unsigned char __DEFAULT_FN_ATTRS
63 _subborrow_u64(unsigned char __cf, unsigned long long __x,
64 unsigned long long __y, unsigned long long *__p)
66 return __builtin_ia32_subborrow_u64(__cf, __x, __y, __p);
68 #endif
70 #undef __DEFAULT_FN_ATTRS
72 #endif /* __ADXINTRIN_H */