Stop only if there aren't any usable algorithms
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vpermpdi-2.c
blobd979828a6324eaa67c3f0cf0ad797e1ef4926407
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
5 #define AVX512F
7 #include "avx512f-helper.h"
9 #define SIZE (AVX512F_LEN / 64)
10 #include "avx512f-mask-type.h"
12 #define N 0x7c
14 static void
15 CALC (double *s1, double *r)
17 int i;
19 for (i = 0; i < SIZE; i++)
21 int index = (N >> ((i % 4) * 2)) & 3;
22 int base = i / 4;
23 r[i] = s1[4 * base + index];
27 void
28 TEST (void)
30 UNION_TYPE (AVX512F_LEN, d) src1, res1, res2, res3;
31 MASK_TYPE mask = MASK_VALUE;
32 double res_ref[SIZE];
33 int i, sign = 1;
35 for (i = 0; i < SIZE; i++)
37 src1.a[i] = i * i * sign;
38 res2.a[i] = DEFAULT_VALUE;
39 sign = -sign;
42 res1.x = INTRINSIC (_permutex_pd) (src1.x, N);
43 res2.x = INTRINSIC (_mask_permutex_pd) (res2.x, mask, src1.x, N);
44 res3.x = INTRINSIC (_maskz_permutex_pd) (mask, src1.x, N);
46 CALC (src1.a, res_ref);
48 if (UNION_CHECK (AVX512F_LEN, d) (res1, res_ref))
49 abort ();
51 MASK_MERGE (d) (res_ref, mask, SIZE);
52 if (UNION_CHECK (AVX512F_LEN, d) (res2, res_ref))
53 abort ();
55 MASK_ZERO (d) (res_ref, mask, SIZE);
56 if (UNION_CHECK (AVX512F_LEN, d) (res3, res_ref))
57 abort ();