avx512vpopcntdqvlintrin.h revision 327024
1/*===------------- avx512vpopcntdqintrin.h - AVX512VPOPCNTDQ intrinsics 2 *------------------=== 3 * 4 * 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: 11 * 12 * The above copyright notice and this permission notice shall be included in 13 * all copies or substantial portions of the Software. 14 * 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 21 * THE SOFTWARE. 22 * 23 *===-----------------------------------------------------------------------=== 24 */ 25#ifndef __IMMINTRIN_H 26#error \ 27 "Never use <avx512vpopcntdqvlintrin.h> directly; include <immintrin.h> instead." 28#endif 29 30#ifndef __AVX512VPOPCNTDQVLINTRIN_H 31#define __AVX512VPOPCNTDQVLINTRIN_H 32 33/* Define the default attributes for the functions in this file. */ 34#define __DEFAULT_FN_ATTRS \ 35 __attribute__((__always_inline__, __nodebug__, __target__("avx512vpopcntdq,avx512vl"))) 36 37static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_popcnt_epi64(__m128i __A) { 38 return (__m128i)__builtin_ia32_vpopcntq_128((__v2di)__A); 39} 40 41static __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); 45} 46 47static __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); 50} 51 52static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_popcnt_epi32(__m128i __A) { 53 return (__m128i)__builtin_ia32_vpopcntd_128((__v4si)__A); 54} 55 56static __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); 60} 61 62static __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); 65} 66 67static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_popcnt_epi64(__m256i __A) { 68 return (__m256i)__builtin_ia32_vpopcntq_256((__v4di)__A); 69} 70 71static __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); 75} 76 77static __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); 80} 81 82static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_popcnt_epi32(__m256i __A) { 83 return (__m256i)__builtin_ia32_vpopcntd_256((__v8si)__A); 84} 85 86static __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); 90} 91 92static __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); 95} 96 97#undef __DEFAULT_FN_ATTRS 98 99#endif 100