1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
4 
5 #define AVX512F
6 
7 #include "avx512f-helper.h"
8 
9 #define SRC_SIZE (AVX512F_LEN / 32)
10 #include "avx512f-mask-type.h"
11 #define DST_SIZE (AVX512F_LEN / 64)
12 
13 static void
CALC(unsigned int * s1,unsigned int * s2,unsigned long long * r)14 CALC (unsigned int *s1, unsigned int *s2, unsigned long long *r)
15 {
16   int i;
17 
18   for (i = 0; i < DST_SIZE; i++)
19     r[i] = s1[i * 2] * s2[i * 2];
20 }
21 
22 void
TEST(void)23 TEST (void)
24 {
25   UNION_TYPE (AVX512F_LEN, i_ud) s1, s2;
26   UNION_TYPE (AVX512F_LEN, i_uq) res1, res2, res3;
27   MASK_TYPE mask = MASK_VALUE;
28   unsigned long long res_ref[DST_SIZE];
29   int i;
30 
31   for (i = 0; i < SRC_SIZE; i++)
32     {
33       s1.a[i] = i * 20;
34       s2.a[i] = i + 20;
35     }
36   for (i = 0; i < DST_SIZE; i++)
37     res2.a[i] = DEFAULT_VALUE;
38 
39   CALC (s1.a, s2.a, res_ref);
40 
41   res1.x = INTRINSIC (_mul_epu32) (s1.x, s2.x);
42   res2.x = INTRINSIC (_mask_mul_epu32) (res2.x, mask, s1.x, s2.x);
43   res3.x = INTRINSIC (_maskz_mul_epu32) (mask, s1.x, s2.x);
44 
45   if (UNION_CHECK (AVX512F_LEN, i_uq) (res1, res_ref))
46     abort ();
47 
48   MASK_MERGE (i_uq) (res_ref, mask, DST_SIZE);
49   if (UNION_CHECK (AVX512F_LEN, i_uq) (res2, res_ref))
50     abort ();
51 
52   MASK_ZERO (i_uq) (res_ref, mask, DST_SIZE);
53   if (UNION_CHECK (AVX512F_LEN, i_uq) (res3, res_ref))
54     abort ();
55 }
56