]>
Commit | Line | Data |
---|---|---|
a945c346 | 1 | /* Copyright (C) 2017-2024 Free Software Foundation, Inc. |
e2a29465 JK |
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 | ||
fd514717 HJ |
31 | #if !defined(__AVX512VPOPCNTDQ__) || !defined(__AVX512VL__) \ |
32 | || defined (__EVEX512__) | |
e2a29465 | 33 | #pragma GCC push_options |
fd514717 | 34 | #pragma GCC target("avx512vpopcntdq,avx512vl,no-evex512") |
e2a29465 JK |
35 | #define __DISABLE_AVX512VPOPCNTDQVL__ |
36 | #endif /* __AVX512VPOPCNTDQVL__ */ | |
37 | ||
38 | extern __inline __m128i | |
39 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
40 | _mm_popcnt_epi32 (__m128i __A) | |
41 | { | |
42 | return (__m128i) __builtin_ia32_vpopcountd_v4si ((__v4si) __A); | |
43 | } | |
44 | ||
45 | extern __inline __m128i | |
46 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
ae2b8ede | 47 | _mm_mask_popcnt_epi32 (__m128i __W, __mmask16 __U, __m128i __A) |
e2a29465 JK |
48 | { |
49 | return (__m128i) __builtin_ia32_vpopcountd_v4si_mask ((__v4si) __A, | |
ae2b8ede | 50 | (__v4si) __W, |
e2a29465 JK |
51 | (__mmask16) __U); |
52 | } | |
53 | ||
54 | extern __inline __m128i | |
55 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
56 | _mm_maskz_popcnt_epi32 (__mmask16 __U, __m128i __A) | |
57 | { | |
58 | return (__m128i) __builtin_ia32_vpopcountd_v4si_mask ((__v4si) __A, | |
59 | (__v4si) | |
fd79b414 | 60 | _mm_avx512_setzero_si128 (), |
e2a29465 JK |
61 | (__mmask16) __U); |
62 | } | |
63 | ||
64 | extern __inline __m256i | |
65 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
66 | _mm256_popcnt_epi32 (__m256i __A) | |
67 | { | |
68 | return (__m256i) __builtin_ia32_vpopcountd_v8si ((__v8si) __A); | |
69 | } | |
70 | ||
71 | extern __inline __m256i | |
72 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
ae2b8ede | 73 | _mm256_mask_popcnt_epi32 (__m256i __W, __mmask16 __U, __m256i __A) |
e2a29465 JK |
74 | { |
75 | return (__m256i) __builtin_ia32_vpopcountd_v8si_mask ((__v8si) __A, | |
ae2b8ede | 76 | (__v8si) __W, |
e2a29465 JK |
77 | (__mmask16) __U); |
78 | } | |
79 | ||
80 | extern __inline __m256i | |
81 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
82 | _mm256_maskz_popcnt_epi32 (__mmask16 __U, __m256i __A) | |
83 | { | |
84 | return (__m256i) __builtin_ia32_vpopcountd_v8si_mask ((__v8si) __A, | |
85 | (__v8si) | |
fd79b414 | 86 | _mm256_avx512_setzero_si256 (), |
e2a29465 JK |
87 | (__mmask16) __U); |
88 | } | |
89 | ||
90 | extern __inline __m128i | |
91 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
92 | _mm_popcnt_epi64 (__m128i __A) | |
93 | { | |
94 | return (__m128i) __builtin_ia32_vpopcountq_v2di ((__v2di) __A); | |
95 | } | |
96 | ||
97 | extern __inline __m128i | |
98 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
ae2b8ede | 99 | _mm_mask_popcnt_epi64 (__m128i __W, __mmask8 __U, __m128i __A) |
e2a29465 JK |
100 | { |
101 | return (__m128i) __builtin_ia32_vpopcountq_v2di_mask ((__v2di) __A, | |
ae2b8ede | 102 | (__v2di) __W, |
e2a29465 JK |
103 | (__mmask8) __U); |
104 | } | |
105 | ||
106 | extern __inline __m128i | |
107 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
108 | _mm_maskz_popcnt_epi64 (__mmask8 __U, __m128i __A) | |
109 | { | |
110 | return (__m128i) __builtin_ia32_vpopcountq_v2di_mask ((__v2di) __A, | |
111 | (__v2di) | |
fd79b414 | 112 | _mm_avx512_setzero_si128 (), |
e2a29465 JK |
113 | (__mmask8) __U); |
114 | } | |
115 | ||
116 | extern __inline __m256i | |
117 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
118 | _mm256_popcnt_epi64 (__m256i __A) | |
119 | { | |
120 | return (__m256i) __builtin_ia32_vpopcountq_v4di ((__v4di) __A); | |
121 | } | |
122 | ||
123 | extern __inline __m256i | |
124 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
ae2b8ede | 125 | _mm256_mask_popcnt_epi64 (__m256i __W, __mmask8 __U, __m256i __A) |
e2a29465 JK |
126 | { |
127 | return (__m256i) __builtin_ia32_vpopcountq_v4di_mask ((__v4di) __A, | |
ae2b8ede | 128 | (__v4di) __W, |
e2a29465 JK |
129 | (__mmask8) __U); |
130 | } | |
131 | ||
132 | extern __inline __m256i | |
133 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | |
134 | _mm256_maskz_popcnt_epi64 (__mmask8 __U, __m256i __A) | |
135 | { | |
136 | return (__m256i) __builtin_ia32_vpopcountq_v4di_mask ((__v4di) __A, | |
137 | (__v4di) | |
fd79b414 | 138 | _mm256_avx512_setzero_si256 (), |
e2a29465 JK |
139 | (__mmask8) __U); |
140 | } | |
141 | ||
142 | #ifdef __DISABLE_AVX512VPOPCNTDQVL__ | |
143 | #undef __DISABLE_AVX512VPOPCNTDQVL__ | |
144 | #pragma GCC pop_options | |
145 | #endif /* __DISABLE_AVX512VPOPCNTDQVL__ */ | |
146 | ||
147 | #endif /* _AVX512VPOPCNTDQVLINTRIN_H_INCLUDED */ |