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 / 64)
9 #include "avx512f-mask-type.h"
10 
11 #define IMM 0x23
12 
13 void
CALC(double * s,double * r)14 CALC (double *s, double *r)
15 {
16   int i;
17 
18   for (i = 0; i < SIZE; i++)
19     {
20       double tmp = (int) (4 * s[i]) / 4.0;
21       r[i] = s[i] - tmp;
22     }
23 }
24 
25 void
TEST(void)26 TEST (void)
27 {
28   UNION_TYPE (AVX512F_LEN, d) s, res1, res2, res3;
29   MASK_TYPE mask = MASK_VALUE;
30   double res_ref[SIZE];
31   int i, sign = 1;
32 
33   for (i = 0; i < SIZE; i++)
34     {
35       s.a[i] = 123.456 * (i + 2000) * sign;
36       res2.a[i] = DEFAULT_VALUE;
37       sign = -sign;
38     }
39 
40   res1.x = INTRINSIC (_reduce_pd) (s.x, IMM);
41   res2.x = INTRINSIC (_mask_reduce_pd) (res2.x, mask, s.x, IMM);
42   res3.x = INTRINSIC (_maskz_reduce_pd) (mask, s.x, IMM);
43 
44   CALC (s.a, res_ref);
45 
46   if (UNION_FP_CHECK (AVX512F_LEN, d) (res1, res_ref))
47     abort ();
48 
49   MASK_MERGE (d) (res_ref, mask, SIZE);
50   if (UNION_FP_CHECK (AVX512F_LEN, d) (res2, res_ref))
51     abort ();
52 
53   MASK_ZERO (d) (res_ref, mask, SIZE);
54   if (UNION_FP_CHECK (AVX512F_LEN, d) (res3, res_ref))
55     abort ();
56 }
57