Initial support for AVX-512{VL,BW,DQ}
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512dq-vbroadcastf32x8-2.c
blobeda3baf6da62f31111fad1c9ffcab78bb2995752
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512dq -DAVX512DQ" } */
3 /* { dg-require-effective-target avx512dq } */
5 #include "avx512f-helper.h"
7 #define SIZE (AVX512F_LEN / 32)
8 #include "avx512f-mask-type.h"
10 CALC (float *r, float *s)
12 int i;
13 for (i = 0; i < SIZE; i++)
15 r[i] = s[i % 8];
19 void
20 TEST (void)
22 int i, sign;
23 UNION_TYPE (AVX512F_LEN,) res1, res2, res3;
24 UNION_TYPE (256,) src;
25 MASK_TYPE mask = SIZE | 123;
26 float res_ref[SIZE];
28 sign = -1;
29 for (i = 0; i < 8; i++)
31 src.a[i] = 34.67 * i * sign;
32 sign = sign * -1;
34 for (i = 0; i < SIZE; i++)
35 res2.a[i] = DEFAULT_VALUE;
37 res1.x = INTRINSIC (_broadcast_f32x8) (src.x);
38 res2.x = INTRINSIC (_mask_broadcast_f32x8) (res2.x, mask, src.x);
39 res3.x = INTRINSIC (_maskz_broadcast_f32x8) (mask, src.x);
41 CALC (res_ref, src.a);
43 if (UNION_CHECK (AVX512F_LEN,) (res1, res_ref))
44 abort ();
46 MASK_MERGE ()(res_ref, mask, SIZE);
47 if (UNION_CHECK (AVX512F_LEN,) (res2, res_ref))
48 abort ();
50 MASK_ZERO ()(res_ref, mask, SIZE);
51 if (UNION_CHECK (AVX512F_LEN,) (res3, res_ref))
52 abort ();