vaesintrin.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* Copyright (C) 2017-2019 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. GCC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. #ifndef __VAESINTRIN_H_INCLUDED
  19. #define __VAESINTRIN_H_INCLUDED
  20. #if !defined(__VAES__) || !defined(__AVX__)
  21. #pragma GCC push_options
  22. #pragma GCC target("vaes,avx")
  23. #define __DISABLE_VAES__
  24. #endif /* __VAES__ */
  25. extern __inline __m256i
  26. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  27. _mm256_aesdec_epi128 (__m256i __A, __m256i __B)
  28. {
  29. return (__m256i)__builtin_ia32_vaesdec_v32qi ((__v32qi) __A, (__v32qi) __B);
  30. }
  31. extern __inline __m256i
  32. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  33. _mm256_aesdeclast_epi128 (__m256i __A, __m256i __B)
  34. {
  35. return (__m256i)__builtin_ia32_vaesdeclast_v32qi ((__v32qi) __A,
  36. (__v32qi) __B);
  37. }
  38. extern __inline __m256i
  39. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  40. _mm256_aesenc_epi128 (__m256i __A, __m256i __B)
  41. {
  42. return (__m256i)__builtin_ia32_vaesenc_v32qi ((__v32qi) __A, (__v32qi) __B);
  43. }
  44. extern __inline __m256i
  45. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  46. _mm256_aesenclast_epi128 (__m256i __A, __m256i __B)
  47. {
  48. return (__m256i)__builtin_ia32_vaesenclast_v32qi ((__v32qi) __A,
  49. (__v32qi) __B);
  50. }
  51. #ifdef __DISABLE_VAES__
  52. #undef __DISABLE_VAES__
  53. #pragma GCC pop_options
  54. #endif /* __DISABLE_VAES__ */
  55. #if !defined(__VAES__) || !defined(__AVX512F__)
  56. #pragma GCC push_options
  57. #pragma GCC target("vaes,avx512f")
  58. #define __DISABLE_VAESF__
  59. #endif /* __VAES__ */
  60. extern __inline __m512i
  61. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  62. _mm512_aesdec_epi128 (__m512i __A, __m512i __B)
  63. {
  64. return (__m512i)__builtin_ia32_vaesdec_v64qi ((__v64qi) __A, (__v64qi) __B);
  65. }
  66. extern __inline __m512i
  67. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  68. _mm512_aesdeclast_epi128 (__m512i __A, __m512i __B)
  69. {
  70. return (__m512i)__builtin_ia32_vaesdeclast_v64qi ((__v64qi) __A,
  71. (__v64qi) __B);
  72. }
  73. extern __inline __m512i
  74. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  75. _mm512_aesenc_epi128 (__m512i __A, __m512i __B)
  76. {
  77. return (__m512i)__builtin_ia32_vaesenc_v64qi ((__v64qi) __A, (__v64qi) __B);
  78. }
  79. extern __inline __m512i
  80. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  81. _mm512_aesenclast_epi128 (__m512i __A, __m512i __B)
  82. {
  83. return (__m512i)__builtin_ia32_vaesenclast_v64qi ((__v64qi) __A,
  84. (__v64qi) __B);
  85. }
  86. #ifdef __DISABLE_VAESF__
  87. #undef __DISABLE_VAESF__
  88. #pragma GCC pop_options
  89. #endif /* __DISABLE_VAES__ */
  90. #endif /* __VAESINTRIN_H_INCLUDED */