annotate clang/lib/Headers/__wmmintrin_aes.h @ 176:de4ac79aef9d

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 17:13:11 +0900
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 /*===---- __wmmintrin_aes.h - AES intrinsics -------------------------------===
anatofuz
parents:
diff changeset
2 *
anatofuz
parents:
diff changeset
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 * See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 *
anatofuz
parents:
diff changeset
7 *===-----------------------------------------------------------------------===
anatofuz
parents:
diff changeset
8 */
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 #ifndef __WMMINTRIN_H
anatofuz
parents:
diff changeset
11 #error "Never use <__wmmintrin_aes.h> directly; include <wmmintrin.h> instead."
anatofuz
parents:
diff changeset
12 #endif
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 #ifndef __WMMINTRIN_AES_H
anatofuz
parents:
diff changeset
15 #define __WMMINTRIN_AES_H
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 /* Define the default attributes for the functions in this file. */
anatofuz
parents:
diff changeset
18 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("aes"), __min_vector_width__(128)))
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 /// Performs a single round of AES encryption using the Equivalent
anatofuz
parents:
diff changeset
21 /// Inverse Cipher, transforming the state value from the first source
anatofuz
parents:
diff changeset
22 /// operand using a 128-bit round key value contained in the second source
anatofuz
parents:
diff changeset
23 /// operand, and writes the result to the destination.
anatofuz
parents:
diff changeset
24 ///
anatofuz
parents:
diff changeset
25 /// \headerfile <x86intrin.h>
anatofuz
parents:
diff changeset
26 ///
anatofuz
parents:
diff changeset
27 /// This intrinsic corresponds to the <c> VAESENC </c> instruction.
anatofuz
parents:
diff changeset
28 ///
anatofuz
parents:
diff changeset
29 /// \param __V
anatofuz
parents:
diff changeset
30 /// A 128-bit integer vector containing the state value.
anatofuz
parents:
diff changeset
31 /// \param __R
anatofuz
parents:
diff changeset
32 /// A 128-bit integer vector containing the round key value.
anatofuz
parents:
diff changeset
33 /// \returns A 128-bit integer vector containing the encrypted value.
anatofuz
parents:
diff changeset
34 static __inline__ __m128i __DEFAULT_FN_ATTRS
anatofuz
parents:
diff changeset
35 _mm_aesenc_si128(__m128i __V, __m128i __R)
anatofuz
parents:
diff changeset
36 {
anatofuz
parents:
diff changeset
37 return (__m128i)__builtin_ia32_aesenc128((__v2di)__V, (__v2di)__R);
anatofuz
parents:
diff changeset
38 }
anatofuz
parents:
diff changeset
39
anatofuz
parents:
diff changeset
40 /// Performs the final round of AES encryption using the Equivalent
anatofuz
parents:
diff changeset
41 /// Inverse Cipher, transforming the state value from the first source
anatofuz
parents:
diff changeset
42 /// operand using a 128-bit round key value contained in the second source
anatofuz
parents:
diff changeset
43 /// operand, and writes the result to the destination.
anatofuz
parents:
diff changeset
44 ///
anatofuz
parents:
diff changeset
45 /// \headerfile <x86intrin.h>
anatofuz
parents:
diff changeset
46 ///
anatofuz
parents:
diff changeset
47 /// This intrinsic corresponds to the <c> VAESENCLAST </c> instruction.
anatofuz
parents:
diff changeset
48 ///
anatofuz
parents:
diff changeset
49 /// \param __V
anatofuz
parents:
diff changeset
50 /// A 128-bit integer vector containing the state value.
anatofuz
parents:
diff changeset
51 /// \param __R
anatofuz
parents:
diff changeset
52 /// A 128-bit integer vector containing the round key value.
anatofuz
parents:
diff changeset
53 /// \returns A 128-bit integer vector containing the encrypted value.
anatofuz
parents:
diff changeset
54 static __inline__ __m128i __DEFAULT_FN_ATTRS
anatofuz
parents:
diff changeset
55 _mm_aesenclast_si128(__m128i __V, __m128i __R)
anatofuz
parents:
diff changeset
56 {
anatofuz
parents:
diff changeset
57 return (__m128i)__builtin_ia32_aesenclast128((__v2di)__V, (__v2di)__R);
anatofuz
parents:
diff changeset
58 }
anatofuz
parents:
diff changeset
59
anatofuz
parents:
diff changeset
60 /// Performs a single round of AES decryption using the Equivalent
anatofuz
parents:
diff changeset
61 /// Inverse Cipher, transforming the state value from the first source
anatofuz
parents:
diff changeset
62 /// operand using a 128-bit round key value contained in the second source
anatofuz
parents:
diff changeset
63 /// operand, and writes the result to the destination.
anatofuz
parents:
diff changeset
64 ///
anatofuz
parents:
diff changeset
65 /// \headerfile <x86intrin.h>
anatofuz
parents:
diff changeset
66 ///
anatofuz
parents:
diff changeset
67 /// This intrinsic corresponds to the <c> VAESDEC </c> instruction.
anatofuz
parents:
diff changeset
68 ///
anatofuz
parents:
diff changeset
69 /// \param __V
anatofuz
parents:
diff changeset
70 /// A 128-bit integer vector containing the state value.
anatofuz
parents:
diff changeset
71 /// \param __R
anatofuz
parents:
diff changeset
72 /// A 128-bit integer vector containing the round key value.
anatofuz
parents:
diff changeset
73 /// \returns A 128-bit integer vector containing the decrypted value.
anatofuz
parents:
diff changeset
74 static __inline__ __m128i __DEFAULT_FN_ATTRS
anatofuz
parents:
diff changeset
75 _mm_aesdec_si128(__m128i __V, __m128i __R)
anatofuz
parents:
diff changeset
76 {
anatofuz
parents:
diff changeset
77 return (__m128i)__builtin_ia32_aesdec128((__v2di)__V, (__v2di)__R);
anatofuz
parents:
diff changeset
78 }
anatofuz
parents:
diff changeset
79
anatofuz
parents:
diff changeset
80 /// Performs the final round of AES decryption using the Equivalent
anatofuz
parents:
diff changeset
81 /// Inverse Cipher, transforming the state value from the first source
anatofuz
parents:
diff changeset
82 /// operand using a 128-bit round key value contained in the second source
anatofuz
parents:
diff changeset
83 /// operand, and writes the result to the destination.
anatofuz
parents:
diff changeset
84 ///
anatofuz
parents:
diff changeset
85 /// \headerfile <x86intrin.h>
anatofuz
parents:
diff changeset
86 ///
anatofuz
parents:
diff changeset
87 /// This intrinsic corresponds to the <c> VAESDECLAST </c> instruction.
anatofuz
parents:
diff changeset
88 ///
anatofuz
parents:
diff changeset
89 /// \param __V
anatofuz
parents:
diff changeset
90 /// A 128-bit integer vector containing the state value.
anatofuz
parents:
diff changeset
91 /// \param __R
anatofuz
parents:
diff changeset
92 /// A 128-bit integer vector containing the round key value.
anatofuz
parents:
diff changeset
93 /// \returns A 128-bit integer vector containing the decrypted value.
anatofuz
parents:
diff changeset
94 static __inline__ __m128i __DEFAULT_FN_ATTRS
anatofuz
parents:
diff changeset
95 _mm_aesdeclast_si128(__m128i __V, __m128i __R)
anatofuz
parents:
diff changeset
96 {
anatofuz
parents:
diff changeset
97 return (__m128i)__builtin_ia32_aesdeclast128((__v2di)__V, (__v2di)__R);
anatofuz
parents:
diff changeset
98 }
anatofuz
parents:
diff changeset
99
anatofuz
parents:
diff changeset
100 /// Applies the AES InvMixColumns() transformation to an expanded key
anatofuz
parents:
diff changeset
101 /// contained in the source operand, and writes the result to the
anatofuz
parents:
diff changeset
102 /// destination.
anatofuz
parents:
diff changeset
103 ///
anatofuz
parents:
diff changeset
104 /// \headerfile <x86intrin.h>
anatofuz
parents:
diff changeset
105 ///
anatofuz
parents:
diff changeset
106 /// This intrinsic corresponds to the <c> VAESIMC </c> instruction.
anatofuz
parents:
diff changeset
107 ///
anatofuz
parents:
diff changeset
108 /// \param __V
anatofuz
parents:
diff changeset
109 /// A 128-bit integer vector containing the expanded key.
anatofuz
parents:
diff changeset
110 /// \returns A 128-bit integer vector containing the transformed value.
anatofuz
parents:
diff changeset
111 static __inline__ __m128i __DEFAULT_FN_ATTRS
anatofuz
parents:
diff changeset
112 _mm_aesimc_si128(__m128i __V)
anatofuz
parents:
diff changeset
113 {
anatofuz
parents:
diff changeset
114 return (__m128i)__builtin_ia32_aesimc128((__v2di)__V);
anatofuz
parents:
diff changeset
115 }
anatofuz
parents:
diff changeset
116
anatofuz
parents:
diff changeset
117 /// Generates a round key for AES encryption, operating on 128-bit data
anatofuz
parents:
diff changeset
118 /// specified in the first source operand and using an 8-bit round constant
anatofuz
parents:
diff changeset
119 /// specified by the second source operand, and writes the result to the
anatofuz
parents:
diff changeset
120 /// destination.
anatofuz
parents:
diff changeset
121 ///
anatofuz
parents:
diff changeset
122 /// \headerfile <x86intrin.h>
anatofuz
parents:
diff changeset
123 ///
anatofuz
parents:
diff changeset
124 /// \code
anatofuz
parents:
diff changeset
125 /// __m128i _mm_aeskeygenassist_si128(__m128i C, const int R);
anatofuz
parents:
diff changeset
126 /// \endcode
anatofuz
parents:
diff changeset
127 ///
anatofuz
parents:
diff changeset
128 /// This intrinsic corresponds to the <c> AESKEYGENASSIST </c> instruction.
anatofuz
parents:
diff changeset
129 ///
anatofuz
parents:
diff changeset
130 /// \param C
anatofuz
parents:
diff changeset
131 /// A 128-bit integer vector that is used to generate the AES encryption key.
anatofuz
parents:
diff changeset
132 /// \param R
anatofuz
parents:
diff changeset
133 /// An 8-bit round constant used to generate the AES encryption key.
anatofuz
parents:
diff changeset
134 /// \returns A 128-bit round key for AES encryption.
anatofuz
parents:
diff changeset
135 #define _mm_aeskeygenassist_si128(C, R) \
anatofuz
parents:
diff changeset
136 (__m128i)__builtin_ia32_aeskeygenassist128((__v2di)(__m128i)(C), (int)(R))
anatofuz
parents:
diff changeset
137
anatofuz
parents:
diff changeset
138 #undef __DEFAULT_FN_ATTRS
anatofuz
parents:
diff changeset
139
anatofuz
parents:
diff changeset
140 #endif /* __WMMINTRIN_AES_H */