avx512vpopcntdqvlintrin.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /* Copyright (C) 2017-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. #if !defined _IMMINTRIN_H_INCLUDED
  19. # error "Never use <avx512vpopcntdqvlintrin.h> directly; include <immintrin.h> instead."
  20. #endif
  21. #ifndef _AVX512VPOPCNTDQVLINTRIN_H_INCLUDED
  22. #define _AVX512VPOPCNTDQVLINTRIN_H_INCLUDED
  23. #if !defined(__AVX512VPOPCNTDQ__) || !defined(__AVX512VL__)
  24. #pragma GCC push_options
  25. #pragma GCC target("avx512vpopcntdq,avx512vl")
  26. #define __DISABLE_AVX512VPOPCNTDQVL__
  27. #endif /* __AVX512VPOPCNTDQVL__ */
  28. extern __inline __m128i
  29. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  30. _mm_popcnt_epi32 (__m128i __A)
  31. {
  32. return (__m128i) __builtin_ia32_vpopcountd_v4si ((__v4si) __A);
  33. }
  34. extern __inline __m128i
  35. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  36. _mm_mask_popcnt_epi32 (__m128i __W, __mmask16 __U, __m128i __A)
  37. {
  38. return (__m128i) __builtin_ia32_vpopcountd_v4si_mask ((__v4si) __A,
  39. (__v4si) __W,
  40. (__mmask16) __U);
  41. }
  42. extern __inline __m128i
  43. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  44. _mm_maskz_popcnt_epi32 (__mmask16 __U, __m128i __A)
  45. {
  46. return (__m128i) __builtin_ia32_vpopcountd_v4si_mask ((__v4si) __A,
  47. (__v4si)
  48. _mm_setzero_si128 (),
  49. (__mmask16) __U);
  50. }
  51. extern __inline __m256i
  52. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  53. _mm256_popcnt_epi32 (__m256i __A)
  54. {
  55. return (__m256i) __builtin_ia32_vpopcountd_v8si ((__v8si) __A);
  56. }
  57. extern __inline __m256i
  58. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  59. _mm256_mask_popcnt_epi32 (__m256i __W, __mmask16 __U, __m256i __A)
  60. {
  61. return (__m256i) __builtin_ia32_vpopcountd_v8si_mask ((__v8si) __A,
  62. (__v8si) __W,
  63. (__mmask16) __U);
  64. }
  65. extern __inline __m256i
  66. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  67. _mm256_maskz_popcnt_epi32 (__mmask16 __U, __m256i __A)
  68. {
  69. return (__m256i) __builtin_ia32_vpopcountd_v8si_mask ((__v8si) __A,
  70. (__v8si)
  71. _mm256_setzero_si256 (),
  72. (__mmask16) __U);
  73. }
  74. extern __inline __m128i
  75. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  76. _mm_popcnt_epi64 (__m128i __A)
  77. {
  78. return (__m128i) __builtin_ia32_vpopcountq_v2di ((__v2di) __A);
  79. }
  80. extern __inline __m128i
  81. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  82. _mm_mask_popcnt_epi64 (__m128i __W, __mmask8 __U, __m128i __A)
  83. {
  84. return (__m128i) __builtin_ia32_vpopcountq_v2di_mask ((__v2di) __A,
  85. (__v2di) __W,
  86. (__mmask8) __U);
  87. }
  88. extern __inline __m128i
  89. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  90. _mm_maskz_popcnt_epi64 (__mmask8 __U, __m128i __A)
  91. {
  92. return (__m128i) __builtin_ia32_vpopcountq_v2di_mask ((__v2di) __A,
  93. (__v2di)
  94. _mm_setzero_si128 (),
  95. (__mmask8) __U);
  96. }
  97. extern __inline __m256i
  98. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  99. _mm256_popcnt_epi64 (__m256i __A)
  100. {
  101. return (__m256i) __builtin_ia32_vpopcountq_v4di ((__v4di) __A);
  102. }
  103. extern __inline __m256i
  104. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  105. _mm256_mask_popcnt_epi64 (__m256i __W, __mmask8 __U, __m256i __A)
  106. {
  107. return (__m256i) __builtin_ia32_vpopcountq_v4di_mask ((__v4di) __A,
  108. (__v4di) __W,
  109. (__mmask8) __U);
  110. }
  111. extern __inline __m256i
  112. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  113. _mm256_maskz_popcnt_epi64 (__mmask8 __U, __m256i __A)
  114. {
  115. return (__m256i) __builtin_ia32_vpopcountq_v4di_mask ((__v4di) __A,
  116. (__v4di)
  117. _mm256_setzero_si256 (),
  118. (__mmask8) __U);
  119. }
  120. #ifdef __DISABLE_AVX512VPOPCNTDQVL__
  121. #undef __DISABLE_AVX512VPOPCNTDQVL__
  122. #pragma GCC pop_options
  123. #endif /* __DISABLE_AVX512VPOPCNTDQVL__ */
  124. #endif /* _AVX512VPOPCNTDQVLINTRIN_H_INCLUDED */