Home | History | Annotate | Download | only in include
      1 /* APPLE LOCAL file 5612787 mainline sse4 */
      2 /* Copyright (C) 2007 Free Software Foundation, Inc.
      3 
      4    This file is part of GCC.
      5 
      6    GCC is free software; you can redistribute it and/or modify
      7    it under the terms of the GNU General Public License as published by
      8    the Free Software Foundation; either version 2, or (at your option)
      9    any later version.
     10 
     11    GCC is distributed in the hope that it will be useful,
     12    but WITHOUT ANY WARRANTY; without even the implied warranty of
     13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14    GNU General Public License for more details.
     15 
     16    You should have received a copy of the GNU General Public License
     17    along with GCC; see the file COPYING.  If not, write to
     18    the Free Software Foundation, 51 Franklin Street, Fifth Floor,
     19    Boston, MA 02110-1301, USA.  */
     20 
     21 /* As a special exception, if you include this header file into source
     22    files compiled by GCC, this header file does not by itself cause
     23    the resulting executable to be covered by the GNU General Public
     24    License.  This exception does not however invalidate any other
     25    reasons why the executable file might be covered by the GNU General
     26    Public License.  */
     27 
     28 /* Implemented from the specification included in the AMD Programmers
     29    Manual Update, version 2.x */
     30 
     31 #ifndef _AMMINTRIN_H_INCLUDED
     32 #define _AMMINTRIN_H_INCLUDED
     33 
     34 #ifndef __SSE4A__
     35 # error "SSE4A instruction set not enabled"
     36 #else
     37 
     38 /* We need definitions from the SSE3, SSE2 and SSE header files*/
     39 #include <pmmintrin.h>
     40 
     41 /* APPLE LOCAL begin nodebug inline 4152603 */
     42 #define __always_inline__ __always_inline__, __nodebug__
     43 /* APPLE LOCAL end nodebug inline 4152603 */
     44 
     45 /* APPLE LOCAL begin radar 5618945 */
     46 #undef __STATIC_INLINE
     47 #ifdef __GNUC_STDC_INLINE__
     48 #define __STATIC_INLINE __inline
     49 #else
     50 #define __STATIC_INLINE static __inline
     51 #endif
     52 /* APPLE LOCAL end radar 5618945 */
     53 
     54 __STATIC_INLINE void __attribute__((__always_inline__))
     55 _mm_stream_sd (double * __P, __m128d __Y)
     56 {
     57   __builtin_ia32_movntsd (__P, (__v2df) __Y);
     58 }
     59 
     60 __STATIC_INLINE void __attribute__((__always_inline__))
     61 _mm_stream_ss (float * __P, __m128 __Y)
     62 {
     63   __builtin_ia32_movntss (__P, (__v4sf) __Y);
     64 }
     65 
     66 __STATIC_INLINE __m128i __attribute__((__always_inline__))
     67 _mm_extract_si64 (__m128i __X, __m128i __Y)
     68 {
     69   return (__m128i) __builtin_ia32_extrq ((__v2di) __X, (__v16qi) __Y);
     70 }
     71 
     72 #ifdef __OPTIMIZE__
     73 __STATIC_INLINE __m128i __attribute__((__always_inline__))
     74 _mm_extracti_si64 (__m128i __X, unsigned const int __I, unsigned const int __L)
     75 {
     76   return (__m128i) __builtin_ia32_extrqi ((__v2di) __X, __I, __L);
     77 }
     78 #else
     79 #define _mm_extracti_si64(X, I, L) \
     80   ((__m128i) __builtin_ia32_extrqi ((__v2di)(X), I, L))
     81 #endif
     82 
     83 __STATIC_INLINE __m128i __attribute__((__always_inline__))
     84 _mm_insert_si64 (__m128i __X,__m128i __Y)
     85 {
     86   return (__m128i) __builtin_ia32_insertq ((__v2di)__X, (__v2di)__Y);
     87 }
     88 
     89 #ifdef __OPTIMIZE__
     90 __STATIC_INLINE __m128i __attribute__((__always_inline__))
     91 _mm_inserti_si64(__m128i __X, __m128i __Y, unsigned const int __I, unsigned const int __L)
     92 {
     93   return (__m128i) __builtin_ia32_insertqi ((__v2di)__X, (__v2di)__Y, __I, __L);
     94 }
     95 #else
     96 #define _mm_inserti_si64(X, Y, I, L) \
     97   ((__m128i) __builtin_ia32_insertqi ((__v2di)(X), (__v2di)(Y), I, L))
     98 #endif
     99 
    100 #endif /* __SSE4A__ */
    101 
    102 /* APPLE LOCAL begin nodebug inline 4152603 */
    103 #undef __always_inline__
    104 /* APPLE LOCAL end nodebug inline 4152603 */
    105 
    106 #endif /* _AMMINTRIN_H_INCLUDED */
    107