2023-06-05 07:37:25 +00:00
|
|
|
#if defined(__x86_64__) && !(__ASSEMBLER__ + __LINKER__ + 0)
|
2023-04-27 09:56:41 +00:00
|
|
|
#ifndef _WMMINTRIN_H_INCLUDED
|
|
|
|
#define _WMMINTRIN_H_INCLUDED
|
|
|
|
#include "third_party/intel/emmintrin.internal.h"
|
|
|
|
#if !defined(__AES__) || !defined(__SSE2__)
|
|
|
|
#pragma GCC push_options
|
|
|
|
#pragma GCC target("aes,sse2")
|
|
|
|
#define __DISABLE_AES__
|
2023-06-05 07:37:25 +00:00
|
|
|
#endif
|
2024-07-23 10:16:17 +00:00
|
|
|
#define _mm_aesdec_si128(X, Y) (__m128i) __builtin_ia32_aesdec128 ((__v2di) (X), (__v2di) (Y))
|
|
|
|
#define _mm_aesdeclast_si128(X, Y) (__m128i) __builtin_ia32_aesdeclast128 ((__v2di) (X), (__v2di) (Y))
|
|
|
|
#define _mm_aesenc_si128(X, Y) (__m128i) __builtin_ia32_aesenc128 ((__v2di) (X), (__v2di) (Y))
|
|
|
|
#define _mm_aesenclast_si128(X, Y) (__m128i) __builtin_ia32_aesenclast128 ((__v2di) (X), (__v2di) (Y))
|
2023-06-05 07:37:25 +00:00
|
|
|
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_mm_aesimc_si128 (__m128i __X)
|
|
|
|
{
|
|
|
|
return (__m128i) __builtin_ia32_aesimc128 ((__v2di)__X);
|
2023-04-27 09:56:41 +00:00
|
|
|
}
|
|
|
|
#ifdef __OPTIMIZE__
|
2023-06-05 07:37:25 +00:00
|
|
|
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_mm_aeskeygenassist_si128 (__m128i __X, const int __C)
|
|
|
|
{
|
|
|
|
return (__m128i) __builtin_ia32_aeskeygenassist128 ((__v2di)__X, __C);
|
2023-04-27 09:56:41 +00:00
|
|
|
}
|
|
|
|
#else
|
2023-06-05 07:37:25 +00:00
|
|
|
#define _mm_aeskeygenassist_si128(X, C) ((__m128i) __builtin_ia32_aeskeygenassist128 ((__v2di)(__m128i)(X), (int)(C)))
|
2023-04-27 09:56:41 +00:00
|
|
|
#endif
|
|
|
|
#ifdef __DISABLE_AES__
|
|
|
|
#undef __DISABLE_AES__
|
|
|
|
#pragma GCC pop_options
|
2023-06-05 07:37:25 +00:00
|
|
|
#endif
|
2023-04-27 09:56:41 +00:00
|
|
|
#if !defined(__PCLMUL__) || !defined(__SSE2__)
|
|
|
|
#pragma GCC push_options
|
|
|
|
#pragma GCC target("pclmul,sse2")
|
|
|
|
#define __DISABLE_PCLMUL__
|
2023-06-05 07:37:25 +00:00
|
|
|
#endif
|
2023-04-27 09:56:41 +00:00
|
|
|
#ifdef __OPTIMIZE__
|
2023-06-05 07:37:25 +00:00
|
|
|
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_mm_clmulepi64_si128 (__m128i __X, __m128i __Y, const int __I)
|
|
|
|
{
|
|
|
|
return (__m128i) __builtin_ia32_pclmulqdq128 ((__v2di)__X,
|
|
|
|
(__v2di)__Y, __I);
|
2023-04-27 09:56:41 +00:00
|
|
|
}
|
|
|
|
#else
|
2023-06-05 07:37:25 +00:00
|
|
|
#define _mm_clmulepi64_si128(X, Y, I) ((__m128i) __builtin_ia32_pclmulqdq128 ((__v2di)(__m128i)(X), (__v2di)(__m128i)(Y), (int)(I)))
|
2023-04-27 09:56:41 +00:00
|
|
|
#endif
|
|
|
|
#ifdef __DISABLE_PCLMUL__
|
|
|
|
#undef __DISABLE_PCLMUL__
|
|
|
|
#pragma GCC pop_options
|
2023-06-05 07:37:25 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|