Clang Project

clang_source_code/lib/Headers/avx512vpopcntdqvlintrin.h
1/*===---- avx512vpopcntdqintrin.h - AVX512VPOPCNTDQ intrinsics -------------===
2 *
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 *
22 *===-----------------------------------------------------------------------===
23 */
24#ifndef __IMMINTRIN_H
25#error                                                                         \
26    "Never use <avx512vpopcntdqvlintrin.h> directly; include <immintrin.h> instead."
27#endif
28
29#ifndef __AVX512VPOPCNTDQVLINTRIN_H
30#define __AVX512VPOPCNTDQVLINTRIN_H
31
32/* Define the default attributes for the functions in this file. */
33#define __DEFAULT_FN_ATTRS128                                                  \
34  __attribute__((__always_inline__, __nodebug__, __target__("avx512vpopcntdq,avx512vl"), __min_vector_width__(128)))
35#define __DEFAULT_FN_ATTRS256                                                  \
36  __attribute__((__always_inline__, __nodebug__, __target__("avx512vpopcntdq,avx512vl"), __min_vector_width__(256)))
37
38static __inline__ __m128i __DEFAULT_FN_ATTRS128
39_mm_popcnt_epi64(__m128i __A) {
40  return (__m128i)__builtin_ia32_vpopcntq_128((__v2di)__A);
41}
42
43static __inline__ __m128i __DEFAULT_FN_ATTRS128
44_mm_mask_popcnt_epi64(__m128i __W__mmask8 __U__m128i __A) {
45  return (__m128i)__builtin_ia32_selectq_128(
46      (__mmask8)__U, (__v2di)_mm_popcnt_epi64(__A), (__v2di)__W);
47}
48
49static __inline__ __m128i __DEFAULT_FN_ATTRS128
50_mm_maskz_popcnt_epi64(__mmask8 __U__m128i __A) {
51  return _mm_mask_popcnt_epi64((__m128i)_mm_setzero_si128(), __U__A);
52}
53
54static __inline__ __m128i __DEFAULT_FN_ATTRS128
55_mm_popcnt_epi32(__m128i __A) {
56  return (__m128i)__builtin_ia32_vpopcntd_128((__v4si)__A);
57}
58
59static __inline__ __m128i __DEFAULT_FN_ATTRS128
60_mm_mask_popcnt_epi32(__m128i __W__mmask8 __U__m128i __A) {
61  return (__m128i)__builtin_ia32_selectd_128(
62      (__mmask8)__U, (__v4si)_mm_popcnt_epi32(__A), (__v4si)__W);
63}
64
65static __inline__ __m128i __DEFAULT_FN_ATTRS128
66_mm_maskz_popcnt_epi32(__mmask8 __U__m128i __A) {
67  return _mm_mask_popcnt_epi32((__m128i)_mm_setzero_si128(), __U__A);
68}
69
70static __inline__ __m256i __DEFAULT_FN_ATTRS256
71_mm256_popcnt_epi64(__m256i __A) {
72  return (__m256i)__builtin_ia32_vpopcntq_256((__v4di)__A);
73}
74
75static __inline__ __m256i __DEFAULT_FN_ATTRS256
76_mm256_mask_popcnt_epi64(__m256i __W__mmask8 __U__m256i __A) {
77  return (__m256i)__builtin_ia32_selectq_256(
78      (__mmask8)__U, (__v4di)_mm256_popcnt_epi64(__A), (__v4di)__W);
79}
80
81static __inline__ __m256i __DEFAULT_FN_ATTRS256
82_mm256_maskz_popcnt_epi64(__mmask8 __U__m256i __A) {
83  return _mm256_mask_popcnt_epi64((__m256i)_mm256_setzero_si256(), __U__A);
84}
85
86static __inline__ __m256i __DEFAULT_FN_ATTRS256
87_mm256_popcnt_epi32(__m256i __A) {
88  return (__m256i)__builtin_ia32_vpopcntd_256((__v8si)__A);
89}
90
91static __inline__ __m256i __DEFAULT_FN_ATTRS256
92_mm256_mask_popcnt_epi32(__m256i __W__mmask8 __U__m256i __A) {
93  return (__m256i)__builtin_ia32_selectd_256(
94      (__mmask8)__U, (__v8si)_mm256_popcnt_epi32(__A), (__v8si)__W);
95}
96
97static __inline__ __m256i __DEFAULT_FN_ATTRS256
98_mm256_maskz_popcnt_epi32(__mmask8 __U__m256i __A) {
99  return _mm256_mask_popcnt_epi32((__m256i)_mm256_setzero_si256(), __U__A);
100}
101
102#undef __DEFAULT_FN_ATTRS128
103#undef __DEFAULT_FN_ATTRS256
104
105#endif
106