Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def =================================================================== --- cfe/trunk/include/clang/Basic/BuiltinsX86.def +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def @@ -1719,6 +1719,13 @@ TARGET_BUILTIN(__builtin_ia32_movddup512_mask, "V8dV8dV8dUc","","avx512f") TARGET_BUILTIN(__builtin_ia32_movddup128_mask, "V2dV2dV2dUc","","avx512vl") TARGET_BUILTIN(__builtin_ia32_movddup256_mask, "V4dV4dV4dUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_pbroadcastb512_gpr_mask, "V64ccV64cULLi","","avx512bw") +TARGET_BUILTIN(__builtin_ia32_pbroadcastb128_gpr_mask, "V16ccV16cUs","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_pbroadcastb256_gpr_mask, "V32ccV32cUi","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_pbroadcastd128_gpr_mask, "V4iiV4iUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_pbroadcastd256_gpr_mask, "V8iiV8iUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_pbroadcastq128_gpr_mask, "V2LLiULLiV2LLiUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_pbroadcastq256_gpr_mask, "V4LLiULLiV4LLiUc","","avx512vl") #undef BUILTIN #undef TARGET_BUILTIN Index: cfe/trunk/lib/Headers/avx512bwintrin.h =================================================================== --- cfe/trunk/lib/Headers/avx512bwintrin.h +++ cfe/trunk/lib/Headers/avx512bwintrin.h @@ -1917,6 +1917,23 @@ } +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_mask_set1_epi8 (__m512i __O, __mmask64 __M, char __A) +{ + return (__m512i) __builtin_ia32_pbroadcastb512_gpr_mask (__A, + (__v64qi) __O, + __M); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_maskz_set1_epi8 (__mmask64 __M, char __A) +{ + return (__m512i) __builtin_ia32_pbroadcastb512_gpr_mask (__A, + (__v64qi) + _mm512_setzero_qi(), + __M); +} + #undef __DEFAULT_FN_ATTRS #endif Index: cfe/trunk/lib/Headers/avx512vlbwintrin.h =================================================================== --- cfe/trunk/lib/Headers/avx512vlbwintrin.h +++ cfe/trunk/lib/Headers/avx512vlbwintrin.h @@ -2919,6 +2919,39 @@ } +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_mask_set1_epi8 (__m128i __O, __mmask16 __M, char __A) +{ + return (__m128i) __builtin_ia32_pbroadcastb128_gpr_mask (__A, + (__v16qi) __O, + __M); +} + +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_maskz_set1_epi8 (__mmask16 __M, char __A) +{ + return (__m128i) __builtin_ia32_pbroadcastb128_gpr_mask (__A, + (__v16qi) + _mm_setzero_si128 (), + __M); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_mask_set1_epi8 (__m256i __O, __mmask32 __M, char __A) +{ + return (__m256i) __builtin_ia32_pbroadcastb256_gpr_mask (__A, + (__v32qi) __O, + __M); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_maskz_set1_epi8 (__mmask32 __M, char __A) +{ + return (__m256i) __builtin_ia32_pbroadcastb256_gpr_mask (__A, + (__v32qi) + _mm256_setzero_si256 (), + __M); +} #undef __DEFAULT_FN_ATTRS #endif /* __AVX512VLBWINTRIN_H */ Index: cfe/trunk/lib/Headers/avx512vlintrin.h =================================================================== --- cfe/trunk/lib/Headers/avx512vlintrin.h +++ cfe/trunk/lib/Headers/avx512vlintrin.h @@ -6012,6 +6012,62 @@ (__mmask8) __U); } + +#define _mm_mask_set1_epi32( __O, __M, __A) __extension__ ({ \ +__builtin_ia32_pbroadcastd128_gpr_mask (__A, (__v4si)( __O),\ + ( __M));\ +}) + +#define _mm_maskz_set1_epi32( __M, __A) __extension__ ({ \ +__builtin_ia32_pbroadcastd128_gpr_mask (__A,\ + (__v4si)\ + _mm_setzero_si128 (),\ + ( __M));\ +}) + +#define _mm256_mask_set1_epi32( __O, __M, __A) __extension__ ({ \ +__builtin_ia32_pbroadcastd256_gpr_mask (__A, (__v8si)( __O),\ + ( __M));\ +}) + +#define _mm256_maskz_set1_epi32( __M, __A) __extension__ ({ \ +__builtin_ia32_pbroadcastd256_gpr_mask (__A,\ + (__v8si)\ + _mm256_setzero_si256 (),\ + ( __M));\ +}) + +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_mask_set1_epi64 (__m128i __O, __mmask8 __M, long long __A) +{ + return (__m128i) __builtin_ia32_pbroadcastq128_gpr_mask (__A, (__v2di) __O, + __M); +} + +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_maskz_set1_epi64 (__mmask8 __M, long long __A) +{ + return (__m128i) __builtin_ia32_pbroadcastq128_gpr_mask (__A, + (__v2di) + _mm_setzero_si128 (), + __M); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_mask_set1_epi64 (__m256i __O, __mmask8 __M, long long __A) +{ + return (__m256i) __builtin_ia32_pbroadcastq256_gpr_mask (__A, (__v4di) __O, + __M); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_maskz_set1_epi64 (__mmask8 __M, long long __A) +{ + return (__m256i) __builtin_ia32_pbroadcastq256_gpr_mask (__A, + (__v4di) + _mm256_setzero_si256 (), + __M); +} #undef __DEFAULT_FN_ATTRS #undef __DEFAULT_FN_ATTRS_BOTH Index: cfe/trunk/test/CodeGen/avx512bw-builtins.c =================================================================== --- cfe/trunk/test/CodeGen/avx512bw-builtins.c +++ cfe/trunk/test/CodeGen/avx512bw-builtins.c @@ -1299,4 +1299,16 @@ return _mm512_maskz_mov_epi8(__U, __A); } +__m512i test_mm512_mask_set1_epi8(__m512i __O, __mmask64 __M, char __A) { + // CHECK-LABEL: @test_mm512_mask_set1_epi8 + // CHECK: @llvm.x86.avx512.mask.pbroadcast.b.gpr.512 + return _mm512_mask_set1_epi8(__O, __M, __A); +} + +__m512i test_mm512_maskz_set1_epi8(__mmask64 __M, char __A) { + // CHECK-LABEL: @test_mm512_maskz_set1_epi8 + // CHECK: @llvm.x86.avx512.mask.pbroadcast.b.gpr.512 + return _mm512_maskz_set1_epi8(__M, __A); +} + Index: cfe/trunk/test/CodeGen/avx512vl-builtins.c =================================================================== --- cfe/trunk/test/CodeGen/avx512vl-builtins.c +++ cfe/trunk/test/CodeGen/avx512vl-builtins.c @@ -4030,4 +4030,53 @@ // CHECK-LABEL: @test_mm256_maskz_movedup_pd // CHECK: @llvm.x86.avx512.mask.movddup.256 return _mm256_maskz_movedup_pd(__U, __A); -} \ No newline at end of file +} + +__m128i test_mm_mask_set1_epi32(__m128i __O, __mmask8 __M) { + // CHECK-LABEL: @test_mm_mask_set1_epi32 + // CHECK: @llvm.x86.avx512.mask.pbroadcast.d.gpr.128 + return _mm_mask_set1_epi32(__O, __M, 5); +} + +__m128i test_mm_maskz_set1_epi32(__mmask8 __M) { + // CHECK-LABEL: @test_mm_maskz_set1_epi32 + // CHECK: @llvm.x86.avx512.mask.pbroadcast.d.gpr.128 + return _mm_maskz_set1_epi32(__M, 5); +} + +__m256i test_mm256_mask_set1_epi32(__m256i __O, __mmask8 __M) { + // CHECK-LABEL: @test_mm256_mask_set1_epi32 + // CHECK: @llvm.x86.avx512.mask.pbroadcast.d.gpr.256 + return _mm256_mask_set1_epi32(__O, __M, 5); +} + +__m256i test_mm256_maskz_set1_epi32(__mmask8 __M) { + // CHECK-LABEL: @test_mm256_maskz_set1_epi32 + // CHECK: @llvm.x86.avx512.mask.pbroadcast.d.gpr.256 + return _mm256_maskz_set1_epi32(__M, 5); +} + +__m128i test_mm_mask_set1_epi64(__m128i __O, __mmask8 __M, long long __A) { + // CHECK-LABEL: @test_mm_mask_set1_epi64 + // CHECK: @llvm.x86.avx512.mask.pbroadcast.q.gpr.128 + return _mm_mask_set1_epi64(__O, __M, __A); +} + +__m128i test_mm_maskz_set1_epi64(__mmask8 __M, long long __A) { + // CHECK-LABEL: @test_mm_maskz_set1_epi64 + // CHECK: @llvm.x86.avx512.mask.pbroadcast.q.gpr.128 + return _mm_maskz_set1_epi64(__M, __A); +} + +__m256i test_mm256_mask_set1_epi64(__m256i __O, __mmask8 __M, long long __A) { + // CHECK-LABEL: @test_mm256_mask_set1_epi64 + // CHECK: @llvm.x86.avx512.mask.pbroadcast.q.gpr.256 + return _mm256_mask_set1_epi64(__O, __M, __A); +} + +__m256i test_mm256_maskz_set1_epi64(__mmask8 __M, long long __A) { + // CHECK-LABEL: @test_mm256_maskz_set1_epi64 + // CHECK: @llvm.x86.avx512.mask.pbroadcast.q.gpr.256 + return _mm256_maskz_set1_epi64(__M, __A); +} +