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

#ifndef _IMMINTRIN_H_INCLUDED
#define _IMMINTRIN_H_INCLUDED

#ifdef __MMX__
#include <mmintrin.h>
#endif

#ifdef __SSE__
#include <xmmintrin.h>
#endif

#ifdef __SSE2__
#include <emmintrin.h>
#endif

#ifdef __SSE3__
#include <pmmintrin.h>
#endif

#ifdef __SSSE3__
#include <tmmintrin.h>
#endif

#if defined (__SSE4_2__) || defined (__SSE4_1__)
#include <smmintrin.h>
#endif

#if defined (__AES__) || defined (__PCLMUL__)
#include <wmmintrin.h>
#endif

#ifdef __AVX__
#include <avxintrin.h>
#endif

#ifdef __AVX2__
#include <avx2intrin.h>
#endif

/*
#include <avx512fintrin.h>

#include <avx512erintrin.h>

#include <avx512pfintrin.h>

#include <avx512cdintrin.h>

#include <avx512vlintrin.h>

#include <avx512bwintrin.h>

#include <avx512dqintrin.h>

#include <avx512vlbwintrin.h>

#include <avx512vldqintrin.h>

#include <avx512ifmaintrin.h>

#include <avx512ifmavlintrin.h>

#include <avx512vbmiintrin.h>

#include <avx512vbmivlintrin.h>

#include <avx5124fmapsintrin.h>

#include <avx5124vnniwintrin.h>

#include <avx512vpopcntdqintrin.h>
*/

#ifdef __SHA__
#include <shaintrin.h>
#endif

#ifdef __LZCNT__
#include <lzcntintrin.h>
#endif

#ifdef __BMI__
#include <bmiintrin.h>
#endif

#ifdef __BMI2__
#include <bmi2intrin.h>
#endif

#ifdef __FMA__
#include <fmaintrin.h>
#endif

#ifdef __F16C__
#include <f16cintrin.h>
#endif

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

#ifdef __RDRND__
__E2K_INLINE int __DEFAULT_FUNCS_ATTRS
_rdrand16_step (unsigned short *__P)
{
  return __builtin_ia32_rdrand16_step (__P);
}

__E2K_INLINE int __DEFAULT_FUNCS_ATTRS
_rdrand32_step (unsigned int *__P)
{
  return __builtin_ia32_rdrand32_step (__P);
}
#endif /* __RDRND__ */

#ifdef __RDPID__
__E2K_INLINE unsigned int __DEFAULT_FUNCS_ATTRS
_rdpid_u32 (void)
{
  return __builtin_ia32_rdpid ();
}
#endif /* __RDPID__ */

#ifdef __RDRND__

__E2K_INLINE int __DEFAULT_FUNCS_ATTRS
_rdrand64_step (unsigned long long *__P)
{
  return __builtin_ia32_rdrand64_step (__P);
}
#endif /* __RDRND__ */

#undef __DEFAULT_FUNCS_ATTRS

#endif /* _IMMINTRIN_H_INCLUDED */
