Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def =================================================================== --- cfe/trunk/include/clang/Basic/BuiltinsX86.def +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def @@ -2151,6 +2151,24 @@ TARGET_BUILTIN(__builtin_ia32_vfmaddsd3_mask, "V2dV2dV2dV2dUcIi", "", "avx512f") TARGET_BUILTIN(__builtin_ia32_vfmaddsd3_maskz, "V2dV2dV2dV2dUcIi", "", "avx512f") TARGET_BUILTIN(__builtin_ia32_vfmaddsd3_mask3, "V2dV2dV2dV2dUcIi", "", "avx512f") +TARGET_BUILTIN(__builtin_ia32_permdf512_mask, "V8dV8dUcV8dUc","","avx512f") +TARGET_BUILTIN(__builtin_ia32_permdi512_mask, "V8LLiV8LLiUcV8LLiUc","","avx512f") +TARGET_BUILTIN(__builtin_ia32_permdf256_mask, "V4dV4dUcV4dUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_permdi256_mask, "V4LLiV4LLiUcV4LLiUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvarhi512_mask, "V32sV32sV32sV32sUi","","avx512bw") +TARGET_BUILTIN(__builtin_ia32_permvardf512_mask, "V8dV8dV8LLiV8dUc","","avx512f") +TARGET_BUILTIN(__builtin_ia32_permvardi512_mask, "V8LLiV8LLiV8LLiV8LLiUc","","avx512f") +TARGET_BUILTIN(__builtin_ia32_permvarsf512_mask, "V16fV16fV16iV16fUs","","avx512f") +TARGET_BUILTIN(__builtin_ia32_permvarsi512_mask, "V16iV16iV16iV16iUs","","avx512f") +TARGET_BUILTIN(__builtin_ia32_permvarqi512_mask, "V64cV64cV64cV64cULLi","","avx512vbmi") +TARGET_BUILTIN(__builtin_ia32_permvarqi128_mask, "V16cV16cV16cV16cUs","","avx512vbmi,avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvarqi256_mask, "V32cV32cV32cV32cUi","","avx512vbmi,avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvarhi128_mask, "V8sV8sV8sV8sUc","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvarhi256_mask, "V16sV16sV16sV16sUs","","avx512bw,avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvardf256_mask, "V4dV4dV4LLiV4dUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvardi256_mask, "V4LLiV4LLiV4LLiV4LLiUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvarsf256_mask, "V8fV8fV8iV8fUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_permvarsi256_mask, "V8iV8iV8iV8iUc","","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 @@ -2139,6 +2139,35 @@ __M); } +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_permutexvar_epi16 (__m512i __A, __m512i __B) +{ + return (__m512i) __builtin_ia32_permvarhi512_mask ((__v32hi) __B, + (__v32hi) __A, + (__v32hi) _mm512_undefined_epi32 (), + (__mmask32) -1); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_maskz_permutexvar_epi16 (__mmask32 __M, __m512i __A, + __m512i __B) +{ + return (__m512i) __builtin_ia32_permvarhi512_mask ((__v32hi) __B, + (__v32hi) __A, + (__v32hi) _mm512_setzero_hi(), + (__mmask32) __M); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_mask_permutexvar_epi16 (__m512i __W, __mmask32 __M, __m512i __A, + __m512i __B) +{ + return (__m512i) __builtin_ia32_permvarhi512_mask ((__v32hi) __B, + (__v32hi) __A, + (__v32hi) __W, + (__mmask32) __M); +} + #undef __DEFAULT_FN_ATTRS #endif Index: cfe/trunk/lib/Headers/avx512fintrin.h =================================================================== --- cfe/trunk/lib/Headers/avx512fintrin.h +++ cfe/trunk/lib/Headers/avx512fintrin.h @@ -7048,6 +7048,154 @@ __R);\ }) +#define _mm512_permutex_pd( __X, __M) __extension__ ({ \ +__builtin_ia32_permdf512_mask ((__v8df)( __X),( __M),\ + (__v8df) _mm512_undefined_pd (),\ + (__mmask8) -1);\ +}) + +#define _mm512_mask_permutex_pd( __W, __U, __X, __M) __extension__ ({ \ +__builtin_ia32_permdf512_mask ((__v8df)( __X),( __M),\ + (__v8df)( __W),\ + (__mmask8)( __U));\ +}) + +#define _mm512_maskz_permutex_pd( __U, __X, __M) __extension__ ({ \ +__builtin_ia32_permdf512_mask ((__v8df)( __X),( __M),\ + (__v8df) _mm512_setzero_pd (),\ + (__mmask8)( __U));\ +}) + +#define _mm512_permutex_epi64( __X, __I) __extension__ ({ \ +__builtin_ia32_permdi512_mask ((__v8di)( __X),( __I),\ + (__v8di) _mm512_undefined_epi32 (),\ + (__mmask8) (-1));\ +}) + +#define _mm512_mask_permutex_epi64( __W, __M, __X, __I) __extension__ ({ \ +__builtin_ia32_permdi512_mask ((__v8di)( __X),( __I),\ + (__v8di)( __W),\ + (__mmask8)( __M));\ +}) + +#define _mm512_maskz_permutex_epi64( __M, __X, __I) __extension__ ({ \ +__builtin_ia32_permdi512_mask ((__v8di)( __X),( __I),\ + (__v8di) _mm512_setzero_si512 (),\ + (__mmask8)( __M));\ +}) + +static __inline__ __m512d __DEFAULT_FN_ATTRS +_mm512_permutexvar_pd (__m512i __X, __m512d __Y) +{ + return (__m512d) __builtin_ia32_permvardf512_mask ((__v8df) __Y, + (__v8di) __X, + (__v8df) _mm512_undefined_pd (), + (__mmask8) -1); +} + +static __inline__ __m512d __DEFAULT_FN_ATTRS +_mm512_mask_permutexvar_pd (__m512d __W, __mmask8 __U, __m512i __X, __m512d __Y) +{ + return (__m512d) __builtin_ia32_permvardf512_mask ((__v8df) __Y, + (__v8di) __X, + (__v8df) __W, + (__mmask8) __U); +} + +static __inline__ __m512d __DEFAULT_FN_ATTRS +_mm512_maskz_permutexvar_pd (__mmask8 __U, __m512i __X, __m512d __Y) +{ + return (__m512d) __builtin_ia32_permvardf512_mask ((__v8df) __Y, + (__v8di) __X, + (__v8df) _mm512_setzero_pd (), + (__mmask8) __U); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_maskz_permutexvar_epi64 (__mmask8 __M, __m512i __X, __m512i __Y) +{ + return (__m512i) __builtin_ia32_permvardi512_mask ((__v8di) __Y, + (__v8di) __X, + (__v8di) _mm512_setzero_si512 (), + __M); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_permutexvar_epi64 (__m512i __X, __m512i __Y) +{ + return (__m512i) __builtin_ia32_permvardi512_mask ((__v8di) __Y, + (__v8di) __X, + (__v8di) _mm512_undefined_epi32 (), + (__mmask8) -1); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_mask_permutexvar_epi64 (__m512i __W, __mmask8 __M, __m512i __X, + __m512i __Y) +{ + return (__m512i) __builtin_ia32_permvardi512_mask ((__v8di) __Y, + (__v8di) __X, + (__v8di) __W, + __M); +} + +static __inline__ __m512 __DEFAULT_FN_ATTRS +_mm512_permutexvar_ps (__m512i __X, __m512 __Y) +{ + return (__m512) __builtin_ia32_permvarsf512_mask ((__v16sf) __Y, + (__v16si) __X, + (__v16sf) _mm512_undefined_ps (), + (__mmask16) -1); +} + +static __inline__ __m512 __DEFAULT_FN_ATTRS +_mm512_mask_permutexvar_ps (__m512 __W, __mmask16 __U, __m512i __X, __m512 __Y) +{ + return (__m512) __builtin_ia32_permvarsf512_mask ((__v16sf) __Y, + (__v16si) __X, + (__v16sf) __W, + (__mmask16) __U); +} + +static __inline__ __m512 __DEFAULT_FN_ATTRS +_mm512_maskz_permutexvar_ps (__mmask16 __U, __m512i __X, __m512 __Y) +{ + return (__m512) __builtin_ia32_permvarsf512_mask ((__v16sf) __Y, + (__v16si) __X, + (__v16sf) _mm512_setzero_ps (), + (__mmask16) __U); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_maskz_permutexvar_epi32 (__mmask16 __M, __m512i __X, __m512i __Y) +{ + return (__m512i) __builtin_ia32_permvarsi512_mask ((__v16si) __Y, + (__v16si) __X, + (__v16si) _mm512_setzero_si512 (), + __M); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_permutexvar_epi32 (__m512i __X, __m512i __Y) +{ + return (__m512i) __builtin_ia32_permvarsi512_mask ((__v16si) __Y, + (__v16si) __X, + (__v16si) _mm512_undefined_epi32 (), + (__mmask16) -1); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_mask_permutexvar_epi32 (__m512i __W, __mmask16 __M, __m512i __X, + __m512i __Y) +{ + return (__m512i) __builtin_ia32_permvarsi512_mask ((__v16si) __Y, + (__v16si) __X, + (__v16si) __W, + __M); +} + + + #undef __DEFAULT_FN_ATTRS #endif // __AVX512FINTRIN_H Index: cfe/trunk/lib/Headers/avx512vbmiintrin.h =================================================================== --- cfe/trunk/lib/Headers/avx512vbmiintrin.h +++ cfe/trunk/lib/Headers/avx512vbmiintrin.h @@ -79,6 +79,35 @@ __U); } +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_permutexvar_epi8 (__m512i __A, __m512i __B) +{ + return (__m512i) __builtin_ia32_permvarqi512_mask ((__v64qi) __B, + (__v64qi) __A, + (__v64qi) _mm512_undefined_epi32 (), + (__mmask64) -1); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_maskz_permutexvar_epi8 (__mmask64 __M, __m512i __A, + __m512i __B) +{ + return (__m512i) __builtin_ia32_permvarqi512_mask ((__v64qi) __B, + (__v64qi) __A, + (__v64qi) _mm512_setzero_si512(), + (__mmask64) __M); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_mask_permutexvar_epi8 (__m512i __W, __mmask64 __M, __m512i __A, + __m512i __B) +{ + return (__m512i) __builtin_ia32_permvarqi512_mask ((__v64qi) __B, + (__v64qi) __A, + (__v64qi) __W, + (__mmask64) __M); +} + #undef __DEFAULT_FN_ATTRS #endif Index: cfe/trunk/lib/Headers/avx512vbmivlintrin.h =================================================================== --- cfe/trunk/lib/Headers/avx512vbmivlintrin.h +++ cfe/trunk/lib/Headers/avx512vbmivlintrin.h @@ -126,6 +126,62 @@ __U); } +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_permutexvar_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i) __builtin_ia32_permvarqi128_mask ((__v16qi) __B, + (__v16qi) __A, + (__v16qi) _mm_undefined_si128 (), + (__mmask16) -1); +} + +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_maskz_permutexvar_epi8 (__mmask16 __M, __m128i __A, __m128i __B) +{ + return (__m128i) __builtin_ia32_permvarqi128_mask ((__v16qi) __B, + (__v16qi) __A, + (__v16qi) _mm_setzero_si128 (), + (__mmask16) __M); +} + +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_mask_permutexvar_epi8 (__m128i __W, __mmask16 __M, __m128i __A, + __m128i __B) +{ + return (__m128i) __builtin_ia32_permvarqi128_mask ((__v16qi) __B, + (__v16qi) __A, + (__v16qi) __W, + (__mmask16) __M); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_permutexvar_epi8 (__m256i __A, __m256i __B) +{ + return (__m256i) __builtin_ia32_permvarqi256_mask ((__v32qi) __B, + (__v32qi) __A, + (__v32qi) _mm256_undefined_si256 (), + (__mmask32) -1); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_maskz_permutexvar_epi8 (__mmask32 __M, __m256i __A, + __m256i __B) +{ + return (__m256i) __builtin_ia32_permvarqi256_mask ((__v32qi) __B, + (__v32qi) __A, + (__v32qi) _mm256_setzero_si256 (), + (__mmask32) __M); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_mask_permutexvar_epi8 (__m256i __W, __mmask32 __M, __m256i __A, + __m256i __B) +{ + return (__m256i) __builtin_ia32_permvarqi256_mask ((__v32qi) __B, + (__v32qi) __A, + (__v32qi) __W, + (__mmask32) __M); +} #undef __DEFAULT_FN_ATTRS Index: cfe/trunk/lib/Headers/avx512vlbwintrin.h =================================================================== --- cfe/trunk/lib/Headers/avx512vlbwintrin.h +++ cfe/trunk/lib/Headers/avx512vlbwintrin.h @@ -3301,7 +3301,62 @@ __M); } +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_permutexvar_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i) __builtin_ia32_permvarhi128_mask ((__v8hi) __B, + (__v8hi) __A, + (__v8hi) _mm_undefined_si128 (), + (__mmask8) -1); +} + +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_maskz_permutexvar_epi16 (__mmask8 __M, __m128i __A, __m128i __B) +{ + return (__m128i) __builtin_ia32_permvarhi128_mask ((__v8hi) __B, + (__v8hi) __A, + (__v8hi) _mm_setzero_si128 (), + (__mmask8) __M); +} + +static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_mask_permutexvar_epi16 (__m128i __W, __mmask8 __M, __m128i __A, + __m128i __B) +{ + return (__m128i) __builtin_ia32_permvarhi128_mask ((__v8hi) __B, + (__v8hi) __A, + (__v8hi) __W, + (__mmask8) __M); +} +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_permutexvar_epi16 (__m256i __A, __m256i __B) +{ + return (__m256i) __builtin_ia32_permvarhi256_mask ((__v16hi) __B, + (__v16hi) __A, + (__v16hi) _mm256_undefined_si256 (), + (__mmask16) -1); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_maskz_permutexvar_epi16 (__mmask16 __M, __m256i __A, + __m256i __B) +{ + return (__m256i) __builtin_ia32_permvarhi256_mask ((__v16hi) __B, + (__v16hi) __A, + (__v16hi) _mm256_setzero_si256 (), + (__mmask16) __M); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_mask_permutexvar_epi16 (__m256i __W, __mmask16 __M, __m256i __A, + __m256i __B) +{ + return (__m256i) __builtin_ia32_permvarhi256_mask ((__v16hi) __B, + (__v16hi) __A, + (__v16hi) __W, + (__mmask16) __M); +} #undef __DEFAULT_FN_ATTRS Index: cfe/trunk/lib/Headers/avx512vlintrin.h =================================================================== --- cfe/trunk/lib/Headers/avx512vlintrin.h +++ cfe/trunk/lib/Headers/avx512vlintrin.h @@ -9058,6 +9058,157 @@ __mask, __scale);\ }) +#define _mm256_mask_permutex_pd( __W, __U, __X, __imm) __extension__ ({ \ +__builtin_ia32_permdf256_mask ((__v4df)( __X),( __imm),\ + (__v4df)( __W),\ + (__mmask8)( __U));\ +}) + +#define _mm256_maskz_permutex_pd( __U, __X, __imm) __extension__ ({ \ +__builtin_ia32_permdf256_mask ((__v4df)( __X),( __imm),\ + (__v4df) _mm256_setzero_pd (),\ + (__mmask8)( __U));\ +}) + +#define _mm256_permutex_pd( __X, __M) __extension__ ({ \ +__builtin_ia32_permdf256_mask ((__v4df)( __X),( __M),\ + (__v4df) _mm256_undefined_pd (),\ + (__mmask8) -1);\ +}) + +#define _mm256_mask_permutex_epi64( __W, __M, __X, __I) __extension__ ({ \ +__builtin_ia32_permdi256_mask ((__v4di)( __X),\ + ( __I),\ + (__v4di)( __W),\ + (__mmask8)( __M));\ +}) + +#define _mm256_maskz_permutex_epi64( __M, __X, __I) __extension__ ({ \ +__builtin_ia32_permdi256_mask ((__v4di)( __X),\ + ( __I),\ + (__v4di) _mm256_setzero_si256 (),\ + (__mmask8)( __M));\ +}) + +#define _mm256_permutex_epi64( __X, __I) __extension__ ({ \ +__builtin_ia32_permdi256_mask ((__v4di)( __X),\ + ( __I),\ + (__v4di) _mm256_undefined_si256 (),\ + (__mmask8) -1);\ +}) + +static __inline__ __m256d __DEFAULT_FN_ATTRS +_mm256_permutexvar_pd (__m256i __X, __m256d __Y) +{ + return (__m256d) __builtin_ia32_permvardf256_mask ((__v4df) __Y, + (__v4di) __X, + (__v4df) _mm256_undefined_si256 (), + (__mmask8) -1); +} + +static __inline__ __m256d __DEFAULT_FN_ATTRS +_mm256_mask_permutexvar_pd (__m256d __W, __mmask8 __U, __m256i __X, + __m256d __Y) +{ + return (__m256d) __builtin_ia32_permvardf256_mask ((__v4df) __Y, + (__v4di) __X, + (__v4df) __W, + (__mmask8) __U); +} + +static __inline__ __m256d __DEFAULT_FN_ATTRS +_mm256_maskz_permutexvar_pd (__mmask8 __U, __m256i __X, __m256d __Y) +{ + return (__m256d) __builtin_ia32_permvardf256_mask ((__v4df) __Y, + (__v4di) __X, + (__v4df) _mm256_setzero_pd (), + (__mmask8) __U); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_maskz_permutexvar_epi64 (__mmask8 __M, __m256i __X, __m256i __Y) +{ + return (__m256i) __builtin_ia32_permvardi256_mask ((__v4di) __Y, + (__v4di) __X, + (__v4di) _mm256_setzero_si256 (), + (__mmask8) __M); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_permutexvar_epi64 (__mmask8 __M, __m256i __X, __m256i __Y) +{ + return (__m256i) __builtin_ia32_permvardi256_mask ((__v4di) __Y, + (__v4di) __X, + (__v4di) _mm256_undefined_si256 (), + (__mmask8) -1); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_mask_permutexvar_epi64 (__m256i __W, __mmask8 __M, __m256i __X, + __m256i __Y) +{ + return (__m256i) __builtin_ia32_permvardi256_mask ((__v4di) __Y, + (__v4di) __X, + (__v4di) __W, + __M); +} + +static __inline__ __m256 __DEFAULT_FN_ATTRS +_mm256_mask_permutexvar_ps (__m256 __W, __mmask8 __U, __m256i __X, + __m256 __Y) +{ + return (__m256) __builtin_ia32_permvarsf256_mask ((__v8sf) __Y, + (__v8si) __X, + (__v8sf) __W, + (__mmask8) __U); +} + +static __inline__ __m256 __DEFAULT_FN_ATTRS +_mm256_maskz_permutexvar_ps (__mmask8 __U, __m256i __X, __m256 __Y) +{ + return (__m256) __builtin_ia32_permvarsf256_mask ((__v8sf) __Y, + (__v8si) __X, + (__v8sf) _mm256_setzero_ps (), + (__mmask8) __U); +} + +static __inline__ __m256 __DEFAULT_FN_ATTRS +_mm256_permutexvar_ps (__m256i __X, __m256 __Y) +{ + return (__m256) __builtin_ia32_permvarsf256_mask ((__v8sf) __Y, + (__v8si) __X, + (__v8sf) _mm256_undefined_si256 (), + (__mmask8) -1); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_maskz_permutexvar_epi32 (__mmask8 __M, __m256i __X, __m256i __Y) +{ + return (__m256i) __builtin_ia32_permvarsi256_mask ((__v8si) __Y, + (__v8si) __X, + (__v8si) _mm256_setzero_si256 (), + __M); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_mask_permutexvar_epi32 (__m256i __W, __mmask8 __M, __m256i __X, + __m256i __Y) +{ + return (__m256i) __builtin_ia32_permvarsi256_mask ((__v8si) __Y, + (__v8si) __X, + (__v8si) __W, + (__mmask8) __M); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_permutexvar_epi32 (__m256i __X, __m256i __Y) +{ + return (__m256i) __builtin_ia32_permvarsi256_mask ((__v8si) __Y, + (__v8si) __X, + (__v8si) _mm256_undefined_si256(), + (__mmask8) -1); +} + #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 @@ -1470,3 +1470,20 @@ // CHECK: @llvm.x86.avx512.mask.pbroadcast.w.gpr.512 return _mm512_maskz_set1_epi16(__M, __A); } +__m512i test_mm512_permutexvar_epi16(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_permutexvar_epi16 + // CHECK: @llvm.x86.avx512.mask.permvar.hi.512 + return _mm512_permutexvar_epi16(__A, __B); +} + +__m512i test_mm512_maskz_permutexvar_epi16(__mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_permutexvar_epi16 + // CHECK: @llvm.x86.avx512.mask.permvar.hi.512 + return _mm512_maskz_permutexvar_epi16(__M, __A, __B); +} + +__m512i test_mm512_mask_permutexvar_epi16(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_permutexvar_epi16 + // CHECK: @llvm.x86.avx512.mask.permvar.hi.512 + return _mm512_mask_permutexvar_epi16(__W, __M, __A, __B); +} Index: cfe/trunk/test/CodeGen/avx512f-builtins.c =================================================================== --- cfe/trunk/test/CodeGen/avx512f-builtins.c +++ cfe/trunk/test/CodeGen/avx512f-builtins.c @@ -4801,3 +4801,111 @@ // CHECK: @llvm.x86.avx512.mask3.vfmadd.sd return _mm_mask3_fnmsub_round_sd(__W, __X, __Y, __U, _MM_FROUND_CUR_DIRECTION); } + +__m512d test_mm512_permutex_pd(__m512d __X) { + // CHECK-LABEL: @test_mm512_permutex_pd + // CHECK: @llvm.x86.avx512.mask.perm.df.512 + return _mm512_permutex_pd(__X, 0); +} + +__m512d test_mm512_mask_permutex_pd(__m512d __W, __mmask8 __U, __m512d __X) { + // CHECK-LABEL: @test_mm512_mask_permutex_pd + // CHECK: @llvm.x86.avx512.mask.perm.df.512 + return _mm512_mask_permutex_pd(__W, __U, __X, 0); +} + +__m512d test_mm512_maskz_permutex_pd(__mmask8 __U, __m512d __X) { + // CHECK-LABEL: @test_mm512_maskz_permutex_pd + // CHECK: @llvm.x86.avx512.mask.perm.df.512 + return _mm512_maskz_permutex_pd(__U, __X, 0); +} + +__m512i test_mm512_permutex_epi64(__m512i __X) { + // CHECK-LABEL: @test_mm512_permutex_epi64 + // CHECK: @llvm.x86.avx512.mask.perm.di.512 + return _mm512_permutex_epi64(__X, 0); +} + +__m512i test_mm512_mask_permutex_epi64(__m512i __W, __mmask8 __M, __m512i __X) { + // CHECK-LABEL: @test_mm512_mask_permutex_epi64 + // CHECK: @llvm.x86.avx512.mask.perm.di.512 + return _mm512_mask_permutex_epi64(__W, __M, __X, 0); +} + +__m512i test_mm512_maskz_permutex_epi64(__mmask8 __M, __m512i __X) { + // CHECK-LABEL: @test_mm512_maskz_permutex_epi64 + // CHECK: @llvm.x86.avx512.mask.perm.di.512 + return _mm512_maskz_permutex_epi64(__M, __X, 0); +} + +__m512d test_mm512_permutexvar_pd(__m512i __X, __m512d __Y) { + // CHECK-LABEL: @test_mm512_permutexvar_pd + // CHECK: @llvm.x86.avx512.mask.permvar.df.512 + return _mm512_permutexvar_pd(__X, __Y); +} + +__m512d test_mm512_mask_permutexvar_pd(__m512d __W, __mmask8 __U, __m512i __X, __m512d __Y) { + // CHECK-LABEL: @test_mm512_mask_permutexvar_pd + // CHECK: @llvm.x86.avx512.mask.permvar.df.512 + return _mm512_mask_permutexvar_pd(__W, __U, __X, __Y); +} + +__m512d test_mm512_maskz_permutexvar_pd(__mmask8 __U, __m512i __X, __m512d __Y) { + // CHECK-LABEL: @test_mm512_maskz_permutexvar_pd + // CHECK: @llvm.x86.avx512.mask.permvar.df.512 + return _mm512_maskz_permutexvar_pd(__U, __X, __Y); +} + +__m512i test_mm512_maskz_permutexvar_epi64(__mmask8 __M, __m512i __X, __m512i __Y) { + // CHECK-LABEL: @test_mm512_maskz_permutexvar_epi64 + // CHECK: @llvm.x86.avx512.mask.permvar.di.512 + return _mm512_maskz_permutexvar_epi64(__M, __X, __Y); +} + +__m512i test_mm512_permutexvar_epi64(__m512i __X, __m512i __Y) { + // CHECK-LABEL: @test_mm512_permutexvar_epi64 + // CHECK: @llvm.x86.avx512.mask.permvar.di.512 + return _mm512_permutexvar_epi64(__X, __Y); +} + +__m512i test_mm512_mask_permutexvar_epi64(__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y) { + // CHECK-LABEL: @test_mm512_mask_permutexvar_epi64 + // CHECK: @llvm.x86.avx512.mask.permvar.di.512 + return _mm512_mask_permutexvar_epi64(__W, __M, __X, __Y); +} + +__m512 test_mm512_permutexvar_ps(__m512i __X, __m512 __Y) { + // CHECK-LABEL: @test_mm512_permutexvar_ps + // CHECK: @llvm.x86.avx512.mask.permvar.sf.512 + return _mm512_permutexvar_ps(__X, __Y); +} + +__m512 test_mm512_mask_permutexvar_ps(__m512 __W, __mmask16 __U, __m512i __X, __m512 __Y) { + // CHECK-LABEL: @test_mm512_mask_permutexvar_ps + // CHECK: @llvm.x86.avx512.mask.permvar.sf.512 + return _mm512_mask_permutexvar_ps(__W, __U, __X, __Y); +} + +__m512 test_mm512_maskz_permutexvar_ps(__mmask16 __U, __m512i __X, __m512 __Y) { + // CHECK-LABEL: @test_mm512_maskz_permutexvar_ps + // CHECK: @llvm.x86.avx512.mask.permvar.sf.512 + return _mm512_maskz_permutexvar_ps(__U, __X, __Y); +} + +__m512i test_mm512_maskz_permutexvar_epi32(__mmask16 __M, __m512i __X, __m512i __Y) { + // CHECK-LABEL: @test_mm512_maskz_permutexvar_epi32 + // CHECK: @llvm.x86.avx512.mask.permvar.si.512 + return _mm512_maskz_permutexvar_epi32(__M, __X, __Y); +} + +__m512i test_mm512_permutexvar_epi32(__m512i __X, __m512i __Y) { + // CHECK-LABEL: @test_mm512_permutexvar_epi32 + // CHECK: @llvm.x86.avx512.mask.permvar.si.512 + return _mm512_permutexvar_epi32(__X, __Y); +} + +__m512i test_mm512_mask_permutexvar_epi32(__m512i __W, __mmask16 __M, __m512i __X, __m512i __Y) { + // CHECK-LABEL: @test_mm512_mask_permutexvar_epi32 + // CHECK: @llvm.x86.avx512.mask.permvar.si.512 + return _mm512_mask_permutexvar_epi32(__W, __M, __X, __Y); +} Index: cfe/trunk/test/CodeGen/avx512vbmi-builtins.c =================================================================== --- cfe/trunk/test/CodeGen/avx512vbmi-builtins.c +++ cfe/trunk/test/CodeGen/avx512vbmi-builtins.c @@ -25,7 +25,24 @@ __m512i test_mm512_maskz_permutex2var_epi8(__mmask64 __U, __m512i __A, __m512i __I, __m512i __B) { // CHECK-LABEL: @test_mm512_maskz_permutex2var_epi8 - // CHECK: @llvm.x86.avx512.mask.vpermt2var.qi.512 + // CHECK: @llvm.x86.avx512.maskz.vpermt2var.qi.512 return _mm512_maskz_permutex2var_epi8(__U, __A, __I, __B); } +__m512i test_mm512_permutexvar_epi8(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_permutexvar_epi8 + // CHECK: @llvm.x86.avx512.mask.permvar.qi.512 + return _mm512_permutexvar_epi8(__A, __B); +} + +__m512i test_mm512_maskz_permutexvar_epi8(__mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_permutexvar_epi8 + // CHECK: @llvm.x86.avx512.mask.permvar.qi.512 + return _mm512_maskz_permutexvar_epi8(__M, __A, __B); +} + +__m512i test_mm512_mask_permutexvar_epi8(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_permutexvar_epi8 + // CHECK: @llvm.x86.avx512.mask.permvar.qi.512 + return _mm512_mask_permutexvar_epi8(__W, __M, __A, __B); +} Index: cfe/trunk/test/CodeGen/avx512vbmivl-builtin.c =================================================================== --- cfe/trunk/test/CodeGen/avx512vbmivl-builtin.c +++ cfe/trunk/test/CodeGen/avx512vbmivl-builtin.c @@ -5,6 +5,41 @@ #include +__m128i test_mm_permutexvar_epi8(__m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_permutexvar_epi8 + // CHECK: @llvm.x86.avx512.mask.permvar.qi.128 + return _mm_permutexvar_epi8(__A, __B); +} + +__m128i test_mm_maskz_permutexvar_epi8(__mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_permutexvar_epi8 + // CHECK: @llvm.x86.avx512.mask.permvar.qi.128 + return _mm_maskz_permutexvar_epi8(__M, __A, __B); +} + +__m128i test_mm_mask_permutexvar_epi8(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_permutexvar_epi8 + // CHECK: @llvm.x86.avx512.mask.permvar.qi.128 + return _mm_mask_permutexvar_epi8(__W, __M, __A, __B); +} + +__m256i test_mm256_permutexvar_epi8(__m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_permutexvar_epi8 + // CHECK: @llvm.x86.avx512.mask.permvar.qi.256 + return _mm256_permutexvar_epi8(__A, __B); +} + +__m256i test_mm256_maskz_permutexvar_epi8(__mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_permutexvar_epi8 + // CHECK: @llvm.x86.avx512.mask.permvar.qi.256 + return _mm256_maskz_permutexvar_epi8(__M, __A, __B); +} + +__m256i test_mm256_mask_permutexvar_epi8(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_permutexvar_epi8 + // CHECK: @llvm.x86.avx512.mask.permvar.qi.256 + return _mm256_mask_permutexvar_epi8(__W, __M, __A, __B); +} __m128i test_mm_mask2_permutex2var_epi8(__m128i __A, __m128i __I, __mmask16 __U, __m128i __B) { // CHECK-LABEL: @test_mm_mask2_permutex2var_epi8 Index: cfe/trunk/test/CodeGen/avx512vl-builtins.c =================================================================== --- cfe/trunk/test/CodeGen/avx512vl-builtins.c +++ cfe/trunk/test/CodeGen/avx512vl-builtins.c @@ -6358,3 +6358,106 @@ // CHECK: @llvm.x86.avx512.gather3siv8.si return _mm256_mmask_i32gather_epi32(__v1_old, __mask, __index, __addr, 2); } + +__m256d test_mm256_mask_permutex_pd(__m256d __W, __mmask8 __U, __m256d __X) { + // CHECK-LABEL: @test_mm256_mask_permutex_pd + // CHECK: @llvm.x86.avx512.mask.perm.df.256 + return _mm256_mask_permutex_pd(__W, __U, __X, 1); +} + +__m256d test_mm256_maskz_permutex_pd(__mmask8 __U, __m256d __X) { + // CHECK-LABEL: @test_mm256_maskz_permutex_pd + // CHECK: @llvm.x86.avx512.mask.perm.df.256 + return _mm256_maskz_permutex_pd(__U, __X, 1); +} + +__m256d test_mm256_permutex_pd(__m256d __X) { + // CHECK-LABEL: @test_mm256_permutex_pd + // CHECK: @llvm.x86.avx512.mask.perm.df.256 + return _mm256_permutex_pd(__X, 3); +} + + +__m256i test_mm256_mask_permutex_epi64(__m256i __W, __mmask8 __M, __m256i __X) { + // CHECK-LABEL: @test_mm256_mask_permutex_epi64 + // CHECK: @llvm.x86.avx512.mask.perm.di.256 + return _mm256_mask_permutex_epi64(__W, __M, __X, 3); +} + +__m256i test_mm256_maskz_permutex_epi64(__mmask8 __M, __m256i __X) { + // CHECK-LABEL: @test_mm256_maskz_permutex_epi64 + // CHECK: @llvm.x86.avx512.mask.perm.di.256 + return _mm256_maskz_permutex_epi64(__M, __X, 3); +} + +__m256i test_mm256_permutex_epi64( __m256i __X) { + // CHECK-LABEL: @test_mm256_permutex_epi64 + // CHECK: @llvm.x86.avx512.mask.perm.di.256 + return _mm256_permutex_epi64(__X, 3); +} + +__m256d test_mm256_permutexvar_pd(__m256i __X, __m256d __Y) { + // CHECK-LABEL: @test_mm256_permutexvar_pd + // CHECK: @llvm.x86.avx512.mask.permvar.df.256 + return _mm256_permutexvar_pd(__X, __Y); +} + +__m256d test_mm256_mask_permutexvar_pd(__m256d __W, __mmask8 __U, __m256i __X, __m256d __Y) { + // CHECK-LABEL: @test_mm256_mask_permutexvar_pd + // CHECK: @llvm.x86.avx512.mask.permvar.df.256 + return _mm256_mask_permutexvar_pd(__W, __U, __X, __Y); +} + +__m256d test_mm256_maskz_permutexvar_pd(__mmask8 __U, __m256i __X, __m256d __Y) { + // CHECK-LABEL: @test_mm256_maskz_permutexvar_pd + // CHECK: @llvm.x86.avx512.mask.permvar.df.256 + return _mm256_maskz_permutexvar_pd(__U, __X, __Y); +} + +__m256i test_mm256_maskz_permutexvar_epi64(__mmask8 __M, __m256i __X, __m256i __Y) { + // CHECK-LABEL: @test_mm256_maskz_permutexvar_epi64 + // CHECK: @llvm.x86.avx512.mask.permvar.di.256 + return _mm256_maskz_permutexvar_epi64(__M, __X, __Y); +} + +__m256i test_mm256_mask_permutexvar_epi64(__m256i __W, __mmask8 __M, __m256i __X, __m256i __Y) { + // CHECK-LABEL: @test_mm256_mask_permutexvar_epi64 + // CHECK: @llvm.x86.avx512.mask.permvar.di.256 + return _mm256_mask_permutexvar_epi64(__W, __M, __X, __Y); +} + +__m256 test_mm256_mask_permutexvar_ps(__m256 __W, __mmask8 __U, __m256i __X, __m256 __Y) { + // CHECK-LABEL: @test_mm256_mask_permutexvar_ps + // CHECK: @llvm.x86.avx512.mask.permvar.sf.256 + return _mm256_mask_permutexvar_ps(__W, __U, __X, __Y); +} + +__m256 test_mm256_maskz_permutexvar_ps(__mmask8 __U, __m256i __X, __m256 __Y) { + // CHECK-LABEL: @test_mm256_maskz_permutexvar_ps + // CHECK: @llvm.x86.avx512.mask.permvar.sf.256 + return _mm256_maskz_permutexvar_ps(__U, __X, __Y); +} + +__m256 test_mm256_permutexvar_ps(__m256i __X, __m256 __Y) { + // CHECK-LABEL: @test_mm256_permutexvar_ps + // CHECK: @llvm.x86.avx512.mask.permvar.sf.256 + return _mm256_permutexvar_ps( __X, __Y); +} + +__m256i test_mm256_maskz_permutexvar_epi32(__mmask8 __M, __m256i __X, __m256i __Y) { + // CHECK-LABEL: @test_mm256_maskz_permutexvar_epi32 + // CHECK: @llvm.x86.avx512.mask.permvar.si.256 + return _mm256_maskz_permutexvar_epi32(__M, __X, __Y); +} + +__m256i test_mm256_permutexvar_epi32(__m256i __X, __m256i __Y) { + // CHECK-LABEL: @test_mm256_permutexvar_epi32 + // CHECK: @llvm.x86.avx512.mask.permvar.si.256 + return _mm256_permutexvar_epi32(__X, __Y); +} + +__m256i test_mm256_mask_permutexvar_epi32(__m256i __W, __mmask8 __M, __m256i __X, __m256i __Y) { + // CHECK-LABEL: @test_mm256_mask_permutexvar_epi32 + // CHECK: @llvm.x86.avx512.mask.permvar.si.256 + return _mm256_mask_permutexvar_epi32(__W, __M, __X, __Y); +} Index: cfe/trunk/test/CodeGen/avx512vlbw-builtins.c =================================================================== --- cfe/trunk/test/CodeGen/avx512vlbw-builtins.c +++ cfe/trunk/test/CodeGen/avx512vlbw-builtins.c @@ -2281,3 +2281,38 @@ // CHECK: @llvm.x86.avx512.mask.pbroadcast.w.gpr.128 return _mm_maskz_set1_epi16(__M, __A); } +__m128i test_mm_permutexvar_epi16(__m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_permutexvar_epi16 + // CHECK: @llvm.x86.avx512.mask.permvar.hi.128 + return _mm_permutexvar_epi16(__A, __B); +} + +__m128i test_mm_maskz_permutexvar_epi16(__mmask8 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_permutexvar_epi16 + // CHECK: @llvm.x86.avx512.mask.permvar.hi.128 + return _mm_maskz_permutexvar_epi16(__M, __A, __B); +} + +__m128i test_mm_mask_permutexvar_epi16(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_permutexvar_epi16 + // CHECK: @llvm.x86.avx512.mask.permvar.hi.128 + return _mm_mask_permutexvar_epi16(__W, __M, __A, __B); +} + +__m256i test_mm256_permutexvar_epi16(__m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_permutexvar_epi16 + // CHECK: @llvm.x86.avx512.mask.permvar.hi.256 + return _mm256_permutexvar_epi16(__A, __B); +} + +__m256i test_mm256_maskz_permutexvar_epi16(__mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_permutexvar_epi16 + // CHECK: @llvm.x86.avx512.mask.permvar.hi.256 + return _mm256_maskz_permutexvar_epi16(__M, __A, __B); +} + +__m256i test_mm256_mask_permutexvar_epi16(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_permutexvar_epi16 + // CHECK: @llvm.x86.avx512.mask.permvar.hi.256 + return _mm256_mask_permutexvar_epi16(__W, __M, __A, __B); +}