source: Daodan/MSYS2/mingw32/lib/gcc/i686-w64-mingw32/11.2.0/include/wmmintrin.h@ 1171

Last change on this file since 1171 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 4.5 KB
Line 
1/* Copyright (C) 2008-2021 Free Software Foundation, Inc.
2
3 This file is part of GCC.
4
5 GCC is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
9
10 GCC is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 Under Section 7 of GPL version 3, you are granted additional
16 permissions described in the GCC Runtime Library Exception, version
17 3.1, as published by the Free Software Foundation.
18
19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. */
23
24/* Implemented from the specification included in the Intel C++ Compiler
25 User Guide and Reference, version 10.1. */
26
27#ifndef _WMMINTRIN_H_INCLUDED
28#define _WMMINTRIN_H_INCLUDED
29
30/* We need definitions from the SSE2 header file. */
31#include <emmintrin.h>
32
33/* AES */
34
35#if !defined(__AES__) || !defined(__SSE2__)
36#pragma GCC push_options
37#pragma GCC target("aes,sse2")
38#define __DISABLE_AES__
39#endif /* __AES__ */
40
41/* Performs 1 round of AES decryption of the first m128i using
42 the second m128i as a round key. */
43extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
44_mm_aesdec_si128 (__m128i __X, __m128i __Y)
45{
46 return (__m128i) __builtin_ia32_aesdec128 ((__v2di)__X, (__v2di)__Y);
47}
48
49/* Performs the last round of AES decryption of the first m128i
50 using the second m128i as a round key. */
51extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
52_mm_aesdeclast_si128 (__m128i __X, __m128i __Y)
53{
54 return (__m128i) __builtin_ia32_aesdeclast128 ((__v2di)__X,
55 (__v2di)__Y);
56}
57
58/* Performs 1 round of AES encryption of the first m128i using
59 the second m128i as a round key. */
60extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
61_mm_aesenc_si128 (__m128i __X, __m128i __Y)
62{
63 return (__m128i) __builtin_ia32_aesenc128 ((__v2di)__X, (__v2di)__Y);
64}
65
66/* Performs the last round of AES encryption of the first m128i
67 using the second m128i as a round key. */
68extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
69_mm_aesenclast_si128 (__m128i __X, __m128i __Y)
70{
71 return (__m128i) __builtin_ia32_aesenclast128 ((__v2di)__X, (__v2di)__Y);
72}
73
74/* Performs the InverseMixColumn operation on the source m128i
75 and stores the result into m128i destination. */
76extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
77_mm_aesimc_si128 (__m128i __X)
78{
79 return (__m128i) __builtin_ia32_aesimc128 ((__v2di)__X);
80}
81
82/* Generates a m128i round key for the input m128i AES cipher key and
83 byte round constant. The second parameter must be a compile time
84 constant. */
85#ifdef __OPTIMIZE__
86extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
87_mm_aeskeygenassist_si128 (__m128i __X, const int __C)
88{
89 return (__m128i) __builtin_ia32_aeskeygenassist128 ((__v2di)__X, __C);
90}
91#else
92#define _mm_aeskeygenassist_si128(X, C) \
93 ((__m128i) __builtin_ia32_aeskeygenassist128 ((__v2di)(__m128i)(X), \
94 (int)(C)))
95#endif
96
97#ifdef __DISABLE_AES__
98#undef __DISABLE_AES__
99#pragma GCC pop_options
100#endif /* __DISABLE_AES__ */
101
102/* PCLMUL */
103
104#if !defined(__PCLMUL__) || !defined(__SSE2__)
105#pragma GCC push_options
106#pragma GCC target("pclmul,sse2")
107#define __DISABLE_PCLMUL__
108#endif /* __PCLMUL__ */
109
110/* Performs carry-less integer multiplication of 64-bit halves of
111 128-bit input operands. The third parameter inducates which 64-bit
112 haves of the input parameters v1 and v2 should be used. It must be
113 a compile time constant. */
114#ifdef __OPTIMIZE__
115extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
116_mm_clmulepi64_si128 (__m128i __X, __m128i __Y, const int __I)
117{
118 return (__m128i) __builtin_ia32_pclmulqdq128 ((__v2di)__X,
119 (__v2di)__Y, __I);
120}
121#else
122#define _mm_clmulepi64_si128(X, Y, I) \
123 ((__m128i) __builtin_ia32_pclmulqdq128 ((__v2di)(__m128i)(X), \
124 (__v2di)(__m128i)(Y), (int)(I)))
125#endif
126
127#ifdef __DISABLE_PCLMUL__
128#undef __DISABLE_PCLMUL__
129#pragma GCC pop_options
130#endif /* __DISABLE_PCLMUL__ */
131
132#endif /* _WMMINTRIN_H_INCLUDED */
Note: See TracBrowser for help on using the repository browser.