| 1 |
/* Copyright (C) 2017-2021 Free Software Foundation, Inc. |
| 2 |
|
| 3 |
This file is part of GCC. |
| 4 |
|
| 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) |
| 8 |
any later version. |
| 9 |
|
| 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. |
| 14 |
|
| 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. |
| 18 |
|
| 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/>. */ |
| 23 |
|
| 24 |
#ifndef __VAESINTRIN_H_INCLUDED |
| 25 |
#define __VAESINTRIN_H_INCLUDED |
| 26 |
|
| 27 |
#if !defined(__VAES__) || !defined(__AVX__) |
| 28 |
#pragma GCC push_options |
| 29 |
#pragma GCC target("vaes,avx") |
| 30 |
#define __DISABLE_VAES__ |
| 31 |
#endif /* __VAES__ */ |
| 32 |
|
| 33 |
extern __inline __m256i |
| 34 |
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 35 |
_mm256_aesdec_epi128 (__m256i __A, __m256i __B) |
| 36 |
{ |
| 37 |
return (__m256i)__builtin_ia32_vaesdec_v32qi ((__v32qi) __A, (__v32qi) __B); |
| 38 |
} |
| 39 |
|
| 40 |
extern __inline __m256i |
| 41 |
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 42 |
_mm256_aesdeclast_epi128 (__m256i __A, __m256i __B) |
| 43 |
{ |
| 44 |
return (__m256i)__builtin_ia32_vaesdeclast_v32qi ((__v32qi) __A, |
| 45 |
(__v32qi) __B); |
| 46 |
} |
| 47 |
|
| 48 |
extern __inline __m256i |
| 49 |
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 50 |
_mm256_aesenc_epi128 (__m256i __A, __m256i __B) |
| 51 |
{ |
| 52 |
return (__m256i)__builtin_ia32_vaesenc_v32qi ((__v32qi) __A, (__v32qi) __B); |
| 53 |
} |
| 54 |
|
| 55 |
extern __inline __m256i |
| 56 |
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 57 |
_mm256_aesenclast_epi128 (__m256i __A, __m256i __B) |
| 58 |
{ |
| 59 |
return (__m256i)__builtin_ia32_vaesenclast_v32qi ((__v32qi) __A, |
| 60 |
(__v32qi) __B); |
| 61 |
} |
| 62 |
|
| 63 |
#ifdef __DISABLE_VAES__ |
| 64 |
#undef __DISABLE_VAES__ |
| 65 |
#pragma GCC pop_options |
| 66 |
#endif /* __DISABLE_VAES__ */ |
| 67 |
|
| 68 |
|
| 69 |
#if !defined(__VAES__) || !defined(__AVX512F__) |
| 70 |
#pragma GCC push_options |
| 71 |
#pragma GCC target("vaes,avx512f") |
| 72 |
#define __DISABLE_VAESF__ |
| 73 |
#endif /* __VAES__ */ |
| 74 |
|
| 75 |
|
| 76 |
extern __inline __m512i |
| 77 |
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 78 |
_mm512_aesdec_epi128 (__m512i __A, __m512i __B) |
| 79 |
{ |
| 80 |
return (__m512i)__builtin_ia32_vaesdec_v64qi ((__v64qi) __A, (__v64qi) __B); |
| 81 |
} |
| 82 |
|
| 83 |
extern __inline __m512i |
| 84 |
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 85 |
_mm512_aesdeclast_epi128 (__m512i __A, __m512i __B) |
| 86 |
{ |
| 87 |
return (__m512i)__builtin_ia32_vaesdeclast_v64qi ((__v64qi) __A, |
| 88 |
(__v64qi) __B); |
| 89 |
} |
| 90 |
|
| 91 |
extern __inline __m512i |
| 92 |
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 93 |
_mm512_aesenc_epi128 (__m512i __A, __m512i __B) |
| 94 |
{ |
| 95 |
return (__m512i)__builtin_ia32_vaesenc_v64qi ((__v64qi) __A, (__v64qi) __B); |
| 96 |
} |
| 97 |
|
| 98 |
extern __inline __m512i |
| 99 |
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 100 |
_mm512_aesenclast_epi128 (__m512i __A, __m512i __B) |
| 101 |
{ |
| 102 |
return (__m512i)__builtin_ia32_vaesenclast_v64qi ((__v64qi) __A, |
| 103 |
(__v64qi) __B); |
| 104 |
} |
| 105 |
|
| 106 |
#ifdef __DISABLE_VAESF__ |
| 107 |
#undef __DISABLE_VAESF__ |
| 108 |
#pragma GCC pop_options |
| 109 |
#endif /* __DISABLE_VAES__ */ |
| 110 |
|
| 111 |
#endif /* __VAESINTRIN_H_INCLUDED */ |