1 /* Copyright (C) 2017-2018 Free Software Foundation, Inc.
3 This file is part of GCC.
5 GCC is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
10 GCC is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 Under Section 7 of GPL version 3, you are granted additional
16 permissions described in the GCC Runtime Library Exception, version
17 3.1, as published by the Free Software Foundation.
19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. */
24 #ifndef __VAESINTRIN_H_INCLUDED
25 #define __VAESINTRIN_H_INCLUDED
27 #if !defined(__VAES__) || !defined(__AVX__)
28 #pragma GCC push_options
29 #pragma GCC target("vaes,avx")
30 #define __DISABLE_VAES__
33 extern __inline __m256i
34 __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
35 _mm256_aesdec_epi128 (__m256i __A
, __m256i __B
)
37 return (__m256i
)__builtin_ia32_vaesdec_v32qi ((__v32qi
) __A
, (__v32qi
) __B
);
40 extern __inline __m256i
41 __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
42 _mm256_aesdeclast_epi128 (__m256i __A
, __m256i __B
)
44 return (__m256i
)__builtin_ia32_vaesdeclast_v32qi ((__v32qi
) __A
,
48 extern __inline __m256i
49 __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
50 _mm256_aesenc_epi128 (__m256i __A
, __m256i __B
)
52 return (__m256i
)__builtin_ia32_vaesenc_v32qi ((__v32qi
) __A
, (__v32qi
) __B
);
55 extern __inline __m256i
56 __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
57 _mm256_aesenclast_epi128 (__m256i __A
, __m256i __B
)
59 return (__m256i
)__builtin_ia32_vaesenclast_v32qi ((__v32qi
) __A
,
63 #ifdef __DISABLE_VAES__
64 #undef __DISABLE_VAES__
65 #pragma GCC pop_options
66 #endif /* __DISABLE_VAES__ */
69 #if !defined(__VAES__) || !defined(__AVX512F__)
70 #pragma GCC push_options
71 #pragma GCC target("vaes,avx512f")
72 #define __DISABLE_VAESF__
76 extern __inline __m512i
77 __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
78 _mm512_aesdec_epi128 (__m512i __A
, __m512i __B
)
80 return (__m512i
)__builtin_ia32_vaesdec_v64qi ((__v64qi
) __A
, (__v64qi
) __B
);
83 extern __inline __m512i
84 __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
85 _mm512_aesdeclast_epi128 (__m512i __A
, __m512i __B
)
87 return (__m512i
)__builtin_ia32_vaesdeclast_v64qi ((__v64qi
) __A
,
91 extern __inline __m512i
92 __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
93 _mm512_aesenc_epi128 (__m512i __A
, __m512i __B
)
95 return (__m512i
)__builtin_ia32_vaesenc_v64qi ((__v64qi
) __A
, (__v64qi
) __B
);
98 extern __inline __m512i
99 __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
100 _mm512_aesenclast_epi128 (__m512i __A
, __m512i __B
)
102 return (__m512i
)__builtin_ia32_vaesenclast_v64qi ((__v64qi
) __A
,
106 #ifdef __DISABLE_VAESF__
107 #undef __DISABLE_VAESF__
108 #pragma GCC pop_options
109 #endif /* __DISABLE_VAES__ */
111 #endif /* __VAESINTRIN_H_INCLUDED */