1*0a6a1f1dSLionel Sambuc /*===---- adxintrin.h - ADX intrinsics -------------------------------------===
2*0a6a1f1dSLionel Sambuc *
3*0a6a1f1dSLionel Sambuc * Permission is hereby granted, free of charge, to any person obtaining a copy
4*0a6a1f1dSLionel Sambuc * of this software and associated documentation files (the "Software"), to deal
5*0a6a1f1dSLionel Sambuc * in the Software without restriction, including without limitation the rights
6*0a6a1f1dSLionel Sambuc * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7*0a6a1f1dSLionel Sambuc * copies of the Software, and to permit persons to whom the Software is
8*0a6a1f1dSLionel Sambuc * furnished to do so, subject to the following conditions:
9*0a6a1f1dSLionel Sambuc *
10*0a6a1f1dSLionel Sambuc * The above copyright notice and this permission notice shall be included in
11*0a6a1f1dSLionel Sambuc * all copies or substantial portions of the Software.
12*0a6a1f1dSLionel Sambuc *
13*0a6a1f1dSLionel Sambuc * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14*0a6a1f1dSLionel Sambuc * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15*0a6a1f1dSLionel Sambuc * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16*0a6a1f1dSLionel Sambuc * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17*0a6a1f1dSLionel Sambuc * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18*0a6a1f1dSLionel Sambuc * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19*0a6a1f1dSLionel Sambuc * THE SOFTWARE.
20*0a6a1f1dSLionel Sambuc *
21*0a6a1f1dSLionel Sambuc *===-----------------------------------------------------------------------===
22*0a6a1f1dSLionel Sambuc */
23*0a6a1f1dSLionel Sambuc
24*0a6a1f1dSLionel Sambuc #ifndef __IMMINTRIN_H
25*0a6a1f1dSLionel Sambuc #error "Never use <adxintrin.h> directly; include <immintrin.h> instead."
26*0a6a1f1dSLionel Sambuc #endif
27*0a6a1f1dSLionel Sambuc
28*0a6a1f1dSLionel Sambuc #ifndef __ADXINTRIN_H
29*0a6a1f1dSLionel Sambuc #define __ADXINTRIN_H
30*0a6a1f1dSLionel Sambuc
31*0a6a1f1dSLionel Sambuc /* Intrinsics that are available only if __ADX__ defined */
32*0a6a1f1dSLionel Sambuc #ifdef __ADX__
33*0a6a1f1dSLionel Sambuc static __inline unsigned char __attribute__((__always_inline__, __nodebug__))
_addcarryx_u32(unsigned char __cf,unsigned int __x,unsigned int __y,unsigned int * __p)34*0a6a1f1dSLionel Sambuc _addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
35*0a6a1f1dSLionel Sambuc unsigned int *__p)
36*0a6a1f1dSLionel Sambuc {
37*0a6a1f1dSLionel Sambuc return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
38*0a6a1f1dSLionel Sambuc }
39*0a6a1f1dSLionel Sambuc
40*0a6a1f1dSLionel Sambuc #ifdef __x86_64__
41*0a6a1f1dSLionel Sambuc static __inline unsigned char __attribute__((__always_inline__, __nodebug__))
_addcarryx_u64(unsigned char __cf,unsigned long long __x,unsigned long long __y,unsigned long long * __p)42*0a6a1f1dSLionel Sambuc _addcarryx_u64(unsigned char __cf, unsigned long long __x,
43*0a6a1f1dSLionel Sambuc unsigned long long __y, unsigned long long *__p)
44*0a6a1f1dSLionel Sambuc {
45*0a6a1f1dSLionel Sambuc return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
46*0a6a1f1dSLionel Sambuc }
47*0a6a1f1dSLionel Sambuc #endif
48*0a6a1f1dSLionel Sambuc #endif
49*0a6a1f1dSLionel Sambuc
50*0a6a1f1dSLionel Sambuc /* Intrinsics that are also available if __ADX__ undefined */
51*0a6a1f1dSLionel Sambuc static __inline unsigned char __attribute__((__always_inline__, __nodebug__))
_addcarry_u32(unsigned char __cf,unsigned int __x,unsigned int __y,unsigned int * __p)52*0a6a1f1dSLionel Sambuc _addcarry_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
53*0a6a1f1dSLionel Sambuc unsigned int *__p)
54*0a6a1f1dSLionel Sambuc {
55*0a6a1f1dSLionel Sambuc return __builtin_ia32_addcarry_u32(__cf, __x, __y, __p);
56*0a6a1f1dSLionel Sambuc }
57*0a6a1f1dSLionel Sambuc
58*0a6a1f1dSLionel Sambuc #ifdef __x86_64__
59*0a6a1f1dSLionel Sambuc static __inline unsigned char __attribute__((__always_inline__, __nodebug__))
_addcarry_u64(unsigned char __cf,unsigned long long __x,unsigned long long __y,unsigned long long * __p)60*0a6a1f1dSLionel Sambuc _addcarry_u64(unsigned char __cf, unsigned long long __x,
61*0a6a1f1dSLionel Sambuc unsigned long long __y, unsigned long long *__p)
62*0a6a1f1dSLionel Sambuc {
63*0a6a1f1dSLionel Sambuc return __builtin_ia32_addcarry_u64(__cf, __x, __y, __p);
64*0a6a1f1dSLionel Sambuc }
65*0a6a1f1dSLionel Sambuc #endif
66*0a6a1f1dSLionel Sambuc
67*0a6a1f1dSLionel Sambuc static __inline unsigned char __attribute__((__always_inline__, __nodebug__))
_subborrow_u32(unsigned char __cf,unsigned int __x,unsigned int __y,unsigned int * __p)68*0a6a1f1dSLionel Sambuc _subborrow_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
69*0a6a1f1dSLionel Sambuc unsigned int *__p)
70*0a6a1f1dSLionel Sambuc {
71*0a6a1f1dSLionel Sambuc return __builtin_ia32_subborrow_u32(__cf, __x, __y, __p);
72*0a6a1f1dSLionel Sambuc }
73*0a6a1f1dSLionel Sambuc
74*0a6a1f1dSLionel Sambuc #ifdef __x86_64__
75*0a6a1f1dSLionel Sambuc static __inline unsigned char __attribute__((__always_inline__, __nodebug__))
_subborrow_u64(unsigned char __cf,unsigned long long __x,unsigned long long __y,unsigned long long * __p)76*0a6a1f1dSLionel Sambuc _subborrow_u64(unsigned char __cf, unsigned long long __x,
77*0a6a1f1dSLionel Sambuc unsigned long long __y, unsigned long long *__p)
78*0a6a1f1dSLionel Sambuc {
79*0a6a1f1dSLionel Sambuc return __builtin_ia32_subborrow_u64(__cf, __x, __y, __p);
80*0a6a1f1dSLionel Sambuc }
81*0a6a1f1dSLionel Sambuc #endif
82*0a6a1f1dSLionel Sambuc
83*0a6a1f1dSLionel Sambuc #endif /* __ADXINTRIN_H */
84