1 1.1.1.5 mrg /* Copyright (C) 2017-2022 Free Software Foundation, Inc. 2 1.1 mrg 3 1.1 mrg This file is part of GCC. 4 1.1 mrg 5 1.1 mrg GCC is free software; you can redistribute it and/or modify 6 1.1 mrg it under the terms of the GNU General Public License as published by 7 1.1 mrg the Free Software Foundation; either version 3, or (at your option) 8 1.1 mrg any later version. 9 1.1 mrg 10 1.1 mrg GCC is distributed in the hope that it will be useful, 11 1.1 mrg but WITHOUT ANY WARRANTY; without even the implied warranty of 12 1.1 mrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 1.1 mrg GNU General Public License for more details. 14 1.1 mrg 15 1.1 mrg Under Section 7 of GPL version 3, you are granted additional 16 1.1 mrg permissions described in the GCC Runtime Library Exception, version 17 1.1 mrg 3.1, as published by the Free Software Foundation. 18 1.1 mrg 19 1.1 mrg You should have received a copy of the GNU General Public License and 20 1.1 mrg a copy of the GCC Runtime Library Exception along with this program; 21 1.1 mrg see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 1.1 mrg <http://www.gnu.org/licenses/>. */ 23 1.1 mrg 24 1.1 mrg #if !defined _IMMINTRIN_H_INCLUDED 25 1.1 mrg # error "Never use <avx512vpopcntdqintrin.h> directly; include <x86intrin.h> instead." 26 1.1 mrg #endif 27 1.1 mrg 28 1.1 mrg #ifndef _AVX512VPOPCNTDQINTRIN_H_INCLUDED 29 1.1 mrg #define _AVX512VPOPCNTDQINTRIN_H_INCLUDED 30 1.1 mrg 31 1.1 mrg #ifndef __AVX512VPOPCNTDQ__ 32 1.1 mrg #pragma GCC push_options 33 1.1 mrg #pragma GCC target("avx512vpopcntdq") 34 1.1 mrg #define __DISABLE_AVX512VPOPCNTDQ__ 35 1.1 mrg #endif /* __AVX512VPOPCNTDQ__ */ 36 1.1 mrg 37 1.1 mrg extern __inline __m512i 38 1.1 mrg __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 1.1 mrg _mm512_popcnt_epi32 (__m512i __A) 40 1.1 mrg { 41 1.1 mrg return (__m512i) __builtin_ia32_vpopcountd_v16si ((__v16si) __A); 42 1.1 mrg } 43 1.1 mrg 44 1.1 mrg extern __inline __m512i 45 1.1 mrg __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 46 1.1.1.2 mrg _mm512_mask_popcnt_epi32 (__m512i __W, __mmask16 __U, __m512i __A) 47 1.1 mrg { 48 1.1 mrg return (__m512i) __builtin_ia32_vpopcountd_v16si_mask ((__v16si) __A, 49 1.1.1.2 mrg (__v16si) __W, 50 1.1 mrg (__mmask16) __U); 51 1.1 mrg } 52 1.1 mrg 53 1.1 mrg extern __inline __m512i 54 1.1 mrg __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 55 1.1 mrg _mm512_maskz_popcnt_epi32 (__mmask16 __U, __m512i __A) 56 1.1 mrg { 57 1.1 mrg return (__m512i) __builtin_ia32_vpopcountd_v16si_mask ((__v16si) __A, 58 1.1 mrg (__v16si) 59 1.1 mrg _mm512_setzero_si512 (), 60 1.1 mrg (__mmask16) __U); 61 1.1 mrg } 62 1.1 mrg 63 1.1 mrg extern __inline __m512i 64 1.1 mrg __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 65 1.1 mrg _mm512_popcnt_epi64 (__m512i __A) 66 1.1 mrg { 67 1.1 mrg return (__m512i) __builtin_ia32_vpopcountq_v8di ((__v8di) __A); 68 1.1 mrg } 69 1.1 mrg 70 1.1 mrg extern __inline __m512i 71 1.1 mrg __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 72 1.1.1.2 mrg _mm512_mask_popcnt_epi64 (__m512i __W, __mmask8 __U, __m512i __A) 73 1.1 mrg { 74 1.1 mrg return (__m512i) __builtin_ia32_vpopcountq_v8di_mask ((__v8di) __A, 75 1.1.1.2 mrg (__v8di) __W, 76 1.1 mrg (__mmask8) __U); 77 1.1 mrg } 78 1.1 mrg 79 1.1 mrg extern __inline __m512i 80 1.1 mrg __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 81 1.1 mrg _mm512_maskz_popcnt_epi64 (__mmask8 __U, __m512i __A) 82 1.1 mrg { 83 1.1 mrg return (__m512i) __builtin_ia32_vpopcountq_v8di_mask ((__v8di) __A, 84 1.1 mrg (__v8di) 85 1.1 mrg _mm512_setzero_si512 (), 86 1.1 mrg (__mmask8) __U); 87 1.1 mrg } 88 1.1 mrg 89 1.1 mrg #ifdef __DISABLE_AVX512VPOPCNTDQ__ 90 1.1 mrg #undef __DISABLE_AVX512VPOPCNTDQ__ 91 1.1 mrg #pragma GCC pop_options 92 1.1 mrg #endif /* __DISABLE_AVX512VPOPCNTDQ__ */ 93 1.1 mrg 94 1.1 mrg #endif /* _AVX512VPOPCNTDQINTRIN_H_INCLUDED */ 95