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 void
CALC(double * src1,double * src2,double * dst)12 CALC (double *src1, double *src2, double *dst)
13 {
14   int i;
15 
16   for (i = 0; i < SIZE; i++)
17     {
18       union U { double d; long long l; } u1, u2;
19       u1.d = src1[i];
20       u2.d = src2[i];
21       u1.l ^= u2.l;
22       dst[i] = u1.d;
23     }
24 }
25 
26 void
TEST(void)27 TEST (void)
28 {
29   UNION_TYPE (AVX512F_LEN,d) s1, s2, res1, res2, res3;
30   MASK_TYPE mask = MASK_VALUE;
31   double dst_ref[SIZE];
32   int i;
33 
34   for (i = 0; i < SIZE; i++) {
35       s1.a[i] = 132.45 * i;
36       s2.a[i] = 43.6 - i * 4.4;
37       res2.a[i] = DEFAULT_VALUE;
38   }
39 
40   res1.x = INTRINSIC (_xor_pd) (s1.x, s2.x);
41   res2.x = INTRINSIC (_mask_xor_pd) (res2.x, mask, s1.x, s2.x);
42   res3.x = INTRINSIC (_maskz_xor_pd) (mask, s1.x, s2.x);
43 
44   CALC (s1.a, s2.a, dst_ref);
45 
46   if (UNION_CHECK (AVX512F_LEN,d) (res1, dst_ref))
47     abort ();
48 
49   MASK_MERGE (d) (dst_ref, mask, SIZE);
50   if (UNION_CHECK (AVX512F_LEN,d) (res2, dst_ref))
51     abort ();
52 
53   MASK_ZERO (d) (dst_ref, mask, SIZE);
54   if (UNION_CHECK (AVX512F_LEN,d) (res3, dst_ref))
55     abort ();
56 }
57