]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/i386/avx512bitalgintrin.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / i386 / avx512bitalgintrin.h
1 /* Copyright (C) 2017-2024 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 <avx512bitalgintrin.h> directly; include <immintrin.h> instead."
26 #endif
27
28 #ifndef _AVX512BITALGINTRIN_H_INCLUDED
29 #define _AVX512BITALGINTRIN_H_INCLUDED
30
31 #if !defined (__AVX512BITALG__) || !defined (__EVEX512__)
32 #pragma GCC push_options
33 #pragma GCC target("avx512bitalg,evex512")
34 #define __DISABLE_AVX512BITALG__
35 #endif /* __AVX512BITALG__ */
36
37 extern __inline __m512i
38 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
39 _mm512_popcnt_epi8 (__m512i __A)
40 {
41 return (__m512i) __builtin_ia32_vpopcountb_v64qi ((__v64qi) __A);
42 }
43
44 extern __inline __m512i
45 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
46 _mm512_popcnt_epi16 (__m512i __A)
47 {
48 return (__m512i) __builtin_ia32_vpopcountw_v32hi ((__v32hi) __A);
49 }
50
51 extern __inline __m512i
52 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
53 _mm512_mask_popcnt_epi8 (__m512i __W, __mmask64 __U, __m512i __A)
54 {
55 return (__m512i) __builtin_ia32_vpopcountb_v64qi_mask ((__v64qi) __A,
56 (__v64qi) __W,
57 (__mmask64) __U);
58 }
59
60 extern __inline __m512i
61 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
62 _mm512_maskz_popcnt_epi8 (__mmask64 __U, __m512i __A)
63 {
64 return (__m512i) __builtin_ia32_vpopcountb_v64qi_mask ((__v64qi) __A,
65 (__v64qi)
66 _mm512_setzero_si512 (),
67 (__mmask64) __U);
68 }
69 extern __inline __m512i
70 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
71 _mm512_mask_popcnt_epi16 (__m512i __W, __mmask32 __U, __m512i __A)
72 {
73 return (__m512i) __builtin_ia32_vpopcountw_v32hi_mask ((__v32hi) __A,
74 (__v32hi) __W,
75 (__mmask32) __U);
76 }
77
78 extern __inline __m512i
79 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
80 _mm512_maskz_popcnt_epi16 (__mmask32 __U, __m512i __A)
81 {
82 return (__m512i) __builtin_ia32_vpopcountw_v32hi_mask ((__v32hi) __A,
83 (__v32hi)
84 _mm512_setzero_si512 (),
85 (__mmask32) __U);
86 }
87
88 extern __inline __mmask64
89 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
90 _mm512_bitshuffle_epi64_mask (__m512i __A, __m512i __B)
91 {
92 return (__mmask64) __builtin_ia32_vpshufbitqmb512_mask ((__v64qi) __A,
93 (__v64qi) __B,
94 (__mmask64) -1);
95 }
96
97 extern __inline __mmask64
98 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
99 _mm512_mask_bitshuffle_epi64_mask (__mmask64 __M, __m512i __A, __m512i __B)
100 {
101 return (__mmask64) __builtin_ia32_vpshufbitqmb512_mask ((__v64qi) __A,
102 (__v64qi) __B,
103 (__mmask64) __M);
104 }
105
106 #ifdef __DISABLE_AVX512BITALG__
107 #undef __DISABLE_AVX512BITALG__
108 #pragma GCC pop_options
109 #endif /* __DISABLE_AVX512BITALG__ */
110
111 #endif /* _AVX512BITALGINTRIN_H_INCLUDED */