10b57cec5SDimitry Andric /*===------------- avx512cdintrin.h - AVX512CD 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 "Never use <avx512cdintrin.h> directly; include <immintrin.h> instead." 120b57cec5SDimitry Andric #endif 130b57cec5SDimitry Andric 140b57cec5SDimitry Andric #ifndef __AVX512CDINTRIN_H 150b57cec5SDimitry Andric #define __AVX512CDINTRIN_H 160b57cec5SDimitry Andric 170b57cec5SDimitry Andric /* Define the default attributes for the functions in this file. */ 18*5f757f3fSDimitry Andric #define __DEFAULT_FN_ATTRS \ 19*5f757f3fSDimitry Andric __attribute__((__always_inline__, __nodebug__, \ 20*5f757f3fSDimitry Andric __target__("avx512cd,evex512"), __min_vector_width__(512))) 210b57cec5SDimitry Andric 220b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 230b57cec5SDimitry Andric _mm512_conflict_epi64 (__m512i __A) 240b57cec5SDimitry Andric { 250b57cec5SDimitry Andric return (__m512i) __builtin_ia32_vpconflictdi_512 ((__v8di) __A); 260b57cec5SDimitry Andric } 270b57cec5SDimitry Andric 280b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 290b57cec5SDimitry Andric _mm512_mask_conflict_epi64 (__m512i __W, __mmask8 __U, __m512i __A) 300b57cec5SDimitry Andric { 310b57cec5SDimitry Andric return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U, 320b57cec5SDimitry Andric (__v8di)_mm512_conflict_epi64(__A), 330b57cec5SDimitry Andric (__v8di)__W); 340b57cec5SDimitry Andric } 350b57cec5SDimitry Andric 360b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 370b57cec5SDimitry Andric _mm512_maskz_conflict_epi64 (__mmask8 __U, __m512i __A) 380b57cec5SDimitry Andric { 390b57cec5SDimitry Andric return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U, 400b57cec5SDimitry Andric (__v8di)_mm512_conflict_epi64(__A), 410b57cec5SDimitry Andric (__v8di)_mm512_setzero_si512 ()); 420b57cec5SDimitry Andric } 430b57cec5SDimitry Andric 440b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 450b57cec5SDimitry Andric _mm512_conflict_epi32 (__m512i __A) 460b57cec5SDimitry Andric { 470b57cec5SDimitry Andric return (__m512i) __builtin_ia32_vpconflictsi_512 ((__v16si) __A); 480b57cec5SDimitry Andric } 490b57cec5SDimitry Andric 500b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 510b57cec5SDimitry Andric _mm512_mask_conflict_epi32 (__m512i __W, __mmask16 __U, __m512i __A) 520b57cec5SDimitry Andric { 530b57cec5SDimitry Andric return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U, 540b57cec5SDimitry Andric (__v16si)_mm512_conflict_epi32(__A), 550b57cec5SDimitry Andric (__v16si)__W); 560b57cec5SDimitry Andric } 570b57cec5SDimitry Andric 580b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 590b57cec5SDimitry Andric _mm512_maskz_conflict_epi32 (__mmask16 __U, __m512i __A) 600b57cec5SDimitry Andric { 610b57cec5SDimitry Andric return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U, 620b57cec5SDimitry Andric (__v16si)_mm512_conflict_epi32(__A), 630b57cec5SDimitry Andric (__v16si)_mm512_setzero_si512()); 640b57cec5SDimitry Andric } 650b57cec5SDimitry Andric 660b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 670b57cec5SDimitry Andric _mm512_lzcnt_epi32 (__m512i __A) 680b57cec5SDimitry Andric { 690b57cec5SDimitry Andric return (__m512i) __builtin_ia32_vplzcntd_512 ((__v16si) __A); 700b57cec5SDimitry Andric } 710b57cec5SDimitry Andric 720b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 730b57cec5SDimitry Andric _mm512_mask_lzcnt_epi32 (__m512i __W, __mmask16 __U, __m512i __A) 740b57cec5SDimitry Andric { 750b57cec5SDimitry Andric return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U, 760b57cec5SDimitry Andric (__v16si)_mm512_lzcnt_epi32(__A), 770b57cec5SDimitry Andric (__v16si)__W); 780b57cec5SDimitry Andric } 790b57cec5SDimitry Andric 800b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 810b57cec5SDimitry Andric _mm512_maskz_lzcnt_epi32 (__mmask16 __U, __m512i __A) 820b57cec5SDimitry Andric { 830b57cec5SDimitry Andric return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U, 840b57cec5SDimitry Andric (__v16si)_mm512_lzcnt_epi32(__A), 850b57cec5SDimitry Andric (__v16si)_mm512_setzero_si512()); 860b57cec5SDimitry Andric } 870b57cec5SDimitry Andric 880b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 890b57cec5SDimitry Andric _mm512_lzcnt_epi64 (__m512i __A) 900b57cec5SDimitry Andric { 910b57cec5SDimitry Andric return (__m512i) __builtin_ia32_vplzcntq_512 ((__v8di) __A); 920b57cec5SDimitry Andric } 930b57cec5SDimitry Andric 940b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 950b57cec5SDimitry Andric _mm512_mask_lzcnt_epi64 (__m512i __W, __mmask8 __U, __m512i __A) 960b57cec5SDimitry Andric { 970b57cec5SDimitry Andric return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U, 980b57cec5SDimitry Andric (__v8di)_mm512_lzcnt_epi64(__A), 990b57cec5SDimitry Andric (__v8di)__W); 1000b57cec5SDimitry Andric } 1010b57cec5SDimitry Andric 1020b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 1030b57cec5SDimitry Andric _mm512_maskz_lzcnt_epi64 (__mmask8 __U, __m512i __A) 1040b57cec5SDimitry Andric { 1050b57cec5SDimitry Andric return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U, 1060b57cec5SDimitry Andric (__v8di)_mm512_lzcnt_epi64(__A), 1070b57cec5SDimitry Andric (__v8di)_mm512_setzero_si512()); 1080b57cec5SDimitry Andric } 1090b57cec5SDimitry Andric 1100b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 1110b57cec5SDimitry Andric _mm512_broadcastmb_epi64 (__mmask8 __A) 1120b57cec5SDimitry Andric { 1130b57cec5SDimitry Andric return (__m512i) _mm512_set1_epi64((long long) __A); 1140b57cec5SDimitry Andric } 1150b57cec5SDimitry Andric 1160b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS 1170b57cec5SDimitry Andric _mm512_broadcastmw_epi32 (__mmask16 __A) 1180b57cec5SDimitry Andric { 1190b57cec5SDimitry Andric return (__m512i) _mm512_set1_epi32((int) __A); 1200b57cec5SDimitry Andric 1210b57cec5SDimitry Andric } 1220b57cec5SDimitry Andric 1230b57cec5SDimitry Andric #undef __DEFAULT_FN_ATTRS 1240b57cec5SDimitry Andric 1250b57cec5SDimitry Andric #endif 126