Index: include/clang/Basic/BuiltinsX86.def =================================================================== --- include/clang/Basic/BuiltinsX86.def +++ include/clang/Basic/BuiltinsX86.def @@ -1962,6 +1962,24 @@ TARGET_BUILTIN(__builtin_ia32_rsqrt14pd256_mask, "V4dV4dV4dUc","","avx512vl") TARGET_BUILTIN(__builtin_ia32_rsqrt14ps128_mask, "V4fV4fV4fUc","","avx512vl") TARGET_BUILTIN(__builtin_ia32_rsqrt14ps256_mask, "V8fV8fV8fUc","","avx512vl") +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: lib/Headers/avx512bwintrin.h =================================================================== --- lib/Headers/avx512bwintrin.h +++ lib/Headers/avx512bwintrin.h @@ -2057,6 +2057,34 @@ (__v32hi) __B, __U); } +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_setzero_hi (), + (__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 Index: lib/Headers/avx512fintrin.h =================================================================== --- lib/Headers/avx512fintrin.h +++ lib/Headers/avx512fintrin.h @@ -5619,6 +5619,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_setzero_si512 (),\ + (__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_setzero_si512 (), + (__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_setzero_si512 (), + (__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: lib/Headers/avx512vbmiintrin.h =================================================================== --- lib/Headers/avx512vbmiintrin.h +++ 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_setzero_si512 (), + (__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: lib/Headers/avx512vbmivlintrin.h =================================================================== --- lib/Headers/avx512vbmivlintrin.h +++ 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: lib/Headers/avx512vlbwintrin.h =================================================================== --- lib/Headers/avx512vlbwintrin.h +++ lib/Headers/avx512vlbwintrin.h @@ -3172,7 +3172,62 @@ (__v16hi) __B, __U); } +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_setzero_hi (), + (__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_setzero_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: lib/Headers/avx512vlintrin.h =================================================================== --- lib/Headers/avx512vlintrin.h +++ lib/Headers/avx512vlintrin.h @@ -7765,6 +7765,123 @@ (__mmask8) __U); } +#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));\ +}) + +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_setzero_pd (), + (__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 (), + __M); +} + +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__ __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, + __M); +} + #undef __DEFAULT_FN_ATTRS #undef __DEFAULT_FN_ATTRS_BOTH Index: test/CodeGen/avx512bw-builtins.c =================================================================== --- test/CodeGen/avx512bw-builtins.c +++ test/CodeGen/avx512bw-builtins.c @@ -1404,3 +1404,20 @@ return _mm512_mask_testn_epi16_mask(__U, __A, __B); } +__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); +} \ No newline at end of file Index: test/CodeGen/avx512f-builtins.c =================================================================== --- test/CodeGen/avx512f-builtins.c +++ test/CodeGen/avx512f-builtins.c @@ -3700,4 +3700,110 @@ return _mm_maskz_sqrt_round_ss(__U,__A,__B,_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: test/CodeGen/avx512vbmi-builtins.c =================================================================== --- test/CodeGen/avx512vbmi-builtins.c +++ test/CodeGen/avx512vbmi-builtins.c @@ -29,3 +29,20 @@ 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: test/CodeGen/avx512vbmivl-builtin.c =================================================================== --- test/CodeGen/avx512vbmivl-builtin.c +++ test/CodeGen/avx512vbmivl-builtin.c @@ -52,4 +52,77 @@ // CHECK-LABEL: @test_mm256_maskz_permutex2var_epi8 // CHECK: @llvm.x86.avx512.mask.vpermt2var.qi.256 return _mm256_maskz_permutex2var_epi8(__U, __A, __I, __B); -} \ No newline at end of file +} + +__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_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); +} + Index: test/CodeGen/avx512vl-builtins.c =================================================================== --- test/CodeGen/avx512vl-builtins.c +++ test/CodeGen/avx512vl-builtins.c @@ -5278,3 +5278,87 @@ // CHECK: @llvm.x86.avx512.rsqrt14.ps.256 return _mm256_maskz_rsqrt14_ps(__U, __A); } + +__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); +} + +__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); +} + +__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_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: test/CodeGen/avx512vlbw-builtins.c =================================================================== --- test/CodeGen/avx512vlbw-builtins.c +++ test/CodeGen/avx512vlbw-builtins.c @@ -2172,3 +2172,38 @@ return _mm256_mask_testn_epi16_mask(__U, __A, __B); } +__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); +}