r215486 - [AVX512] Add intrinsics for FP scalar broadcasts
Adam Nemet
anemet at apple.com
Tue Aug 12 17:29:01 PDT 2014
Author: anemet
Date: Tue Aug 12 19:29:01 2014
New Revision: 215486
URL: http://llvm.org/viewvc/llvm-project?rev=215486&view=rev
Log:
[AVX512] Add intrinsics for FP scalar broadcasts
Similar approach to the set1 intrinsics is used: implement in terms of vector
initializers and then ensure with an LLVM test that a broadcast is generated
at the end.
Part of <rdar://problem/17688758>
Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c
Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=215486&r1=215485&r2=215486&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Tue Aug 12 19:29:01 2014
@@ -117,6 +117,24 @@ _mm512_set1_epi64(long long __d)
return (__m512i)(__v8di){ __d, __d, __d, __d, __d, __d, __d, __d };
}
+static __inline__ __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_broadcastss_ps(__m128 __X)
+{
+ float __f = __X[0];
+ return (__v16sf){ __f, __f, __f, __f,
+ __f, __f, __f, __f,
+ __f, __f, __f, __f,
+ __f, __f, __f, __f };
+}
+
+static __inline__ __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_broadcastsd_pd(__m128d __X)
+{
+ double __d = __X[0];
+ return (__v8df){ __d, __d, __d, __d,
+ __d, __d, __d, __d };
+}
+
/* Cast between vector types */
static __inline __m512d __attribute__((__always_inline__, __nodebug__))
Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=215486&r1=215485&r2=215486&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Tue Aug 12 19:29:01 2014
@@ -137,3 +137,17 @@ __m512i test_mm512_valign_epi64(__m512i
// CHECK: @llvm.x86.avx512.mask.valign.q.512
return _mm512_valign_epi64(a, b, 2);
}
+
+__m512d test_mm512_broadcastsd_pd(__m128d a)
+{
+ // CHECK-LABEL: @test_mm512_broadcastsd_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_broadcastsd_pd(a);
+}
More information about the cfe-commits
mailing list