1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512dq" } */
3 /* { dg-require-effective-target avx512dq } */
4 
5 #define AVX512DQ
6 #include "avx512f-helper.h"
7 
8 #define SIZE (AVX512F_LEN / 32)
9 #include "avx512f-mask-type.h"
10 
11 void
CALC(float * r,float * s)12 CALC (float *r, float *s)
13 {
14   int i;
15   for (i = 0; i < SIZE; i++)
16     {
17       r[i] = s[i % 2];
18     }
19 }
20 
21 void
TEST(void)22 TEST (void)
23 {
24   int i, sign;
25   UNION_TYPE (AVX512F_LEN,) res1, res2, res3;
26   UNION_TYPE (128,) src;
27   MASK_TYPE mask = SIZE | 123;
28   float res_ref[SIZE];
29 
30   sign = -1;
31   for (i = 0; i < 4; i++)
32     {
33       src.a[i] = 34.67 * i * sign;
34       sign = sign * -1;
35     }
36   for (i = 0; i < SIZE; i++)
37     res2.a[i] = DEFAULT_VALUE;
38 
39   res1.x = INTRINSIC (_broadcast_f32x2) (src.x);
40   res2.x = INTRINSIC (_mask_broadcast_f32x2) (res2.x, mask, src.x);
41   res3.x = INTRINSIC (_maskz_broadcast_f32x2) (mask, src.x);
42 
43   CALC (res_ref, src.a);
44 
45   if (UNION_CHECK (AVX512F_LEN,) (res1, res_ref))
46     abort ();
47 
48   MASK_MERGE ()(res_ref, mask, SIZE);
49   if (UNION_CHECK (AVX512F_LEN,) (res2, res_ref))
50     abort ();
51 
52   MASK_ZERO ()(res_ref, mask, SIZE);
53   if (UNION_CHECK (AVX512F_LEN,) (res3, res_ref))
54     abort ();
55 }
56