Initial support for AVX-512{VL,BW,DQ}
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512dq-vextractf64x2-2.c
blob02a2543cbb17c429c0e0d561b9bb13eeaa912989
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512dq -DAVX512DQ" } */
3 /* { dg-require-effective-target avx512dq } */
5 #include "avx512f-helper.h"
7 #define SIZE (AVX512F_LEN / 64)
8 #include "avx512f-mask-type.h"
9 #include "string.h"
11 void
12 CALC (double *s1, double *res_ref, int mask)
14 memset (res_ref, 0, 16);
15 memcpy (res_ref, s1 + mask * 2, 16);
18 void
19 TEST (void)
21 UNION_TYPE (AVX512F_LEN, d) s1;
22 union128d res1, res2, res3;
23 double res_ref[2];
24 MASK_TYPE mask = MASK_VALUE;
25 int j;
27 for (j = 0; j < SIZE; j++)
29 s1.a[j] = j * j / 4.56;
32 for (j = 0; j < 2; j++)
34 res1.a[j] = DEFAULT_VALUE;
35 res2.a[j] = DEFAULT_VALUE;
36 res3.a[j] = DEFAULT_VALUE;
39 res1.x = INTRINSIC (_extractf64x2_pd) (s1.x, 1);
40 res2.x = INTRINSIC (_mask_extractf64x2_pd) (res2.x, mask, s1.x, 1);
41 res3.x = INTRINSIC (_maskz_extractf64x2_pd) (mask, s1.x, 1);
42 CALC (s1.a, res_ref, 1);
44 if (check_union128d (res1, res_ref))
45 abort ();
47 MASK_MERGE (d) (res_ref, mask, 2);
48 if (check_union128d (res2, res_ref))
49 abort ();
51 MASK_ZERO (d) (res_ref, mask, 2);
52 if (check_union128d (res3, res_ref))
53 abort ();