adxintrin.h revision 344779
159191Skris/*===---- adxintrin.h - ADX intrinsics -------------------------------------=== 259191Skris * 359191Skris * Permission is hereby granted, free of charge, to any person obtaining a copy 459191Skris * of this software and associated documentation files (the "Software"), to deal 559191Skris * in the Software without restriction, including without limitation the rights 659191Skris * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 759191Skris * copies of the Software, and to permit persons to whom the Software is 859191Skris * furnished to do so, subject to the following conditions: 959191Skris * 1059191Skris * The above copyright notice and this permission notice shall be included in 1159191Skris * all copies or substantial portions of the Software. 1259191Skris * 1359191Skris * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1459191Skris * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1559191Skris * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1659191Skris * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1759191Skris * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1859191Skris * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1959191Skris * THE SOFTWARE. 2059191Skris * 2159191Skris *===-----------------------------------------------------------------------=== 2259191Skris */ 2359191Skris 2459191Skris#ifndef __IMMINTRIN_H 2559191Skris#error "Never use <adxintrin.h> directly; include <immintrin.h> instead." 2659191Skris#endif 2759191Skris 2859191Skris#ifndef __ADXINTRIN_H 2959191Skris#define __ADXINTRIN_H 3059191Skris 3159191Skris/* Define the default attributes for the functions in this file. */ 3259191Skris#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__)) 33109998Smarkm 34109998Smarkm/* Intrinsics that are available only if __ADX__ defined */ 3559191Skrisstatic __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx"))) 3659191Skris_addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y, 3759191Skris unsigned int *__p) 3859191Skris{ 3959191Skris return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p); 4059191Skris} 41 42#ifdef __x86_64__ 43static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx"))) 44_addcarryx_u64(unsigned char __cf, unsigned long long __x, 45 unsigned long long __y, unsigned long long *__p) 46{ 47 return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p); 48} 49#endif 50 51/* Intrinsics that are also available if __ADX__ undefined */ 52static __inline unsigned char __DEFAULT_FN_ATTRS 53_addcarry_u32(unsigned char __cf, unsigned int __x, unsigned int __y, 54 unsigned int *__p) 55{ 56 return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p); 57} 58 59#ifdef __x86_64__ 60static __inline unsigned char __DEFAULT_FN_ATTRS 61_addcarry_u64(unsigned char __cf, unsigned long long __x, 62 unsigned long long __y, unsigned long long *__p) 63{ 64 return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p); 65} 66#endif 67 68static __inline unsigned char __DEFAULT_FN_ATTRS 69_subborrow_u32(unsigned char __cf, unsigned int __x, unsigned int __y, 70 unsigned int *__p) 71{ 72 return __builtin_ia32_subborrow_u32(__cf, __x, __y, __p); 73} 74 75#ifdef __x86_64__ 76static __inline unsigned char __DEFAULT_FN_ATTRS 77_subborrow_u64(unsigned char __cf, unsigned long long __x, 78 unsigned long long __y, unsigned long long *__p) 79{ 80 return __builtin_ia32_subborrow_u64(__cf, __x, __y, __p); 81} 82#endif 83 84#undef __DEFAULT_FN_ATTRS 85 86#endif /* __ADXINTRIN_H */ 87