1 /*===------------- avx512vpopcntdqintrin.h - AVX512VPOPCNTDQ intrinsics
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 *===-----------------------------------------------------------------------===
27 "Never use <avx512vpopcntdqvlintrin.h> directly; include <immintrin.h> instead."
30 #ifndef __AVX512VPOPCNTDQVLINTRIN_H
31 #define __AVX512VPOPCNTDQVLINTRIN_H
33 /* Define the default attributes for the functions in this file. */
34 #define __DEFAULT_FN_ATTRS \
35 __attribute__((__always_inline__, __nodebug__, __target__("avx512vpopcntdq,avx512vl")))
37 static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_popcnt_epi64(__m128i __A) {
38 return (__m128i)__builtin_ia32_vpopcntq_128((__v2di)__A);
41 static __inline__ __m128i __DEFAULT_FN_ATTRS
42 _mm_mask_popcnt_epi64(__m128i __W, __mmask8 __U, __m128i __A) {
43 return (__m128i)__builtin_ia32_selectq_128(
44 (__mmask8)__U, (__v2di)_mm_popcnt_epi64(__A), (__v2di)__W);
47 static __inline__ __m128i __DEFAULT_FN_ATTRS
48 _mm_maskz_popcnt_epi64(__mmask8 __U, __m128i __A) {
49 return _mm_mask_popcnt_epi64((__m128i)_mm_setzero_si128(), __U, __A);
52 static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_popcnt_epi32(__m128i __A) {
53 return (__m128i)__builtin_ia32_vpopcntd_128((__v4si)__A);
56 static __inline__ __m128i __DEFAULT_FN_ATTRS
57 _mm_mask_popcnt_epi32(__m128i __W, __mmask8 __U, __m128i __A) {
58 return (__m128i)__builtin_ia32_selectd_128(
59 (__mmask8)__U, (__v4si)_mm_popcnt_epi32(__A), (__v4si)__W);
62 static __inline__ __m128i __DEFAULT_FN_ATTRS
63 _mm_maskz_popcnt_epi32(__mmask8 __U, __m128i __A) {
64 return _mm_mask_popcnt_epi32((__m128i)_mm_setzero_si128(), __U, __A);
67 static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_popcnt_epi64(__m256i __A) {
68 return (__m256i)__builtin_ia32_vpopcntq_256((__v4di)__A);
71 static __inline__ __m256i __DEFAULT_FN_ATTRS
72 _mm256_mask_popcnt_epi64(__m256i __W, __mmask8 __U, __m256i __A) {
73 return (__m256i)__builtin_ia32_selectq_256(
74 (__mmask8)__U, (__v4di)_mm256_popcnt_epi64(__A), (__v4di)__W);
77 static __inline__ __m256i __DEFAULT_FN_ATTRS
78 _mm256_maskz_popcnt_epi64(__mmask8 __U, __m256i __A) {
79 return _mm256_mask_popcnt_epi64((__m256i)_mm256_setzero_si256(), __U, __A);
82 static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_popcnt_epi32(__m256i __A) {
83 return (__m256i)__builtin_ia32_vpopcntd_256((__v8si)__A);
86 static __inline__ __m256i __DEFAULT_FN_ATTRS
87 _mm256_mask_popcnt_epi32(__m256i __W, __mmask8 __U, __m256i __A) {
88 return (__m256i)__builtin_ia32_selectd_256(
89 (__mmask8)__U, (__v8si)_mm256_popcnt_epi32(__A), (__v8si)__W);
92 static __inline__ __m256i __DEFAULT_FN_ATTRS
93 _mm256_maskz_popcnt_epi32(__mmask8 __U, __m256i __A) {
94 return _mm256_mask_popcnt_epi32((__m256i)_mm256_setzero_si256(), __U, __A);
97 #undef __DEFAULT_FN_ATTRS