vpclmulqdqintrin.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* Copyright (C) 2014-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 _IMMINTRIN_H_INCLUDED
  19. #error "Never use <vpclmulqdqintrin.h> directly; include <immintrin.h> instead."
  20. #endif
  21. #ifndef _VPCLMULQDQINTRIN_H_INCLUDED
  22. #define _VPCLMULQDQINTRIN_H_INCLUDED
  23. #if !defined(__VPCLMULQDQ__) || !defined(__AVX512F__)
  24. #pragma GCC push_options
  25. #pragma GCC target("vpclmulqdq,avx512f")
  26. #define __DISABLE_VPCLMULQDQF__
  27. #endif /* __VPCLMULQDQF__ */
  28. #ifdef __OPTIMIZE__
  29. extern __inline __m512i
  30. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  31. _mm512_clmulepi64_epi128 (__m512i __A, __m512i __B, const int __C)
  32. {
  33. return (__m512i) __builtin_ia32_vpclmulqdq_v8di ((__v8di)__A,
  34. (__v8di) __B, __C);
  35. }
  36. #else
  37. #define _mm512_clmulepi64_epi128(A, B, C) \
  38. ((__m512i) __builtin_ia32_vpclmulqdq_v8di ((__v8di)(__m512i)(A), \
  39. (__v8di)(__m512i)(B), (int)(C)))
  40. #endif
  41. #ifdef __DISABLE_VPCLMULQDQF__
  42. #undef __DISABLE_VPCLMULQDQF__
  43. #pragma GCC pop_options
  44. #endif /* __DISABLE_VPCLMULQDQF__ */
  45. #if !defined(__VPCLMULQDQ__) || !defined(__AVX__)
  46. #pragma GCC push_options
  47. #pragma GCC target("vpclmulqdq,avx")
  48. #define __DISABLE_VPCLMULQDQ__
  49. #endif /* __VPCLMULQDQ__ */
  50. #ifdef __OPTIMIZE__
  51. extern __inline __m256i
  52. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  53. _mm256_clmulepi64_epi128 (__m256i __A, __m256i __B, const int __C)
  54. {
  55. return (__m256i) __builtin_ia32_vpclmulqdq_v4di ((__v4di)__A,
  56. (__v4di) __B, __C);
  57. }
  58. #else
  59. #define _mm256_clmulepi64_epi128(A, B, C) \
  60. ((__m256i) __builtin_ia32_vpclmulqdq_v4di ((__v4di)(__m256i)(A), \
  61. (__v4di)(__m256i)(B), (int)(C)))
  62. #endif
  63. #ifdef __DISABLE_VPCLMULQDQ__
  64. #undef __DISABLE_VPCLMULQDQ__
  65. #pragma GCC pop_options
  66. #endif /* __DISABLE_VPCLMULQDQ__ */
  67. #endif /* _VPCLMULQDQINTRIN_H_INCLUDED */