Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/clang/lib/Headers/adxintrin.h
35233 views
1
/*===---- adxintrin.h - ADX intrinsics -------------------------------------===
2
*
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
6
*
7
*===-----------------------------------------------------------------------===
8
*/
9
10
#ifndef __IMMINTRIN_H
11
#error "Never use <adxintrin.h> directly; include <immintrin.h> instead."
12
#endif
13
14
#ifndef __ADXINTRIN_H
15
#define __ADXINTRIN_H
16
17
/* Define the default attributes for the functions in this file. */
18
#define __DEFAULT_FN_ATTRS \
19
__attribute__((__always_inline__, __nodebug__, __target__("adx")))
20
21
/* Use C++ inline semantics in C++, GNU inline for C mode. */
22
#if defined(__cplusplus)
23
#define __INLINE __inline
24
#else
25
#define __INLINE static __inline
26
#endif
27
28
#if defined(__cplusplus)
29
extern "C" {
30
#endif
31
32
/* Intrinsics that are available only if __ADX__ is defined. */
33
34
/// Adds unsigned 32-bit integers \a __x and \a __y, plus 0 or 1 as indicated
35
/// by the carry flag \a __cf. Stores the unsigned 32-bit sum in the memory
36
/// at \a __p, and returns the 8-bit carry-out (carry flag).
37
///
38
/// \code{.operation}
39
/// temp := (__cf == 0) ? 0 : 1
40
/// Store32(__p, __x + __y + temp)
41
/// result := CF
42
/// \endcode
43
///
44
/// \headerfile <immintrin.h>
45
///
46
/// This intrinsic corresponds to the \c ADCX instruction.
47
///
48
/// \param __cf
49
/// The 8-bit unsigned carry flag; any non-zero value indicates carry.
50
/// \param __x
51
/// A 32-bit unsigned addend.
52
/// \param __y
53
/// A 32-bit unsigned addend.
54
/// \param __p
55
/// Pointer to memory for storing the sum.
56
/// \returns The 8-bit unsigned carry-out value.
57
__INLINE unsigned char __DEFAULT_FN_ATTRS _addcarryx_u32(unsigned char __cf,
58
unsigned int __x,
59
unsigned int __y,
60
unsigned int *__p) {
61
return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
62
}
63
64
#ifdef __x86_64__
65
/// Adds unsigned 64-bit integers \a __x and \a __y, plus 0 or 1 as indicated
66
/// by the carry flag \a __cf. Stores the unsigned 64-bit sum in the memory
67
/// at \a __p, and returns the 8-bit carry-out (carry flag).
68
///
69
/// \code{.operation}
70
/// temp := (__cf == 0) ? 0 : 1
71
/// Store64(__p, __x + __y + temp)
72
/// result := CF
73
/// \endcode
74
///
75
/// \headerfile <immintrin.h>
76
///
77
/// This intrinsic corresponds to the \c ADCX instruction.
78
///
79
/// \param __cf
80
/// The 8-bit unsigned carry flag; any non-zero value indicates carry.
81
/// \param __x
82
/// A 64-bit unsigned addend.
83
/// \param __y
84
/// A 64-bit unsigned addend.
85
/// \param __p
86
/// Pointer to memory for storing the sum.
87
/// \returns The 8-bit unsigned carry-out value.
88
__INLINE unsigned char __DEFAULT_FN_ATTRS
89
_addcarryx_u64(unsigned char __cf, unsigned long long __x,
90
unsigned long long __y, unsigned long long *__p) {
91
return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
92
}
93
#endif
94
95
#if defined(__cplusplus)
96
}
97
#endif
98
99
#undef __INLINE
100
#undef __DEFAULT_FN_ATTRS
101
102
#endif /* __ADXINTRIN_H */
103
104