1/* Copyright (C) 2017-2020 Free Software Foundation, Inc. 2 3 This file is part of GCC. 4 5 GCC is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 3, or (at your option) 8 any later version. 9 10 GCC is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 Under Section 7 of GPL version 3, you are granted additional 16 permissions described in the GCC Runtime Library Exception, version 17 3.1, as published by the Free Software Foundation. 18 19 You should have received a copy of the GNU General Public License and 20 a copy of the GCC Runtime Library Exception along with this program; 21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 <http://www.gnu.org/licenses/>. */ 23 24#if !defined _IMMINTRIN_H_INCLUDED 25# error "Never use <avx512vpopcntdqvlintrin.h> directly; include <immintrin.h> instead." 26#endif 27 28#ifndef _AVX512VPOPCNTDQVLINTRIN_H_INCLUDED 29#define _AVX512VPOPCNTDQVLINTRIN_H_INCLUDED 30 31#if !defined(__AVX512VPOPCNTDQ__) || !defined(__AVX512VL__) 32#pragma GCC push_options 33#pragma GCC target("avx512vpopcntdq,avx512vl") 34#define __DISABLE_AVX512VPOPCNTDQVL__ 35#endif /* __AVX512VPOPCNTDQVL__ */ 36 37extern __inline __m128i 38__attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39_mm_popcnt_epi32 (__m128i __A) 40{ 41 return (__m128i) __builtin_ia32_vpopcountd_v4si ((__v4si) __A); 42} 43 44extern __inline __m128i 45__attribute__((__gnu_inline__, __always_inline__, __artificial__)) 46_mm_mask_popcnt_epi32 (__m128i __W, __mmask16 __U, __m128i __A) 47{ 48 return (__m128i) __builtin_ia32_vpopcountd_v4si_mask ((__v4si) __A, 49 (__v4si) __W, 50 (__mmask16) __U); 51} 52 53extern __inline __m128i 54__attribute__((__gnu_inline__, __always_inline__, __artificial__)) 55_mm_maskz_popcnt_epi32 (__mmask16 __U, __m128i __A) 56{ 57 return (__m128i) __builtin_ia32_vpopcountd_v4si_mask ((__v4si) __A, 58 (__v4si) 59 _mm_setzero_si128 (), 60 (__mmask16) __U); 61} 62 63extern __inline __m256i 64__attribute__((__gnu_inline__, __always_inline__, __artificial__)) 65_mm256_popcnt_epi32 (__m256i __A) 66{ 67 return (__m256i) __builtin_ia32_vpopcountd_v8si ((__v8si) __A); 68} 69 70extern __inline __m256i 71__attribute__((__gnu_inline__, __always_inline__, __artificial__)) 72_mm256_mask_popcnt_epi32 (__m256i __W, __mmask16 __U, __m256i __A) 73{ 74 return (__m256i) __builtin_ia32_vpopcountd_v8si_mask ((__v8si) __A, 75 (__v8si) __W, 76 (__mmask16) __U); 77} 78 79extern __inline __m256i 80__attribute__((__gnu_inline__, __always_inline__, __artificial__)) 81_mm256_maskz_popcnt_epi32 (__mmask16 __U, __m256i __A) 82{ 83 return (__m256i) __builtin_ia32_vpopcountd_v8si_mask ((__v8si) __A, 84 (__v8si) 85 _mm256_setzero_si256 (), 86 (__mmask16) __U); 87} 88 89extern __inline __m128i 90__attribute__((__gnu_inline__, __always_inline__, __artificial__)) 91_mm_popcnt_epi64 (__m128i __A) 92{ 93 return (__m128i) __builtin_ia32_vpopcountq_v2di ((__v2di) __A); 94} 95 96extern __inline __m128i 97__attribute__((__gnu_inline__, __always_inline__, __artificial__)) 98_mm_mask_popcnt_epi64 (__m128i __W, __mmask8 __U, __m128i __A) 99{ 100 return (__m128i) __builtin_ia32_vpopcountq_v2di_mask ((__v2di) __A, 101 (__v2di) __W, 102 (__mmask8) __U); 103} 104 105extern __inline __m128i 106__attribute__((__gnu_inline__, __always_inline__, __artificial__)) 107_mm_maskz_popcnt_epi64 (__mmask8 __U, __m128i __A) 108{ 109 return (__m128i) __builtin_ia32_vpopcountq_v2di_mask ((__v2di) __A, 110 (__v2di) 111 _mm_setzero_si128 (), 112 (__mmask8) __U); 113} 114 115extern __inline __m256i 116__attribute__((__gnu_inline__, __always_inline__, __artificial__)) 117_mm256_popcnt_epi64 (__m256i __A) 118{ 119 return (__m256i) __builtin_ia32_vpopcountq_v4di ((__v4di) __A); 120} 121 122extern __inline __m256i 123__attribute__((__gnu_inline__, __always_inline__, __artificial__)) 124_mm256_mask_popcnt_epi64 (__m256i __W, __mmask8 __U, __m256i __A) 125{ 126 return (__m256i) __builtin_ia32_vpopcountq_v4di_mask ((__v4di) __A, 127 (__v4di) __W, 128 (__mmask8) __U); 129} 130 131extern __inline __m256i 132__attribute__((__gnu_inline__, __always_inline__, __artificial__)) 133_mm256_maskz_popcnt_epi64 (__mmask8 __U, __m256i __A) 134{ 135 return (__m256i) __builtin_ia32_vpopcountq_v4di_mask ((__v4di) __A, 136 (__v4di) 137 _mm256_setzero_si256 (), 138 (__mmask8) __U); 139} 140 141#ifdef __DISABLE_AVX512VPOPCNTDQVL__ 142#undef __DISABLE_AVX512VPOPCNTDQVL__ 143#pragma GCC pop_options 144#endif /* __DISABLE_AVX512VPOPCNTDQVL__ */ 145 146#endif /* _AVX512VPOPCNTDQVLINTRIN_H_INCLUDED */ 147