pmmintrin.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* Copyright (C) 2003-2019 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. GCC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. /* Implemented from the specification included in the Intel C++ Compiler
  19. User Guide and Reference, version 9.0. */
  20. #ifndef _PMMINTRIN_H_INCLUDED
  21. #define _PMMINTRIN_H_INCLUDED
  22. /* We need definitions from the SSE2 and SSE header files*/
  23. #include <emmintrin.h>
  24. #ifndef __SSE3__
  25. #pragma GCC push_options
  26. #pragma GCC target("sse3")
  27. #define __DISABLE_SSE3__
  28. #endif /* __SSE3__ */
  29. /* Additional bits in the MXCSR. */
  30. #define _MM_DENORMALS_ZERO_MASK 0x0040
  31. #define _MM_DENORMALS_ZERO_ON 0x0040
  32. #define _MM_DENORMALS_ZERO_OFF 0x0000
  33. #define _MM_SET_DENORMALS_ZERO_MODE(mode) \
  34. _mm_setcsr ((_mm_getcsr () & ~_MM_DENORMALS_ZERO_MASK) | (mode))
  35. #define _MM_GET_DENORMALS_ZERO_MODE() \
  36. (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)
  37. extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  38. _mm_addsub_ps (__m128 __X, __m128 __Y)
  39. {
  40. return (__m128) __builtin_ia32_addsubps ((__v4sf)__X, (__v4sf)__Y);
  41. }
  42. extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  43. _mm_hadd_ps (__m128 __X, __m128 __Y)
  44. {
  45. return (__m128) __builtin_ia32_haddps ((__v4sf)__X, (__v4sf)__Y);
  46. }
  47. extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  48. _mm_hsub_ps (__m128 __X, __m128 __Y)
  49. {
  50. return (__m128) __builtin_ia32_hsubps ((__v4sf)__X, (__v4sf)__Y);
  51. }
  52. extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  53. _mm_movehdup_ps (__m128 __X)
  54. {
  55. return (__m128) __builtin_ia32_movshdup ((__v4sf)__X);
  56. }
  57. extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  58. _mm_moveldup_ps (__m128 __X)
  59. {
  60. return (__m128) __builtin_ia32_movsldup ((__v4sf)__X);
  61. }
  62. extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  63. _mm_addsub_pd (__m128d __X, __m128d __Y)
  64. {
  65. return (__m128d) __builtin_ia32_addsubpd ((__v2df)__X, (__v2df)__Y);
  66. }
  67. extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  68. _mm_hadd_pd (__m128d __X, __m128d __Y)
  69. {
  70. return (__m128d) __builtin_ia32_haddpd ((__v2df)__X, (__v2df)__Y);
  71. }
  72. extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  73. _mm_hsub_pd (__m128d __X, __m128d __Y)
  74. {
  75. return (__m128d) __builtin_ia32_hsubpd ((__v2df)__X, (__v2df)__Y);
  76. }
  77. extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  78. _mm_loaddup_pd (double const *__P)
  79. {
  80. return _mm_load1_pd (__P);
  81. }
  82. extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  83. _mm_movedup_pd (__m128d __X)
  84. {
  85. return _mm_shuffle_pd (__X, __X, _MM_SHUFFLE2 (0,0));
  86. }
  87. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  88. _mm_lddqu_si128 (__m128i const *__P)
  89. {
  90. return (__m128i) __builtin_ia32_lddqu ((char const *)__P);
  91. }
  92. extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  93. _mm_monitor (void const * __P, unsigned int __E, unsigned int __H)
  94. {
  95. __builtin_ia32_monitor (__P, __E, __H);
  96. }
  97. extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  98. _mm_mwait (unsigned int __E, unsigned int __H)
  99. {
  100. __builtin_ia32_mwait (__E, __H);
  101. }
  102. #ifdef __DISABLE_SSE3__
  103. #undef __DISABLE_SSE3__
  104. #pragma GCC pop_options
  105. #endif /* __DISABLE_SSE3__ */
  106. #endif /* _PMMINTRIN_H_INCLUDED */