home *** CD-ROM | disk | FTP | other *** search
/ Beginning C++ Through Gam…rogramming (2nd Edition) / BCGP2E.ISO / bloodshed / devcpp-4.9.9.2_setup.exe / pmmintrin.h < prev    next >
C/C++ Source or Header  |  2005-01-29  |  4KB  |  133 lines

  1. /* Copyright (C) 2003 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 2, 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.    You should have received a copy of the GNU General Public License
  16.    along with GCC; see the file COPYING.  If not, write to
  17.    the Free Software Foundation, 59 Temple Place - Suite 330,
  18.    Boston, MA 02111-1307, USA.  */
  19.  
  20. /* As a special exception, if you include this header file into source
  21.    files compiled by GCC, this header file does not by itself cause
  22.    the resulting executable to be covered by the GNU General Public
  23.    License.  This exception does not however invalidate any other
  24.    reasons why the executable file might be covered by the GNU General
  25.    Public License.  */
  26.  
  27. /* Implemented from the specification included in the Intel C++ Compiler
  28.    User Guide and Reference, version 8.0.  */
  29.  
  30. #ifndef _PMMINTRIN_H_INCLUDED
  31. #define _PMMINTRIN_H_INCLUDED
  32.  
  33. #ifdef __SSE3__
  34. #include <xmmintrin.h>
  35. #include <emmintrin.h>
  36.  
  37. /* Additional bits in the MXCSR.  */
  38. #define _MM_DENORMALS_ZERO_MASK        0x0040
  39. #define _MM_DENORMALS_ZERO_ON        0x0040
  40. #define _MM_DENORMALS_ZERO_OFF        0x0000
  41.  
  42. #define _MM_SET_DENORMALS_ZERO_MODE(mode) \
  43.   _mm_setcsr ((_mm_getcsr () & ~_MM_DENORMALS_ZERO_MASK) | (mode))
  44. #define _MM_GET_DENORMALS_ZERO_MODE() \
  45.   (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)
  46.  
  47. static __inline __m128
  48. _mm_addsub_ps (__m128 __X, __m128 __Y)
  49. {
  50.   return (__m128) __builtin_ia32_addsubps ((__v4sf)__X, (__v4sf)__Y);
  51. }
  52.  
  53. static __inline __m128
  54. _mm_hadd_ps (__m128 __X, __m128 __Y)
  55. {
  56.   return (__m128) __builtin_ia32_haddps ((__v4sf)__X, (__v4sf)__Y);
  57. }
  58.  
  59. static __inline __m128
  60. _mm_hsub_ps (__m128 __X, __m128 __Y)
  61. {
  62.   return (__m128) __builtin_ia32_hsubps ((__v4sf)__X, (__v4sf)__Y);
  63. }
  64.  
  65. static __inline __m128
  66. _mm_movehdup_ps (__m128 __X)
  67. {
  68.   return (__m128) __builtin_ia32_movshdup ((__v4sf)__X);
  69. }
  70.  
  71. static __inline __m128
  72. _mm_moveldup_ps (__m128 __X)
  73. {
  74.   return (__m128) __builtin_ia32_movsldup ((__v4sf)__X);
  75. }
  76.  
  77. static __inline __m128d
  78. _mm_addsub_pd (__m128d __X, __m128d __Y)
  79. {
  80.   return (__m128d) __builtin_ia32_addsubpd ((__v2df)__X, (__v2df)__Y);
  81. }
  82.  
  83. static __inline __m128d
  84. _mm_hadd_pd (__m128d __X, __m128d __Y)
  85. {
  86.   return (__m128d) __builtin_ia32_haddpd ((__v2df)__X, (__v2df)__Y);
  87. }
  88.  
  89. static __inline __m128d
  90. _mm_hsub_pd (__m128d __X, __m128d __Y)
  91. {
  92.   return (__m128d) __builtin_ia32_hsubpd ((__v2df)__X, (__v2df)__Y);
  93. }
  94.  
  95. static __inline __m128d
  96. _mm_loaddup_pd (double const *__P)
  97. {
  98.   return (__m128d) __builtin_ia32_loadddup (__P);
  99. }
  100.  
  101. static __inline __m128d
  102. _mm_movedup_pd (__m128d __X)
  103. {
  104.   return (__m128d) __builtin_ia32_movddup ((__v2df)__X);
  105. }
  106.  
  107. static __inline __m128i
  108. _mm_lddqu_si128 (__m128i const *__P)
  109. {
  110.   return (__m128i) __builtin_ia32_lddqu ((char const *)__P);
  111. }
  112.  
  113. #if 0
  114. static __inline void
  115. _mm_monitor (void const * __P, unsigned int __E, unsigned int __H)
  116. {
  117.   __builtin_ia32_monitor (__P, __E, __H);
  118. }
  119.  
  120. static __inline void
  121. _mm_mwait (unsigned int __E, unsigned int __H)
  122. {
  123.   __builtin_ia32_mwait (__E, __H);
  124. }
  125. #else
  126. #define _mm_monitor(P, E, H)    __builtin_ia32_monitor ((P), (E), (H))
  127. #define _mm_mwait(E, H)        __builtin_ia32_mwait ((E), (H))
  128. #endif
  129.  
  130. #endif /* __SSE3__ */
  131.  
  132. #endif /* _PMMINTRIN_H_INCLUDED */
  133.