Stop only if there aren't any usable algorithms
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vextractf64x4-2.c
blobb73044917b514a8e6b78205d264edb2cda506180
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx512f } */
3 /* { dg-options "-O2 -mavx512f" } */
5 #include <string.h>
6 #include "avx512f-check.h"
7 #include "avx512f-helper.h"
9 void static
10 avx512f_test (void)
12 union512d s1;
13 union256d res1, res2, res3;
14 __mmask8 mask = 0xBA;
15 double res_ref[4];
16 int j;
18 for (j = 0; j < 8; j++)
20 s1.a[j] = j * j / 4.56;
23 for (j = 0; j < 4; j++)
25 res1.a[j] = DEFAULT_VALUE;
26 res2.a[j] = DEFAULT_VALUE;
27 res3.a[j] = DEFAULT_VALUE;
30 res1.x = _mm512_extractf64x4_pd (s1.x, 0);
31 res2.x = _mm512_mask_extractf64x4_pd (res2.x, mask, s1.x, 0);
32 res3.x = _mm512_maskz_extractf64x4_pd (mask, s1.x, 0);
34 memset (res_ref, 0, 32);
35 memcpy (res_ref, s1.a, 32);
37 if (check_union256d (res1, res_ref))
38 abort ();
40 MASK_MERGE (d) (res_ref, mask, 4);
41 if (check_union256d (res2, res_ref))
42 abort ();
44 MASK_ZERO (d) (res_ref, mask, 4);
45 if (check_union256d (res3, res_ref))
46 abort ();
48 res1.x = _mm512_extractf64x4_pd (s1.x, 1);
49 res2.x = _mm512_mask_extractf64x4_pd (res2.x, mask, s1.x, 1);
50 res3.x = _mm512_maskz_extractf64x4_pd (mask, s1.x, 1);
52 memset (res_ref, 0, 32);
53 memcpy (res_ref, s1.a + 4, 32);
55 if (check_union256d (res1, res_ref))
56 abort ();
58 MASK_MERGE (d) (res_ref, mask, 4);
59 if (check_union256d (res2, res_ref))
60 abort ();
62 MASK_ZERO (d) (res_ref, mask, 4);
63 if (check_union256d (res3, res_ref))
64 abort ();