avx512vpopcntdqintrin.h revision 319142
160484Sobrien/*===------------- avx512vpopcntdqintrin.h - AVX512VPOPCNTDQ intrinsics
2218822Sdim *------------------===
360484Sobrien *
460484Sobrien *
560484Sobrien * Permission is hereby granted, free of charge, to any person obtaining a copy
660484Sobrien * of this software and associated documentation files (the "Software"), to deal
760484Sobrien * in the Software without restriction, including without limitation the rights
860484Sobrien * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
960484Sobrien * copies of the Software, and to permit persons to whom the Software is
1060484Sobrien * furnished to do so, subject to the following conditions:
1160484Sobrien *
1260484Sobrien * The above copyright notice and this permission notice shall be included in
1360484Sobrien * all copies or substantial portions of the Software.
1460484Sobrien *
1560484Sobrien * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1660484Sobrien * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1760484Sobrien * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18218822Sdim * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1960484Sobrien * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2060484Sobrien * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2160484Sobrien * THE SOFTWARE.
2260484Sobrien *
2360484Sobrien *===-----------------------------------------------------------------------===
2460484Sobrien */
2560484Sobrien#ifndef __IMMINTRIN_H
2660484Sobrien#error                                                                         \
2760484Sobrien    "Never use <avx512vpopcntdqintrin.h> directly; include <immintrin.h> instead."
2860484Sobrien#endif
2960484Sobrien
3060484Sobrien#ifndef __AVX512VPOPCNTDQINTRIN_H
3160484Sobrien#define __AVX512VPOPCNTDQINTRIN_H
32130561Sobrien
3360484Sobrien/* Define the default attributes for the functions in this file. */
3460484Sobrien#define __DEFAULT_FN_ATTRS                                                     \
35130561Sobrien  __attribute__((__always_inline__, __nodebug__, __target__("avx512vpopcntd"   \
36130561Sobrien                                                            "q")))
37218822Sdim
3860484Sobrienstatic __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_popcnt_epi64(__m512i __A) {
39218822Sdim  return (__m512i)__builtin_ia32_vpopcntq_512((__v8di)__A);
40218822Sdim}
41218822Sdim
42218822Sdimstatic __inline__ __m512i __DEFAULT_FN_ATTRS
43218822Sdim_mm512_mask_popcnt_epi64(__m512i __W, __mmask8 __U, __m512i __A) {
44130561Sobrien  return (__m512i)__builtin_ia32_selectq_512(
45218822Sdim      (__mmask8)__U, (__v8di)_mm512_popcnt_epi64(__A), (__v8di)__W);
46218822Sdim}
47218822Sdim
48218822Sdimstatic __inline__ __m512i __DEFAULT_FN_ATTRS
49218822Sdim_mm512_maskz_popcnt_epi64(__mmask8 __U, __m512i __A) {
5091041Sobrien  return _mm512_mask_popcnt_epi64((__m512i)_mm512_setzero_si512(), __U, __A);
5191041Sobrien}
5291041Sobrien
53218822Sdimstatic __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_popcnt_epi32(__m512i __A) {
54218822Sdim  return (__m512i)__builtin_ia32_vpopcntd_512((__v16si)__A);
55218822Sdim}
56218822Sdim
57218822Sdimstatic __inline__ __m512i __DEFAULT_FN_ATTRS
58218822Sdim_mm512_mask_popcnt_epi32(__m512i __W, __mmask16 __U, __m512i __A) {
59218822Sdim  return (__m512i)__builtin_ia32_selectd_512(
60218822Sdim      (__mmask16)__U, (__v16si)_mm512_popcnt_epi32(__A), (__v16si)__W);
61218822Sdim}
62218822Sdim
63218822Sdimstatic __inline__ __m512i __DEFAULT_FN_ATTRS
64218822Sdim_mm512_maskz_popcnt_epi32(__mmask16 __U, __m512i __A) {
65218822Sdim  return _mm512_mask_popcnt_epi32((__m512i)_mm512_setzero_si512(), __U, __A);
66218822Sdim}
67218822Sdim
68218822Sdim#undef __DEFAULT_FN_ATTRS
69218822Sdim
70218822Sdim#endif
71218822Sdim