shaintrin.h revision 1.1.1.3 1 1.1.1.3 mrg /* Copyright (C) 2013-2017 Free Software Foundation, Inc.
2 1.1 mrg
3 1.1 mrg This file is part of GCC.
4 1.1 mrg
5 1.1 mrg GCC is free software; you can redistribute it and/or modify
6 1.1 mrg it under the terms of the GNU General Public License as published by
7 1.1 mrg the Free Software Foundation; either version 3, or (at your option)
8 1.1 mrg any later version.
9 1.1 mrg
10 1.1 mrg GCC is distributed in the hope that it will be useful,
11 1.1 mrg but WITHOUT ANY WARRANTY; without even the implied warranty of
12 1.1 mrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 1.1 mrg GNU General Public License for more details.
14 1.1 mrg
15 1.1 mrg Under Section 7 of GPL version 3, you are granted additional
16 1.1 mrg permissions described in the GCC Runtime Library Exception, version
17 1.1 mrg 3.1, as published by the Free Software Foundation.
18 1.1 mrg
19 1.1 mrg You should have received a copy of the GNU General Public License and
20 1.1 mrg a copy of the GCC Runtime Library Exception along with this program;
21 1.1 mrg see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 1.1 mrg <http://www.gnu.org/licenses/>. */
23 1.1 mrg
24 1.1 mrg #ifndef _IMMINTRIN_H_INCLUDED
25 1.1 mrg #error "Never use <shaintrin.h> directly; include <immintrin.h> instead."
26 1.1 mrg #endif
27 1.1 mrg
28 1.1 mrg #ifndef _SHAINTRIN_H_INCLUDED
29 1.1 mrg #define _SHAINTRIN_H_INCLUDED
30 1.1 mrg
31 1.1 mrg #ifndef __SHA__
32 1.1 mrg #pragma GCC push_options
33 1.1 mrg #pragma GCC target("sha")
34 1.1 mrg #define __DISABLE_SHA__
35 1.1 mrg #endif /* __SHA__ */
36 1.1 mrg
37 1.1 mrg extern __inline __m128i
38 1.1 mrg __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
39 1.1 mrg _mm_sha1msg1_epu32 (__m128i __A, __m128i __B)
40 1.1 mrg {
41 1.1 mrg return (__m128i) __builtin_ia32_sha1msg1 ((__v4si) __A, (__v4si) __B);
42 1.1 mrg }
43 1.1 mrg
44 1.1 mrg extern __inline __m128i
45 1.1 mrg __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
46 1.1 mrg _mm_sha1msg2_epu32 (__m128i __A, __m128i __B)
47 1.1 mrg {
48 1.1 mrg return (__m128i) __builtin_ia32_sha1msg2 ((__v4si) __A, (__v4si) __B);
49 1.1 mrg }
50 1.1 mrg
51 1.1 mrg extern __inline __m128i
52 1.1 mrg __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
53 1.1 mrg _mm_sha1nexte_epu32 (__m128i __A, __m128i __B)
54 1.1 mrg {
55 1.1 mrg return (__m128i) __builtin_ia32_sha1nexte ((__v4si) __A, (__v4si) __B);
56 1.1 mrg }
57 1.1 mrg
58 1.1 mrg #ifdef __OPTIMIZE__
59 1.1 mrg extern __inline __m128i
60 1.1 mrg __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
61 1.1 mrg _mm_sha1rnds4_epu32 (__m128i __A, __m128i __B, const int __I)
62 1.1 mrg {
63 1.1 mrg return (__m128i) __builtin_ia32_sha1rnds4 ((__v4si) __A, (__v4si) __B, __I);
64 1.1 mrg }
65 1.1 mrg #else
66 1.1 mrg #define _mm_sha1rnds4_epu32(A, B, I) \
67 1.1 mrg ((__m128i) __builtin_ia32_sha1rnds4 ((__v4si)(__m128i)A, \
68 1.1 mrg (__v4si)(__m128i)B, (int)I))
69 1.1 mrg #endif
70 1.1 mrg
71 1.1 mrg extern __inline __m128i
72 1.1 mrg __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
73 1.1 mrg _mm_sha256msg1_epu32 (__m128i __A, __m128i __B)
74 1.1 mrg {
75 1.1 mrg return (__m128i) __builtin_ia32_sha256msg1 ((__v4si) __A, (__v4si) __B);
76 1.1 mrg }
77 1.1 mrg
78 1.1 mrg extern __inline __m128i
79 1.1 mrg __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
80 1.1 mrg _mm_sha256msg2_epu32 (__m128i __A, __m128i __B)
81 1.1 mrg {
82 1.1 mrg return (__m128i) __builtin_ia32_sha256msg2 ((__v4si) __A, (__v4si) __B);
83 1.1 mrg }
84 1.1 mrg
85 1.1 mrg extern __inline __m128i
86 1.1 mrg __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
87 1.1 mrg _mm_sha256rnds2_epu32 (__m128i __A, __m128i __B, __m128i __C)
88 1.1 mrg {
89 1.1 mrg return (__m128i) __builtin_ia32_sha256rnds2 ((__v4si) __A, (__v4si) __B,
90 1.1 mrg (__v4si) __C);
91 1.1 mrg }
92 1.1 mrg
93 1.1 mrg #ifdef __DISABLE_SHA__
94 1.1 mrg #undef __DISABLE_SHA__
95 1.1 mrg #pragma GCC pop_options
96 1.1 mrg #endif /* __DISABLE_SHA__ */
97 1.1 mrg
98 1.1 mrg #endif /* _SHAINTRIN_H_INCLUDED */
99