ammintrin.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* Copyright (C) 2007-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 AMD Programmers
  19. Manual Update, version 2.x */
  20. #ifndef _AMMINTRIN_H_INCLUDED
  21. #define _AMMINTRIN_H_INCLUDED
  22. /* We need definitions from the SSE3, SSE2 and SSE header files*/
  23. #include <pmmintrin.h>
  24. #ifndef __SSE4A__
  25. #pragma GCC push_options
  26. #pragma GCC target("sse4a")
  27. #define __DISABLE_SSE4A__
  28. #endif /* __SSE4A__ */
  29. extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  30. _mm_stream_sd (double * __P, __m128d __Y)
  31. {
  32. __builtin_ia32_movntsd (__P, (__v2df) __Y);
  33. }
  34. extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  35. _mm_stream_ss (float * __P, __m128 __Y)
  36. {
  37. __builtin_ia32_movntss (__P, (__v4sf) __Y);
  38. }
  39. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  40. _mm_extract_si64 (__m128i __X, __m128i __Y)
  41. {
  42. return (__m128i) __builtin_ia32_extrq ((__v2di) __X, (__v16qi) __Y);
  43. }
  44. #ifdef __OPTIMIZE__
  45. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  46. _mm_extracti_si64 (__m128i __X, unsigned const int __I, unsigned const int __L)
  47. {
  48. return (__m128i) __builtin_ia32_extrqi ((__v2di) __X, __I, __L);
  49. }
  50. #else
  51. #define _mm_extracti_si64(X, I, L) \
  52. ((__m128i) __builtin_ia32_extrqi ((__v2di)(__m128i)(X), \
  53. (unsigned int)(I), (unsigned int)(L)))
  54. #endif
  55. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  56. _mm_insert_si64 (__m128i __X,__m128i __Y)
  57. {
  58. return (__m128i) __builtin_ia32_insertq ((__v2di)__X, (__v2di)__Y);
  59. }
  60. #ifdef __OPTIMIZE__
  61. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  62. _mm_inserti_si64(__m128i __X, __m128i __Y, unsigned const int __I, unsigned const int __L)
  63. {
  64. return (__m128i) __builtin_ia32_insertqi ((__v2di)__X, (__v2di)__Y, __I, __L);
  65. }
  66. #else
  67. #define _mm_inserti_si64(X, Y, I, L) \
  68. ((__m128i) __builtin_ia32_insertqi ((__v2di)(__m128i)(X), \
  69. (__v2di)(__m128i)(Y), \
  70. (unsigned int)(I), (unsigned int)(L)))
  71. #endif
  72. #ifdef __DISABLE_SSE4A__
  73. #undef __DISABLE_SSE4A__
  74. #pragma GCC pop_options
  75. #endif /* __DISABLE_SSE4A__ */
  76. #endif /* _AMMINTRIN_H_INCLUDED */