shaintrin.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* Copyright (C) 2013-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 <shaintrin.h> directly; include <immintrin.h> instead."
  20. #endif
  21. #ifndef _SHAINTRIN_H_INCLUDED
  22. #define _SHAINTRIN_H_INCLUDED
  23. #ifndef __SHA__
  24. #pragma GCC push_options
  25. #pragma GCC target("sha")
  26. #define __DISABLE_SHA__
  27. #endif /* __SHA__ */
  28. extern __inline __m128i
  29. __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
  30. _mm_sha1msg1_epu32 (__m128i __A, __m128i __B)
  31. {
  32. return (__m128i) __builtin_ia32_sha1msg1 ((__v4si) __A, (__v4si) __B);
  33. }
  34. extern __inline __m128i
  35. __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
  36. _mm_sha1msg2_epu32 (__m128i __A, __m128i __B)
  37. {
  38. return (__m128i) __builtin_ia32_sha1msg2 ((__v4si) __A, (__v4si) __B);
  39. }
  40. extern __inline __m128i
  41. __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
  42. _mm_sha1nexte_epu32 (__m128i __A, __m128i __B)
  43. {
  44. return (__m128i) __builtin_ia32_sha1nexte ((__v4si) __A, (__v4si) __B);
  45. }
  46. #ifdef __OPTIMIZE__
  47. extern __inline __m128i
  48. __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
  49. _mm_sha1rnds4_epu32 (__m128i __A, __m128i __B, const int __I)
  50. {
  51. return (__m128i) __builtin_ia32_sha1rnds4 ((__v4si) __A, (__v4si) __B, __I);
  52. }
  53. #else
  54. #define _mm_sha1rnds4_epu32(A, B, I) \
  55. ((__m128i) __builtin_ia32_sha1rnds4 ((__v4si)(__m128i)A, \
  56. (__v4si)(__m128i)B, (int)I))
  57. #endif
  58. extern __inline __m128i
  59. __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
  60. _mm_sha256msg1_epu32 (__m128i __A, __m128i __B)
  61. {
  62. return (__m128i) __builtin_ia32_sha256msg1 ((__v4si) __A, (__v4si) __B);
  63. }
  64. extern __inline __m128i
  65. __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
  66. _mm_sha256msg2_epu32 (__m128i __A, __m128i __B)
  67. {
  68. return (__m128i) __builtin_ia32_sha256msg2 ((__v4si) __A, (__v4si) __B);
  69. }
  70. extern __inline __m128i
  71. __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
  72. _mm_sha256rnds2_epu32 (__m128i __A, __m128i __B, __m128i __C)
  73. {
  74. return (__m128i) __builtin_ia32_sha256rnds2 ((__v4si) __A, (__v4si) __B,
  75. (__v4si) __C);
  76. }
  77. #ifdef __DISABLE_SHA__
  78. #undef __DISABLE_SHA__
  79. #pragma GCC pop_options
  80. #endif /* __DISABLE_SHA__ */
  81. #endif /* _SHAINTRIN_H_INCLUDED */