/* Copyright (c) 2018 ZAO "MCST". All rights reserved. */

#if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED
# error "Never use <adxintrin.h> directly; include <x86intrin.h> instead."
#endif

#ifndef _ADXINTRIN_H_INCLUDED
#define _ADXINTRIN_H_INCLUDED

/* Define the default attributes for the functions in this file */
#define __DEFAULT_FUNCS_ATTRS __attribute__((/*__gnu_inline__,*/ __always_inline__, __artificial__))

__E2K_INLINE unsigned char __DEFAULT_FUNCS_ATTRS
_subborrow_u32 (unsigned char __CF, unsigned int __X,
                unsigned int __Y, unsigned int *__P)
{
  return __builtin_ia32_sbb_u32 (__CF, __Y, __X, __P);
}

__E2K_INLINE unsigned char __DEFAULT_FUNCS_ATTRS
_addcarry_u32 (unsigned char __CF, unsigned int __X,
               unsigned int __Y, unsigned int *__P)
{
  return __builtin_ia32_addcarryx_u32 (__CF, __X, __Y, __P);
}

__E2K_INLINE unsigned char __DEFAULT_FUNCS_ATTRS
_addcarryx_u32 (unsigned char __CF, unsigned int __X,
                unsigned int __Y, unsigned int *__P)
{
  return __builtin_ia32_addcarryx_u32 (__CF, __X, __Y, __P);
}

__E2K_INLINE unsigned char __DEFAULT_FUNCS_ATTRS
_subborrow_u64 (unsigned char __CF, unsigned long long __X,
                unsigned long long __Y, unsigned long long *__P)
{
  return __builtin_ia32_sbb_u64 (__CF, __Y, __X, __P);
}

__E2K_INLINE unsigned char __DEFAULT_FUNCS_ATTRS
_addcarry_u64 (unsigned char __CF, unsigned long long __X,
               unsigned long long __Y, unsigned long long *__P)
{
  return __builtin_ia32_addcarryx_u64 (__CF, __X, __Y, __P);
}

__E2K_INLINE unsigned char __DEFAULT_FUNCS_ATTRS
_addcarryx_u64 (unsigned char __CF, unsigned long long __X,
                unsigned long long __Y, unsigned long long *__P)
{
  return __builtin_ia32_addcarryx_u64 (__CF, __X, __Y, __P);
}

#undef __DEFAULT_FUNCS_ATTRS

#endif /* _ADXINTRIN_H_INCLUDED */
