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 *===-----------------------------------------------------------------------===
11 #error "Never use <adxintrin.h> directly; include <immintrin.h> instead."
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__("adx"))) constexpr
22 #define __DEFAULT_FN_ATTRS \
23 __attribute__((__always_inline__, __nodebug__, __target__("adx")))
26 /* Use C++ inline semantics in C++, GNU inline for C mode. */
27 #if defined(__cplusplus)
28 #define __INLINE __inline
30 #define __INLINE static __inline
33 #if defined(__cplusplus)
37 /* Intrinsics that are available only if __ADX__ is defined. */
39 /// Adds unsigned 32-bit integers \a __x and \a __y, plus 0 or 1 as indicated
40 /// by the carry flag \a __cf. Stores the unsigned 32-bit sum in the memory
41 /// at \a __p, and returns the 8-bit carry-out (carry flag).
44 /// temp := (__cf == 0) ? 0 : 1
45 /// Store32(__p, __x + __y + temp)
49 /// \headerfile <immintrin.h>
51 /// This intrinsic corresponds to the \c ADCX instruction.
54 /// The 8-bit unsigned carry flag; any non-zero value indicates carry.
56 /// A 32-bit unsigned addend.
58 /// A 32-bit unsigned addend.
60 /// Pointer to memory for storing the sum.
61 /// \returns The 8-bit unsigned carry-out value.
62 __INLINE
unsigned char __DEFAULT_FN_ATTRS
_addcarryx_u32(unsigned char __cf
,
66 return __builtin_ia32_addcarryx_u32(__cf
, __x
, __y
, __p
);
70 /// Adds unsigned 64-bit integers \a __x and \a __y, plus 0 or 1 as indicated
71 /// by the carry flag \a __cf. Stores the unsigned 64-bit sum in the memory
72 /// at \a __p, and returns the 8-bit carry-out (carry flag).
75 /// temp := (__cf == 0) ? 0 : 1
76 /// Store64(__p, __x + __y + temp)
80 /// \headerfile <immintrin.h>
82 /// This intrinsic corresponds to the \c ADCX instruction.
85 /// The 8-bit unsigned carry flag; any non-zero value indicates carry.
87 /// A 64-bit unsigned addend.
89 /// A 64-bit unsigned addend.
91 /// Pointer to memory for storing the sum.
92 /// \returns The 8-bit unsigned carry-out value.
93 __INLINE
unsigned char __DEFAULT_FN_ATTRS
94 _addcarryx_u64(unsigned char __cf
, unsigned long long __x
,
95 unsigned long long __y
, unsigned long long *__p
) {
96 return __builtin_ia32_addcarryx_u64(__cf
, __x
, __y
, __p
);
100 #if defined(__cplusplus)
105 #undef __DEFAULT_FN_ATTRS
107 #endif /* __ADXINTRIN_H */