clang 8.0.0

__wmmintrin_aes.h
Go to the documentation of this file.
1 /*===---- __wmmintrin_aes.h - AES intrinsics -------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24 #ifndef __WMMINTRIN_H
25 #error "Never use <__wmmintrin_aes.h> directly; include <wmmintrin.h> instead."
26 #endif
27
28 #ifndef __WMMINTRIN_AES_H
29 #define __WMMINTRIN_AES_H
30
31 /* Define the default attributes for the functions in this file. */
32 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("aes"), __min_vector_width__(128)))
33
34 /// Performs a single round of AES encryption using the Equivalent
35 /// Inverse Cipher, transforming the state value from the first source
36 /// operand using a 128-bit round key value contained in the second source
37 /// operand, and writes the result to the destination.
38 ///
39 /// \headerfile <x86intrin.h>
40 ///
41 /// This intrinsic corresponds to the <c> VAESENC </c> instruction.
42 ///
43 /// \param __V
44 /// A 128-bit integer vector containing the state value.
45 /// \param __R
46 /// A 128-bit integer vector containing the round key value.
47 /// \returns A 128-bit integer vector containing the encrypted value.
48 static __inline__ __m128i __DEFAULT_FN_ATTRS
49 _mm_aesenc_si128(__m128i __V, __m128i __R)
50 {
51 return (__m128i)__builtin_ia32_aesenc128((__v2di)__V, (__v2di)__R);
52 }
53
54 /// Performs the final round of AES encryption using the Equivalent
55 /// Inverse Cipher, transforming the state value from the first source
56 /// operand using a 128-bit round key value contained in the second source
57 /// operand, and writes the result to the destination.
58 ///
59 /// \headerfile <x86intrin.h>
60 ///
61 /// This intrinsic corresponds to the <c> VAESENCLAST </c> instruction.
62 ///
63 /// \param __V
64 /// A 128-bit integer vector containing the state value.
65 /// \param __R
66 /// A 128-bit integer vector containing the round key value.
67 /// \returns A 128-bit integer vector containing the encrypted value.
68 static __inline__ __m128i __DEFAULT_FN_ATTRS
69 _mm_aesenclast_si128(__m128i __V, __m128i __R)
70 {
71 return (__m128i)__builtin_ia32_aesenclast128((__v2di)__V, (__v2di)__R);
72 }
73
74 /// Performs a single round of AES decryption using the Equivalent
75 /// Inverse Cipher, transforming the state value from the first source
76 /// operand using a 128-bit round key value contained in the second source
77 /// operand, and writes the result to the destination.
78 ///
79 /// \headerfile <x86intrin.h>
80 ///
81 /// This intrinsic corresponds to the <c> VAESDEC </c> instruction.
82 ///
83 /// \param __V
84 /// A 128-bit integer vector containing the state value.
85 /// \param __R
86 /// A 128-bit integer vector containing the round key value.
87 /// \returns A 128-bit integer vector containing the decrypted value.
88 static __inline__ __m128i __DEFAULT_FN_ATTRS
89 _mm_aesdec_si128(__m128i __V, __m128i __R)
90 {
91 return (__m128i)__builtin_ia32_aesdec128((__v2di)__V, (__v2di)__R);
92 }
93
94 /// Performs the final round of AES decryption using the Equivalent
95 /// Inverse Cipher, transforming the state value from the first source
96 /// operand using a 128-bit round key value contained in the second source
97 /// operand, and writes the result to the destination.
98 ///
99 /// \headerfile <x86intrin.h>
100 ///
101 /// This intrinsic corresponds to the <c> VAESDECLAST </c> instruction.
102 ///
103 /// \param __V
104 /// A 128-bit integer vector containing the state value.
105 /// \param __R
106 /// A 128-bit integer vector containing the round key value.
107 /// \returns A 128-bit integer vector containing the decrypted value.
108 static __inline__ __m128i __DEFAULT_FN_ATTRS
109 _mm_aesdeclast_si128(__m128i __V, __m128i __R)
110 {
111 return (__m128i)__builtin_ia32_aesdeclast128((__v2di)__V, (__v2di)__R);
112 }
113
114 /// Applies the AES InvMixColumns() transformation to an expanded key
115 /// contained in the source operand, and writes the result to the
116 /// destination.
117 ///
118 /// \headerfile <x86intrin.h>
119 ///
120 /// This intrinsic corresponds to the <c> VAESIMC </c> instruction.
121 ///
122 /// \param __V
123 /// A 128-bit integer vector containing the expanded key.
124 /// \returns A 128-bit integer vector containing the transformed value.
125 static __inline__ __m128i __DEFAULT_FN_ATTRS
126 _mm_aesimc_si128(__m128i __V)
127 {
128 return (__m128i)__builtin_ia32_aesimc128((__v2di)__V);
129 }
130
131 /// Generates a round key for AES encryption, operating on 128-bit data
132 /// specified in the first source operand and using an 8-bit round constant
133 /// specified by the second source operand, and writes the result to the
134 /// destination.
135 ///
136 /// \headerfile <x86intrin.h>
137 ///
138 /// \code
139 /// __m128i _mm_aeskeygenassist_si128(__m128i C, const int R);
140 /// \endcode
141 ///
142 /// This intrinsic corresponds to the <c> AESKEYGENASSIST </c> instruction.
143 ///
144 /// \param C
145 /// A 128-bit integer vector that is used to generate the AES encryption key.
146 /// \param R
147 /// An 8-bit round constant used to generate the AES encryption key.
148 /// \returns A 128-bit round key for AES encryption.
149 #define _mm_aeskeygenassist_si128(C, R) \
150 (__m128i)__builtin_ia32_aeskeygenassist128((__v2di)(__m128i)(C), (int)(R))
151
152 #undef __DEFAULT_FN_ATTRS
153
154 #endif /* __WMMINTRIN_AES_H */
_mm_aesenclast_si128
static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_aesenclast_si128(__m128i __V, __m128i __R)
Performs the final round of AES encryption using the Equivalent Inverse Cipher, transforming the stat...
Definition: __wmmintrin_aes.h:69
_mm_aesimc_si128
static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_aesimc_si128(__m128i __V)
Applies the AES InvMixColumns() transformation to an expanded key contained in the source operand...
Definition: __wmmintrin_aes.h:126
__DEFAULT_FN_ATTRS
#define __DEFAULT_FN_ATTRS
Definition: __wmmintrin_aes.h:32
_mm_aesenc_si128
static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_aesenc_si128(__m128i __V, __m128i __R)
Performs a single round of AES encryption using the Equivalent Inverse Cipher, transforming the state...
Definition: __wmmintrin_aes.h:49
_mm_aesdeclast_si128
static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_aesdeclast_si128(__m128i __V, __m128i __R)
Performs the final round of AES decryption using the Equivalent Inverse Cipher, transforming the stat...
Definition: __wmmintrin_aes.h:109
_mm_aesdec_si128
static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_aesdec_si128(__m128i __V, __m128i __R)
Performs a single round of AES decryption using the Equivalent Inverse Cipher, transforming the state...
Definition: __wmmintrin_aes.h:89