Another set of functions missing are those to set all elements of a
512-bit vector to the same float or double value.  I think the patch
below uses the optimal code sequence for that.  The patch requires the
previous patch introducing _mm*_undefined_*.


2014-03-19  Ulrich Drepper  <drep...@gmail.com>

        * config/i386/avx512fintrin.h: Define _mm512_set1_ps and
        _mm512_set1_pd.


diff -u b/gcc/config/i386/avx512fintrin.h b/gcc/config/i386/avx512fintrin.h
--- b/gcc/config/i386/avx512fintrin.h
+++ b/gcc/config/i386/avx512fintrin.h
@@ -130,6 +130,28 @@
   return __Y;
 }
 
+extern __inline __m512d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_set1_pd (double __A)
+{
+  return (__m512d) __builtin_ia32_broadcastsd512 (__extension__
+                                                 (__v2df) { __A, },
+                                                 (__v8df)
+                                                 _mm512_undefined_pd (),
+                                                 (__mmask8) -1);
+}
+
+extern __inline __m512
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_set1_ps (float __A)
+{
+  return (__m512) __builtin_ia32_broadcastss512 (__extension__
+                                                (__v4sf) { __A, },
+                                                (__v16sf)
+                                                _mm512_undefined_ps (),
+                                                (__mmask16) -1);
+}
+
 extern __inline __m512
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm512_setzero_ps (void)

Reply via email to