Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def =================================================================== --- cfe/trunk/include/clang/Basic/BuiltinsX86.def +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def @@ -1632,6 +1632,12 @@ TARGET_BUILTIN(__builtin_ia32_prorvd256_mask, "V8iV8iV8iV8iUc","","avx512vl") TARGET_BUILTIN(__builtin_ia32_prorvq128_mask, "V2LLiV2LLiV2LLiV2LLiUc","","avx512vl") TARGET_BUILTIN(__builtin_ia32_prorvq256_mask, "V4LLiV4LLiV4LLiV4LLiUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_pshufhw512_mask, "V32sV32sIiV32sUi","","avx512bw") +TARGET_BUILTIN(__builtin_ia32_pshuflw512_mask, "V32sV32sIiV32sUi","","avx512bw") +TARGET_BUILTIN(__builtin_ia32_pshufhw128_mask, "V8sV8sIiV8sUc","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_pshufhw256_mask, "V16sV16sIiV16sUs","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_pshuflw128_mask, "V8sV8sIiV8sUc","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_pshuflw256_mask, "V16sV16sIiV16sUs","","avx512bw,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 @@ -1589,6 +1589,54 @@ (__v32hi)(__m512i)(b), \ (p), (__mmask32)(m)); }) +#define _mm512_shufflehi_epi16( __A, __imm) __extension__ ({ \ +__builtin_ia32_pshufhw512_mask ((__v32hi)( __A),\ + ( __imm),\ + (__v32hi)\ + _mm512_setzero_hi (),\ + (__mmask32) -1);\ +}) + +#define _mm512_mask_shufflehi_epi16( __W, __U, __A ,__imm) __extension__ ({ \ +__builtin_ia32_pshufhw512_mask ((__v32hi) (__A),\ + (__imm),\ + (__v32hi)( __W),\ + (__mmask32)( __U));\ +}) + + +#define _mm512_maskz_shufflehi_epi16( __U, __A ,__imm) __extension__ ({ \ +__builtin_ia32_pshufhw512_mask ((__v32hi) (__A),\ + (__imm),\ + (__v32hi)\ + _mm512_setzero_hi (),\ + (__mmask32)( __U));\ +}) + +#define _mm512_shufflelo_epi16( __A, __imm) __extension__ ({ \ +__builtin_ia32_pshuflw512_mask ((__v32hi)( __A),\ + ( __imm),\ + (__v32hi)\ + _mm512_setzero_hi (),\ + (__mmask32) -1);\ +}) + + +#define _mm512_mask_shufflelo_epi16( __W, __U, __A, __imm) __extension__ ({ \ +__builtin_ia32_pshuflw512_mask ((__v32hi) (__A),\ + (__imm),\ + (__v32hi)( __W),\ + (__mmask32)( __U));\ +}) + + +#define _mm512_maskz_shufflelo_epi16( __U, __A, __imm) __extension__ ({ \ +__builtin_ia32_pshuflw512_mask ((__v32hi) (__A),\ + (__imm),\ + (__v32hi)\ + _mm512_setzero_hi (),\ + (__mmask32)( __U));\ +}) #undef __DEFAULT_FN_ATTRS Index: cfe/trunk/lib/Headers/avx512vlbwintrin.h =================================================================== --- cfe/trunk/lib/Headers/avx512vlbwintrin.h +++ cfe/trunk/lib/Headers/avx512vlbwintrin.h @@ -31,6 +31,11 @@ /* Define the default attributes for the functions in this file. */ #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512vl,avx512bw"))) +static __inline __m128i __DEFAULT_FN_ATTRS +_mm_setzero_hi(void){ + return (__m128i){ 0LL, 0LL }; +} + /* Integer compare */ static __inline__ __mmask16 __DEFAULT_FN_ATTRS @@ -2401,6 +2406,67 @@ (__v16hi)(__m256i)(b), \ (p), (__mmask16)(m)); }) +#define _mm_mask_shufflehi_epi16( __W, __U, __A, __imm) __extension__ ({ \ +__builtin_ia32_pshufhw128_mask ((__v8hi) __A, (__imm),\ + (__v8hi)( __W),\ + (__mmask8)( __U));\ +}) + +#define _mm_maskz_shufflehi_epi16( __U, __A, __imm) __extension__ ({ \ +__builtin_ia32_pshufhw128_mask ((__v8hi)( __A),( __imm),\ + (__v8hi)\ + _mm_setzero_hi (),\ + (__mmask8)( __U));\ +}) + + +#define _mm256_mask_shufflehi_epi16( __W, __U, __A, __imm) __extension__ ({ \ +__builtin_ia32_pshufhw256_mask ((__v16hi) (__A),\ + (__imm),\ + (__v16hi)( __W),\ + (__mmask16)( __U));\ +}) + + +#define _mm256_maskz_shufflehi_epi16( __U, __A, __imm) __extension__ ({ \ +__builtin_ia32_pshufhw256_mask ((__v16hi) (__A),\ + (__imm),\ + (__v16hi)\ + _mm256_setzero_si256 (),\ + (__mmask16)( __U));\ +}) + + +#define _mm_mask_shufflelo_epi16( __W, __U, __A, __imm) __extension__ ({ \ +__builtin_ia32_pshuflw128_mask ((__v8hi) __A, (__imm),\ + (__v8hi)( __W),\ + (__mmask8)( __U));\ +}) + +#define _mm_maskz_shufflelo_epi16( __U, __A, __imm) __extension__ ({ \ +__builtin_ia32_pshuflw128_mask ((__v8hi)( __A),( __imm),\ + (__v8hi)\ + _mm_setzero_hi (),\ + (__mmask8)( __U));\ +}) + + +#define _mm256_mask_shufflelo_epi16( __W, __U, __A, __imm) __extension__ ({ \ +__builtin_ia32_pshuflw256_mask ((__v16hi) (__A),\ + (__imm),\ + (__v16hi)( __W),\ + (__mmask16)( __U));\ +}) + + +#define _mm256_maskz_shufflelo_epi16( __U, __A, __imm) __extension__ ({ \ +__builtin_ia32_pshuflw256_mask ((__v16hi) (__A),\ + (__imm),\ + (__v16hi)\ + _mm256_setzero_si256 (),\ + (__mmask16)( __U));\ +}) + #undef __DEFAULT_FN_ATTRS #endif /* __AVX512VLBWINTRIN_H */ Index: cfe/trunk/test/CodeGen/avx512bw-builtins.c =================================================================== --- cfe/trunk/test/CodeGen/avx512bw-builtins.c +++ cfe/trunk/test/CodeGen/avx512bw-builtins.c @@ -1076,3 +1076,41 @@ // CHECK: @llvm.x86.avx512.mask.pmovzxb.w.512 return _mm512_maskz_cvtepu8_epi16(__U, __A); } + +__m512i test_mm512_shufflehi_epi16(__m512i __A) { + // CHECK-LABEL: @test_mm512_shufflehi_epi16 + // CHECK: @llvm.x86.avx512.mask.pshufh.w.512 + return _mm512_shufflehi_epi16(__A, 5); +} + +__m512i test_mm512_mask_shufflehi_epi16(__m512i __W, __mmask32 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_mask_shufflehi_epi16 + // CHECK: @llvm.x86.avx512.mask.pshufh.w.512 + return _mm512_mask_shufflehi_epi16(__W, __U, __A, 5); +} + +__m512i test_mm512_maskz_shufflehi_epi16(__mmask32 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_maskz_shufflehi_epi16 + // CHECK: @llvm.x86.avx512.mask.pshufh.w.512 + return _mm512_maskz_shufflehi_epi16(__U, __A, 5); +} + +__m512i test_mm512_shufflelo_epi16(__m512i __A) { + // CHECK-LABEL: @test_mm512_shufflelo_epi16 + // CHECK: @llvm.x86.avx512.mask.pshufl.w.512 + return _mm512_shufflelo_epi16(__A, 5); +} + +__m512i test_mm512_mask_shufflelo_epi16(__m512i __W, __mmask32 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_mask_shufflelo_epi16 + // CHECK: @llvm.x86.avx512.mask.pshufl.w.512 + return _mm512_mask_shufflelo_epi16(__W, __U, __A, 5); +} + +__m512i test_mm512_maskz_shufflelo_epi16(__mmask32 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_maskz_shufflelo_epi16 + // CHECK: @llvm.x86.avx512.mask.pshufl.w.512 + return _mm512_maskz_shufflelo_epi16(__U, __A, 5); +} + +