From da1b4a8c38f0ac7f3879c105d86ffef1113532ca Mon Sep 17 00:00:00 2001 From: Adam Nemet Date: Wed, 30 Jul 2014 16:51:22 +0000 Subject: [PATCH] [AVX512] Add set1 intrinsics (Dropped the byte and word variants from the patch. Turns out these are not part of AVX512F but only AVX512BW/VL.) Part of git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214314 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Headers/avx512fintrin.h | 26 ++++++++++++++++++++++++++ test/CodeGen/avx512f-builtins.c | 14 ++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/lib/Headers/avx512fintrin.h b/lib/Headers/avx512fintrin.h index cebb0d5a05..a336f6d746 100644 --- a/lib/Headers/avx512fintrin.h +++ b/lib/Headers/avx512fintrin.h @@ -91,6 +91,32 @@ _mm512_setzero_pd(void) return (__m512d){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; } +static __inline __m512 __attribute__((__always_inline__, __nodebug__)) +_mm512_set1_ps(float __w) +{ + return (__m512){ __w, __w, __w, __w, __w, __w, __w, __w, + __w, __w, __w, __w, __w, __w, __w, __w }; +} + +static __inline __m512d __attribute__((__always_inline__, __nodebug__)) +_mm512_set1_pd(double __w) +{ + return (__m512d){ __w, __w, __w, __w, __w, __w, __w, __w }; +} + +static __inline __m512i __attribute__((__always_inline__, __nodebug__)) +_mm512_set1_epi32(int __s) +{ + return (__m512i)(__v16si){ __s, __s, __s, __s, __s, __s, __s, __s, + __s, __s, __s, __s, __s, __s, __s, __s }; +} + +static __inline __m512i __attribute__((__always_inline__, __nodebug__)) +_mm512_set1_epi64(long long __d) +{ + return (__m512i)(__v8di){ __d, __d, __d, __d, __d, __d, __d, __d }; +} + /* Arithmetic */ static __inline __m512d __attribute__((__always_inline__, __nodebug__)) diff --git a/test/CodeGen/avx512f-builtins.c b/test/CodeGen/avx512f-builtins.c index ea84583734..ddeb3b6365 100644 --- a/test/CodeGen/avx512f-builtins.c +++ b/test/CodeGen/avx512f-builtins.c @@ -88,3 +88,17 @@ void test_mm512_store_pd(void *p, __m512d a) // CHECK: store <8 x double> _mm512_store_pd(p, a); } + +__m512d test_mm512_set1_pd(double d) +{ + // CHECK-LABEL: @test_mm512_set1_pd + // CHECK: insertelement <8 x double> {{.*}}, i32 0 + // CHECK: insertelement <8 x double> {{.*}}, i32 1 + // CHECK: insertelement <8 x double> {{.*}}, i32 2 + // CHECK: insertelement <8 x double> {{.*}}, i32 3 + // CHECK: insertelement <8 x double> {{.*}}, i32 4 + // CHECK: insertelement <8 x double> {{.*}}, i32 5 + // CHECK: insertelement <8 x double> {{.*}}, i32 6 + // CHECK: insertelement <8 x double> {{.*}}, i32 7 + return _mm512_set1_pd(d); +} -- 2.40.0