diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index 963a8c576ff7c8b89df54bba547a8e7301045a26..452f42d1fc9217cd3b8945ce1e64111fb37b0541 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -2218,6 +2218,10 @@ TARGET_BUILTIN(__builtin_ia32_dbpsadbw128_mask, "V8sV16cV16cIiV8sUc","","avx512b TARGET_BUILTIN(__builtin_ia32_dbpsadbw256_mask, "V16sV32cV32cIiV16sUs","","avx512bw,avx512vl") TARGET_BUILTIN(__builtin_ia32_dbpsadbw512_mask, "V32sV64cV64cIiV32sUi","","avx512bw") TARGET_BUILTIN(__builtin_ia32_psadbw512, "V8LLiV64cV64c","","avx512bw") +TARGET_BUILTIN(__builtin_ia32_compressdf512_mask, "V8dV8dV8dUc","","avx512f") +TARGET_BUILTIN(__builtin_ia32_compressdi512_mask, "V8LLiV8LLiV8LLiUc","","avx512f") +TARGET_BUILTIN(__builtin_ia32_compresssf512_mask, "V16fV16fV16fUs","","avx512f") +TARGET_BUILTIN(__builtin_ia32_compresssi512_mask, "V16iV16iV16iUs","","avx512f") #undef BUILTIN diff --git a/lib/Headers/avx512fintrin.h b/lib/Headers/avx512fintrin.h index 844025836a4884b125d929bc9e81d1978d533157..5b9a45b4bd4d41b32fe798560a12488c46a5e330 100644 --- a/lib/Headers/avx512fintrin.h +++ b/lib/Headers/avx512fintrin.h @@ -7561,6 +7561,74 @@ _mm512_stream_ps (float *__P, __m512 __A) __builtin_ia32_movntps512 (__P, (__v16sf) __A); } +static __inline__ __m512d __DEFAULT_FN_ATTRS +_mm512_mask_compress_pd (__m512d __W, __mmask8 __U, __m512d __A) +{ + return (__m512d) __builtin_ia32_compressdf512_mask ((__v8df) __A, + (__v8df) __W, + (__mmask8) __U); +} + +static __inline__ __m512d __DEFAULT_FN_ATTRS +_mm512_maskz_compress_pd (__mmask8 __U, __m512d __A) +{ + return (__m512d) __builtin_ia32_compressdf512_mask ((__v8df) __A, + (__v8df) + _mm512_setzero_pd (), + (__mmask8) __U); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_mask_compress_epi64 (__m512i __W, __mmask8 __U, __m512i __A) +{ + return (__m512i) __builtin_ia32_compressdi512_mask ((__v8di) __A, + (__v8di) __W, + (__mmask8) __U); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_maskz_compress_epi64 (__mmask8 __U, __m512i __A) +{ + return (__m512i) __builtin_ia32_compressdi512_mask ((__v8di) __A, + (__v8di) + _mm512_setzero_si512 (), + (__mmask8) __U); +} + +static __inline__ __m512 __DEFAULT_FN_ATTRS +_mm512_mask_compress_ps (__m512 __W, __mmask16 __U, __m512 __A) +{ + return (__m512) __builtin_ia32_compresssf512_mask ((__v16sf) __A, + (__v16sf) __W, + (__mmask16) __U); +} + +static __inline__ __m512 __DEFAULT_FN_ATTRS +_mm512_maskz_compress_ps (__mmask16 __U, __m512 __A) +{ + return (__m512) __builtin_ia32_compresssf512_mask ((__v16sf) __A, + (__v16sf) + _mm512_setzero_ps (), + (__mmask16) __U); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_mask_compress_epi32 (__m512i __W, __mmask16 __U, __m512i __A) +{ + return (__m512i) __builtin_ia32_compresssi512_mask ((__v16si) __A, + (__v16si) __W, + (__mmask16) __U); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_maskz_compress_epi32 (__mmask16 __U, __m512i __A) +{ + return (__m512i) __builtin_ia32_compresssi512_mask ((__v16si) __A, + (__v16si) + _mm512_setzero_si512 (), + (__mmask16) __U); +} + #undef __DEFAULT_FN_ATTRS #endif // __AVX512FINTRIN_H diff --git a/test/CodeGen/avx512f-builtins.c b/test/CodeGen/avx512f-builtins.c index 1f048d36b158be8459e6b4e9ed5f46ae83b2957d..c73aa95b6d231c563da4e3132852dc34b5705d42 100644 --- a/test/CodeGen/avx512f-builtins.c +++ b/test/CodeGen/avx512f-builtins.c @@ -5238,3 +5238,50 @@ void test_mm512_stream_ps(float *__P, __m512 __A) { _mm512_stream_ps(__P, __A); } +__m512d test_mm512_mask_compress_pd(__m512d __W, __mmask8 __U, __m512d __A) { + // CHECK-LABEL: @test_mm512_mask_compress_pd + // CHECK: @llvm.x86.avx512.mask.compress.pd.512 + return _mm512_mask_compress_pd(__W, __U, __A); +} + +__m512d test_mm512_maskz_compress_pd(__mmask8 __U, __m512d __A) { + // CHECK-LABEL: @test_mm512_maskz_compress_pd + // CHECK: @llvm.x86.avx512.mask.compress.pd.512 + return _mm512_maskz_compress_pd(__U, __A); +} + +__m512i test_mm512_mask_compress_epi64(__m512i __W, __mmask8 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_mask_compress_epi64 + // CHECK: @llvm.x86.avx512.mask.compress.q.512 + return _mm512_mask_compress_epi64(__W, __U, __A); +} + +__m512i test_mm512_maskz_compress_epi64(__mmask8 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_maskz_compress_epi64 + // CHECK: @llvm.x86.avx512.mask.compress.q.512 + return _mm512_maskz_compress_epi64(__U, __A); +} + +__m512 test_mm512_mask_compress_ps(__m512 __W, __mmask16 __U, __m512 __A) { + // CHECK-LABEL: @test_mm512_mask_compress_ps + // CHECK: @llvm.x86.avx512.mask.compress.ps.512 + return _mm512_mask_compress_ps(__W, __U, __A); +} + +__m512 test_mm512_maskz_compress_ps(__mmask16 __U, __m512 __A) { + // CHECK-LABEL: @test_mm512_maskz_compress_ps + // CHECK: @llvm.x86.avx512.mask.compress.ps.512 + return _mm512_maskz_compress_ps(__U, __A); +} + +__m512i test_mm512_mask_compress_epi32(__m512i __W, __mmask16 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_mask_compress_epi32 + // CHECK: @llvm.x86.avx512.mask.compress.d.512 + return _mm512_mask_compress_epi32(__W, __U, __A); +} + +__m512i test_mm512_maskz_compress_epi32(__mmask16 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_maskz_compress_epi32 + // CHECK: @llvm.x86.avx512.mask.compress.d.512 + return _mm512_maskz_compress_epi32(__U, __A); +}