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 <avx512vpopcntdqintrin.h> directly; include <x86intrin.h> instead."
26#endif
27
28#ifndef _AVX512VPOPCNTDQINTRIN_H_INCLUDED
29#define _AVX512VPOPCNTDQINTRIN_H_INCLUDED
30
31#ifndef __AVX512VPOPCNTDQ__
32#pragma GCC push_options
33#pragma GCC target("avx512vpopcntdq")
34#define __DISABLE_AVX512VPOPCNTDQ__
35#endif /* __AVX512VPOPCNTDQ__ */
36
37extern __inline __m512i
38__attribute__((__gnu_inline__, __always_inline__, __artificial__))
39_mm512_popcnt_epi32 (__m512i __A)
40{
41  return (__m512i) __builtin_ia32_vpopcountd_v16si ((__v16si) __A);
42}
43
44extern __inline __m512i
45__attribute__((__gnu_inline__, __always_inline__, __artificial__))
46_mm512_mask_popcnt_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
47{
48  return (__m512i) __builtin_ia32_vpopcountd_v16si_mask ((__v16si) __A,
49							 (__v16si) __W,
50							 (__mmask16) __U);
51}
52
53extern __inline __m512i
54__attribute__((__gnu_inline__, __always_inline__, __artificial__))
55_mm512_maskz_popcnt_epi32 (__mmask16 __U, __m512i __A)
56{
57  return (__m512i) __builtin_ia32_vpopcountd_v16si_mask ((__v16si) __A,
58							 (__v16si)
59							 _mm512_setzero_si512 (),
60							 (__mmask16) __U);
61}
62
63extern __inline __m512i
64__attribute__((__gnu_inline__, __always_inline__, __artificial__))
65_mm512_popcnt_epi64 (__m512i __A)
66{
67  return (__m512i) __builtin_ia32_vpopcountq_v8di ((__v8di) __A);
68}
69
70extern __inline __m512i
71__attribute__((__gnu_inline__, __always_inline__, __artificial__))
72_mm512_mask_popcnt_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
73{
74  return (__m512i) __builtin_ia32_vpopcountq_v8di_mask ((__v8di) __A,
75							(__v8di) __W,
76							(__mmask8) __U);
77}
78
79extern __inline __m512i
80__attribute__((__gnu_inline__, __always_inline__, __artificial__))
81_mm512_maskz_popcnt_epi64 (__mmask8 __U, __m512i __A)
82{
83  return (__m512i) __builtin_ia32_vpopcountq_v8di_mask ((__v8di) __A,
84							(__v8di)
85							_mm512_setzero_si512 (),
86							(__mmask8) __U);
87}
88
89#ifdef __DISABLE_AVX512VPOPCNTDQ__
90#undef __DISABLE_AVX512VPOPCNTDQ__
91#pragma GCC pop_options
92#endif /* __DISABLE_AVX512VPOPCNTDQ__ */
93
94#endif /* _AVX512VPOPCNTDQINTRIN_H_INCLUDED */
95