From 4f1e6b5c2eaf8a717bb7c5c90c6287c885cd14cd Mon Sep 17 00:00:00 2001 From: Michael Zuckerman Date: Thu, 21 Apr 2016 12:47:27 +0000 Subject: [PATCH] [Clang][AVX512][BuiltIn] Adding intrinsics of VGATHER{DPS|DPD} , VPGATHER{QD|QQ|DD|DQ} and VGATHERPF{0|1}{DPS|QPS|DPD|QPD} instruction set . Differential Revision: http://reviews.llvm.org/D19224 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266983 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/BuiltinsX86.def | 20 +++++- lib/Headers/CMakeLists.txt | 1 + lib/Headers/avx512fintrin.h | 81 ++++++++++++++++++++++++ lib/Headers/avx512pfintrin.h | 53 ++++++++++++++++ lib/Headers/avx512vlintrin.h | 80 ++++++++++++++++++++++++ lib/Headers/immintrin.h | 2 + test/CodeGen/avx512f-builtins.c | 97 +++++++++++++++++++++++++++++ test/CodeGen/avx512pf-builtins.c | 30 +++++++++ test/CodeGen/avx512vl-builtins.c | 96 ++++++++++++++++++++++++++++ 9 files changed, 458 insertions(+), 2 deletions(-) create mode 100644 lib/Headers/avx512pfintrin.h create mode 100644 test/CodeGen/avx512pf-builtins.c diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index c153f6692d..f8b9d27908 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -1059,12 +1059,28 @@ TARGET_BUILTIN(__builtin_ia32_alignd512_mask, "V16iV16iV16iIiV16iUs", "", "avx51 TARGET_BUILTIN(__builtin_ia32_extractf64x4_mask, "V4dV8dIiV4dUc", "", "avx512f") TARGET_BUILTIN(__builtin_ia32_extractf32x4_mask, "V4fV16fIiV4fUc", "", "avx512f") +TARGET_BUILTIN(__builtin_ia32_gather3div2df, "V2dV2dvC*V2LLiUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3div2di, "V4iV2LLivC*V2LLiUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3div4df, "V4dV4dvC*V4LLiUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3div4di, "V8iV4LLivC*V4LLiUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3div4sf, "V4fV4fvC*V2LLiUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3div4si, "V4iV4ivC*V2LLiUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3div8sf, "V4fV4fvC*V4LLiUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3div8si, "V4iV4ivC*V4LLiUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3siv2df, "V2dV2dvC*V4iUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3siv2di, "V4iV2LLivC*V4iUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3siv4df, "V4dV4dvC*V4iUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3siv4di, "V8iV4LLivC*V4iUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3siv4sf, "V4fV4fvC*V4iUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3siv4si, "V4iV4ivC*V4iUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3siv8sf, "V8fV8fvC*V8iUci","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_gather3siv8si, "V8iV8ivC*V8iUci","","avx512vl") TARGET_BUILTIN(__builtin_ia32_gathersiv8df, "V8dV8dvC*V8iUcIi", "", "avx512f") -TARGET_BUILTIN(__builtin_ia32_gathersiv16sf, "V16fV16fvC*UsIi", "", "avx512f") +TARGET_BUILTIN(__builtin_ia32_gathersiv16sf, "V16fV16fvC*V16fUsIi", "", "avx512f") TARGET_BUILTIN(__builtin_ia32_gatherdiv8df, "V8dV8dvC*V8LLiUcIi", "", "avx512f") TARGET_BUILTIN(__builtin_ia32_gatherdiv16sf, "V8fV8fvC*V8LLiUcIi", "", "avx512f") TARGET_BUILTIN(__builtin_ia32_gathersiv8di, "V8LLiV8LLivC*V8iUcIi", "", "avx512f") -TARGET_BUILTIN(__builtin_ia32_gathersiv16si, "V16iV16ivC*UsIi", "", "avx512f") +TARGET_BUILTIN(__builtin_ia32_gathersiv16si, "V16iV16ivC*V16iUsIi", "", "avx512f") TARGET_BUILTIN(__builtin_ia32_gatherdiv8di, "V8LLiV8LLivC*V8LLiUcIi", "", "avx512f") TARGET_BUILTIN(__builtin_ia32_gatherdiv16si, "V8iV8ivC*V8LLiUcIi", "", "avx512f") TARGET_BUILTIN(__builtin_ia32_scattersiv8df, "vv*UcV8iV8dIi", "", "avx512f") diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt index ff852ef874..4370b5a4d0 100644 --- a/lib/Headers/CMakeLists.txt +++ b/lib/Headers/CMakeLists.txt @@ -8,6 +8,7 @@ set(files avx512cdintrin.h avx512erintrin.h avx512fintrin.h + avx512pfintrin.h avx512vlbwintrin.h avx512vlintrin.h avx512dqintrin.h diff --git a/lib/Headers/avx512fintrin.h b/lib/Headers/avx512fintrin.h index 65e7851e2f..3301afe0df 100644 --- a/lib/Headers/avx512fintrin.h +++ b/lib/Headers/avx512fintrin.h @@ -6321,6 +6321,87 @@ _mm512_maskz_getexp_ps (__mmask16 __U, __m512 __A) _MM_FROUND_CUR_DIRECTION); } +#define _mm512_i64gather_ps( __index, __addr, __scale) __extension__ ({ \ +__builtin_ia32_gatherdiv16sf ((__v8sf) _mm256_undefined_ps (),\ + __addr, (__v8di) __index, (__mmask8) -1, __scale);\ +}) + +#define _mm512_mask_i64gather_ps( __v1_old, __mask, __index,\ + __addr, __scale) __extension__({\ +__builtin_ia32_gatherdiv16sf ((__v8sf) __v1_old,\ + __addr,(__v8di) __index, __mask, __scale);\ +}) + +#define _mm512_i64gather_epi32(__index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gatherdiv16si ((__v8si) _mm256_undefined_ps (),\ + __addr, (__v8di) __index, (__mmask8) -1 , __scale);\ +}) + +#define _mm512_mask_i64gather_epi32( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gatherdiv16si ((__v8si) __v1_old,\ + __addr, (__v8di) __index, __mask , __scale);\ +}) + +#define _mm512_i64gather_pd(__index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gatherdiv8df ((__v8df) _mm512_undefined_pd(),\ + __addr, (__v8di) __index, (__mmask8) -1 , __scale);\ +}) + +#define _mm512_mask_i64gather_pd( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gatherdiv8df ((__v8df) __v1_old,\ + __addr, (__v8di) __index, __mask , __scale);\ +}) + +#define _mm512_i64gather_epi64(__index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gatherdiv8di ((__v8di) _mm512_undefined_pd(),\ + __addr, (__v8di) __index, (__mmask8) -1 , __scale);\ +}) + +#define _mm512_mask_i64gather_epi64( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gatherdiv8di ((__v8di) __v1_old,\ + __addr, (__v8di) __index, __mask , __scale);\ +}) + +#define _mm512_i32gather_ps(__index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gathersiv16sf ((__v16sf) _mm512_undefined_ps(),\ + __addr, (__v16si) __index, (__mmask8) -1 , __scale);\ +}) + +#define _mm512_mask_i32gather_ps( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gathersiv16sf ((__v16sf) __v1_old,\ + __addr, (__v16si) __index, __mask , __scale);\ +}) + +#define _mm512_i32gather_epi32(__index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gathersiv16si ((__v16sf) _mm512_undefined_epi32(),\ + __addr, (__v16si) __index, (__mmask8) -1 , __scale);\ +}) + +#define _mm512_mask_i32gather_epi32( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gathersiv16si ((__v16sf) __v1_old,\ + __addr, (__v16si) __index, __mask , __scale);\ +}) + +#define _mm512_i32gather_pd(__index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gathersiv8df ((__v8df) _mm512_undefined_pd(),\ + __addr, (__v8si) __index, (__mmask8) -1 , __scale);\ +}) + +#define _mm512_mask_i32gather_pd( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gathersiv8df ((__v8df) __v1_old,\ + __addr, (__v8si) __index, __mask , __scale);\ +}) + +#define _mm512_i32gather_epi64(__index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gathersiv8di ((__v8di) _mm512_undefined_epi32(),\ + __addr, (__v8si) __index, (__mmask8) -1 , __scale);\ +}) + +#define _mm512_mask_i32gather_epi64( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gathersiv8di ((__v8di) __v1_old,\ + __addr, (__v8si) __index, __mask , __scale);\ +}) + #undef __DEFAULT_FN_ATTRS #endif // __AVX512FINTRIN_H diff --git a/lib/Headers/avx512pfintrin.h b/lib/Headers/avx512pfintrin.h new file mode 100644 index 0000000000..4741569dc1 --- /dev/null +++ b/lib/Headers/avx512pfintrin.h @@ -0,0 +1,53 @@ +/*===------------- avx512pfintrin.h - PF intrinsics ------------------=== + * + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + *===-----------------------------------------------------------------------=== + */ +#ifndef __IMMINTRIN_H +#error "Never use directly; include instead." +#endif + +#ifndef __AVX512PFINTRIN_H +#define __AVX512PFINTRIN_H + +/* Define the default attributes for the functions in this file. */ +#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512pf"))) + +#define _mm512_mask_prefetch_i32gather_pd( index, mask, addr, scale, hint) __extension__ ({\ +__builtin_ia32_gatherpfdpd (mask, (__v8si) index, (long long const *) addr, scale, hint);\ +}) + +#define _mm512_mask_prefetch_i32gather_ps( index, mask, addr, scale, hint) ({\ +__builtin_ia32_gatherpfdps (mask, (__v16si) index, (int const *) addr, scale, hint);\ +}) + +#define _mm512_mask_prefetch_i64gather_pd( index, mask, addr, scale, hint) __extension__ ({\ +__builtin_ia32_gatherpfqpd (mask, (__v8di) index, (long long const *) addr, scale, hint);\ +}) + +#define _mm512_mask_prefetch_i64gather_ps( index, mask, addr, scale, hint) ({\ +__builtin_ia32_gatherpfqps (mask, (__v8di) index, (int const *) addr, scale, hint);\ +}) + + +#undef __DEFAULT_FN_ATTRS + +#endif diff --git a/lib/Headers/avx512vlintrin.h b/lib/Headers/avx512vlintrin.h index 78b79a02d4..a88fa996b3 100644 --- a/lib/Headers/avx512vlintrin.h +++ b/lib/Headers/avx512vlintrin.h @@ -8978,6 +8978,86 @@ __builtin_ia32_getmantps256_mask ((__v8sf)( __A),\ (__mmask8)( __U));\ }) +#define _mm_mmask_i64gather_pd( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3div2df ((__v2df) __v1_old, __addr, (__v2di) __index,\ + __mask, __scale);\ +}) + +#define _mm_mmask_i64gather_epi64( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3div2di ((__v2di) __v1_old, __addr, (__v2di) __index,\ + __mask, __scale);\ +}) + +#define _mm256_mmask_i64gather_pd( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3div4df ((__v4df) __v1_old, __addr, (__v4di) __index,\ + __mask, __scale);\ +}) + +#define _mm256_mmask_i64gather_epi64( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3div4di ((__v4di) __v1_old, __addr, (__v4di) __index,\ + __mask, __scale);\ +}) + +#define _mm_mmask_i64gather_ps( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3div4sf ((__v4sf) __v1_old, __addr, (__v2di) __index,\ + __mask, __scale);\ +}) + +#define _mm_mmask_i64gather_epi32( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3div4si ((__v4si) __v1_old, __addr, (__v2di) __index,\ + __mask, __scale);\ +}) + +#define _mm256_mmask_i64gather_ps( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3div8sf ((__v4sf) __v1_old, __addr, (__v4di) __index,\ + __mask, __scale);\ +}) + +#define _mm256_mmask_i64gather_epi32( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3div8si ((__v4si) __v1_old, __addr, (__v4di) __index,\ + __mask, __scale);\ +}) + +#define _mm_mmask_i32gather_pd( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3siv2df ((__v2df) __v1_old, __addr, (__v4si) __index,\ + __mask, __scale);\ +}) + +#define _mm_mmask_i32gather_epi64( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3siv2di ((__v2di) __v1_old, __addr, (__v4si) __index,\ + __mask, __scale);\ +}) + +#define _mm256_mmask_i32gather_pd( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3siv4df ((__v4df) __v1_old, __addr, (__v4si) __index,\ + __mask, __scale);\ +}) + +#define _mm256_mmask_i32gather_epi64( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3siv4di ((__v4di) __v1_old, __addr, (__v4si) __index,\ + __mask, __scale);\ +}) + +#define _mm_mmask_i32gather_ps( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3siv4sf ((__v4sf) __v1_old, __addr, (__v4si) __index,\ + __mask, __scale);\ +}) + +#define _mm_mmask_i32gather_epi32( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3siv4si ((__v4si) __v1_old, __addr, (__v4si) __index,\ + __mask, __scale);\ +}) + +#define _mm256_mmask_i32gather_ps( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3siv8sf ((__v8sf) __v1_old, __addr, (__v8si) __index,\ + __mask, __scale);\ +}) + +#define _mm256_mmask_i32gather_epi32( __v1_old, __mask, __index, __addr, __scale) __extension__ ({\ +__builtin_ia32_gather3siv8si ((__v8si) __v1_old, __addr, (__v8si) __index,\ + __mask, __scale);\ +}) + #undef __DEFAULT_FN_ATTRS #undef __DEFAULT_FN_ATTRS_BOTH diff --git a/lib/Headers/immintrin.h b/lib/Headers/immintrin.h index ceaa103835..281ec17266 100644 --- a/lib/Headers/immintrin.h +++ b/lib/Headers/immintrin.h @@ -87,6 +87,8 @@ _mm256_cvtph_ps(__m128i __a) #include +#include + #include static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd"))) diff --git a/test/CodeGen/avx512f-builtins.c b/test/CodeGen/avx512f-builtins.c index dc41309a6b..844c92f3f0 100644 --- a/test/CodeGen/avx512f-builtins.c +++ b/test/CodeGen/avx512f-builtins.c @@ -4275,3 +4275,100 @@ __m512 test_mm512_maskz_getexp_ps(__mmask16 __U, __m512 __A) { // CHECK: @llvm.x86.avx512.mask.getexp.ps.512 return _mm512_maskz_getexp_ps(__U, __A); } + +__m256 test_mm512_i64gather_ps(__m512i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_i64gather_ps + // CHECK: @llvm.x86.avx512.gather.qps.512 + return _mm512_i64gather_ps(__index, __addr, 2); +} + +__m256 test_mm512_mask_i64gather_ps(__m256 __v1_old, __mmask8 __mask, __m512i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_mask_i64gather_ps + // CHECK: @llvm.x86.avx512.gather.qps.512 + return _mm512_mask_i64gather_ps(__v1_old, __mask, __index, __addr, 2); +} + +__m256i test_mm512_i64gather_epi32(__m512i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_i64gather_epi32 + // CHECK: @llvm.x86.avx512.gather.qpi.512 + return _mm512_i64gather_epi32(__index, __addr, 2); +} + +__m256i test_mm512_mask_i64gather_epi32(__m256i __v1_old, __mmask8 __mask, __m512i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_mask_i64gather_epi32 + // CHECK: @llvm.x86.avx512.gather.qpi.512 + return _mm512_mask_i64gather_epi32(__v1_old, __mask, __index, __addr, 2); +} + +__m512d test_mm512_i64gather_pd(__m512i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_i64gather_pd + // CHECK: @llvm.x86.avx512.gather.qpd.512 + return _mm512_i64gather_pd(__index, __addr, 2); +} + +__m512d test_mm512_mask_i64gather_pd(__m512d __v1_old, __mmask8 __mask, __m512i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_mask_i64gather_pd + // CHECK: @llvm.x86.avx512.gather.qpd.512 + return _mm512_mask_i64gather_pd(__v1_old, __mask, __index, __addr, 2); +} + +__m512i test_mm512_i64gather_epi64(__m512i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_i64gather_epi64 + // CHECK: @llvm.x86.avx512.gather.qpq.512 + return _mm512_i64gather_epi64(__index, __addr, 2); +} + +__m512i test_mm512_mask_i64gather_epi64(__m512i __v1_old, __mmask8 __mask, __m512i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_mask_i64gather_epi64 + // CHECK: @llvm.x86.avx512.gather.qpq.512 + return _mm512_mask_i64gather_epi64(__v1_old, __mask, __index, __addr, 2); +} + +__m512 test_mm512_i32gather_ps(__m512i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_i32gather_ps + // CHECK: @llvm.x86.avx512.gather.dps.512 + return _mm512_i32gather_ps(__index, __addr, 2); +} + +__m512 test_mm512_mask_i32gather_ps(__m512 v1_old, __mmask16 __mask, __m512i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_mask_i32gather_ps + // CHECK: @llvm.x86.avx512.gather.dps.512 + return _mm512_mask_i32gather_ps(v1_old, __mask, __index, __addr, 2); +} + +__m512i test_mm512_i32gather_epi32(__m512i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_i32gather_epi32 + // CHECK: @llvm.x86.avx512.gather.dpi.512 + return _mm512_i32gather_epi32(__index, __addr, 2); +} + +__m512i test_mm512_mask_i32gather_epi32(__m512i __v1_old, __mmask16 __mask, __m512i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_mask_i32gather_epi32 + // CHECK: @llvm.x86.avx512.gather.dpi.512 + return _mm512_mask_i32gather_epi32(__v1_old, __mask, __index, __addr, 2); +} + +__m512d test_mm512_i32gather_pd(__m256i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_i32gather_pd + // CHECK: @llvm.x86.avx512.gather.dpd.512 + return _mm512_i32gather_pd(__index, __addr, 2); +} + +__m512d test_mm512_mask_i32gather_pd(__m512d __v1_old, __mmask8 __mask, __m256i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_mask_i32gather_pd + // CHECK: @llvm.x86.avx512.gather.dpd.512 + return _mm512_mask_i32gather_pd(__v1_old, __mask, __index, __addr, 2); +} + +__m512i test_mm512_i32gather_epi64(__m256i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_i32gather_epi64 + // CHECK: @llvm.x86.avx512.gather.dpq.512 + return _mm512_i32gather_epi64(__index, __addr, 2); +} + +__m512i test_mm512_mask_i32gather_epi64(__m512i __v1_old, __mmask8 __mask, __m256i __index, void const *__addr) { + // CHECK-LABEL: @test_mm512_mask_i32gather_epi64 + // CHECK: @llvm.x86.avx512.gather.dpq.512 + return _mm512_mask_i32gather_epi64(__v1_old, __mask, __index, __addr, 2); +} + diff --git a/test/CodeGen/avx512pf-builtins.c b/test/CodeGen/avx512pf-builtins.c new file mode 100644 index 0000000000..fe51de5cac --- /dev/null +++ b/test/CodeGen/avx512pf-builtins.c @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +avx512pf -emit-llvm -o - -Werror | FileCheck %s + +// Don't include mm_malloc.h, it's system specific. +#define __MM_MALLOC_H + +#include + +void test_mm512_mask_prefetch_i32gather_pd(__m256i index, __mmask8 mask, void const *addr, int hint) { + // CHECK-LABEL: @test_mm512_mask_prefetch_i32gather_pd + // CHECK: @llvm.x86.avx512.gatherpf.dpd + return _mm512_mask_prefetch_i32gather_pd(index, mask, addr, 2, 1); +} + +void test_mm512_mask_prefetch_i32gather_ps(__m512i index, __mmask16 mask, void const *addr, int hint) { + // CHECK-LABEL: @test_mm512_mask_prefetch_i32gather_ps + // CHECK: @llvm.x86.avx512.gatherpf.dps + return _mm512_mask_prefetch_i32gather_ps(index, mask, addr, 2, 1); +} + +void test_mm512_mask_prefetch_i64gather_pd(__m512i index, __mmask8 mask, void const *addr, int hint) { + // CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_pd + // CHECK: @llvm.x86.avx512.gatherpf.qpd + return _mm512_mask_prefetch_i64gather_pd(index, mask, addr, 2, 1); +} + +void test_mm512_mask_prefetch_i64gather_ps(__m512i index, __mmask8 mask, void const *addr, int hint) { + // CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_ps + // CHECK: @llvm.x86.avx512.gatherpf.qps + return _mm512_mask_prefetch_i64gather_ps(index, mask, addr, 2, 1); +} diff --git a/test/CodeGen/avx512vl-builtins.c b/test/CodeGen/avx512vl-builtins.c index 587c7d2aec..167d79bd2d 100644 --- a/test/CodeGen/avx512vl-builtins.c +++ b/test/CodeGen/avx512vl-builtins.c @@ -6262,3 +6262,99 @@ __m256 test_mm256_maskz_getmant_ps(__mmask8 __U, __m256 __A) { // CHECK: @llvm.x86.avx512.mask.getmant.ps.256 return _mm256_maskz_getmant_ps(__U, __A,_MM_MANT_NORM_p5_2, _MM_MANT_SIGN_nan); } + +__m128d test_mm_mmask_i64gather_pd(__m128d __v1_old, __mmask8 __mask, __m128i __index, void const *__addr) { + // CHECK-LABEL: @test_mm_mmask_i64gather_pd + // CHECK: @llvm.x86.avx512.gather3div2.df + return _mm_mmask_i64gather_pd(__v1_old, __mask, __index, __addr, 2); +} + +__m128i test_mm_mmask_i64gather_epi64(__m128i __v1_old, __mmask8 __mask, __m128i __index, void const *__addr) { + // CHECK-LABEL: @test_mm_mmask_i64gather_epi64 + // CHECK: @llvm.x86.avx512.gather3div2.di + return _mm_mmask_i64gather_epi64(__v1_old, __mask, __index, __addr, 2); +} + +__m256d test_mm256_mmask_i64gather_pd(__m256d __v1_old, __mmask8 __mask, __m256i __index, void const *__addr) { + // CHECK-LABEL: @test_mm256_mmask_i64gather_pd + // CHECK: @llvm.x86.avx512.gather3div4.df + return _mm256_mmask_i64gather_pd(__v1_old, __mask, __index, __addr, 2); +} + +__m256i test_mm256_mmask_i64gather_epi64(__m256i __v1_old, __mmask8 __mask, __m256i __index, void const *__addr) { + // CHECK-LABEL: @test_mm256_mmask_i64gather_epi64 + // CHECK: @llvm.x86.avx512.gather3div4.di + return _mm256_mmask_i64gather_epi64(__v1_old, __mask, __index, __addr, 2); +} + +__m128 test_mm_mmask_i64gather_ps(__m128 __v1_old, __mmask8 __mask, __m128i __index, void const *__addr) { + // CHECK-LABEL: @test_mm_mmask_i64gather_ps + // CHECK: @llvm.x86.avx512.gather3div4.sf + return _mm_mmask_i64gather_ps(__v1_old, __mask, __index, __addr, 2); +} + +__m128i test_mm_mmask_i64gather_epi32(__m128i __v1_old, __mmask8 __mask, __m128i __index, void const *__addr) { + // CHECK-LABEL: @test_mm_mmask_i64gather_epi32 + // CHECK: @llvm.x86.avx512.gather3div4.si + return _mm_mmask_i64gather_epi32(__v1_old, __mask, __index, __addr, 2); +} + +__m128 test_mm256_mmask_i64gather_ps(__m128 __v1_old, __mmask8 __mask, __m256i __index, void const *__addr) { + // CHECK-LABEL: @test_mm256_mmask_i64gather_ps + // CHECK: @llvm.x86.avx512.gather3div8.sf + return _mm256_mmask_i64gather_ps(__v1_old, __mask, __index, __addr, 2); +} + +__m128i test_mm256_mmask_i64gather_epi32(__m128i __v1_old, __mmask8 __mask, __m256i __index, void const *__addr) { + // CHECK-LABEL: @test_mm256_mmask_i64gather_epi32 + // CHECK: @llvm.x86.avx512.gather3div8.si + return _mm256_mmask_i64gather_epi32(__v1_old, __mask, __index, __addr, 2); +} + +__m128d test_mm_mask_i32gather_pd(__m128d __v1_old, __mmask8 __mask, __m128i __index, void const *__addr) { + // CHECK-LABEL: @test_mm_mask_i32gather_pd + // CHECK: @llvm.x86.avx512.gather3siv2.df + return _mm_mmask_i32gather_pd(__v1_old, __mask, __index, __addr, 2); +} + +__m128i test_mm_mask_i32gather_epi64(__m128i __v1_old, __mmask8 __mask, __m128i __index, void const *__addr) { + // CHECK-LABEL: @test_mm_mask_i32gather_epi64 + // CHECK: @llvm.x86.avx512.gather3siv2.di + return _mm_mmask_i32gather_epi64(__v1_old, __mask, __index, __addr, 2); +} + +__m256d test_mm256_mask_i32gather_pd(__m256d __v1_old, __mmask8 __mask, __m128i __index, void const *__addr) { + // CHECK-LABEL: @test_mm256_mask_i32gather_pd + // CHECK: @llvm.x86.avx512.gather3siv4.df + return _mm256_mmask_i32gather_pd(__v1_old, __mask, __index, __addr, 2); +} + +__m256i test_mm256_mask_i32gather_epi64(__m256i __v1_old, __mmask8 __mask, __m128i __index, void const *__addr) { + // CHECK-LABEL: @test_mm256_mask_i32gather_epi64 + // CHECK: @llvm.x86.avx512.gather3siv4.di + return _mm256_mmask_i32gather_epi64(__v1_old, __mask, __index, __addr, 2); +} + +__m128 test_mm_mask_i32gather_ps(__m128 __v1_old, __mmask8 __mask, __m128i __index, void const *__addr) { + // CHECK-LABEL: @test_mm_mask_i32gather_ps + // CHECK: @llvm.x86.avx512.gather3siv4.sf + return _mm_mmask_i32gather_ps(__v1_old, __mask, __index, __addr, 2); +} + +__m128i test_mm_mask_i32gather_epi32(__m128i __v1_old, __mmask8 __mask, __m128i __index, void const *__addr) { + // CHECK-LABEL: @test_mm_mask_i32gather_epi32 + // CHECK: @llvm.x86.avx512.gather3siv4.si + return _mm_mmask_i32gather_epi32(__v1_old, __mask, __index, __addr, 2); +} + +__m256 test_mm256_mask_i32gather_ps(__m256 __v1_old, __mmask8 __mask, __m256i __index, void const *__addr) { + // CHECK-LABEL: @test_mm256_mask_i32gather_ps + // CHECK: @llvm.x86.avx512.gather3siv8.sf + return _mm256_mmask_i32gather_ps(__v1_old, __mask, __index, __addr, 2); +} + +__m256i test_mm256_mask_i32gather_epi32(__m256i __v1_old, __mmask8 __mask, __m256i __index, void const *__addr) { + // CHECK-LABEL: @test_mm256_mask_i32gather_epi32 + // CHECK: @llvm.x86.avx512.gather3siv8.si + return _mm256_mmask_i32gather_epi32(__v1_old, __mask, __index, __addr, 2); +} -- 2.40.0