Index: include/clang/Basic/BuiltinsX86.def =================================================================== --- include/clang/Basic/BuiltinsX86.def +++ include/clang/Basic/BuiltinsX86.def @@ -1942,6 +1942,28 @@ TARGET_BUILTIN(__builtin_ia32_pternlogq128_maskz, "V2LLiV2LLiV2LLiV2LLiIiUc","","avx512vl") TARGET_BUILTIN(__builtin_ia32_pternlogq256_mask, "V4LLiV4LLiV4LLiV4LLiIiUc","","avx512vl") TARGET_BUILTIN(__builtin_ia32_pternlogq256_maskz, "V4LLiV4LLiV4LLiV4LLiIiUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtb2mask512, "ULLiV64c","","avx512bw") +TARGET_BUILTIN(__builtin_ia32_cvtmask2b512, "V64cULLi","","avx512bw") +TARGET_BUILTIN(__builtin_ia32_cvtmask2w512, "V32sUi","","avx512bw") +TARGET_BUILTIN(__builtin_ia32_cvtd2mask512, "UsV16i","","avx512dq") +TARGET_BUILTIN(__builtin_ia32_cvtmask2d512, "V16iUs","","avx512dq") +TARGET_BUILTIN(__builtin_ia32_cvtmask2q512, "V8LLiUc","","avx512dq") +TARGET_BUILTIN(__builtin_ia32_cvtq2mask512, "UcV8LLi","","avx512dq") +TARGET_BUILTIN(__builtin_ia32_cvtb2mask128, "UsV16c","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtb2mask256, "UiV32c","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtmask2b128, "V16cUs","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtmask2b256, "V32cUi","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtmask2w128, "V8sUc","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtmask2w256, "V16sUs","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtd2mask128, "UcV4i","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtd2mask256, "UcV8i","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtmask2d128, "V4iUc","","avx512dq,avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtmask2d256, "V8iUc","","avx512dq,avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtmask2q128, "V2LLiUc","","avx512dq,avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtmask2q256, "V4LLiUc","","avx512dq,avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtq2mask128, "UcV2LLi","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_cvtq2mask256, "UcV4LLi","","avx512vl") + #undef BUILTIN #undef TARGET_BUILTIN Index: lib/Headers/avx512bwintrin.h =================================================================== --- lib/Headers/avx512bwintrin.h +++ lib/Headers/avx512bwintrin.h @@ -2057,6 +2057,24 @@ (__v32hi) __B, __U); } +static __inline__ __mmask64 __DEFAULT_FN_ATTRS +_mm512_movepi8_mask (__m512i __A) +{ + return (__mmask64) __builtin_ia32_cvtb2mask512 ((__v64qi) __A); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_movm_epi8 (__mmask64 __A) +{ + return (__m512i) __builtin_ia32_cvtmask2b512 (__A); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_movm_epi16 (__mmask32 __A) +{ + return (__m512i) __builtin_ia32_cvtmask2w512 (__A); +} + #undef __DEFAULT_FN_ATTRS Index: lib/Headers/avx512dqintrin.h =================================================================== --- lib/Headers/avx512dqintrin.h +++ lib/Headers/avx512dqintrin.h @@ -773,6 +773,31 @@ (__m512) __builtin_ia32_reduceps512_mask ((__v16sf) __A, __B, \ (__v16sf) _mm512_setzero_ps(), (__mmask16) __U, __R);}) +static __inline__ __mmask16 __DEFAULT_FN_ATTRS +_mm512_movepi32_mask (__m512i __A) +{ + return (__mmask16) __builtin_ia32_cvtd2mask512 ((__v16si) __A); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_movm_epi32 (__mmask16 __A) +{ + return (__m512i) __builtin_ia32_cvtmask2d512 (__A); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_movm_epi64 (__mmask8 __A) +{ + return (__m512i) __builtin_ia32_cvtmask2q512 (__A); +} + +static __inline__ __mmask8 __DEFAULT_FN_ATTRS +_mm512_movepi64_mask (__m512i __A) +{ + return (__mmask8) __builtin_ia32_cvtq2mask512 ((__v8di) __A); +} + + #undef __DEFAULT_FN_ATTRS #endif Index: lib/Headers/avx512vlbwintrin.h =================================================================== --- lib/Headers/avx512vlbwintrin.h +++ lib/Headers/avx512vlbwintrin.h @@ -3172,6 +3172,42 @@ (__v16hi) __B, __U); } +static __inline__ __mmask16 __DEFAULT_FN_ATTRS +_mm_movepi8_mask (__m128i __A) +{ + return (__mmask16) __builtin_ia32_cvtb2mask128 ((__v16qi) __A); +} + +static __inline__ __mmask32 __DEFAULT_FN_ATTRS +_mm256_movepi8_mask (__m256i __A) +{ + return (__mmask32) __builtin_ia32_cvtb2mask256 ((__v32qi) __A); +} + +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_movm_epi8 (__mmask16 __A) +{ + return (__m128i) __builtin_ia32_cvtmask2b128 (__A); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_movm_epi8 (__mmask32 __A) +{ + return (__m256i) __builtin_ia32_cvtmask2b256 (__A); +} + +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_movm_epi16 (__mmask8 __A) +{ + return (__m128i) __builtin_ia32_cvtmask2w128 (__A); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_movm_epi16 (__mmask16 __A) +{ + return (__m256i) __builtin_ia32_cvtmask2w256 (__A); +} + #undef __DEFAULT_FN_ATTRS Index: lib/Headers/avx512vldqintrin.h =================================================================== --- lib/Headers/avx512vldqintrin.h +++ lib/Headers/avx512vldqintrin.h @@ -948,6 +948,54 @@ (__m256) __builtin_ia32_reduceps256_mask ((__v8sf) __A, __B, \ (__v8sf) _mm256_setzero_ps(), (__mmask8) __U); }) +static __inline__ __mmask8 __DEFAULT_FN_ATTRS +_mm_movepi32_mask (__m128i __A) +{ + return (__mmask8) __builtin_ia32_cvtd2mask128 ((__v4si) __A); +} + +static __inline__ __mmask8 __DEFAULT_FN_ATTRS +_mm256_movepi32_mask (__m256i __A) +{ + return (__mmask8) __builtin_ia32_cvtd2mask256 ((__v8si) __A); +} + +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_movm_epi32 (__mmask8 __A) +{ + return (__m128i) __builtin_ia32_cvtmask2d128 (__A); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_movm_epi32 (__mmask8 __A) +{ + return (__m256i) __builtin_ia32_cvtmask2d256 (__A); +} + +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_movm_epi64 (__mmask8 __A) +{ + return (__m128i) __builtin_ia32_cvtmask2q128 (__A); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_movm_epi64 (__mmask8 __A) +{ + return (__m256i) __builtin_ia32_cvtmask2q256 (__A); +} + +static __inline__ __mmask8 __DEFAULT_FN_ATTRS +_mm_movepi64_mask (__m128i __A) +{ + return (__mmask8) __builtin_ia32_cvtq2mask128 ((__v2di) __A); +} + +static __inline__ __mmask8 __DEFAULT_FN_ATTRS +_mm256_movepi64_mask (__m256i __A) +{ + return (__mmask8) __builtin_ia32_cvtq2mask256 ((__v4di) __A); +} + #undef __DEFAULT_FN_ATTRS #endif Index: test/CodeGen/avx512bw-builtins.c =================================================================== --- test/CodeGen/avx512bw-builtins.c +++ test/CodeGen/avx512bw-builtins.c @@ -1404,3 +1404,22 @@ return _mm512_mask_testn_epi16_mask(__U, __A, __B); } +__mmask64 test_mm512_movepi8_mask(__m512i __A) { + // CHECK-LABEL: @test_mm512_movepi8_mask + // CHECK: @llvm.x86.avx512.cvtb2mask.512 + return _mm512_movepi8_mask(__A); +} + +__m512i test_mm512_movm_epi8(__mmask64 __A) { + // CHECK-LABEL: @test_mm512_movm_epi8 + // CHECK: @llvm.x86.avx512.cvtmask2b.512 + return _mm512_movm_epi8(__A); +} + +__m512i test_mm512_movm_epi16(__mmask32 __A) { + // CHECK-LABEL: @test_mm512_movm_epi16 + // CHECK: @llvm.x86.avx512.cvtmask2w.512 + return _mm512_movm_epi16(__A); +} + + Index: test/CodeGen/avx512dq-builtins.c =================================================================== --- test/CodeGen/avx512dq-builtins.c +++ test/CodeGen/avx512dq-builtins.c @@ -743,3 +743,27 @@ return _mm512_maskz_reduce_round_ps(__U, __A, 4, 8); } +__mmask16 test_mm512_movepi32_mask(__m512i __A) { + // CHECK-LABEL: @test_mm512_movepi32_mask + // CHECK: @llvm.x86.avx512.cvtd2mask.512 + return _mm512_movepi32_mask(__A); +} + +__m512i test_mm512_movm_epi32(__mmask16 __A) { + // CHECK-LABEL: @test_mm512_movm_epi32 + // CHECK: @llvm.x86.avx512.cvtmask2d.512 + return _mm512_movm_epi32(__A); +} + +__m512i test_mm512_movm_epi64(__mmask8 __A) { + // CHECK-LABEL: @test_mm512_movm_epi64 + // CHECK: @llvm.x86.avx512.cvtmask2q.512 + return _mm512_movm_epi64(__A); +} + +__mmask8 test_mm512_movepi64_mask(__m512i __A) { + // CHECK-LABEL: @test_mm512_movepi64_mask + // CHECK: @llvm.x86.avx512.cvtq2mask.512 + return _mm512_movepi64_mask(__A); +} + Index: test/CodeGen/avx512vlbw-builtins.c =================================================================== --- test/CodeGen/avx512vlbw-builtins.c +++ test/CodeGen/avx512vlbw-builtins.c @@ -2172,3 +2172,41 @@ return _mm256_mask_testn_epi16_mask(__U, __A, __B); } +__mmask16 test_mm_movepi8_mask(__m128i __A) { + // CHECK-LABEL: @test_mm_movepi8_mask + // CHECK: @llvm.x86.avx512.cvtb2mask.128 + return _mm_movepi8_mask(__A); +} + +__mmask32 test_mm256_movepi8_mask(__m256i __A) { + // CHECK-LABEL: @test_mm256_movepi8_mask + // CHECK: @llvm.x86.avx512.cvtb2mask.256 + return _mm256_movepi8_mask(__A); +} + +__m128i test_mm_movm_epi8(__mmask16 __A) { + // CHECK-LABEL: @test_mm_movm_epi8 + // CHECK: @llvm.x86.avx512.cvtmask2b.128 + return _mm_movm_epi8(__A); +} + +__m256i test_mm256_movm_epi8(__mmask32 __A) { + // CHECK-LABEL: @test_mm256_movm_epi8 + // CHECK: @llvm.x86.avx512.cvtmask2b.256 + return _mm256_movm_epi8(__A); +} + +__m128i test_mm_movm_epi16(__mmask8 __A) { + // CHECK-LABEL: @test_mm_movm_epi16 + // CHECK: @llvm.x86.avx512.cvtmask2w.128 + return _mm_movm_epi16(__A); +} + +__m256i test_mm256_movm_epi16(__mmask16 __A) { + // CHECK-LABEL: @test_mm256_movm_epi16 + // CHECK: @llvm.x86.avx512.cvtmask2w.256 + return _mm256_movm_epi16(__A); +} + + + Index: test/CodeGen/avx512vldq-builtins.c =================================================================== --- test/CodeGen/avx512vldq-builtins.c +++ test/CodeGen/avx512vldq-builtins.c @@ -808,3 +808,52 @@ // CHECK: @llvm.x86.avx512.mask.reduce.ps.256 return _mm256_maskz_reduce_ps(__U, __A, 4); } + +__mmask8 test_mm_movepi32_mask(__m128i __A) { + // CHECK-LABEL: @test_mm_movepi32_mask + // CHECK: @llvm.x86.avx512.cvtd2mask.128 + return _mm_movepi32_mask(__A); +} + +__mmask8 test_mm256_movepi32_mask(__m256i __A) { + // CHECK-LABEL: @test_mm256_movepi32_mask + // CHECK: @llvm.x86.avx512.cvtd2mask.256 + return _mm256_movepi32_mask(__A); +} + +__m128i test_mm_movm_epi32(__mmask8 __A) { + // CHECK-LABEL: @test_mm_movm_epi32 + // CHECK: @llvm.x86.avx512.cvtmask2d.128 + return _mm_movm_epi32(__A); +} + +__m256i test_mm256_movm_epi32(__mmask8 __A) { + // CHECK-LABEL: @test_mm256_movm_epi32 + // CHECK: @llvm.x86.avx512.cvtmask2d.256 + return _mm256_movm_epi32(__A); +} + +__m128i test_mm_movm_epi64(__mmask8 __A) { + // CHECK-LABEL: @test_mm_movm_epi64 + // CHECK: @llvm.x86.avx512.cvtmask2q.128 + return _mm_movm_epi64(__A); +} + +__m256i test_mm256_movm_epi64(__mmask8 __A) { + // CHECK-LABEL: @test_mm256_movm_epi64 + // CHECK: @llvm.x86.avx512.cvtmask2q.256 + return _mm256_movm_epi64(__A); +} + +__mmask8 test_mm_movepi64_mask(__m128i __A) { + // CHECK-LABEL: @test_mm_movepi64_mask + // CHECK: @llvm.x86.avx512.cvtq2mask.128 + return _mm_movepi64_mask(__A); +} + +__mmask8 test_mm256_movepi64_mask(__m256i __A) { + // CHECK-LABEL: @test_mm256_movepi64_mask + // CHECK: @llvm.x86.avx512.cvtq2mask.256 + return _mm256_movepi64_mask(__A); +} +