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