2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512dq-vreducepd-2.c
blob00a190e873ed4f656698f7b368066f2755275988
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512dq" } */
3 /* { dg-require-effective-target avx512dq } */
5 #define AVX512DQ
6 #include "avx512f-helper.h"
8 #define SIZE (AVX512F_LEN / 64)
9 #include "avx512f-mask-type.h"
11 #define IMM 0x23
13 void
14 CALC (double *s, double *r)
16 int i;
18 for (i = 0; i < SIZE; i++)
20 double tmp = (int) (4 * s[i]) / 4.0;
21 r[i] = s[i] - tmp;
25 void
26 TEST (void)
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;
33 for (i = 0; i < SIZE; i++)
35 s.a[i] = 123.456 * (i + 2000) * sign;
36 res2.a[i] = DEFAULT_VALUE;
37 sign = -sign;
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);
44 CALC (s.a, res_ref);
46 if (UNION_FP_CHECK (AVX512F_LEN, d) (res1, res_ref))
47 abort ();
49 MASK_MERGE (d) (res_ref, mask, SIZE);
50 if (UNION_FP_CHECK (AVX512F_LEN, d) (res2, res_ref))
51 abort ();
53 MASK_ZERO (d) (res_ref, mask, SIZE);
54 if (UNION_FP_CHECK (AVX512F_LEN, d) (res3, res_ref))
55 abort ();