Stop only if there aren't any usable algorithms
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512dq-vinserti64x2-2.c
blobdb93db2c3d7bef3126beec911a64117016e2e839
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512dq" } */
3 /* { dg-require-effective-target avx512dq } */
5 #define AVX512DQ
6 #include "avx512f-helper.h"
7 #include "string.h"
9 #define SIZE (AVX512F_LEN / 64)
10 #include "avx512f-mask-type.h"
12 void
13 CALC (UNION_TYPE (AVX512F_LEN, i_q) s1, union128i_q s2,
14 long long *res_ref, int mask)
16 memcpy (res_ref, s1.a, SIZE * sizeof (long long));
17 memcpy (res_ref + mask * 2, s2.a, 16);
20 void
21 TEST (void)
23 UNION_TYPE (AVX512F_LEN, i_q) s1, res1, res2, res3;
24 union128i_q s2;
25 long long res_ref[SIZE];
26 MASK_TYPE mask = MASK_VALUE;
27 int j;
29 for (j = 0; j < SIZE; j++)
31 s1.a[j] = j * j;
32 res1.a[j] = DEFAULT_VALUE;
33 res2.a[j] = DEFAULT_VALUE;
34 res3.a[j] = DEFAULT_VALUE;
37 for (j = 0; j < 2; j++)
38 s2.a[j] = j * j * j;
40 res1.x = INTRINSIC (_inserti64x2) (s1.x, s2.x, 1);
41 res2.x = INTRINSIC (_mask_inserti64x2) (res2.x, mask, s1.x, s2.x, 1);
42 res3.x = INTRINSIC (_maskz_inserti64x2) (mask, s1.x, s2.x, 1);
44 CALC (s1, s2, res_ref, 1);
46 if (UNION_CHECK (AVX512F_LEN, i_q) (res1, res_ref))
47 abort ();
49 MASK_MERGE (i_q) (res_ref, mask, SIZE);
50 if (UNION_CHECK (AVX512F_LEN, i_q) (res2, res_ref))
51 abort ();
53 MASK_ZERO (i_q) (res_ref, mask, SIZE);
54 if (UNION_CHECK (AVX512F_LEN, i_q) (res3, res_ref))
55 abort ();