Index: include/clang/Basic/BuiltinsX86.def =================================================================== --- include/clang/Basic/BuiltinsX86.def +++ include/clang/Basic/BuiltinsX86.def @@ -1691,6 +1691,9 @@ TARGET_BUILTIN(__builtin_ia32_psraw256_mask, "V16sV16sV8sV16sUs","","avx512bw,avx512vl") TARGET_BUILTIN(__builtin_ia32_psrawi128_mask, "V8sV8sIiV8sUc","","avx512bw,avx512vl") TARGET_BUILTIN(__builtin_ia32_psrawi256_mask, "V16sV16sIiV16sUs","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_movddup512_mask, "V8dV8dV8dUc","","avx512f") +TARGET_BUILTIN(__builtin_ia32_movddup128_mask, "V2dV2dV2dUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_movddup256_mask, "V4dV4dV4dUc","","avx512vl") #undef BUILTIN #undef TARGET_BUILTIN Index: lib/Headers/avx512fintrin.h =================================================================== --- lib/Headers/avx512fintrin.h +++ lib/Headers/avx512fintrin.h @@ -3602,6 +3602,34 @@ (__mmask8)( __U));\ }) + +static __inline__ __m512d __DEFAULT_FN_ATTRS +_mm512_movedup_pd (__m512d __A) +{ + return (__m512d) __builtin_ia32_movddup512_mask ((__v8df) __A, + (__v8df) + _mm512_undefined_pd (), + (__mmask8) -1); +} + +static __inline__ __m512d __DEFAULT_FN_ATTRS +_mm512_mask_movedup_pd (__m512d __W, __mmask8 __U, __m512d __A) +{ + return (__m512d) __builtin_ia32_movddup512_mask ((__v8df) __A, + (__v8df) __W, + (__mmask8) __U); +} + +static __inline__ __m512d __DEFAULT_FN_ATTRS +_mm512_maskz_movedup_pd (__mmask8 __U, __m512d __A) +{ + return (__m512d) __builtin_ia32_movddup512_mask ((__v8df) __A, + (__v8df) + _mm512_setzero_pd (), + (__mmask8) __U); +} + + #undef __DEFAULT_FN_ATTRS #endif // __AVX512FINTRIN_H Index: lib/Headers/avx512vlintrin.h =================================================================== --- lib/Headers/avx512vlintrin.h +++ lib/Headers/avx512vlintrin.h @@ -5871,6 +5871,43 @@ _mm256_setzero_si256 (), (__mmask8) __U); } + + +static __inline__ __m128d __DEFAULT_FN_ATTRS +_mm_mask_movedup_pd (__m128d __W, __mmask8 __U, __m128d __A) +{ + return (__m128d) __builtin_ia32_movddup128_mask ((__v2df) __A, + (__v2df) __W, + (__mmask8) __U); +} + +static __inline__ __m128d __DEFAULT_FN_ATTRS +_mm_maskz_movedup_pd (__mmask8 __U, __m128d __A) +{ + return (__m128d) __builtin_ia32_movddup128_mask ((__v2df) __A, + (__v2df) + _mm_setzero_pd (), + (__mmask8) __U); +} + +static __inline__ __m256d __DEFAULT_FN_ATTRS +_mm256_mask_movedup_pd (__m256d __W, __mmask8 __U, __m256d __A) +{ + return (__m256d) __builtin_ia32_movddup256_mask ((__v4df) __A, + (__v4df) __W, + (__mmask8) __U); +} + +static __inline__ __m256d __DEFAULT_FN_ATTRS +_mm256_maskz_movedup_pd (__mmask8 __U, __m256d __A) +{ + return (__m256d) __builtin_ia32_movddup256_mask ((__v4df) __A, + (__v4df) + _mm256_setzero_pd (), + (__mmask8) __U); +} + + #undef __DEFAULT_FN_ATTRS #undef __DEFAULT_FN_ATTRS_BOTH Index: test/CodeGen/avx512f-builtins.c =================================================================== --- test/CodeGen/avx512f-builtins.c +++ test/CodeGen/avx512f-builtins.c @@ -2298,3 +2298,22 @@ return _mm512_maskz_srli_epi64(__U, __A, 5); } +__m512d test_mm512_movedup_pd(__m512d __A) { + // CHECK-LABEL: @test_mm512_movedup_pd + // CHECK: @llvm.x86.avx512.mask.movddup.512 + return _mm512_movedup_pd(__A); +} + +__m512d test_mm512_mask_movedup_pd(__m512d __W, __mmask8 __U, __m512d __A) { + // CHECK-LABEL: @test_mm512_mask_movedup_pd + // CHECK: @llvm.x86.avx512.mask.movddup.512 + return _mm512_mask_movedup_pd(__W, __U, __A); +} + +__m512d test_mm512_maskz_movedup_pd(__mmask8 __U, __m512d __A) { + // CHECK-LABEL: @test_mm512_maskz_movedup_pd + // CHECK: @llvm.x86.avx512.mask.movddup.512 + return _mm512_maskz_movedup_pd(__U, __A); +} + + Index: test/CodeGen/avx512vl-builtins.c =================================================================== --- test/CodeGen/avx512vl-builtins.c +++ test/CodeGen/avx512vl-builtins.c @@ -3936,3 +3936,27 @@ return _mm256_maskz_srav_epi64(__U, __X, __Y); } +__m128d test_mm_mask_movedup_pd(__m128d __W, __mmask8 __U, __m128d __A) { + // CHECK-LABEL: @test_mm_mask_movedup_pd + // CHECK: @llvm.x86.avx512.mask.movddup.128 + return _mm_mask_movedup_pd(__W, __U, __A); +} + +__m128d test_mm_maskz_movedup_pd(__mmask8 __U, __m128d __A) { + // CHECK-LABEL: @test_mm_maskz_movedup_pd + // CHECK: @llvm.x86.avx512.mask.movddup.128 + return _mm_maskz_movedup_pd(__U, __A); +} + +__m256d test_mm256_mask_movedup_pd(__m256d __W, __mmask8 __U, __m256d __A) { + // CHECK-LABEL: @test_mm256_mask_movedup_pd + // CHECK: @llvm.x86.avx512.mask.movddup.256 + return _mm256_mask_movedup_pd(__W, __U, __A); +} + +__m256d test_mm256_maskz_movedup_pd(__mmask8 __U, __m256d __A) { + // CHECK-LABEL: @test_mm256_maskz_movedup_pd + // CHECK: @llvm.x86.avx512.mask.movddup.256 + return _mm256_maskz_movedup_pd(__U, __A); +} +