Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512bw-vpbroadcastw-2.c
blobdb4c2fe93cb2bc9ede802baaec97fb41ce090833
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512bw" } */
3 /* { dg-require-effective-target avx512bw } */
5 #define AVX512BW
6 #include "avx512f-helper.h"
8 #define SIZE (AVX512F_LEN / 16)
9 #include "avx512f-mask-type.h"
11 void
12 CALC (short *r, short *s)
14 int i;
15 for (i = 0; i < SIZE; i++)
17 r[i] = s[0];
21 void
22 TEST (void)
24 int i, sign;
25 UNION_TYPE (AVX512F_LEN, i_w) res1, res2, res3;
26 UNION_TYPE (128, i_w) src;
27 MASK_TYPE mask = SIZE | 123;
28 short res_ref[SIZE];
30 sign = -1;
31 for (i = 0; i < 8; i++)
33 src.a[i] = 1 + 3 * i * sign;
34 sign = sign * -1;
36 for (i = 0; i < SIZE; i++)
37 res2.a[i] = DEFAULT_VALUE;
39 CALC (res_ref, src.a);
41 if (AVX512F_LEN == 512)
43 res1.x = INTRINSIC (_broadcastw_epi16) (src.x);
44 if (UNION_CHECK (AVX512F_LEN, i_w) (res1, res_ref))
45 abort ();
48 res2.x = INTRINSIC (_mask_broadcastw_epi16) (res2.x, mask, src.x);
49 res3.x = INTRINSIC (_maskz_broadcastw_epi16) (mask, src.x);
51 MASK_MERGE (i_w) (res_ref, mask, SIZE);
52 if (UNION_CHECK (AVX512F_LEN, i_w) (res2, res_ref))
53 abort ();
55 MASK_ZERO (i_w) (res_ref, mask, SIZE);
56 if (UNION_CHECK (AVX512F_LEN, i_w) (res3, res_ref))
57 abort ();
59 CALC (res_ref, src.a);
61 if (AVX512F_LEN == 512)
63 res1.x = INTRINSIC (_set1_epi16) (src.a[0]);
64 if (UNION_CHECK (AVX512F_LEN, i_w) (res1, res_ref))
65 abort ();
68 res2.x = INTRINSIC (_mask_set1_epi16) (res2.x, mask, src.a[0]);
69 res3.x = INTRINSIC (_maskz_set1_epi16) (mask, src.a[0]);
71 MASK_MERGE (i_w) (res_ref, mask, SIZE);
72 if (UNION_CHECK (AVX512F_LEN, i_w) (res2, res_ref))
73 abort ();
75 MASK_ZERO (i_w) (res_ref, mask, SIZE);
76 if (UNION_CHECK (AVX512F_LEN, i_w) (res3, res_ref))
77 abort ();