xref: /freebsd/contrib/llvm-project/clang/lib/Headers/avx512vpopcntdqintrin.h (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
10b57cec5SDimitry Andric /*===----- avx512vpopcntdqintrin.h - AVX512VPOPCNTDQ intrinsics-------------===
20b57cec5SDimitry Andric  *
30b57cec5SDimitry Andric  *
40b57cec5SDimitry Andric  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
50b57cec5SDimitry Andric  * See https://llvm.org/LICENSE.txt for license information.
60b57cec5SDimitry Andric  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
70b57cec5SDimitry Andric  *
80b57cec5SDimitry Andric  *===-----------------------------------------------------------------------===
90b57cec5SDimitry Andric  */
100b57cec5SDimitry Andric #ifndef __IMMINTRIN_H
110b57cec5SDimitry Andric #error                                                                         \
120b57cec5SDimitry Andric     "Never use <avx512vpopcntdqintrin.h> directly; include <immintrin.h> instead."
130b57cec5SDimitry Andric #endif
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric #ifndef __AVX512VPOPCNTDQINTRIN_H
160b57cec5SDimitry Andric #define __AVX512VPOPCNTDQINTRIN_H
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric /* Define the default attributes for the functions in this file. */
190b57cec5SDimitry Andric #define __DEFAULT_FN_ATTRS                                                     \
20*5f757f3fSDimitry Andric   __attribute__((__always_inline__, __nodebug__,                               \
21*5f757f3fSDimitry Andric                  __target__("avx512vpopcntdq,evex512"),                        \
22*5f757f3fSDimitry Andric                  __min_vector_width__(512)))
230b57cec5SDimitry Andric 
240b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_popcnt_epi64(__m512i __A) {
250b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_vpopcntq_512((__v8di)__A);
260b57cec5SDimitry Andric }
270b57cec5SDimitry Andric 
280b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
290b57cec5SDimitry Andric _mm512_mask_popcnt_epi64(__m512i __W, __mmask8 __U, __m512i __A) {
300b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_selectq_512(
310b57cec5SDimitry Andric       (__mmask8)__U, (__v8di)_mm512_popcnt_epi64(__A), (__v8di)__W);
320b57cec5SDimitry Andric }
330b57cec5SDimitry Andric 
340b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
350b57cec5SDimitry Andric _mm512_maskz_popcnt_epi64(__mmask8 __U, __m512i __A) {
360b57cec5SDimitry Andric   return _mm512_mask_popcnt_epi64((__m512i)_mm512_setzero_si512(), __U, __A);
370b57cec5SDimitry Andric }
380b57cec5SDimitry Andric 
390b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_popcnt_epi32(__m512i __A) {
400b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_vpopcntd_512((__v16si)__A);
410b57cec5SDimitry Andric }
420b57cec5SDimitry Andric 
430b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
440b57cec5SDimitry Andric _mm512_mask_popcnt_epi32(__m512i __W, __mmask16 __U, __m512i __A) {
450b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_selectd_512(
460b57cec5SDimitry Andric       (__mmask16)__U, (__v16si)_mm512_popcnt_epi32(__A), (__v16si)__W);
470b57cec5SDimitry Andric }
480b57cec5SDimitry Andric 
490b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
500b57cec5SDimitry Andric _mm512_maskz_popcnt_epi32(__mmask16 __U, __m512i __A) {
510b57cec5SDimitry Andric   return _mm512_mask_popcnt_epi32((__m512i)_mm512_setzero_si512(), __U, __A);
520b57cec5SDimitry Andric }
530b57cec5SDimitry Andric 
540b57cec5SDimitry Andric #undef __DEFAULT_FN_ATTRS
550b57cec5SDimitry Andric 
560b57cec5SDimitry Andric #endif
57