2014-09-19 18:17:06 +08:00
|
|
|
/*===---- adxintrin.h - ADX intrinsics -------------------------------------===
|
|
|
|
*
|
2019-04-09 04:51:30 +08:00
|
|
|
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
* See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2014-09-19 18:17:06 +08:00
|
|
|
*
|
|
|
|
*===-----------------------------------------------------------------------===
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __IMMINTRIN_H
|
|
|
|
#error "Never use <adxintrin.h> directly; include <immintrin.h> instead."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __ADXINTRIN_H
|
|
|
|
#define __ADXINTRIN_H
|
|
|
|
|
2015-06-17 15:09:20 +08:00
|
|
|
/* Define the default attributes for the functions in this file. */
|
2015-06-30 21:36:19 +08:00
|
|
|
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
|
2015-06-17 15:09:20 +08:00
|
|
|
|
2014-09-19 18:29:22 +08:00
|
|
|
/* Intrinsics that are available only if __ADX__ defined */
|
2015-06-17 15:09:32 +08:00
|
|
|
static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx")))
|
2014-09-19 18:17:06 +08:00
|
|
|
_addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
|
|
|
|
unsigned int *__p)
|
|
|
|
{
|
|
|
|
return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef __x86_64__
|
2015-06-17 15:09:32 +08:00
|
|
|
static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx")))
|
2014-09-24 14:45:23 +08:00
|
|
|
_addcarryx_u64(unsigned char __cf, unsigned long long __x,
|
|
|
|
unsigned long long __y, unsigned long long *__p)
|
2014-09-19 18:17:06 +08:00
|
|
|
{
|
|
|
|
return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-09-19 18:29:22 +08:00
|
|
|
/* Intrinsics that are also available if __ADX__ undefined */
|
2015-06-30 21:36:19 +08:00
|
|
|
static __inline unsigned char __DEFAULT_FN_ATTRS
|
2014-09-19 18:29:22 +08:00
|
|
|
_addcarry_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
|
|
|
|
unsigned int *__p)
|
|
|
|
{
|
2018-12-10 14:07:59 +08:00
|
|
|
return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
|
2014-09-19 18:29:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef __x86_64__
|
2015-06-30 21:36:19 +08:00
|
|
|
static __inline unsigned char __DEFAULT_FN_ATTRS
|
2014-09-24 14:45:23 +08:00
|
|
|
_addcarry_u64(unsigned char __cf, unsigned long long __x,
|
|
|
|
unsigned long long __y, unsigned long long *__p)
|
2014-09-19 18:29:22 +08:00
|
|
|
{
|
2018-12-10 14:07:59 +08:00
|
|
|
return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
|
2014-09-19 18:29:22 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-06-30 21:36:19 +08:00
|
|
|
static __inline unsigned char __DEFAULT_FN_ATTRS
|
2014-09-19 18:29:22 +08:00
|
|
|
_subborrow_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
|
|
|
|
unsigned int *__p)
|
|
|
|
{
|
|
|
|
return __builtin_ia32_subborrow_u32(__cf, __x, __y, __p);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef __x86_64__
|
2015-06-30 21:36:19 +08:00
|
|
|
static __inline unsigned char __DEFAULT_FN_ATTRS
|
2014-09-24 14:45:23 +08:00
|
|
|
_subborrow_u64(unsigned char __cf, unsigned long long __x,
|
|
|
|
unsigned long long __y, unsigned long long *__p)
|
2014-09-19 18:29:22 +08:00
|
|
|
{
|
|
|
|
return __builtin_ia32_subborrow_u64(__cf, __x, __y, __p);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-06-30 21:36:19 +08:00
|
|
|
#undef __DEFAULT_FN_ATTRS
|
2015-06-17 15:09:20 +08:00
|
|
|
|
2014-09-19 18:17:06 +08:00
|
|
|
#endif /* __ADXINTRIN_H */
|